XML refactoring preview highlights namespace declarations

Having trouble installing <oXygen/>? Got a bug to report? Post it all here.
mboudreau
Posts: 20

XML refactoring preview highlights namespace declarations

Fri Nov 03, 2017 10:25 pm

I'm exploring the XML Refactoring tool, and I decided to try making a simple change: sec/title => sec/label

In the 'Rename element' dialog box, I specified this:
https://www.dropbox.com/s/rpiojvn5odi47gp/XML%20refactoring%201.png?dl=0

But the preview showed this, highlighting namespace declaration changes that I didn't request:
https://www.dropbox.com/s/byhwjdlxy95ydkw/XML%20refactoring%202.png?dl=0

It turns out the preview also showed the changes I wanted, but I had to scroll past a number of namespace declaration changes to find them. When I clicked Finish, the changes I wanted were made, but all the highlighted namespace declarations had been deleted as well.

Shouldn't the refactoring tool make only the requested changes?
alin
Site Admin
Posts: 109

Re: XML refactoring preview highlights namespace declarations

Wed Nov 08, 2017 1:24 pm

Hello,

I was able to obtain a similar situation using the XML document listed below:

Code: Select all

<root xmlns:ns="my-ns">
    <other
        xmlns:ns="my-ns"
        ns:attr="value"/>
    <sec>
        <title>My Title</title>
    </sec>
</root>


As you can see, in my case, the namespace declaration is redundant as it appears once on the root element and once on the <other> element.
Is this also true for your documents? If not, please send us a sample to reproduce the problem.

Although these changes may be unwanted and they may clutter the preview dialog, the resulted document is XML-equivalent with the original one from the namespaces context point of view. The XML Refactoring processor tries to limit the amount of changes performed on the input documents but it is not 100% accurate. Under the hood an XML Refactoring operation is in fact an XQuery Update or XSLT transformation performed with some tweaks and restrictions in order to minimize unwanted changes. In the case I have described above, the namespaces declarations are optimized by the XQuery Update / XSLT processor which triggers the removal of the redundant declarations.
You can read more about how an XML Refactoring operation is applied on a document here: https://www.oxygenxml.com/doc/versions/ ... tools.html

Regards,
Alin
Alin Balasa
Software Developer
<oXygen/> XML Editor
http://www.oxygenxml.com
mboudreau
Posts: 20

Re: XML refactoring preview highlights namespace declarations

Wed Nov 08, 2017 7:16 pm

Hi Alin,

Yes, the 'xlink' namespace is also defined on the root element of my document. I don't know why the redundant declaration occurs, but unfortunately I have no control over the files I'm given to work with.

It would be convenient if there were an 'Ignore namespaces' option, as there is in the Diff tool.
alin
Site Admin
Posts: 109

Re: XML refactoring preview highlights namespace declarations

Tue Nov 14, 2017 3:58 pm

Hello,

Thank you for your feedback! I have logged your request in our issue tracking tool.

Regards,
Alin
Alin Balasa
Software Developer
<oXygen/> XML Editor
http://www.oxygenxml.com

Return to “Common Problems”

Who is online

Users browsing this forum: No registered users and 2 guests