Forum Discussion

rashmi's avatar
rashmi
New Contributor III
3 years ago

Excel columns to xml using paticular xsd

Hi All,
I had parsed the excel sheets which is required and got the columns and rows need to convert to xml with xsd as shown below

B & C are columns of one excel sheet after parsing

pls could any one help how incoming data should be structured/framed(Json format) to satisfy this condition in xsd

Any help is appreciated.

cc: @dmiller, @koryknick, @ptaylor, @bojanvelevski, @siwadon, @del

7 Replies

  • rashmi's avatar
    rashmi
    New Contributor III

    I had formatted to below json excluding XML attribute just for testing purpose but xml generator is giving empty xml pls could any one help if i am missing anything or suggest any way
    json(i/p)

    xml(o/p)

    • bojanvelevski's avatar
      bojanvelevski
      Valued Contributor

      Hi @rashmi,

      It would be much easier if you send us the sample input data, and the XML used, complete with the Apache code.

      If I’m not mistaken, you are doing additional referencing step in the #For cycles.

      Try that and let us know.

      • rashmi's avatar
        rashmi
        New Contributor III

        PIMData.txt (1.8 KB)

        hi @bojanvelevski i was trying to frame that structure will share the sample input and xsd pls could u help pls
        samplerecords.json (262 Bytes)
        Please convert PIMData.txt to PIMData.xsd as the template is in that format
        Please also find output expected xml in txt format
        outputxml.txt (3.2 KB)

  • rashmi's avatar
    rashmi
    New Contributor III

    @bojanvelevski @alchemiz thanks a lot!! but one thing is how can we add id(which is dynamic) & translatable=“yes” which is constant for first column and translatable="no " which is constant for second column wanted to add attribute to even columns like how u added id attribute to row??

    Please could you help

    • alchemiz's avatar
      alchemiz
      Contributor III

      Hi Rashmi,

      Here’s an updated poc pipeline where I did some object manipulation to set col attributes id and translatable

      For setting up an attribute in an object key name should start with ‘@’ then set the node value to ‘$’

      I use regex to determine if col value is translatable or not e.g. value.match(/[a-z]/gi)

      canvas 15_2022_12_03.slp (7.2 KB)

      Thanks,
      EmEm