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/XmlCursor.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]

Reply via email to