commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mcduffey, Joe" <jdmc...@nsa.gov>
Subject RE: Problem with JXPath 1.3 - Registering Namespaces
Date Wed, 25 Jul 2007 21:08:37 GMT
Matt,
   Thanks for getting back...
There are 2 problems:
1. What steps should be taken if you have an default namespace defined? see below
   <ElementA  xmlns="urn:/myspace" A:myAttr="Mytype">
      <ElementB>MY VALUE</ElementB>
   </ElementA>

I get no results from 
   JXPathContext.selectNodes("//ElementB");
However if I register a namespace as the default namespace uri I can get my results:
   JXPathContext.registerNamespace("myns","urn:/myspace"); // Default Namespace
      then query
   XPathContext.selectNodes("//myns:ElementB");

2. The next problem is that I thought if I register namespaces e.g.  
JXPathContext.registerNamespace();
Then I would not have to worry about the document not having them. However when I call

JXPathContext.registerNamespace("A","http://A");
JXPathContext.createPathAndSetValue("ElementA[1]/@A:mystuff,"value");

For the following

   <ElementA  xmlns="urn:/myspace">
      <ElementB A:mystuff="junk">MY VALUE</ElementB>
   </ElementA>

I get an exception thrown saying A
	org.apache.common.ri.model.dom.DOMNodePointer.createAttribute
	unknown namespace prefix: A

HELP!

-----Original Message-----
From: Matt Benson [mailto:gudnabrsam@yahoo.com]
Sent: Wednesday, July 25, 2007 3:48 PM
To: Jakarta Commons Users List
Subject: RE: Problem with JXPath 1.3 - Registering Namespaces



--- "Mcduffey, Joe" <jdmcduf@nsa.gov> wrote:

> I have an instance with a default namespace however
> I cannot get any results from a selectNodes() call.
> However if I register a namespaceNamespace("A",
> "http://A/") with the Default namespace the query
> works e.g.
> JXpathContext.selectNodes(//A:Element)
> but if I did not register the namespace and try to
> run the query as 
> JXpathContext.selectNodes(//Element) I get no
> Results. 
> 
> HELP!!!!!!!!!!!!!!!!

Whoa... calm down!  :)  I can't follow all that.  Give
me a breakdown of exactly how to evoke the
(mis-)behavior you're seeing.  Also, note that in a
few minutes' time I'll be committing what is intended
to fix your problems with createPathAndSetValue() for
externally-registered namespaced attributes.

-Matt

> 
> -----Original Message-----
> From: Mcduffey, Joe [mailto:jdmcduf@nsa.gov]
> Sent: Wednesday, July 25, 2007 11:37 AM
> To: Jakarta Commons Users List
> Subject: RE: Problem with JXPath 1.3 - Registering
> Namespaces
> 
> 
> Having a problem after registering a namespace as in
> your example then executing the following:
>   - createPathAndSetValue(element/@A:attribute);
> 
> -----Original Message-----
> From: Matt Benson [mailto:gudnabrsam@yahoo.com]
> Sent: Wednesday, July 25, 2007 11:15 AM
> To: Jakarta Commons Users List
> Subject: RE: Problem with JXPath 1.3 - Registering
> Namespaces
> 
> 
> Joe:  Did you test Sergey's patch or the latest 1.3
> trunk as of Tuesday afternoon/evening?  As of that
> time the svn trunk version worked for me against
> your
> submitted example.  If not, please attach more code
> which shows how to break the current ns handling and
> reopen JXPATH-97 in JIRA.  I'm trying to get all
> bugs
> resolved for a 1.3 release and this definitely
> sounds
> like something we want to have working properly.
> 
> Thanks,
> Matt
> 
> 
> --- "Mcduffey, Joe" <jdmcduf@nsa.gov> wrote:
> 
> > This still doesn't work properly see previous
> > message from 7/20/07...
> > 
> > ------------------   FROM PREVIOUS MESSAGE
> > ------------------
> > After registering Namespaces in JXPath 1.3 and
> then
> > calling
> > JXPathContext.createPathAndSetValue(key,value)
> > I get an exception
> > Unknown namespace prefix
> > 
> > However it had been successfully registered as I
> > checked with the method call
> > JXPathContext.getPrefix();
> > 
> > Any help in this area???? 
> > ------------------   FROM PREVIOUS MESSAGE
> > ------------------
> > 
> > -----Original Message-----
> > From: Sergey Vladimirov
> [mailto:vlsergey@gmail.com]
> > Sent: Saturday, July 21, 2007 10:12 AM
> > To: Jakarta Commons Users List
> > Subject: Re: Problem with JXPath 1.3 - Registering
> > Namespaces
> > 
> > 
> > Joe,
> > 
> > Please, look at the following issue and fix :)
> > http://issues.apache.org/jira/browse/JXPATH-97
> > 
> > -- 
> > Sergey
> > 
> > 
> > 2007/7/16, Mcduffey, Joe <jdmcduf@nsa.gov>:
> > >
> > > Can someone tell me how to register namespaces
> so
> > that attributes with
> > > namespaces does not cause the exception
> > >
> > >
> >
>
org.apache.common.ri.model.dom.DOMNodePointer.createAttribute
> > > unknown namespace prefix: xsi
> > >
> > > For example the following
> > > <ElementA  A:myAttr="Mytype">
> > >   <B:ElementB>MY VALUE</B:ElementB>
> > > </ElementA>
> > >
> > > Would result in the following exception:
> > >
> >
>
org.apache.common.ri.model.dom.DOMNodePointer.createAttribute
> > > unknown namespace prefix: A
> > >
> > > FYI: In this example there was a namespace
> > decaration in the file and I
> > > also manually called the
> > > registerNamespace(A,"/http...");
> > > registerNamespace(B,"/http...");
> > >
> > > There was no problem encountered for elements.
> > Only attributes. Can
> > > someone help? Thanks.
> > >
> > >
> > 
> > 
> > -- 
> > Sergey Vladimirov
> > 
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > commons-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> > commons-user-help@jakarta.apache.org
> > 
> > 
> 
> 
> 
>      
>
____________________________________________________________________________________
> Shape Yahoo! in your own image.  Join our Network
> Research Panel today!  
>
http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7
> 
> 
> 
> 
>
---------------------------------------------------------------------
> 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
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@commons.apache.org
> For additional commands, e-mail:
> user-help@commons.apache.org
> 
> 



      ____________________________________________________________________________________
Park yourself in front of a world of choices in alternative vehicles. Visit the Yahoo! Auto
Green Center.
http://autos.yahoo.com/green_center/ 

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


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


Mime
View raw message