XPath validation errors?

Oxygen general issues.
ttasovac
Posts: 87
Joined: Fri Dec 19, 2003 6:02 pm

XPath validation errors?

Post by ttasovac »

Hi.

I need to process some Word Documents that have been saved as Word XML. An example can be found here https://dl.dropboxusercontent.com/u/357143/Test.xml

For some reason, when I open this file in Oxygen, I can't even begin to run XPath queries on it. All XPath queries give me an error that says:

Code: Select all

XPath failed due to: One or molre validation errors were reported
I assume I am doing something wrong. The root element of the document is <pkg:package> but //package (or even //pkg:package) doesn't work. (As far as I know Oxygen doesn't care about prefixes in XPath queries.

I'd be vary grateful for any tips how I should proceed.

All best,
Toma
Costin
Posts: 846
Joined: Mon Dec 05, 2011 6:04 pm

Re: XPath validation errors?

Post by Costin »

Hello,

Code: Select all

XPath failed due to: One or molre validation errors were reported
We have just tested the XPath queries you have specified over your Test.xml document, but we could not reproduce the issue related to the error you receive, neither on oXygen XML Editor v15.2, nor on the latest version - v16.0.

Regarding the queries you are trying to run, you should first check what is the default namespace you have set in oXygen's preferences. For that, you should go into oXygen menu to Options > Preferences > XML > XSLT-FO-XQuery > XPath then check what option you have enabled under the "XPath Default Namespace" section.

In case the one that is currently active is "Use the default namespace of the root element", this explains why the XPath query does not return any results for "//package", because the default namespace is not declared for your root element. However, "//pkg:package" should return the result if you are querying in the current file scope.
You can check and set the right scope for your XPath queries from the droplist next to "Scope" in the XPath/XQuery Builder view, or from the related button in the left side of the XPath toolbar (with a little "document" like icon).

To return results even for the "//package" query, in the above specified XPath preferences page you should set the "XPath Default Namespace" to "Use the namespace of the root". This way, the "pkg:" prefix will be picked and considered for your queries.

I hope you find this helpful and let me know if you need additional assistance.

Kind Regards,
Costin
Costin Sandoi
oXygen XML Editor and Author Support
Post Reply