You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xmlbeans.apache.org by Aleksander Slominski <as...@cs.indiana.edu> on 2004/06/21 11:21:57 UTC

Re: bug fix for XPath using Namespace

Cezar Andrei wrote:

>The problem with this approach is that the user of the selectPath method has to know for sure what prefixes and namespaces are used in the XmlObject. 
>
>I think the prefixes in xpath expressions a independent from the ones in the document, so this means that the user should provide their own prefix resolver. This resolver can come from the same XmlObject if this is the intent, but otherwise they should be different.
>  
>

Cezar,

i agree and i think as jaxen is already used then either use Jaxen APIs directly or provide small wrapper over SimpleNamespaceContext <http://jaxen.org/apidocs/org/jaxen/SimpleNamespaceContext.html> (code example is available form an article about using XPATH with SOAP <http://webservices.xml.com/pub/a/ws/2003/09/16/jaxen.html> on xml.com)

it looks to me like the easiest, simplest, and well documented way to enable this functionality.

thanks,

alek

-- 
The best way to predict the future is to invent it - Alan Kay


Re: bug fix for XPath using Namespace

Posted by David Waite <ma...@akuma.org>.
The interfaces are also available through JAXP 1.3; I do not know if 
jaxen supports the new interfaces yet.

-David Waite

On Jun 21, 2004, at 3:21 AM, Aleksander Slominski wrote:

>  Cezar Andrei wrote:
>
> The problem with this approach is that the user of the selectPath 
> method has to know for sure what prefixes and namespaces are used in 
> the XmlObject.
>
> I think the prefixes in xpath expressions a independent from the ones 
> in the document, so this means that the user should provide their own 
> prefix resolver. This resolver can come from the same XmlObject if 
> this is the intent, but otherwise they should be different.
>
>
>
> Cezar,
>
> i agree and i think as jaxen is already used then either use Jaxen 
> APIs directly or provide small wrapper over SimpleNamespaceContext 
> (code example is available form an article about using XPATH with SOAP 
> on xml.com)
>
> it looks to me like the easiest, simplest, and well documented way to 
> enable this functionality.
>
> thanks,
>
> alek
>
> -- 
> The best way to predict the future is to invent it - Alan Kay
>


- ---------------------------------------------------------------------
To unsubscribe, e-mail:   xmlbeans-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xmlbeans-dev-help@xml.apache.org
Apache XMLBeans Project -- URL: http://xml.apache.org/xmlbeans/


Re: bug fix for XPath using Namespace

Posted by nn <nn...@comcast.net>.
If XMLBeans should follow JAXEN API, it is better to introduce XPath interface or BaseXPath class in XMBeans.
This approach is more suitable for precompilation of Xpath and the reuse of it for different XML objects.
And it is also useful to maintain the evaluation context, like namespaceContext and variableContext(maybe FunctionContext).

e.g.
XPath xpath = new XBeanXPath("/j/a[c = $n");
SimpleVariableCOntext varContext = new SimpleVariableContext();
varContext.setVariable("n", "zz");
xpath.setVariableContext(varContext);
ADocument doc = ADocment.Factory.parse(new File("xml/a.xml"));
List res = xpath.selectNodes(doc);

The support efficient query of XPath including variable is important feature, but current XMLBeans seems not supporting it.
nn

  ----- Original Message ----- 
  From: Aleksander Slominski 
  To: xmlbeans-dev@xml.apache.org 
  Sent: Monday, June 21, 2004 2:21 AM
  Subject: Re: bug fix for XPath using Namespace


  Cezar Andrei wrote:

The problem with this approach is that the user of the selectPath method has to know for sure what prefixes and namespaces are used in the XmlObject. 

I think the prefixes in xpath expressions a independent from the ones in the document, so this means that the user should provide their own prefix resolver. This resolver can come from the same XmlObject if this is the intent, but otherwise they should be different.
  

Cezar,

i agree and i think as jaxen is already used then either use Jaxen APIs directly or provide small wrapper over SimpleNamespaceContext (code example is available form an article about using XPATH with SOAP on xml.com)

it looks to me like the easiest, simplest, and well documented way to enable this functionality.

thanks,

alek
-- 
The best way to predict the future is to invent it - Alan Kay

Re: bug fix for XPath using Namespace

Posted by nn <nn...@comcast.net>.
If XMLBeans should follow JAXEN API, it is better to introduce XPath interface or BaseXPath class in XMBeans.
This approach is more suitable for precompilation of Xpath and the reuse of it for different XML objects.
And it is also useful to maintain the evaluation context, like namespaceContext and variableContext(maybe FunctionContext).

e.g.
XPath xpath = new XBeanXPath("/j/a[c = $n");
SimpleVariableCOntext varContext = new SimpleVariableContext();
varContext.setVariable("n", "zz");
xpath.setVariableContext(varContext);
ADocument doc = ADocment.Factory.parse(new File("xml/a.xml"));
List res = xpath.selectNodes(doc);

The support efficient query of XPath including variable is important feature, but current XMLBeans seems not supporting it.
nn

  ----- Original Message ----- 
  From: Aleksander Slominski 
  To: xmlbeans-dev@xml.apache.org 
  Sent: Monday, June 21, 2004 2:21 AM
  Subject: Re: bug fix for XPath using Namespace


  Cezar Andrei wrote:

The problem with this approach is that the user of the selectPath method has to know for sure what prefixes and namespaces are used in the XmlObject. 

I think the prefixes in xpath expressions a independent from the ones in the document, so this means that the user should provide their own prefix resolver. This resolver can come from the same XmlObject if this is the intent, but otherwise they should be different.
  

Cezar,

i agree and i think as jaxen is already used then either use Jaxen APIs directly or provide small wrapper over SimpleNamespaceContext (code example is available form an article about using XPATH with SOAP on xml.com)

it looks to me like the easiest, simplest, and well documented way to enable this functionality.

thanks,

alek
-- 
The best way to predict the future is to invent it - Alan Kay

Re: bug fix for XPath using Namespace

Posted by David Waite <ma...@akuma.org>.
The interfaces are also available through JAXP 1.3; I do not know if 
jaxen supports the new interfaces yet.

-David Waite

On Jun 21, 2004, at 3:21 AM, Aleksander Slominski wrote:

>  Cezar Andrei wrote:
>
> The problem with this approach is that the user of the selectPath 
> method has to know for sure what prefixes and namespaces are used in 
> the XmlObject.
>
> I think the prefixes in xpath expressions a independent from the ones 
> in the document, so this means that the user should provide their own 
> prefix resolver. This resolver can come from the same XmlObject if 
> this is the intent, but otherwise they should be different.
>
>
>
> Cezar,
>
> i agree and i think as jaxen is already used then either use Jaxen 
> APIs directly or provide small wrapper over SimpleNamespaceContext 
> (code example is available form an article about using XPATH with SOAP 
> on xml.com)
>
> it looks to me like the easiest, simplest, and well documented way to 
> enable this functionality.
>
> thanks,
>
> alek
>
> -- 
> The best way to predict the future is to invent it - Alan Kay
>


- ---------------------------------------------------------------------
To unsubscribe, e-mail:   xmlbeans-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xmlbeans-dev-help@xml.apache.org
Apache XMLBeans Project -- URL: http://xml.apache.org/xmlbeans/