commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dmitri Plotnikov" <dmi...@apache.org>
Subject Re: [JXPath] Registering namespace prefixes - never mind
Date Mon, 19 Jan 2004 20:50:18 GMT
Chap, Sudhir,

After some profound discussions on the jdom-interest@jdom.org mailing list,
I decided to roll back this new feature.  I need to better understand the
use case before I introduce this new API.

Is the functionality you are referring to intended for use with Java
objects?  What is the meaning of a namespace URI in the context of Java
objects?  Please, give me as much information about this use case as
possible.

- Dmiri

----- Original Message ----- 
From: "Dmitri Plotnikov" <dmitri@apache.org>
To: <chprasad@hotmail.com>; "Jakarta Commons Users List"
<commons-user@jakarta.apache.org>; ""Sudhir Rao"" <sudhirrs@att.net>
Cc: "Jakarta Commons Developers List" <commons-dev@jakarta.apache.org>
Sent: Saturday, January 17, 2004 8:52 PM
Subject: Re: [JXPath] Registering namespace prefixes


> Chap,
>
> I added registration of external namespaces to JXPath. My solution is a
> little different from the one proposed by Sudhir.  The main difference in
> the API is that instead of calling registerNamespace directly on
> JXPathContext, you call it indirectly like this:
>
>    JXPathContext context = JXPathContext.newContext(document);
>    NamespaceManager nsm = context.getNamespaceManager();
>    nsm.registerNamespace ("prefix", "http://www.example.com/ns/sample");
>
> Take a look at the NamespaceManager interface - you can supply your own
> implementation, which could perform very flexible customizations of
> namespace lookup.
>
> Please note that external namespaces are supported with DOM but not JDOM,
> because JDOM B9 at this point requires that all namespaces be explicitly
> declared in the XML file itself.
>
> Chap, Sudhir, if you guys get a chance to try out the new APIs to see if
> they address your needs, I will highly appreciate it.
>
> Thanks,
>
> - Dmitri
>
>
> ----- Original Message ----- 
> From: "Sudhir Rao" <sudhirrs@att.net>
> To: <chprasad@hotmail.com>
> Cc: <commons-user@jakarta.apache.org>
> Sent: Saturday, December 06, 2003 6:41 PM
> Subject: Re: [JXPath] Registering namespace prefixes
>
>
> > 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
>
>
>



---------------------------------------------------------------------
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