Page 1 of 1

Show namespaces of elements

Posted: Wed Nov 12, 2014 7:42 pm
by Greg
I have an XML doc that is validated with a Schema. With the XML Editor, is it possible to find out what namespace the schema processor thinks an unqualified name is in? For example, can I get a copy of the XML doc but with any unqualified names replaced by qualified names?
Thanks.
Greg Reese

Re: Show namespaces of elements

Posted: Thu Nov 13, 2014 1:46 pm
by adrian
Hi Greg,

You can check the namespace of the element at current cursor position in the Model view (menu > Window > Show View > Model). Note that the Model view is updated dynamically depending on the cursor position, so you can simply click on another element and glance at the Model view to check the namespace.

Oxygen doesn't have a tool that automatically adds/generates namespace prefixes to all elements with unqualified names. However, if there are a few namespaces, you can use the contextual menu (right click) on an element and pick Refactoring > Rename Prefix... to manually add a namespace prefix for all the elements from each of those namespaces.
The Rename prefix dialog shows you the current prefix and namespace in the title bar. Simply introduce the new prefix name (e.g. ns1) and select the option Rename current prefix in all document to add that namespace prefix for all the elements from that namespace found in the document.

Regards,
Adrian

Re: Show namespaces of elements

Posted: Thu Nov 13, 2014 3:43 pm
by Greg
Thanks Adrian. The technique with the cursor and the model view is just what I was looking for.
Greg Reese