Hi, Has anyone successfully marshalled XML with namespace prefixed using camel-xmljson?
A sample XML is shown below in which all elements are prefixed with namespace "rdm", I'd like to split on Record element to produce 2 json outputs <rdm:Results xmlns:rdm="http://www.arandomcompany.com"> <rdm:Recordset> <rdm:Record> <rdm:Id>1</rdm:Id> <rdm:Name>Alex</rdm:Name> </rdm:Record> <rdm:Record> <rdm:Id>2</rdm:Id> <rdm:Name>Bob</rdm:Name> </rdm:Record> </rdm:Recordset> </rdm:Results> My route looks like this: <camelContext id="blueprintContext" trace="false" xmlns="http://camel.apache.org/schema/blueprint"> <camel:route id="xmlFeed"> <camel:from uri="file://source" /> <camel:split streaming="true"> <camel:tokenize token="Record" xml="true" /> <camel:marshal> <camel:xmljson skipNamespaces="true" removeNamespacePrefixes="true"/> </camel:marshal> <camel:log message="${body}" /> </camel:split> </camel:route> </camelContext> And I'm getting the following error: Caused by: nu.xom.ParsingException: The prefix "rdm" for element "rdm:Record" is not bound. at line 1, column 26 at nu.xom.Builder.build(Unknown Source)[258:nu.xom:1.2.5.osgi] at nu.xom.Builder.build(Unknown Source)[258:nu.xom:1.2.5.osgi] at net.sf.json.xml.XMLSerializer.read(XMLSerializer.java:309)[256:org.apache.servicemix.bundles.json-lib:2.4.0.1] ... 83 more Caused by: org.xml.sax.SAXParseException: The prefix "rdm" for element "rdm:Record" is not bound. at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1236)[:1.7.0_25] ... 86 more Seems to me I need to bind the namespace with the marshaller so it's aware of the namespace but nothing in the doc (http://camel.apache.org/xmljson.html) shows that this can be do on xmljson. btw, xmljson is able to perform the transformation If I add xmlns to each Record elements, e.g. <rdm:Record xmlns:rdm="http://www.arandomcompany.com"> but unfortunately I have no control over the format of XML file It's much appreciated if someone could please shed some lights on this Thanks Phil -- View this message in context: http://camel.465427.n5.nabble.com/Marshall-xml-with-namespace-prefix-using-xmljson-tp5736616.html Sent from the Camel - Users mailing list archive at Nabble.com.
