Recents
ReadRawXML MethodOfficial Content
Allows obtaining flat XML text from the start of an element.

Syntax

&DataType.ReadRawXML()

Type Retruned:
Character

Description

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>

Scope

Extended Data Types: XmlReader
Languages: .NET, Java, Ruby (up to GeneXus X Evolution 3), Visual FoxPro (up to GeneXus X Evolution 3)

See Also

Read
ReadType
SetDocEncoding.htmXmlReader Data Type


Was this page helpful?
What Is This?
Your feedback about this content is important. Let us know what you think.