I have an XML document that includes XPath expressions that I need to use in my application. Since I have to define the Namespaces to Jaxen, I need to retrieve the namespaces that were in the original XML document after it is unmarshalled by JAX-B. How would I go about retrieving the declared namespaces? Thanks.
(*Chris*)
More Info:
I need to supply the Namespaces to the JDOM/Jaxen XPath processor when applying the mappings. (/…/ used for brevity)
<mappings set="RTE" xmlns="http://www.powerschool.com/mappings" xmlns:sif="http://www.sifinfo.org/infrastructure/2.x" xmlns:ntc="http://stumo.transcriptcenter.com">
<mapping name="Area">
<endpoint end="SIF" type="XML">
<xpath>/sif:StudentRecordExchangeData/.../sif:SIF_ExtendedElement[@Name="StudentDemographicRecordExtensions"]/.../ntc:Area</xpath>
</endpoint>
</mapping>
</mappings>
Following up on my comment above:
More specifically, the sif namepsace is not associated with any element or attribute in your XML document per-se, and therefore the declaration xmlns:sif=”xxx” is immaterial, including for JAXB. It’s only relevant to the application that interprets the value for mapping.endpoint.xpath.
Therefore I’m proposing to add the namespace declaration as explicit nodes for your application to process along with the value node, you should then be able to pass along to jaxen or any other module.