1

edit: I'm working with Genexus 16 u2

I have an xml file and I want to read the values son I can save them in local variables of a procedure and later use the to create a new SDT from them.

There's this XMLReader Data Type that Genexus provides, and there's a few documentation (https://wiki.genexus.com/commwiki/servlet/wiki?6928,XMLReader+Data+Type,) but it's not clear how to access the fields, i.e what does the ReadType function does????

let's suppose we have the following XML:

<fatherTag>
<tag1>value1</tag2>
<tag2>value2</tag2>
...
<tagN>valueN</tagN>
</fatherTag>

where it clearly represents a "fatherTag" object with "tagX" properties, each of which have the "valueX" values.

And let's suppose we have an XMLReader variable, named &XMLReedr:

&XMLReedr.Open('myFile.xml')

It's very unclear how to access the values using the methods from XMLReader. Also, it doesn't says anywhere on the documentation about how (and where) to include the xml file in the Knowledge Base.

Thank you in advance.

  • After diggin in the documentation, I found that the properties Name and Value, and the Read() method is enough for processing an xml document. &XMLReedr.Read() : reads a tag, it goes secuentally (the first time you call it, it reads the first tag, then the next one... etc &XMLReedr.Name : it gives you the name of the tag which you last read &XMLReedr.Value : it gives you the value of the tag which you last read Knowing that and some "do while" logic and I could find the solution to my problems. – Marzio Cuello Apr 03 '19 at 17:00

1 Answers1

1

Here are a example how to read

&XMLReader.Open('Meeting.xml')     
&XMLReader.ReadType(1, 'MEMBERS')
&XMLReader.Read()
    Do While &XMLReader.Name <> 'MEMBERS'
        &MEMBER = &XMLReader.Value
        &XMLReader.Read()
    Enddo
&XMLReader.Close()

Here the documentation: https://wiki.genexus.com/commwiki/servlet/wiki?6928,XMLReader+Data+Type,

dmarecos
  • 11
  • 2