I have a very easy (albeit ugly) answer for that one.

Using the SAX parser as an example:


  1. Create a SAX parser.
  2. Parse your example file using a handler that extends
  DefaultHandler2.
  3. 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.

Reply via email to