B4J Question Parse XML document

Luciano Canachiro

New Member
Hi guys,

I'm newbie into B4J and I need help to parse XML document. How can I parse this document with XMLsax or XML2map.bas? I don't know where to start.
I need to read from this line:
B4X:
<rs:data>
<z:row Cliente='TESTE COMUNICACOES E EVENTOS LTDA' Endereco='' areaatend='AT10' Territorio='A10' DiaFech='1' Modelo='L656' Nserie='xxxxx' c7='' CodMaquina='5736' IP='192.168.1.11' Configuracao='SCANER-PADRAO PB' TelefoneOperador='(  )     ' Operador=''/>
to the end.
Follows part of XML document.
Thanks.

Luciano

B4X:
<xml xmlns:s='uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882'
    xmlns:dt='uuid:C2F41010-65B3-11d1-A29F-00AA00C14882'
    xmlns:rs='urn:schemas-microsoft-com:rowset'
    xmlns:z='#RowsetSchema'>
<s:Schema id='RowsetSchema'>
    <s:ElementType name='row' content='eltOnly' rs:updatable='true'>
        <s:AttributeType name='Cliente' rs:number='1' rs:nullable='true' rs:writeunknown='true' rs:basecatalog='admcopy'
             rs:basetable='contrato' rs:basecolumn='Cliente'>
            <s:datatype dt:type='string' rs:dbtype='str' dt:maxLength='500'/>
        </s:AttributeType>
        <s:AttributeType name='Endereco' rs:number='2' rs:nullable='true' rs:writeunknown='true' rs:basecatalog='admcopy'
             rs:basetable='cadMaqCliente' rs:basecolumn='Endereco'>
            <s:datatype dt:type='string' rs:dbtype='str' dt:maxLength='250'/>
        </s:AttributeType>
        <s:AttributeType name='areaatend' rs:number='3' rs:nullable='true' rs:writeunknown='true' rs:basecatalog='admcopy'
             rs:basetable='cadMaqCliente' rs:basecolumn='areaatend'>
            <s:datatype dt:type='string' rs:dbtype='str' dt:maxLength='30'/>
        </s:AttributeType>
        <s:AttributeType name='Territorio' rs:number='4' rs:nullable='true' rs:writeunknown='true' rs:basecatalog='admcopy'
             rs:basetable='cadMaqCliente' rs:basecolumn='Territorio'>
            <s:datatype dt:type='string' rs:dbtype='str' dt:maxLength='100'/>
        </s:AttributeType>
        <s:AttributeType name='DiaFech' rs:number='5' rs:nullable='true' rs:writeunknown='true' rs:basecatalog='admcopy'
             rs:basetable='contrato' rs:basecolumn='DiaFech'>
            <s:datatype dt:type='int' dt:maxLength='4' rs:precision='10' rs:fixedlength='true'/>
        </s:AttributeType>
        <s:AttributeType name='Modelo' rs:number='6' rs:nullable='true' rs:writeunknown='true' rs:basecatalog='admcopy'
             rs:basetable='cadMaqCliente' rs:basecolumn='Modelo'>
            <s:datatype dt:type='string' rs:dbtype='str' dt:maxLength='50'/>
        </s:AttributeType>
        <s:AttributeType name='Nserie' rs:number='7' rs:writeunknown='true' rs:basecatalog='admcopy' rs:basetable='cadMaqCliente'
             rs:basecolumn='Nserie'>
            <s:datatype dt:type='string' rs:dbtype='str' dt:maxLength='30' rs:maybenull='false'/>
        </s:AttributeType>
        <s:AttributeType name='c7' rs:name='localizaçaomaquina' rs:number='8' rs:writeunknown='true' rs:basecatalog='admcopy'
             rs:basetable='cadMaqCliente' rs:basecolumn='localizaçaomaquina'>
            <s:datatype dt:type='string' rs:dbtype='str' dt:maxLength='50' rs:maybenull='false'/>
        </s:AttributeType>
        <s:AttributeType name='CodMaquina' rs:number='9' rs:basecatalog='admcopy' rs:basetable='cadMaqCliente' rs:basecolumn='CodMaquina'
             rs:keycolumn='true' rs:autoincrement='true'>
            <s:datatype dt:type='number' rs:dbtype='numeric' dt:maxLength='19' rs:scale='0' rs:precision='18' rs:fixedlength='true'
             rs:maybenull='false'/>
        </s:AttributeType>
        <s:AttributeType name='IP' rs:number='10' rs:nullable='true' rs:writeunknown='true' rs:basecatalog='admcopy'
             rs:basetable='cadMaqCliente' rs:basecolumn='IP'>
            <s:datatype dt:type='string' rs:dbtype='str' dt:maxLength='30'/>
        </s:AttributeType>
        <s:AttributeType name='Configuracao' rs:number='11' rs:nullable='true' rs:writeunknown='true' rs:basecatalog='admcopy'
             rs:basetable='cadMaqCliente' rs:basecolumn='Configuracao'>
            <s:datatype dt:type='string' rs:dbtype='str' dt:maxLength='70'/>
        </s:AttributeType>
        <s:AttributeType name='TelefoneOperador' rs:number='12' rs:nullable='true' rs:writeunknown='true' rs:basecatalog='admcopy'
             rs:basetable='cadMaqCliente' rs:basecolumn='TelefoneOperador'>
            <s:datatype dt:type='string' rs:dbtype='str' dt:maxLength='50'/>
        </s:AttributeType>
        <s:AttributeType name='Operador' rs:number='13' rs:nullable='true' rs:writeunknown='true' rs:basecatalog='admcopy'
             rs:basetable='cadMaqCliente' rs:basecolumn='Operador'>
            <s:datatype dt:type='string' rs:dbtype='str' dt:maxLength='100'/>
        </s:AttributeType>
        <s:extends type='rs:rowbase'/>
    </s:ElementType>
</s:Schema>
<rs:data>
    <z:row Cliente='TESTE COMUNICACOES E EVENTOS LTDA' Endereco='' areaatend='AT10' Territorio='A10' DiaFech='1'
         Modelo='L656' Nserie='xxxx' c7='' CodMaquina='5736' IP='192.168.1.11' Configuracao='SCANER-PADRAO PB' TelefoneOperador='(  )           '
         Operador=''/>
    <z:row Cliente='TESTE COMUNICACOES E EVENTOS LTDA' Endereco='' areaatend='AT10' Territorio='A10' DiaFech='1'
         Modelo='L656' Nserie='xxxx' c7='' CodMaquina='5765' IP='192.168.1.11' Configuracao='' TelefoneOperador='(  )           '
         Operador=''/>
    <z:row Cliente='TESTE CONTABILIDADE OUTSOURCING LTDA' Endereco='' areaatend='AT10' Territorio='A10' DiaFech='1'
         Modelo='MFC-7460DN' Nserie='xxxx' c7='CONJ. 61' CodMaquina='3424' IP='192.168.0.152' Configuracao=' SCAN@CC4'
         TelefoneOperador='(  )          ' Operador=''/>
 
Top