From: Jimmy Z. <jz...@xi...> - 2018-02-15 23:08:16
|
Thanks will look into it... ----- Original Message ----- From: "Owen Sam Springer UK" To:"vtd...@li..." Cc: Sent:Thu, 1 Feb 2018 12:41:43 +0000 Subject:[Vtd-xml-users] Weird edge case with element fragment and PI Hi, I've come across what I believe is a bug when processing instructions are included. Here's a test case. Thanks, Sam import com.ximpleware.* [1]; import org.junit.Assert [2]; import org.junit [3].Test; public class PIBugTest { @Test public void getElementFragmentTooLongWhenPIAndCarrageReturn() throws XPathParseException, NavException, XPathEvalException, ParseException { String exampleXml = "n" + " valuen" + " hellon" + " n" + " another valuen" + "n"; VTDGen vg = new VTDGen(); vg.setDoc(exampleXml.getBytes()) [4]; vg.parse( [5]false); VTDNav nav = vggetNav() [6]; AutoPilot autoPilot = new AutoPilot(nav); autoPilot.selectXPath( [7]"/a//b"); autoPilot.evalXPath() [8]; long fragment = nav.getElementFragment() [9]; IByteBuffer xml = nav.getXML() [10]; int offset = (int) fragment; int len = (int) (fragment >>> 32); //Fix for weird bug with pi Assert.assertEquals(new String(xml.getBytes() [11], offset, len), "value"); } } DISCLAIMER: This e-mail is confidential and should not be used by anyone who is not the original intended recipient. If you have received this e-mail in error please inform the sender and delete it from your mailbox or any other storage mechanism. Springer-Verlag London Limited does not accept liability for any statements made which are clearly the sender's own and not expressly made on behalf of Springer-Verlag London Limited or one of their agents. Please note that Springer-Verlag London Limited and their agents and affiliates do not accept any responsibility for viruses or malware that may be contained in this e-mail or its attachments and it is your responsibility to scan the e-mail and attachments (if any). Springer-Verlag London Limited. Registered office: The Campus, 4 Crinan Street, London, N1 9XW. Registered Number: 01738860 England. Links: ------ [1] http://sitemail.hostway.com/http: [2] http://org.junit.Assert [3] http://org.junit [4] http://sitemail.hostway.com/http: [5] http://sitemail.hostway.com/http: [6] http://sitemail.hostway.com/http: [7] http://sitemail.hostway.com/http: [8] http://sitemail.hostway.com/http: [9] http://sitemail.hostway.com/http: [10] http://sitemail.hostway.com/http: [11] http://sitemail.hostway.com/http: |