Re: [xml] XPATH question when used within namespace



The namespace for an element is stored in xmlNodePtr::ns member. Namespace *is not*
a part of element name. Hint: what is the difference between
           <aaa:test xmlns:aaa="http://example.org"; />
and
           <bbb:test xmlns:bbb="http://example.org"; />

Please read XML specification.

Aleksey

chris coy . wrote:

When accessing any given element name within a tree document, the element name stored within xmlNodePtr->name is the element name without the namespace, as one would expect. But with XPATH, when trying to access a particular element nodeset that is part of a namespace, the only solution I came upon was to use the contains clause. Is this normal behavior for XPATH or a Gnome feature? Given the following document hierarchy here is my query: Envelope-Request
    Input-Parameters
         ds:Dataset
              ds:Row
XPATH QUERY:
"//Envelope-Request/Input_Parameters/*[contains(name(),'ds:Dataset')]/*[contains(name(),'ds:Row')]"
The above query was the only solution I discovered to access the "ds:Row" nodeset Any clarification appreciated.

------------------------------------------------------------------------
MSN 8 helps ELIMINATE E-MAIL VIRUSES. <http://g.msn.com/8HMUENUS/2743> Get 2 months FREE*._______________________________________________ xml mailing list, project page http://xmlsoft.org/ xml gnome org http://mail.gnome.org/mailman/listinfo/xml






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