GData工作区文档

发布于 2024-09-25 14:06:00 字数 562 浏览 3 评论 0原文

我有一个应用程序当前使用 Apache Abdera 来解析 Atom Pub 文档(工作区、集合、提要、条目) - 并且想要切换 GData 库,主要是为了摆脱大量依赖项,我发现 GData 调用始终保持更快。不管怎样,我不知道如何通过 GData 生成其中一些文档类型。

示例:

Workspace w = new Workspace(new PlainTextConstruct("My Workspace"));
System.out.println(w); // prints a memory location
System.out.println(w.getXmlBlob()); // prints memory location or null

在 Abdera,这会起作用。我猜我错过了一些解析类的使用,但文档在这个主题上并不是很前沿。

我期待这样的文件(不完全是):

<workspace><atom:title>My Workspace</atom:title></workspace>

I have an application that currently uses Apache Abdera to parse Atom Pub documents (Workspace, Collection, Feed, Entry) - and want to switch the the GData Libraries, mainly to get rid of a lot of dependencies and I have found the GData calls to be consistently faster. Anyway, I cannot figure out how to generate some of these document types through GData.

Example:

Workspace w = new Workspace(new PlainTextConstruct("My Workspace"));
System.out.println(w); // prints a memory location
System.out.println(w.getXmlBlob()); // prints memory location or null

In Abdera this would have worked. I am guessing I am missing the use of some parsing class, but the documentation is not very forward on this topic.

I am expecting a document like this (not exactly):

<workspace><atom:title>My Workspace</atom:title></workspace>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

卷耳 2024-10-02 14:06:00

好吧,我自己设法找到了答案,仍在尝试找出如何分配默认名称空间,这样它就不会向每个 xml 标签附加“atom”。

Workspace workspace = new Workspace(new PlainTextConstruct("My Workspace"));
CharArrayWriter charWr = new CharArrayWriter();
workspace.generate(new XmlWriter(charWr), new ExntensionProfile());
System.out.println(charWr.toString());

Well I managed to find the answer myself, still trying to figure out how to assign a default namespace so it doesn't append "atom" to every xml tag.

Workspace workspace = new Workspace(new PlainTextConstruct("My Workspace"));
CharArrayWriter charWr = new CharArrayWriter();
workspace.generate(new XmlWriter(charWr), new ExntensionProfile());
System.out.println(charWr.toString());
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文