Skip to Content.
Sympa Menu

xom-interest - [XOM-interest] XOM Unknown namespace prefix : Noob Question

xom-interest AT

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: "Bhaskar Maddala" <maddalab AT>
  • To: xom-interest AT
  • Subject: [XOM-interest] XOM Unknown namespace prefix : Noob Question
  • Date: Thu, 6 Dec 2007 18:14:17 -0500


I receive a request that conforms to an xml schema, the schema definition
fragment is as follows

<xsd:schema xmlns:xsd=""; xmlns=""; targetNamespace=""; elementFormDefault="qualified">
<xsd:complexType name="BusinessObjectsType">
<xsd:sequence minOccurs="1" maxOccurs="unbounded">
<xsd:element minOccurs="0" name="RequestSettings"
type="RequestSettingsType" />

From my limited understanding I do not believe the client is restricted in
using any namespace prefix when creating a xml that conforms to the schema
definition above.

Here is an example of the xml I receive for processing

<?xml version="1.0" encoding="UTF-8"?>
<ns1:BusinessObjects xmlns:ns1="";>

I use the following code to retrieve a nu.xom.Document instance

Builder builder = new Builder();
StringReader reader = new StringReader(request);
Document document =;

When I attempt to do the following
Nodes nodes = m_document.query("BusinessObjects/RequestSettings");

nodes.size() is zero. I think this is because XPath is Namespace aware
and I need the prefix ns1 in the query XPath expression.

Question : Currently I do not know the prefix used by the client making
the request, is there any way in XOM for me to retrieve the prefix so that I
can use it elsewhere, or better yet is there an option that would allow the
existing query to work?


Archive powered by MHonArc 2.6.24.

Top of Page