Re: [xml] xmllint and namespaces



On Mon, Nov 04, 2002 at 02:14:13PM +0100, Stefan Kost wrote:
 "There is no notion of a default namespace in an XPath query"

Okay, but I have read (under http://www.w3.org/TR/xpath) :
"Thus, the name of a node is modeled as a pair consisting of a local part and a 
possibly null namespace URI; this is called an expanded-name."

and things like that, but can't find your quotation.

  it's not worded as such. but in:
  
  2.3 Node Tests

 "A node test that is a QName is true if and only if the type of the node
  (see [5 Data Model]) is the principal node type and has an expanded-name
  equal to the expanded-name specified by the QName."

http://www.w3.org/TR/xpath#dt-expanded-name
 "Some types of node also have an expanded-name, which is a pair
  consisting of a local part and a namespace URI. The local part is a
  string. The namespace URI is either null or a string. The namespace
  URI specified in the XML document can be a URI reference as defined
  in [RFC2396]; this means it can have a fragment identifier and can
  be relative. A relative URI should be resolved into an absolute URI
  during namespace processing: the namespace URIs of expanded-names of
  nodes in the data model should be absolute. Two expanded-names are
  equal if they have the same local part, and either both have a null
  namespace URI or both have non-null namespace URIs that are equal."

 a node in the default namespace has a non-null namespace URI. To define
a node-test matching you must define a prefix in the XPath expression:

  2.3 Node Tests again

 "A QName in the node test is expanded into an expanded-name using the
  namespace declarations from the expression context. This is the same
  way expansion is done for element type names in start and end-tags
  except that the default namespace declared with xmlns is not used:
  if the QName does not have a prefix, then the namespace URI is null
  (this is the same way attribute names are expanded)."

Daniel

-- 
Daniel Veillard      | Red Hat Network https://rhn.redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



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