Obtains flat XML text from the start of an element.
&VarBasedOnXmlReader.ReadRawXML()
Type Retruned:
Character
Extended Data Types: XmlReader
Generators:
.NET,
Java, Ruby (up to GeneXus X Evolution 3), Visual FoxPro (up to GeneXus X Evolution 3)
Allows obtaining flat XML text from the start of an element.
Note: It is valid only for nodes of the Element type.
XML
<NFe xmlns="http://www.portalfiscal.inf.br/nfe">
<infNFe>
<cobr>
<fat>
<nFat>13111</nFat>
<vOrig>1731.65</vOrig>
<vLiq>1731.65</vLiq>
</fat>
<dup>
<nDup>0/</nDup>
<dVenc>2016-08-08</dVenc>
<vDup>1731.64</vDup>
</dup>
<dup>
<nDup>0/</nDup>
<dVenc>2016-08-08</dVenc>
<vDup>1731.65</vDup>
</dup>
<dup>
<nDup>0/</nDup>
<dVenc>2016-08-08</dVenc>
<vDup>1731.66</vDup>
</dup>
</cobr>
</NFe>
Code
&XMLReader.OpenFromString(&dadosxml)
// &AuxXML - Varchar
// &SubXml - Varchar
// &XMLReader - XMLReader
// &Sucess - Number
&sucess = &XMLReader.ReadType(NodeType.Element, 'infNFe')
&sucess = &XMLReader.ReadType(NodeType.Element, 'cobr')
&sucess = &XMLReader.ReadType(NodeType.Element, 'dup')
Do While (true)
&AuxXML = &XMLReader.ReadRawXML()
If (&AuxXML.Trim().Length() > 0)
&SubXml.Add(&AuxXML)
Else
Exit
EndIf
EndDo
&XMLReader.Close()
Output:
&SubXml will have 3 items with
Item1
<dup>
<nDup>0/</nDup>
<dVenc>2016-08-08</dVenc>
<vDup>1731.64</vDup>
</dup>
Item2
<dup>
<nDup>0/</nDup>
<dVenc>2016-08-08</dVenc>
<vDup>1731.65</vDup>
</dup>
Item3
<dup>
<nDup>0/</nDup>
<dVenc>2016-08-08</dVenc>
<vDup>1731.66</vDup>
</dup>
This method does not sanitize inputs. Proper sanitization is advised.
Read
ReadType
SetDocEncoding.htmXmlReader Data Type