I tried that already. It didn't work. Result is an empty map.

-----Original Message-----
From: Jacob Danner [mailto:[EMAIL PROTECTED] 
Sent: Thursday, May 24, 2007 3:33 PM
To: [email protected]
Subject: Re: how to retrieve namespaces defined in an XML file

Can't you do this via the XmlCursor API.
Something like:
XmlCursor.getAllNamespaces(Map addToThis)
http://xmlbeans.apache.org/docs/2.2.0/reference/org/apache/xmlbeans/XmlC
ursor.html
Hope this helps,
-Jacob Danner

On 5/24/07, Vijai Kalyan <[EMAIL PROTECTED]> wrote:
> I have a very easy (albeit ugly) answer for that one.
>
> Using the SAX parser as an example:
>
>
> Create a SAX parser.
> Parse your example file using a handler that extends DefaultHandler2.
> Override the method startPrefixMapping
> Collect the namespaces and prefixes into a NamespaceContext object in
the
> overriden startPrefixMapping method.
>
> Obviously, this is kinda slow but you can make it work in 20-30 mins.
>
> hth,
>
> Vijai.
>
>
> On 5/24/07, Ajay Aggarwal <[EMAIL PROTECTED]> wrote:
> >
> >
> >
> >
> > How can I retrieve all the namespaces (and prefixes) defined in an
XML
> file?
> >
> >
> >
> > Thanks.
>
>

---------------------------------------------------------------------
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