commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sudhir Rao <sudhi...@att.net>
Subject Re: [JXPath] Registering namespace prefixes
Date Sat, 06 Dec 2003 23:41:36 GMT
I made some local modifications for this. I am not sure if adding  that 
registerNamespace is the right way to do it, as I am not very familiar 
with the codebase. The changes I did locally were to
a) Modify org.apache.commons.jxpath.ri.QName.java to include the 
namespace prefix (similar to the one in Apache Axis). Had to tweak it a 
bit to consider the prefix as the namespaceURI however to keep it 
compatible with existing code.
b) Maintain a HashMap of prefixes to namespace URIs in the TreeCompiler 
class.
c) Modify the TreeCompiler.qName(..) to populate the namespace URI in 
the QName instance returned.
d) Add the registerNamespace method to JXPathContextReferenceImpl and 
JXPathContext which in turn call a registerNamespace in Compiler class.

I can send across my changes if someone would like to look into it.

-Sudhir

>From: Prasad A. Chodavarapu <chprasad@hotmail.com>
>Subject: [JXPath] Registering namespace prefixes
>Date: Wed, 3 Dec 2003 12:32:23 -0500
>Content-Type: text/plain;
>	charset="iso-8859-1"
>
>
>
>Hi All:
>
>Is there a way of registering a namespace prefix upfront in a
>JXPathContext so that I can then use that prefix in xpath expressions?
>Here's what I'm looking for, in pseudo-code.
>
>JXPathContext domContext = JXPathContext.newContext(document);
>domContext.registerNamespace
>  (http://www.example.com/ns/sample, "prefix");
>domContext.getValue("prefix:a/prefix:b");
>
>Thanks
>chap
>
>
>
>
>
>  
>




---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message