<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Get XML Elements in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Get-XML-Elements/m-p/278690#M54113</link>
    <description>&lt;P&gt;1) try the XML wizard. It has several ways to guess the structure of the XML, and a GUI to tailor the guesses. You might not be able to take advantage of the GUI, except to test the guesses.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="XML Wizard can be opened via File-&amp;gt;Open or from JSL as shown." style="width: 821px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/25362i311F51FD6FB99F8C/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture6.PNG" alt="XML Wizard can be opened via File-&amp;gt;Open or from JSL as shown." /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;XML Wizard can be opened via File-&amp;gt;Open or from JSL as shown.&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;If one of the guesses works, you just need to specify the guess option you need.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt=open(file,guess("wide"),xmlwizard(0));&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;2) open the file directly into a table...open(file), below, produces this, probably using the huge guess. Needs an XML extension.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt=open(file);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="elements" style="width: 371px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/25361i54ECC67EED2D0D37/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture5.PNG" alt="elements" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;elements&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;3) Or something like this&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;file=savetextfile("$temp/xxx.xml","&amp;lt;TopElement&amp;gt;
   &amp;lt;Element1&amp;gt;True&amp;lt;/Element1&amp;gt;
   &amp;lt;Element2&amp;gt;True&amp;lt;/Element2&amp;gt;
   &amp;lt;Element3&amp;gt;False&amp;lt;/Element3&amp;gt;
&amp;lt;/TopElement&amp;gt;");
show(loadtextfile(file,xmlparse(1)));
// {TopElement(Element1("True"), Element2("True"), Element3("False"))};&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;the xmlparse converts the xml structure into a JSL expression tree. See the &lt;LI-MESSAGE title="XML Importer Add-In" uid="22723" url="https://community.jmp.com/t5/JMP-Add-Ins/XML-Importer-Add-In/m-p/22723#U22723" discussion_style_icon_css="lia-mention-container-editor-message lia-img-icon-tkb-thread lia-fa-icon lia-fa-tkb lia-fa-thread lia-fa"&gt;&lt;/LI-MESSAGE&gt;&amp;nbsp;for a way to make a data table from the parsed expression tree. &lt;A href="https://community.jmp.com/t5/JMPer-Cable/The-2nd-thing-I-wish-I-knew-when-I-started-scripting-Getting/bc-p/278678#M492" target="_blank" rel="noopener"&gt;Comment on add-ins&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The XML wizard can probably replace the add-in for most cases.&lt;/P&gt;</description>
    <pubDate>Tue, 14 Jul 2020 23:44:13 GMT</pubDate>
    <dc:creator>Craige_Hales</dc:creator>
    <dc:date>2020-07-14T23:44:13Z</dc:date>
    <item>
      <title>Get XML Elements</title>
      <link>https://community.jmp.com/t5/Discussions/Get-XML-Elements/m-p/278667#M54110</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to read and XML file with a structure similar to the snippet below.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;lt;Top Element&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;&amp;lt;Element 1&amp;gt;True&amp;lt;/Element 1&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;&amp;lt;Element 2&amp;gt;True&amp;lt;/Element 2&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;&amp;lt;Element 3&amp;gt;False&amp;lt;/Element 3&amp;gt;&lt;BR /&gt;&amp;lt;/Top Element&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I know how to use the Parse XML by calling out the element names but in the document I have there are hundreds of different element names that I don't want to call out specifically in my code.&amp;nbsp; I understand that you can grab the Attribute info for each of these using the Text() like the following&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;info = "";&lt;/P&gt;&lt;P&gt;Parse XML(xml,&lt;BR /&gt;&amp;nbsp; &amp;nbsp;On Element("Top Element",&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; Text( info= info|| Trim( XML Text() ) || " " )&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;)&lt;/P&gt;&lt;P&gt;);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With the result of info being "True True False" which I could then parse into a list.&amp;nbsp;&amp;nbsp;But I don't really want to use this code for as I would not be able to easily know what the value of False actual belongs to.&amp;nbsp;&amp;nbsp;Is there anyway of getting all the Elements of an XML file and then maybe recursively calling the Parse XML function on those elements to get their attribute info?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Brandon&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 23:31:57 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Get-XML-Elements/m-p/278667#M54110</guid>
      <dc:creator>Brandon</dc:creator>
      <dc:date>2023-06-09T23:31:57Z</dc:date>
    </item>
    <item>
      <title>Re: Get XML Elements</title>
      <link>https://community.jmp.com/t5/Discussions/Get-XML-Elements/m-p/278690#M54113</link>
      <description>&lt;P&gt;1) try the XML wizard. It has several ways to guess the structure of the XML, and a GUI to tailor the guesses. You might not be able to take advantage of the GUI, except to test the guesses.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="XML Wizard can be opened via File-&amp;gt;Open or from JSL as shown." style="width: 821px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/25362i311F51FD6FB99F8C/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture6.PNG" alt="XML Wizard can be opened via File-&amp;gt;Open or from JSL as shown." /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;XML Wizard can be opened via File-&amp;gt;Open or from JSL as shown.&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;If one of the guesses works, you just need to specify the guess option you need.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt=open(file,guess("wide"),xmlwizard(0));&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;2) open the file directly into a table...open(file), below, produces this, probably using the huge guess. Needs an XML extension.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt=open(file);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="elements" style="width: 371px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/25361i54ECC67EED2D0D37/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture5.PNG" alt="elements" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;elements&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;3) Or something like this&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;file=savetextfile("$temp/xxx.xml","&amp;lt;TopElement&amp;gt;
   &amp;lt;Element1&amp;gt;True&amp;lt;/Element1&amp;gt;
   &amp;lt;Element2&amp;gt;True&amp;lt;/Element2&amp;gt;
   &amp;lt;Element3&amp;gt;False&amp;lt;/Element3&amp;gt;
&amp;lt;/TopElement&amp;gt;");
show(loadtextfile(file,xmlparse(1)));
// {TopElement(Element1("True"), Element2("True"), Element3("False"))};&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;the xmlparse converts the xml structure into a JSL expression tree. See the &lt;LI-MESSAGE title="XML Importer Add-In" uid="22723" url="https://community.jmp.com/t5/JMP-Add-Ins/XML-Importer-Add-In/m-p/22723#U22723" discussion_style_icon_css="lia-mention-container-editor-message lia-img-icon-tkb-thread lia-fa-icon lia-fa-tkb lia-fa-thread lia-fa"&gt;&lt;/LI-MESSAGE&gt;&amp;nbsp;for a way to make a data table from the parsed expression tree. &lt;A href="https://community.jmp.com/t5/JMPer-Cable/The-2nd-thing-I-wish-I-knew-when-I-started-scripting-Getting/bc-p/278678#M492" target="_blank" rel="noopener"&gt;Comment on add-ins&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The XML wizard can probably replace the add-in for most cases.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jul 2020 23:44:13 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Get-XML-Elements/m-p/278690#M54113</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2020-07-14T23:44:13Z</dc:date>
    </item>
    <item>
      <title>Re: Get XML Elements</title>
      <link>https://community.jmp.com/t5/Discussions/Get-XML-Elements/m-p/279256#M54137</link>
      <description>&lt;P&gt;Thanks for the quick response.&amp;nbsp; Using the XML wizard I was able to get it working.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jul 2020 14:38:11 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Get-XML-Elements/m-p/279256#M54137</guid>
      <dc:creator>Brandon</dc:creator>
      <dc:date>2020-07-15T14:38:11Z</dc:date>
    </item>
    <item>
      <title>Re: Get XML Elements</title>
      <link>https://community.jmp.com/t5/Discussions/Get-XML-Elements/m-p/279316#M54145</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/982"&gt;@Craige_Hales&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Wowee! I missed the xmlwizard in JMP15. Nice feature.&amp;nbsp; Thank you for the screenshot.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jul 2020 20:40:39 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Get-XML-Elements/m-p/279316#M54145</guid>
      <dc:creator>gzmorgan0</dc:creator>
      <dc:date>2020-07-15T20:40:39Z</dc:date>
    </item>
  </channel>
</rss>

