XML Question for a XML newbie

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf XML Question for a XML newbie

  • Creator
    Topic
  • #54207
    Jerry Tilsley
    Participant

      All,

      I’m a newbie when it comes to processing XML through Cloverleaf.  My question is really simple, can you not access the attributes defined in the XSD within the Xlate tool?

      Thanks,

      Jerry

    Viewing 6 reply threads
    • Author
      Replies
      • #80598
        Charlie Bursell
        Participant

          Simple question, simple answer:  YES

          Just expand the addresses in the Xlate tool

        • #80599
          Jerry Tilsley
          Participant

            I tried that, but I only get the nodes and child nodes, but not the attributes of nodes.  I’m on Cloverleaf 6.02 on Redhat 6.x.

            Thanks,

            Jerry

          • #80600
            Jerry Tilsley
            Participant

              Example of the XML is:

              Code:



               
                 John
                 25
               
               
                …..

              I’m trying to pull the gender and pass it along in a VRL.  The and Nodes are pulled in with no problem.  This is just something I’m playing with to work with all the elements in XML, far from a real world example.

              Thanks![/code]

            • #80601
              Charlie Bursell
              Participant

                You should be able to do that.  Depends on how the schema is defined

              • #80602
                Charlie Bursell
                Participant

                  I should have mentioned that if you run your test file against the schema using hcixmltest you will see the address of the attribute.  For example, I have a simple XML file and run the test, I see:

                  C:cloverleafcis6.0integratorcbtest>hcixmltest -p ship shipOrder shipOrder.xml

                  MESSAGE 1

                  shiporder.&orderid:   >889923<

                  shiporder.orderperson.#text:   >John Smith<

                  shiporder.shipto.name.#text:   >Ola Nordmann<

                  shiporder.shipto.address.#text:   >Langgt 23<

                  shiporder.shipto.city.#text:   >4000 Stavanger<

                  shiporder.shipto.country.#text:   >Norway<

                  shiporder.item(0).title.#text:   >Empire Burlesque<

                  shiporder.item(0).note.#text:   >Special Edition<

                  shiporder.item(0).quantity.#text:   >1<

                  shiporder.item(0).price.#text:   >10.90<

                  shiporder.item(1).title.#text:   >Hide your heart<

                  shiporder.item(1).quantity.#text:   >1<

                  shiporder.item(1).price.#text:   >9.90<

                  Note that is the attribute for the node shipOrder”

                  <shiporder orderid="889923"

                  If I look at it in Xlate I can access it under shipOrder at address &ordered

                  Hope this helps else send me a mail and I can send you an example

                • #80603
                  Jerry Tilsley
                  Participant

                    Ok, so I recompiled the XML and now in the test tool the attribute shows for the data. BUT, the xlate tool still does not show the field.

                    Thanks!

                    Jerry

                  • #80604
                    Jerry Tilsley
                    Participant

                      Alright, I got this to work.  As I said, I’m a newbie to XML.  I was compiling it and forgetting to choose the root level which caused the Xlate to not pick up the attribute.  All is working as expected now.

                      Thanks Charlie for the help!

                      Jerry

                  Viewing 6 reply threads
                  • The forum ‘Cloverleaf’ is closed to new topics and replies.