Re: [xml] question on xml validtion and xpath

On Fri, Aug 04, 2006 at 02:36:52PM -0700, Andric, Milan wrote:
Sample XML file:
<?xml version="1.0" encoding="utf-8" ?>
<TU xmlns="";
xsi:schemaLocation=" config.xsd">  
            <Model Name="Models">
Question: My Xpath Inquiry: 
returns no results - why is this and how can I make it so that both

  That's normal. Your elements are in a namespace, the default namespace
defined in the instance (xmlns="";) and in XPath
you must use a prefix in the query to access a namespaced node. The only
solution is to use /p:TU/p:Model and define a binding between p and
""; in the XPath context. 

  This is really a very very frequently asked XPath question, the one that
each and every beginner to XPath who doesn't learn from a book or a tutorial
get hit with (assuming one uses namespaces)


Daniel Veillard      | Red Hat
veillard redhat com  | libxml GNOME XML XSLT toolkit | Rpmfind RPM search engine

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]