Thank you very much.  That worked.  Sorry to post this question on this
list, I didn't know that the problem was solely related to xpath.

thanks again,
Malia

-----Original Message-----
From: David N Bertoni/Cambridge/IBM [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 12, 2002 12:56 PM
To: [EMAIL PROTECTED]
Subject: Re: problem using XPathAPI



You're getting the error because your expression evaluates to a boolean and
not a node list.  This has nothing to do with Xalan, but is basic XPath
behavior.  If you want a node list, use a predicate:

"xs:[EMAIL PROTECTED]'" + book + "']"

General XPath questions such as this are best asked on the Mulberry XSL
list.

Dave



 

                      Malia Zaheer

                      <[EMAIL PROTECTED]         To:
[EMAIL PROTECTED]

                      acorp.com>               cc:      (bcc: David N
Bertoni/Cambridge/IBM)                                                      
                                               Subject: problem using
XPathAPI                                                                    
                      03/12/2002 09:25

                      AM

 

 




Hi,

I tried to use XPathAPI.selectNodeIterator method to get a NodeIterator but
I get an error that I don't understand:

org.apache.xpath.XPathException: Can not convert #BOOLEAN to a NodeList!
        at org.apache.xpath.objects.XObject.error(XObject.java:718)
        at org.apache.xpath.objects.XObject.nodeset(XObject.java:448)
        at org.apache.xpath.XPathAPI.selectNodeIterator(XPathAPI.java:175)
        at org.apache.xpath.XPathAPI.selectNodeIterator(XPathAPI.java:152)
        at MapXSLGenerator.generate(MapXSLGenerator.java:80)
        at Mapper.transform(Mapper.java:89)
        at test.main(test.java:27)

Here is the xml:

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";>

  <!-- definition of complex type elements -->
  <xs:element name="book">
    <xs:complexType>
      <xs:sequence>
               <xs:element name="title" type="xs:string"/>
               <xs:element name="author" type="xs:string"/>
               <xs:element name="character" minOccurs="0" maxOccurs
="unbounded">
<xs:complexType>
                   <xs:sequence>
                           <xs:element name="name" type="xs:string"/>
                           <xs:element name="friend-of" type="xs:string"
minOccurs="0"
maxOccurs="unbounded"/>
                   </xs:sequence>
                 </xs:complexType>
               </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>

</xs:schema>

I am trying to get xs:elment name="book".

The code is:

NodeIterator nl = XPathAPI.selectNodeIterator(scRoot,
"xs:element/@name=\""+book +"\"");

Note that book is a String containing the value "book".

Please help.

thanks,
Malia






Reply via email to