Uniface User Forum

 View Only
  Thread closed by the administrator, not accepting new replies.
  • 1.  Uniface 9: Renaming elements in XML output

    ROCKETEER
    Posted 11-19-2018 11:40
    No replies, thread closed.

    Renaming elements in XML output

    Author: tneeskens@itblockz.nl (Theo Neeskens)

    Hi, I have a situation where I need to: – retrieve lots of related data in a Uniface service – create a struct using componenttostruct – create XML using structtoxml – dump the XML as a file on disk    It works fine so far, but I need to rename some of the XML tags. Lets say that in Uniface I have a field CUSTNR and my XML tag should be CUSTOMERNUMBER. I have read the documentation a couple of times and I now think it is possible with structtoxml/schema. But since I havent used XSD for output before, I am unsure. Am I on the right track? Can somebody explain in plain English what I need to do?



  • 2.  RE: Uniface 9: Renaming elements in XML output

    ROCKETEER
    Posted 11-19-2018 11:40
    No replies, thread closed.

    Hi Theo, the simplest solution should be the following :   – retrieve lots of related data in a Uniface service – create a struct using componenttostruct   vStruct->*->CUSTNR->$name = "CUSTOMERNUMBER"   – create XML using structtoxml – dump the XML as a file on disk    Regards Norbert


    Author: Lauterbach (norbert.lauterbach@infraserv.com)


  • 3.  RE: Uniface 9: Renaming elements in XML output

    ROCKETEER
    Posted 11-19-2018 11:40
    No replies, thread closed.

    Thank you Norbert! That is what I was looking for.   I think I have done this before but it slipped too far to the back of my mind


    Author: Theo Neeskens (tneeskens@itblockz.nl)


  • 4.  RE: Uniface 9: Renaming elements in XML output

    ROCKETEER
    Posted 11-19-2018 11:40
    No replies, thread closed.

    another way.. structtoxml - where-ever you store the raw xml.... for example variables string vs_xml endvariables vs_xml = $replace(vs_xml, 1, "CUSTNR", "CUSTOMERNUMBER", -1) Don't know which one is the fastest one thou Knut


    Author: Knut (knut.dybendahl@gmail.com)


  • 5.  RE: Uniface 9: Renaming elements in XML output

    ROCKETEER
    Posted 11-19-2018 11:40
    No replies, thread closed.

    Knut With $replace there is the Risk, that you replace a word that is in a textfield. So you have to use 3 replace Statements : vs_xml = $replace(vs_xml, 1, “<CUSTNR>”, “<CUSTOMERNUMBER>”, -1) vs_xml = $replace(vs_xml, 1, “</CUSTNR>”, “</CUSTOMERNUMBER>”, -1) vs_xml = $replace(vs_xml, 1, “<CUSTNR/>”, “<CUSTOMERNUMBER/>”, -1)   Regards Norbert


    Author: Lauterbach (norbert.lauterbach@infraserv.com)


  • 6.  RE: Uniface 9: Renaming elements in XML output

    ROCKETEER
    Posted 11-19-2018 11:40
    No replies, thread closed.

    vs_xml= $replace($replace($replace(vs_xml, 1, "<CUSTNR>","<CUSTOMERNUMBER>",-1),1,"</CUSTNR>","</CUSTOMERNUMBER>",-1),1,"<CUSTNR/>","<CUSTOMERNUMBER/>",-1)


    Author: Knut (knut.dybendahl@gmail.com)