Hi Kakoli,

You need your parser configured namespace-aware.
If you obtain it via JAXP, don't forget to setNamespaceAware(true) on the 
SAXParserFactory. Otherwise you may want to set the 
http://xml.org/sax/features/namespaces feature to true.

Jan Dvorak

Kakoli wrote:
| Hi all,
|
| I am not able to get different namespaces for a parent element and a child
| element even though I have defined different namespaces for both.
|
|  My xml request looks like :
|
| <?xml version="1.0" encoding="UTF-8"?>
| <Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/";>
|         <Body>
|                 <EL1 generic="2.0" xmlns="urn:uddi-org:api_v2">
|                         <EL2 xmlns="urn:uddi-org:repl">abcd</EL2>
|                 </EL1>
|         </Body>
| </Envelope>
|
| This is parsed by SAXParser(xerces 1.4.3)
|
| In my code of startElement method  where namespace is passed as a
| parameter, for both EL1 and EL2, the namespace obtained is the same as
| EL1(i.e., the root element), even though for EL2, different namespace is
| used. How do I get the EL2 namespace?
|
| Any answers?
|  Thanks & Regards,
| Kakoli
|
|
|
|  -----Original Message-----
| From: JC [mailto:[EMAIL PROTECTED]
| Sent: Thursday, June 20, 2002 10:28 PM
| To: [EMAIL PROTECTED]
| Subject: Re: How to identify the namespace?
|
|
|   This was what I needed! (The first part, not the second.) Thank you very
| much.
|
|
|
|   At 05:54 PM 6/20/2002 +0200, you wrote:
|
|     Hi,
|
|     If you use SAX2, you'll see a startPrefixMapping( prefix, nsuri ) event
|     before the startElement() event. Anyway, the startElement() event also
| passes
|     the namespace URI to you.
|     If you use DOM, you can get the namespace URI out of every element
| node.
|
|     Jan Dvorak
|
|     > Here is something that is bugging me... during the parsing of an RSS
|
| file,
|
|     > I need to be able to tell if it is a 0.9 RSS or a 1.0 RSS. Unlike RSS
|
| 0.91
|
|     > and 0.92, there is no "version" attribute. Here is what I have to
|     > work with:
|     >
|     > <rdf:RDF xmlns="http://my.netscape.com/rdf/simple/0.9/";
|     > xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";>
|     >
|     > This is an RSS 0.9 file.
|     >
|     > <rdf:RDF xmlns="http://purl.org/rss/1.0/";
|     > xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";>
|     >
|     > This is an RSS 1.0 file.
|     >
|     > The only difference between the two is the xmlns value. However, I
|
| cannot
|
|     > figure out how to get ahold of it. During element parsing, I only
|     > have access to the xmlns:rdf value (as uri), the element name and the
|
| qname. The
|
|     > attributes length is zero.
|     >
|     > So how can I get ahold of the xmlns value during parsing?
|     >
|     > Thanks for any help!
|     >
|     >
|     > ---------------------------------------------------------------------
|     > To unsubscribe, e-mail: [EMAIL PROTECTED]
|     > For additional commands, e-mail: [EMAIL PROTECTED]
|
|     ---------------------------------------------------------------------
|     To unsubscribe, e-mail: [EMAIL PROTECTED]
|     For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to