cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Browse apps to extend the software in the new JMP Marketplace
Choose Language Hide Translation Bar
jeffjy
Staff (Retired)

Importing an XML file into JMP

Hi guys,

 

Any one try to use JMP to work with XML file before? Can JMP import XML file?

1 ACCEPTED SOLUTION

Accepted Solutions
Craige_Hales
Super User

Re: Reading XML file

Anyone landing here for JMP 15 and beyond: there is built-in support for reading XML and JSON data that includes a GUI-based wizard. (JMP 14 has non-GUI support for JSON as well).

The wizard looks similar for both XML and JSON filesThe wizard looks similar for both XML and JSON files

 

 

Craige

View solution in original post

5 REPLIES 5
jschroedl
Staff

Re: Reading XML file

JMP has functions for loading and parsing XML.

If you have the XML as text strings, use ParseXML

 

ex =
"<table name='fromxml'><col name='x'>[1 2 3]</col><col name='y'>[11 22 33]</col></table>";
Parse XML( ex,
     On Element(
          "table",
          Start Tag(
               New Table( XML Attr( "name" ) )
          )
     ),
     On Element(
          "col",
          End Tag(
               New Column( XML Attr( "name" ),
                    Set Values( Parse( XML Text() ) )
               )
          )
     )
);

From a file:

Parse XML( LoadTextFile("c:\temp\test.xml"),
          "table",
     On Element(
          Start Tag(
               New Table( XML Attr( "name" ) )
          )
     ),
     On Element(
          "col",
          End Tag(
               New Column( XML Attr( "name" ),
                    Set Values( Parse( XML Text() ) )
               )
          )
     )
);
ix_stats
Level I

Re: Reading XML file

Hi Jschroedl,

I have an XML file with contents as shown below. I was trying to create a JMP table from it.

How do i write the jsl so that I can pick up the value in the 'Type' field in folder "CD" which would be '0' and not pick up the '1' from the "DD" folder (also with a 'Type' field but is within "CD")?

Thanks.

XML contents:

- <Summary_Log>

  - <Info>

    <UID>AA11</UID>

    <Ver>1.0</Ver>

    - <CD>

      <UID>AA11</UID>

      <Type>0</Type>

      - <DD>

        <UID>AA11</UID>

        <Type>1</Type>

        </DD>    

      </CD>

    </Info>

</Summary_Log>

sfayer0
Level II

Re: Reading XML file

Having the same problem.  The documentation does not go into much details on this.

Craige_Hales
Super User

Re: Reading XML file

try the addin.

https://community.jmp.com/t5/JMP-Add-Ins/XML-Importer-Add-In/ta-p/22723

Output from XML addinOutput from XML addin

The column names are the fully qualified path through the XML document.

(The addin source JSL is there too. View->add-ins->open the folder and see the JSL.)

Craige
Craige_Hales
Super User

Re: Reading XML file

Anyone landing here for JMP 15 and beyond: there is built-in support for reading XML and JSON data that includes a GUI-based wizard. (JMP 14 has non-GUI support for JSON as well).

The wizard looks similar for both XML and JSON filesThe wizard looks similar for both XML and JSON files

 

 

Craige