Totally bewildering !!

OK I've got problems using namespaces in predicates.
I tried to isolate this in a small example program but unfortunately the program
 works flawlessly :(

So I went to my main application and added some more dianostics.

In summary I have an XML file that contains eg

<ItoXML:Services xmlns=.....>
     <ItoXML:Service>
          <ItoXML:Name>myService</ItoXML:Name>
     </ItoXML:Service>
     <ItoXML:Service isSLA="1">
          <ItoXML:Name>myService_mySLA_SLA</ItoXML:Name>
     </ItoXML:Service>
</ItoXML:Services>

I then modified the big application to use Jaxen to select certain elements.
Then I extract the text against the  ItoXML:Name tag (using JDOM
getChildText("Name",namespace)]  and display it
as ->name-<

Here are the relevant bits of the log....(dont worry about times other stuff is
going in
(incidentally some of that other stuff involves calling XPath too - could it be
a threading issue - Hmmm)

25/10/02 14:22:48 | Testing //ItoXML:Service[ItoXML:Name = 'myService' ]
25/10/02 14:22:49 | XPath: path //ItoXML:Service[ItoXML:Name = 'myService' ]
25/10/02 14:22:54 | Xpath:Number of nodes = 0

     Note the above should be 1 node.

25/10/02 14:22:54 | Testing //ItoXML:Service[ItoXML:Name != 'myService' ]
25/10/02 14:22:54 | XPath: path //ItoXML:Service[ItoXML:Name != 'myService' ]
25/10/02 14:22:54 | Xpath:Number of nodes = 2
25/10/02 14:22:54 | ->myService<-
25/10/02 14:22:54 | ->myService_mySLA_SLA<-

     Again it should be just the latter node.

25/10/02 14:22:54 | Testing //ItoXML:Service[@isSLA = '1']
25/10/02 14:22:54 | XPath: path //ItoXML:Service[@isSLA = '1']
25/10/02 14:22:54 | ->myService_mySLA_SLA<-

25/10/02 14:22:54 | Testing //ItoXML:Service[not(@isSLA)]
25/10/02 14:22:54 | XPath: path //ItoXML:Service[not(@isSLA)]
25/10/02 14:22:54 | Xpath:Number of nodes = 1
25/10/02 14:22:54 | ->myService<-

25/10/02 14:22:54 | Testing //ItoXML:Service/ItoXML:Name
25/10/02 14:22:54 | XPath: path //ItoXML:Service/ItoXML:Name
25/10/02 14:22:54 | Xpath:Number of nodes = 2
25/10/02 14:22:54 | ->null<-
25/10/02 14:22:54 | ->null<-

These nulls are OK because the XPath is not selecting Service items.

NOW for good measure I modified my test program to read the same input file and
got the following
(correct) output ...

$ java -classpath ".;.\\jaxen-full.jar;.\\jdom.jar;.\\saxpath.jar" q
Testing //ItoXML:Service
Number of nodes = 2
Testing //ItoXML:Service[@isSLA = '1']
Number of nodes = 1
Testing //ItoXML:Service[not(@isSLA)]
Number of nodes = 1
Testing //ItoXML:Service[ItoXML:Name = 'myService']
Number of nodes = 1
Testing //ItoXML:Service[ItoXML:Name != 'myService']
Number of nodes = 1

So it seems more & more like some conflicting library problem. The application
is running under
Tomcat 3.1.1  / Java 1.4.1 NT where do I start!!!!

Lordy




-------------------------------------------------------
This sf.net email is sponsored by: Influence the future 
of Java(TM) technology. Join the Java Community 
Process(SM) (JCP(SM)) program now. 
http://ads.sourceforge.net/cgi-bin/redirect.pl?sunm0004en
_______________________________________________
Jaxen-interest mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jaxen-interest

Reply via email to