Hi people.

I am wondering if anyone has managed to sucessfuly use XPathAPI class in XALAN 
2, in conjuction with
namespaces. It seems that whenever I make xpath queries with namespaces I get 
errors.


<?xml version="1.0 encoding="UTF-8" ?>
<test xmlns:test="http://rudedogs/test >
        <test:firstName> Kenny </test:firstName>
        <test:surName> Akpan </test:surName>
</test>

PrefixResolver prefix = new MyPrefixResolver();
XPathAPI xapi = new XPathAPI();
NodeList nlist = xapi.eval(doc.getDocumentElement(), "//test:firstName", 
prefix).nodelist();

// when I execute this nlist.getLength() ....will eqaul 0 when it should be 1

MyPrefixResolver class has this function
        public String getNamespaceForPrefix( String prefix ) {
                return( "http://rudedogs/test"; );
        }
-- 
    _/_/_/_/ _/    _/ _/    _/ Kenny Akpan 
   _/       _/    _/ _/_/  _/  eSunIT, 
  _/_/_/_/ _/    _/ _/ _/ _/   Phone: +44(0)1276 416538       
       _/ _/    _/ _/  _/_/    Email: [EMAIL PROTECTED]       
_/_/_/_/  _/_/_/  _/    _/     Sun Microsystems 

One of the greatest joys known to man is to take a
flight into ignorance in search of knowledge.

Reply via email to