XML Refactoring > Wrap element content
Questions about XML that are not covered by the other forums should go here.
-
- Posts: 5
- Joined: Sat Oct 22, 2016 6:30 pm
XML Refactoring > Wrap element content
I'm having a problem using XML Refactoring > Wrap element content
Within an .xml file I want to wrap the contents of all <li> elements in the file with a <p> element e.g
e.g to change a file
from
<li>a</li>
<li>b</li>
to
<li><p>a</p></li>
<li><p>b</p></li>
Error:-
I get the following error when I try and use the "Wrap element content" operation.
"Description: XQST0059: java.io.FileNotFoundException: http://www.oxygenxml.com/ns/xmlRefactor ... commons.xq"
Steps leading to the error above:-
In the XML Refactoring dialog box, for "Wrap element content", I needed to specify three settings:
1. Target elements (XPath)--> I chose "li"
2. Wrapper element, local name --> I chose "p" from the drop-down menu
3.. Namespace --> I chose <NO_NAMESPACE> (I also have experimented with some of the many other namespaces available)
(at the bottom there is a note --> "Each prefix used in an XPath expression must be declared in the Default prefix-namespace mappings section.)
I went to the "Default prefix-namespace mappings", which opens the Preferences dialog box for XML/XSLT-FO-XQuery / XPath
In section "XPath Default Namespace (only for XPath version 2.0)"
I selected radio button "Use the default namespace from the root element"
For "Default prefix-namespace mappings"
I added Prefix = "li" and Namespace URI = "http://www.w3.org/2001/XMLSchema
Questions:-
a) Do I need to add Default prefix-namespace mappings for "li" and "p" ?
b) If yes, which namespace URI do I use for each of these "li" and "p" prefixes?
Thanks in advance.
Within an .xml file I want to wrap the contents of all <li> elements in the file with a <p> element e.g
e.g to change a file
from
<li>a</li>
<li>b</li>
to
<li><p>a</p></li>
<li><p>b</p></li>
Error:-
I get the following error when I try and use the "Wrap element content" operation.
"Description: XQST0059: java.io.FileNotFoundException: http://www.oxygenxml.com/ns/xmlRefactor ... commons.xq"
Steps leading to the error above:-
In the XML Refactoring dialog box, for "Wrap element content", I needed to specify three settings:
1. Target elements (XPath)--> I chose "li"
2. Wrapper element, local name --> I chose "p" from the drop-down menu
3.. Namespace --> I chose <NO_NAMESPACE> (I also have experimented with some of the many other namespaces available)
(at the bottom there is a note --> "Each prefix used in an XPath expression must be declared in the Default prefix-namespace mappings section.)
I went to the "Default prefix-namespace mappings", which opens the Preferences dialog box for XML/XSLT-FO-XQuery / XPath
In section "XPath Default Namespace (only for XPath version 2.0)"
I selected radio button "Use the default namespace from the root element"
For "Default prefix-namespace mappings"
I added Prefix = "li" and Namespace URI = "http://www.w3.org/2001/XMLSchema
Questions:-
a) Do I need to add Default prefix-namespace mappings for "li" and "p" ?
b) If yes, which namespace URI do I use for each of these "li" and "p" prefixes?
Thanks in advance.
-
- Posts: 404
- Joined: Thu Aug 21, 2003 11:36 am
- Location: Craiova
- Contact:
Re: XML Refactoring > Wrap element content
Post by radu_pisoi »
Hi,
I should admit the error that you get is pretty strange.
http://www.w3schools.com/xml/xml_namespaces.asp
https://www.w3.org/TR/REC-xml-names/
The problem that you get is rather related to the commons.xq XQuery module that is not correctly resolved. This XQuery module contains some utilities functions and it is located on disk in the XML Refactoring framework directory:
An XQuery operation references this module by using an import instruction like:
The remote URI is resolved through the XML catalog defined by the XML Refactoring framework
In order to investigate your issue, could you get us more additional details?
1. What oXygen version and distribution(Eclipse, Standalone) are you using?
2. Do you disable the XML Refactoring framework? Check if 'XML Refactoring' framework is disable in Preferences/Document Type Association options page.
3. Do you remove or modify the commons.xq file? Check if commons.xq file exists in the {oXygenInstallDir}/frameworks/xml_refactoring/libraries/commons folder.
I should admit the error that you get is pretty strange.
No, the problem is not related with the namespace of the 'li' element. XML Namespaces provide a method to avoid element name conflicts. However, the namespace 'http://www.w3.org/2001/XMLSchema' is reserved to the XML Schema vocabulary. Please see more about XML Namespaces and prefixes here:jon45 wrote:Questions:-
a) Do I need to add Default prefix-namespace mappings for "li" and "p" ?
b) If yes, which namespace URI do I use for each of these "li" and "p" prefixes?
http://www.w3schools.com/xml/xml_namespaces.asp
https://www.w3.org/TR/REC-xml-names/
The problem that you get is rather related to the commons.xq XQuery module that is not correctly resolved. This XQuery module contains some utilities functions and it is located on disk in the XML Refactoring framework directory:
Code: Select all
{oXygenINstallDir}/frameworks/xml_refactoring/libraries/commons/commons.xq.
Code: Select all
import module namespace xr = "http://www.oxygenxml.com/ns/xmlRefactoring" at "http://www.oxygenxml.com/ns/xmlRefactoring/resources/commons.xq";
Code: Select all
{oXygenInstallDir}/frameworks/xml_refactoring/catalog.xml
1. What oXygen version and distribution(Eclipse, Standalone) are you using?
2. Do you disable the XML Refactoring framework? Check if 'XML Refactoring' framework is disable in Preferences/Document Type Association options page.
3. Do you remove or modify the commons.xq file? Check if commons.xq file exists in the {oXygenInstallDir}/frameworks/xml_refactoring/libraries/commons folder.
Radu Pisoi
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
-
- Posts: 5
- Joined: Sat Oct 22, 2016 6:30 pm
Re: XML Refactoring > Wrap element content
Thanks for your reply.
The answer to your second question
>>2. Do you disable the XML Refactoring framework? Check if 'XML Refactoring' framework is disable in Preferences/Document Type Association options page.
is no.
So I have now enabled "XML Refactoring" in Preferences/Document Type Association options -- Thanks.
Now I have a secondary (XPath) question..if you would like to try and answer it..
Within an xml file, I'd like to wrap the contents of the <li> elements inside a <p> element, but only where the <li> elements do not currently contain a child <p> element.
1.
The following XPath expression wraps the contents of all <li> elements in a <p> element,
whether or not there is a child <p> element, so it is not the solution that I'm looking for.
Target elements (XPath) = "//ul/li"
Wrapper element
Local name ="p"
2.
I tried:-
Target elements (XPath) = "//ul/li/not(p)"
Wrapper element
Local name ="p"
But that did not yield any results.
--i.e When I selected Preview, the
Oxygen message "Could not find any resources that would be affected by this operation" appeared.
and XML Refactoring errors:
...
XPTY0004: Required item type of third argument of xr:compute-qname() is node(); supplied value has item type xs:boolean
...
Required item type of third argument of xr:compute-qname() is node(); supplied value has item type xs:boolean
I would like the last <li> element (containing "Hyper-V") to be selected in the following example:
<ul>
<li>
<p>Live Migration</p>
</li>
<li>
<p>Snapshot</p>
</li>
<li>
<p>Move</p>
</li>
<li>
<p>Export</p>
</li>
<li>
Hyper-V
</li>
</ul>
thanks.
The answer to your second question
>>2. Do you disable the XML Refactoring framework? Check if 'XML Refactoring' framework is disable in Preferences/Document Type Association options page.
is no.
So I have now enabled "XML Refactoring" in Preferences/Document Type Association options -- Thanks.
Now I have a secondary (XPath) question..if you would like to try and answer it..
Within an xml file, I'd like to wrap the contents of the <li> elements inside a <p> element, but only where the <li> elements do not currently contain a child <p> element.
1.
The following XPath expression wraps the contents of all <li> elements in a <p> element,
whether or not there is a child <p> element, so it is not the solution that I'm looking for.
Target elements (XPath) = "//ul/li"
Wrapper element
Local name ="p"
2.
I tried:-
Target elements (XPath) = "//ul/li/not(p)"
Wrapper element
Local name ="p"
But that did not yield any results.
--i.e When I selected Preview, the
Oxygen message "Could not find any resources that would be affected by this operation" appeared.
and XML Refactoring errors:
...
XPTY0004: Required item type of third argument of xr:compute-qname() is node(); supplied value has item type xs:boolean
...
Required item type of third argument of xr:compute-qname() is node(); supplied value has item type xs:boolean
I would like the last <li> element (containing "Hyper-V") to be selected in the following example:
<ul>
<li>
<p>Live Migration</p>
</li>
<li>
<p>Snapshot</p>
</li>
<li>
<p>Move</p>
</li>
<li>
<p>Export</p>
</li>
<li>
Hyper-V
</li>
</ul>
thanks.
-
- Site Admin
- Posts: 275
- Joined: Thu Dec 24, 2009 11:21 am
Re: XML Refactoring > Wrap element content
Alin Balasa
Software Developer
<oXygen/> XML Editor
http://www.oxygenxml.com
Software Developer
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 5
- Joined: Sat Oct 22, 2016 6:30 pm
Re: XML Refactoring > Wrap element content
Thanks for your reply. I'm nearly there, but frustratingly not quite..
Now, when I use the XPath
//ul/li[not(p)]
, I can see the expected results of the refactoring, when I click "Preview". Only the <li> elements with no child <p> element are selected, which is good.
However when I click "Finish" after "Preview", or I redo the refactoring and just click "Finish", nothing is changed in the XML topic.
I'm using
<oXygen/> XML Author 18.0, build 20160627
The license is one of a group of professional licenses
Another user of Oxygen reports a similar non-result to the one I describe above.
thanks,
Now, when I use the XPath
//ul/li[not(p)]
, I can see the expected results of the refactoring, when I click "Preview". Only the <li> elements with no child <p> element are selected, which is good.
However when I click "Finish" after "Preview", or I redo the refactoring and just click "Finish", nothing is changed in the XML topic.

I'm using
<oXygen/> XML Author 18.0, build 20160627
The license is one of a group of professional licenses
Another user of Oxygen reports a similar non-result to the one I describe above.
thanks,
-
- Site Admin
- Posts: 275
- Joined: Thu Dec 24, 2009 11:21 am
Re: XML Refactoring > Wrap element content
Hello,
In order to reproduce the issue and find a solution to this problem I would need the following details:
- a sample file on which you have reproduced the problem
- the scope you have selected for the operation
- the filters you have specifed for the operation, if any
Regards,
Alin
I cannot reproduce your issue with <oXygen/> XML Author 18.0, build 20160627 using a file with the sample XML fragment you provided:I can see the expected results of the refactoring, when I click "Preview". Only the <li> elements with no child <p> element are selected, which is good.
However when I click "Finish" after "Preview", or I redo the refactoring and just click "Finish", nothing is changed in the XML topic.
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<ul>
<li>
<p>Live Migration</p>
</li>
<li>
<p>Snapshot</p>
</li>
<li>
<p>Move</p>
</li>
<li>
<p>Export</p>
</li>
<li>
Hyper-V
</li>
</ul>
- a sample file on which you have reproduced the problem
- the scope you have selected for the operation
- the filters you have specifed for the operation, if any
Regards,
Alin
Alin Balasa
Software Developer
<oXygen/> XML Editor
http://www.oxygenxml.com
Software Developer
<oXygen/> XML Editor
http://www.oxygenxml.com
Return to “General XML Questions”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service