[Gambas-user] XMLDocument GetSingleNode or XPath support?

Adrien Prokopowicz adrien.prokopowicz at ...626...
Tue Mar 8 03:39:40 CET 2016


Le Mon, 29 Feb 2016 15:10:49 +0100, KKing <kicking177 at ...626...> a écrit:

> On 17/02/16 09:15, KKing wrote:
>> does the XML component support a GetSingleNode method or allow an
>> XPath to be used to obtain single nodes?
>>  - - - -
>>
> is that a no then?
>
>

At the moment, there is no XPath support for the gb.xml component.

However, if you want to select specific nodes, you have several methods
at your disposal :

* The XmlElement.GetChildrenByTagName()[0] can be used to search elements
   with specific tag names, but it also supports LIKE[1] patterns. It can
   also receive a depth parameter if you want to restrict your search;
* The XmlElement.GetChildrenByAttributeValue()[2] works with similar  
options;
* The gb.xml.html sub-component adds a XmlElement.GetChildrenByFilter()[3]  
method,
   to which you can pass a CSS filter. Not all CSS expressions are  
supported though
   (see the MatchFilter()[4] help).

Hope that helps,

[0] http://gambaswiki.org/wiki/comp/gb.xml/xmlelement/getchildrenbytagname
[1] http://gambaswiki.org/wiki/lang/like
[2]  
http://gambaswiki.org/wiki/comp/gb.xml/xmlelement/getchildrenbyattributevalue
[3]  
http://gambaswiki.org/wiki/comp/gb.xml.html/xmlelement/getchildrenbyfilter
[4] http://gambaswiki.org/wiki/comp/gb.xml.html/xmlelement/matchfilter

-- 
Adrien Prokopowicz




More information about the User mailing list