Hello, I have finally solved my problem. I am writing this in case someone else has a similar problem.
For the document that contains multiple namespaces, you need to have a line in your Java class for each of the namespace (thanks Ciao). The XPath would look different for having different types of namespaces. For example, you can define a "global" namespace like the following: <mets:mets xmlns:mets="some uri" xmlns:nnn="some other uri"> <mets:fieldOne> bb </mets:fieldOne> <mets:fieldTwo> aa </mets:fieldTwo> <nnn:aField> dd </nnn:aField> </mets:mets> which is equivalent to: <mets xmlns="http://wateva.com/some/" xmlns:nnn="http://someOtherURI.com/"> <fieldOne> bb </fieldOne> <fieldTwo> aa </fieldTwo> <nnn:aField> dd </nnn:aField> </mets> [Note: the xmlns declaration defines the global ] Therefore to access these, the XPathQueryService would have the following: XPathQueryService service = (XPathQueryService) col.getService ("XPathQueryService", "1.0"); service.setNamespace("mets","http://wateva.com/some/"); service.setNamespace("nnn","http://someOtherURI.com/"); and the XPath to use here would be: //mets:mets [ /mets:mets/mets:fieldOne = ' bb ' ] and similarly for the other namespaces: //mets:mets [ /mets:mets/nnn:aField = ' dd ' ] Thanks for the responses. Gul Akbar Quoting Gul Akbar <[EMAIL PROTECTED]>: > Hi, > I have now found that the XPath is wrong. I tried the XPath in an XSL > and it > didnt pick the node up. Is there a good site I can look at, or examples > for XSL > > (XPath) for the namespace tags? I think if I can sort the XPath out > first in > XSL then I'l use the XPathQueryService class. > > Does anyone know the XPath to the <name> and <ETOC:TEXT> tags in the > attached > document? > > Thanks > Gul > > > Quoting Gianugo Rabellino <[EMAIL PROTECTED]>: > > > Gul Akbar wrote: > > > I have tried removing all the occurences of the namespace in the > XML > > records, > > > and the XPath works fine. So this leaves me to believe that there > must > > be > > > something to do with the XPathQueryService class and the way it > > detects > > > namespaces. > > > > > > Has anyone come across this before. > > > > > > > AFAIK namespaces work just fine: we rely on the Xalan engine, so > > basically if they work with XSLT they should work with Xindice, so I > > tend to suspect that there is something wrong in your code or in > your > > documents. Have you removed the following line? > > > > service.setNamespace("xmlns","http://www.loc.gov/METS/"); > > > > Ciao, > > > > -- > > Gianugo Rabellino > > Pro-netics s.r.l. > > http://www.pro-netics.com > > > > > > > ------------------------------------------------- > This mail sent through IMP: webmail.brad.ac.uk > > ----- End forwarded message ----- > > > ------------------------------------------------- > This mail sent through IMP: webmail.brad.ac.uk > ------------------------------------------------- This mail sent through IMP: webmail.brad.ac.uk