[Gambas-user] XML - Property ReadFlags

Adrien Prokopowicz adrien.prokopowicz at ...626...
Thu Aug 10 23:11:04 CEST 2017


Le Thu, 10 Aug 2017 18:42:37 +0200, Hans Lehmann <hans at ...3219...> a  
écrit:
> Hello Adrian,
>Thank you for this example in the playground. Now I can successfully  
> work with the component gb.xml.
>To the red marked lines in the source text section, I find no  
> description in the documentation.
>Questions: What is the meaning of the Boolean property ReadFlags with  
> regard to the use of the class XmlReader?What is the effect of setting  
> the value to False?
>Public Sub btnParseXMLNodes_Click()
>  txaNodes.Clear   xmlReader.Open(sXMLPath)  
>   xmlReader.ReadFlags[XmlReaderNodeType.Element] = True
>    xmlReader.ReadFlags[XmlReaderNodeType.Attribute] = True     
>   xmlReader.Read()
>   While Not xmlReader.Eof
>    ...
>   Wend
>  End
> Regards Hans

When a ReadFlag is set to False, the Read() method will skip the  
corresponding
XML node type if it encounters it.
By default they are all set to True, setting them to true manually won't  
do anything.

Here is an example, you can toggle the ReadFlags and see the result :

https://gambas-playground.proko.eu/?gist=b90eeff3dacbec0548d01701f3c05133

-- 
Adrien Prokopowicz




More information about the User mailing list