|
From: Computer C. C. <in...@Co...> - 2011-02-15 13:16:45
|
VTD-XML version is 2.9 It looks as parsing throws an error when a prefix is defined at the top level instead of at the element itself: I have the following XML and Java code: <?xml version="1.0" encoding="UTF-8"?> <ODM xmlns="http://www.cdisc.org/ns/odm/v1.3" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:sdm="http://www.cdisc.org/ns/studydesign/v1.0"> <Study OID="Study1"> <MetaDataVersion OID="MV.001" Name="first"> <StudyEventDef OID="SE.001" Name="first visit"> <sdm:ActivityRef ActivityOID="ACT.001"/> </StudyEventDef> </MetaDataVersion> </Study> </ODM> The sdm: prefix is defined at the top level. When I parse using (Java): VTDGen vg = new VTDGen(); vg.setDoc(xmlBytes); try { vg.parse(true); // namespace aware } catch (EOFException eof) { eof.printStackTrace(); } catch (ParseException pe) { pe.printStackTrace(); } I get an error: com.ximpleware.ParseException: Name space qualification Exception: Element not qualified Line Number: 3 Offset: 9 at com.ximpleware.VTDGen.qualifyElement(VTDGen.java:4502) at com.ximpleware.VTDGen.parse(VTDGen.java:2724 When my XML however is: <?xml version="1.0" encoding="UTF-8"?> <ODM xmlns="http://www.cdisc.org/ns/odm/v1.3" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <Study OID="Study1"> <MetaDataVersion OID="MV.001" Name="first"> <StudyEventDef OID="SE.001" Name="first visit"> <sdm:ActivityRef ActivityOID="ACT.001" xmlns:sdm="http://www.cdisc.org/ns/studydesign/v1.0"/> </StudyEventDef> </MetaDataVersion> </Study> </ODM> so defining the prefix at the element level itself. In this case it parses well, there is no error thrown. Is this a bug? Or am I missing something? If it is a bug, is there a workaround? Many thanks in advance Jozef |