[Gambas-user] XMLDocument GetSingleNode or XPath support?
KKing
kicking177 at ...626...
Thu Mar 10 22:24:05 CET 2016
On 08/03/16 02:39, Adrien Prokopowicz wrote:
> 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
>
ta, I did contemplate the GetChildren methods.
Due to time pressures, and a very specific need, I resorted to modifying
the xml file via string manipulation.
If I ever need to revisit I may look to do it better, either within my
code or extending the component.
Would XPath fit within the gb.xml component, or would you imagine a
gb.xml.xpath component?
More information about the User
mailing list