That didn't work, this is the new binding file per the instructions http://www.nabble.com/file/6284/simplebinding2.xml simplebinding2.xml I got this error from the compiler org.jibx.runtime.JiBXException: Prefix required for namespace unless element default at org.jibx.binding.def.NamespaceDefinition.<init>(NamespaceDefinition.java:87)
Right now, I think there is a possible bug in Jibx, because as far as I can tell, it does not identify the proper default name space when I have the following in the XML: <PCHA_to_FPA:PCHA_Dataset xmlns:PCHA_to_FPA="http://businessobjects.datalayer.fpa" .... it then wants me to qualify everything with PCHA_to_FPA. But, if I have this: <PCHA_Dataset xmlns="http://businessobjects.datalayer.fpa" ...then it understands my default name space and doesn't need the qualification. Then again, I'm relatively new to the world of XML, so perhaps it's doing it right, and I'm just a confused developer :-) Either way, to get Jibx to parse my XML I had to modify the XML as stated in the 2nd stanza. Jibx is now happy without the name qualification. thanks for the help! Dennis Sosnoski wrote: > > The <namespace ... default="elements"/> in your binding tells JiBX you > want the namespace to be applied to all elements. In your case you just > want the namespace to apply to the root PCHA_Dataset element of your > document. Remove the default="elements" attribute from the <namespace/> > element in your binding, and add > ns="http://businessobjects.datalayer.fpa" to the <mapping> element start > tag. This will apply the namespace only to the root element. > > - Dennis > > Dennis M. Sosnoski > SOA and Web Services in Java > Training and Consulting > http://www.sosnoski.com - http://www.sosnoski.co.nz > Seattle, WA +1-425-939-0576 - Wellington, NZ +64-4-298-6117 > > > > Carmi wrote: >> I'm using jibx 1.1.3. and unmarshalling an XML. >> I have this binding file (simplified) >> http://www.nabble.com/file/6134/samplebinding.xml samplebinding.xml >> and this XML file http://www.nabble.com/file/6135/sampleTest.XML >> sampleTest.XML >> at runtime jibx complain about the name space. Basically it wants me to >> qulify the elements . In the real world, this is a big XML, and I don't >> see >> why jibx insists that I qualify the names. Don't want to qualify all the >> elements. >> When I put this: >> <PCHA_to_FPA:PCHA_Software_Version>0102042</PCHA_to_FPA:PCHA_Software_Version> >> Jibx is happy. >> Otherwise, it complains with: >> Failed Exception: Failed to parse file /tmp/sampleTest.xml, Expected >> "{http://businessobjects.datalayer.fpa}PCHA_Software_Version" start tag, >> found "PCHA_Software_Version" start tag (line 4, col 28) >> >> if in the xml I remove the namespace from this: >> xmlns:PCHA_to_FPA="http://businessobjects.datalayer.fpa" and leave it as >> xmlns="http://businessobjects.datalayer.fpa" jibx complains about error >> in >> the file. >> >> Any pointers/help would be greatly appriciated. >> Thanks >> > > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job > easier. > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > jibx-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/jibx-users > > -- View this message in context: http://www.nabble.com/problem-with-XML-name-space-qualification-tf3149555.html#a8833518 Sent from the jibx-users mailing list archive at Nabble.com. ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier. Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ jibx-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/jibx-users
