Tips and tricks for using JiBX
start > usage-questions > no-namespaces

no-namespaces

Created by dsosnoski. Last edited by dsosnoski, one year and 218 days ago. Viewed 995 times. #1
I'm having to work with some really poor XML from a supplier my customer uses. They're use of namespaces is very questionable and is giving me a lot of grief. I need either to turn off namespace matching in Jibx, or I need the ability to specify mappings that can appear in more than one namespace. Any suggestions?

There's a public void setDocument(java.io.Reader rdr, java.lang.String name, boolean nsa) method in the org.jibx.runtime.impl.UnmarshallingContext that allows you to disable namespace handling by the parser. I believe that if you disable the namespaces you get the entire name, including any prefix used in the XML document. If you need to worry about stripping off prefixes you may need to use your own parser wrapper class for that purpose, which would implement the IXMLReader interface. See the org.jibx.runtime.impl.XMLPullReaderFactory and StAXReaderFactory code for the XMLPull and StAX wrapper implementations.

no comments
snipsnap.org | Copyright 2000-2002 Matthias L. Jugel and Stephan J. Schmidt