vtd-xml

ArrayIndexOutofBoundException In Scala Program Usind VTD-XML

倖福魔咒の 提交于 2019-12-08 19:33:29
import java.lang._ import com.ximpleware._ object Sample { def main(args :Array[String])= { // println("helloo") try{ var i :Int = -1 val vgen :VTDGen= new VTDGen() val ap :AutoPilot =new AutoPilot() ap.selectXPath("CATALOG/CD/COUNTRY/text()") if(vgen.parseFile("../catalog.xml", false)) { val vnav :VTDNav = vgen.getNav() ap.bind(vnav) while((i=ap.evalXPath)!= -1) { println(vnav.toString(i)) println(vnav.toNormalizedString(vnav.getText())) } ap.resetXPath() } } catch { case e :Exception => println(e) } } } I have imported VTD-XML Library It compiles Well but On Execution prints an Exception

VTD-XML doesn't return the right value, how can I modiy the query to get the right result?

隐身守侯 提交于 2019-12-08 09:14:15
问题 I'm using the following function to parse xml using VTD-XML: final AutoPilot ap = new AutoPilot(vtdNav); ap.selectXPath(path); int i = -1; /** evalXPath returns -1 if no new node is present */ while ((i = ap.evalXPath()) != -1) { extractedValues.add(vtdNav.toString(i+1)); } /** Reset the XPath */ ap.resetXPath(); But when I try to query : <actualUnitCost> <chargeOrAllowance>CHARGE</chargeOrAllowance> <monetaryAmount currencyISOCode="USD">17.08</monetaryAmount> </actualUnitCost> using the path

Using VTD in MultiThreaded App

萝らか妹 提交于 2019-12-08 09:07:23
问题 I have huge xmls as a result I have lot of xpaths to pull out the entries from the xml.So I am trying to spawn multiple threads so that each xpath can get evaluated in a different thread.But I am getting errors below is the code snippet which could give a fair idea, I have used a very small xml here for brevity purpose.I am creating 3 threads and queueing in 10 tasks. import java.io.File; import java.util.*; import java.util.concurrent.Callable; import java.util.concurrent.ExecutionException;

ArrayIndexOutofBoundException In Scala Program Usind VTD-XML

 ̄綄美尐妖づ 提交于 2019-12-08 07:46:55
问题 import java.lang._ import com.ximpleware._ object Sample { def main(args :Array[String])= { // println("helloo") try{ var i :Int = -1 val vgen :VTDGen= new VTDGen() val ap :AutoPilot =new AutoPilot() ap.selectXPath("CATALOG/CD/COUNTRY/text()") if(vgen.parseFile("../catalog.xml", false)) { val vnav :VTDNav = vgen.getNav() ap.bind(vnav) while((i=ap.evalXPath)!= -1) { println(vnav.toString(i)) println(vnav.toNormalizedString(vnav.getText())) } ap.resetXPath() } } catch { case e :Exception =>

CDATA in XML with ]] in the content

寵の児 提交于 2019-12-08 06:23:51
问题 I am using vtd-xml to do some xpaths on XML. My XML contains CDATA tags which vtd-xml seems to have an issue parsing. Here is my XML: <?xml version="1.0" encoding="UTF-8"?> <root><![CDATA[ some random ]] stuff ]]></root> Here is the exception I am getting: Caused by: com.ximpleware.ParseException: Error in CDATA: Invalid termination sequence Line Number: 2 Offset: 30 at com.ximpleware.VTDGen.process_cdata(VTDGen.java:3092) at com.ximpleware.VTDGen.parse(VTDGen.java:2640) at sandpit.lib.xml

How to ingore namespace prefixes on VTD Xpath lookup

[亡魂溺海] 提交于 2019-12-08 05:22:50
问题 I'm building a VTD based XML Parsing engine in order to process files from several input systems. I'm currently trying to get values from tags with namespace prefix: <?xml version="1.0" encoding="UTF-8"?> <cli:clients xmlns declarations > <cli:client> <dat:name>CLIENT NAME</dat:name> <dat:age>1</dat:age> </cli:client> and querying the following Xpaths: //client/age/text() //client/name/text() How can I set VTD AutoPilot to ignore the namespace prefix? NOTE : I cannot change the xpaths as I

How to get Inner array child element in XML using ximpleware

我怕爱的太早我们不能终老 提交于 2019-12-08 04:11:28
问题 AutoPilot searchProperties = new AutoPilot(); searchProperties.selectXPath("/BatchItemSearchResultAnswer/Result/SearchProperties/Content/Item"); searchProperties.bind(nav); searchPro searchOption = new searchPro(); while (searchProperties.evalXPath() != -1) { //reuser name.resetXPath(); name.selectXPath("Name"); searchOption.id = Id.evalXPathToString(); searchOption.name = name.evalXPathToString(); Log.e("SearchId", Id.evalXPathToString()); Log.e("SearchName", name.evalXPathToString()); Image

Map supplementary Unicode characters to BMP (if possible)

主宰稳场 提交于 2019-12-07 23:38:22
问题 I ran into the issue that my XML parser (VTD-XML) doesn't seem to be able to handle Unicode Supplementary characters (please correct if I'm already wrong here). It seems, the parser only uses the lower 16 bit of such characters. I cannot switch to another parser within the project I'm occupied with. I am parsing Medline abstracts (https://www.ncbi.nlm.nih.gov/pubmed) and it seems there have been added documents that contain supplementary characters over the last year (e.g. https://www.ncbi

How to get Attribute values from Select path or select Attribute ximpleware

送分小仙女□ 提交于 2019-12-06 18:57:25
<ConfiguredItems> <OtapiConfiguredItem> <Id>3117283038955</Id> <Quantity>1693</Quantity> <Configurators> <ValuedConfigurator Pid="1627207" Vid="3232480" /> <ValuedConfigurator Pid="20509" Vid="28314" /> </Configurators> </OtapiConfiguredItem> <OtapiConfiguredItem> <Id>3117283038956</Id> <Quantity>1798</Quantity> <Configurators> <ValuedConfigurator Pid="1627207" Vid="3232480" /> <ValuedConfigurator Pid="20509" Vid="6145171" /> </Configurators> </OtapiConfiguredItem> <OtapiConfiguredItem> <Id>3117283038957</Id> <Quantity>1815</Quantity> <Configurators> <ValuedConfigurator Pid="1627207" Vid=

How to ingore namespace prefixes on VTD Xpath lookup

泄露秘密 提交于 2019-12-06 15:59:37
I'm building a VTD based XML Parsing engine in order to process files from several input systems. I'm currently trying to get values from tags with namespace prefix: <?xml version="1.0" encoding="UTF-8"?> <cli:clients xmlns declarations > <cli:client> <dat:name>CLIENT NAME</dat:name> <dat:age>1</dat:age> </cli:client> and querying the following Xpaths: //client/age/text() //client/name/text() How can I set VTD AutoPilot to ignore the namespace prefix? NOTE : I cannot change the xpaths as I already have this engine in production implemented with JDK's default xpath engine. UPDATE : See below