xom-interest AT lists.ibiblio.org
Subject: XOM API for Processing XML with Java
List archive
[XOM-interest] XOM Unknown namespace prefix : Noob Question
- From: "Bhaskar Maddala" <maddalab AT gmail.com>
- To: xom-interest AT lists.ibiblio.org
- Subject: [XOM-interest] XOM Unknown namespace prefix : Noob Question
- Date: Thu, 6 Dec 2007 18:14:17 -0500
Hello,
I receive a request that conforms to an xml schema, the schema definition
fragment is as follows
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="
http://schemas.mycompany.com/2007/pro" targetNamespace="
http://schemas.mycompany.com/2007/pro" elementFormDefault="qualified">
<xsd:complexType name="BusinessObjectsType">
<xsd:sequence minOccurs="1" maxOccurs="unbounded">
<xsd:element minOccurs="0" name="RequestSettings"
type="RequestSettingsType" />
....
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
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="http://schemas.mycompany.com/2007/pro">
<ns1:RequestSettings>
....
</ns1:RequestSettings>
</ns1:BusinessObjects>
I use the following code to retrieve a nu.xom.Document instance
Builder builder = new Builder();
StringReader reader = new StringReader(request);
Document document = builder.build(reader);
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?
Thanks
Bhaskar
-
[XOM-interest] XOM Unknown namespace prefix : Noob Question,
Bhaskar Maddala, 12/06/2007
- Re: [XOM-interest] XOM Unknown namespace prefix : Noob Question, adamc, 12/06/2007
Archive powered by MHonArc 2.6.24.