Hi Dave, Thanks for the reply. Do you mean to say that we need to give prefix to the default namespace in the input xml file? Is that what you mean by mapping a prefix to the default namespace?
Is there anyway with out modifying my input xml file? -----Original Message----- From: David Bertoni [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 09, 2007 10:40 PM To: xalan-c-users@xml.apache.org Subject: Re: xpath expression with namespace Nageswar, Jaya wrote: > Hi Dave, > > If I have namespace like xmlns:ns = "http://....." in my xmal file > (sample.xml) then I can use the xpath expression as you suggested > ("//ns:message"). Yes, because you are using the root element as the prefix resolver. Note this technique won't work if the namespace declaration doesn't occur on the root element. It also won't work if there is more than one mapping for the namespace declaration, but that's a different problem. > > This xpath expression is able to retrieve desired results with the > following xpathevaluator with out using prefixresolver. > > evaluator.selectNodeList( nodelist, > dom_support, > root_context_node, > expression.c_str(), > namespace_node); > > But my question is how do we need to give xpath expression if we have > default namespace(xmlsns="http://....). As I said, you have to map a prefix to the namespace and use that prefix in your XPath expressions. There is nothing magical about the default namespace, so you can map any prefix to the same namespace URI. Similarly, you can map two different prefixes to the same namespace URI and use either of them. Dave