You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by "PJ Fanning (Jira)" <ji...@apache.org> on 2022/04/22 23:19:00 UTC

[jira] [Comment Edited] (XMLBEANS-561) XPath support for namespace prefix to URI mappings

    [ https://issues.apache.org/jira/browse/XMLBEANS-561?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17526718#comment-17526718 ] 

PJ Fanning edited comment on XMLBEANS-561 at 4/22/22 11:18 PM:
---------------------------------------------------------------

Doesn't seem urgent since it took 6 months for you to check. Can we just close this?


was (Author: pj.fanning):
Doesn't seem urgent since it took 6 months for you to check

> XPath support for namespace prefix to URI mappings
> --------------------------------------------------
>
>                 Key: XMLBEANS-561
>                 URL: https://issues.apache.org/jira/browse/XMLBEANS-561
>             Project: XMLBeans
>          Issue Type: Improvement
>          Components: XPath
>    Affects Versions: Version 5.0.0
>            Reporter: Dimitrios Lagkouvardos
>            Priority: Major
>
> 5.0.0 supports Saxon and an XmlBeans xpath engine. I don't see a way to configure or supply at runtime namespace prefix to URI mappings.
> *Suggestions*:
> 1) One solution is to enhance XmlObject.selectPath(String,XmlOptions) to use the namespaces returned by XmlOptions.getLoadAdditionalNamespaces (or perhaps add a new method if this is deemed inappropriate).
> 2) An alternative is to add an extension to retrieve the mappings to be passed to the xpath engine (instead of passing it on each call to selectPath).
> *Note*: Adding the namespace declaration to the xpath expression as documented in [http://xmlbeans.apache.org/guide/XPathXQuery.html] does NOT work:
> ```
> java.lang.RuntimeException: net.sf.saxon.trans.XPathException: Namespace prefix 'table' has not been declared
>  at org.apache.xmlbeans.impl.xpath.saxon.SaxonXPath.selectNodes(SaxonXPath.java:128)
>  at org.apache.xmlbeans.impl.xpath.saxon.SaxonXPath.selectPath(SaxonXPath.java:133)
>  at org.apache.xmlbeans.impl.xpath.saxon.SaxonXPathEngine.next(SaxonXPathEngine.java:60)
>  at org.apache.xmlbeans.impl.store.Cursor._toSelection(Cursor.java:749)
>  at org.apache.xmlbeans.impl.store.Cursor._toNextSelection(Cursor.java:736)
>  at org.apache.xmlbeans.impl.store.Cursor._hasNextSelection(Cursor.java:728)
>  at org.apache.xmlbeans.impl.store.Cursor.syncWrapHelper(Cursor.java:2520)
>  at org.apache.xmlbeans.impl.store.Cursor.syncWrap(Cursor.java:2451)
>  at org.apache.xmlbeans.impl.store.Cursor.hasNextSelection(Cursor.java:2022)
>  at org.apache.xmlbeans.impl.values.XmlObjectBase.selectPath(XmlObjectBase.java:496)
> ```
>  



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org