问题标签 [vtd-xml]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
xml-parsing - VTD-xml 忽略格式良好的文件
我将解析 xml 文件(此文件和平):
使用 vtd-xml ,但我有这个例外:
com.ximpleware.extended.EntityExceptionHuge: Errors in Entity: Illegal entity char
这意味着我的文件包含“实体”,那么我怎样才能让 vtd-xml 忽略验证文件以正确生成一个 persing 。
谢谢
xml - VTD-XML的索引可以不将文件读入内存吗
我需要对内存绑定和 cpu 绑定设备(例如移动设备)上的一组 XML 文件进行随机访问。我已经阅读了有关 VTD-XML 的内容,但关于索引功能的信息似乎很少。
我是否认为我可以: a- 计算机/设备上的索引 A b- 将索引复制到不同的计算机/设备 c- 使用索引访问 XML 的一小段(无需将整个 XML 读入内存)
然后我可以使用小的 XML 片段并应用我喜欢的任何类型的转换(例如 XSLT 等,就像我使用普通的 XML 片段一样)。
第二,我读过一篇文章,其中建议 VTD-XML 格式依赖于平台。有人可以确认是这种情况。
干杯
克里斯
java - (Java)VTD-XML & Xpath Compering Nodes Children Elements
I have two xml files. One is reference(old) file and another one is test(new) file. Based on some rules supplied to me I have to check if something was removed from old model and then added to new one or check if something from old file was removed in new file.
I am using VTD-XML but DOM solution or any other that works with xpath will be really useful.
That is java code:
1)When xpath is done on ref file i get all attributes of man node:
And I get value of name attribute.
2)Then I do another xpath on test file to get common attributes:
3) And then I have my if statements
PROBLEM: Without if statements i get all attributes from ref and test file There should be 29000 of them. When I trying to check if that node(attribute) has child node called mandatory for example I get 2 results back. But there should be much more where is the problem?
Ref File:
Test File:
So when I run my code I should get: attr1 changed from true to false
java - VTD-XML and Xpath 2.0 escaping string
When I try to running the following xpath expression in Java using VTD-XML I get an unexpected error.
Code:
Error:
Is this not a bug? I was under the impression that escaping single quotes in XPath 2.0 was acceptable? When I try running the xpath query in XML Spy with the same document it runs fine.
java - 如何使用VTD-XML扩展吐出大的XML(超过3GB)
我必须拆分一个最小大小为 3GB 的 xml。我们在 Windows 操作系统上的 64 位 JVM 中只能提供 1.5GB 的堆空间。我在整个 Internet 上都获得了仅使用 VTDNav 的示例代码,而不是 VTDNavHuge。议程是读取上述巨大的 XML 并使用 Xpath 从中提取一个特定的节点,并使用上述提取的内容创建一个新的 xml。我总是遇到 OutOfMemomry 异常,尽管有人提到我们也可以使用 VTD 扩展来处理高达 256GB 的文件。那是使用 VTDNavHuge。请帮助我提供示例代码以在提供的开发环境下完成上述任务。>3GB 大小的文件和 1.5GB 堆空间。我在解析扩展了 VTD XML 的文件时尝试使用内存映射模式。
vtd-xml - VTD XML 导航到第一个子节点的兄弟节点
我的 XML
我有的 ..
// 移动到父节点遍历其余的项目 }
我想要的是到达“cd”节点。
在一些示例中,我看到了 VTDNav.NEXT_CHILD 但似乎不可用。谁能建议如何到达我需要的节点。现在我设法通过到达 FIRST_CHILD 然后移动到下一个兄弟姐妹来做到这一点
感谢您的所有帮助
问候
java - 使用 VTD-XML 修改 XML 并删除旧节点
我有这样的结构:
我想修改每个电话号码,使其具有如下结构:
我正在提取数字并构建新节点。但我不知道什么时候应该删除旧的Phone1
和Phone2
节点。
我的代码:
我将提取和插入分成两个while循环,因为@vtd-xml-author在这里说只重新解析一次更有效。
我无法找到删除旧Phone
节点的位置,并且必须有更好的方法来执行此操作,或者没有?
java - Java:如何将 XML 流拆分为带有父节点的小型 XML 文档。VTD-XML
我需要使用 VTD XML 和 XPath 读取大型 xml,并将结果拆分到多个节点中。我在这里找到了一些解决方案,但它拆分了节点但没有父信息。
我为什么要寻找:
XPath 字符串:/CATALOG/MAIN/CD 基于 XPath 文件应该被拆分
1) 初始文件:
<CATALOG>
<MAIN id="1">
<CD>
<TITLE>Empire Burlesque</TITLE>
<ARTIST>Bob Dylan</ARTIST>
</CD>
<CD>
<TITLE>Empire Dummy</TITLE>
<ARTIST>John Doe</ARTIST>
</CD>
<USEFUL>Useful node</USEFUL>
</MAIN>
<MAIN id="2">
<CD>
<TITLE>Still got the blues</TITLE>
<ARTIST>Gary More</ARTIST>
</CD>
</MAIN>
<IGNORED>Ignored node</IGNORED>
</CATALOG>
2) 结果:文件 1:
<CATALOG>
<MAIN id="1">
<CD>
<TITLE>Empire Burlesque</TITLE>
<ARTIST>Bob Dylan</ARTIST>
</CD>
<USEFUL>Useful node</USEFUL>
</MAIN>
</CATALOG>
文件 2:
<CATALOG>
<MAIN id="1">
<CD>
<TITLE>Empire Dummy</TITLE>
<ARTIST>John Doe</ARTIST>
</CD>
<USEFUL>Useful node</USEFUL>
</MAIN>
</CATALOG>
文件 3:
<CATALOG>
<MAIN id="2">
<CD>
<TITLE>Still got the blues</TITLE>
<ARTIST>Gary More</ARTIST>
</CD>
</MAIN>
</CATALOG>
感谢您的时间和建议。
此致!
java - VTD-XML 似乎破坏了 XML 文档中的转义字符串
我正在研究一个 XML 数据集(此处提供 DrugBank 数据库),其中一些字段包含转义的 XML 字符,如“&”等。
为了使问题更具体,这里是一个示例场景:
由于整个文档很大,我将其解析如下:
当我finerParse
使用示例 xml(从相同数据复制粘贴的片段)测试该方法时,它运行良好。但是当从上面的代码调用时,它失败并显示错误消息Errors in Entity: Illegal entity char
。在将输入打印到finerParse
(即drugXML
字符串)后,我注意到&pg=PA440
原始 xml 中的字符串已更改为“&pg=PA440”。
为什么会这样?我所做的只是使用一个非常知名的解析器来解析它。
PS我找到了一个替代解决方案,我只是将 VTDNav 作为参数传递给finerParse
而不是首先获取内容字符串并传递该字符串。但我仍然对上述方法出了什么问题感到好奇。
xml - VTD-XML Performance Tuning
I am processing an average of 18 MB XML where the XPaths are intensive with predicates. I tried to profile the processing (warmed up the JVM) and the average processing time is 20 seconds. I would like to know if there are techniques to make it faster? Like avoid using predicates?