<?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 Parse XML Help in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Parse-XML-Help/m-p/78626#M36483</link>
    <description>&lt;P&gt;All,&amp;nbsp;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;I have some XML, I would like to parse using JSL. I am not familiar with XML, so pardon my ignorance.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;&amp;lt;Table&amp;gt;&amp;lt;Rule DayName=\!"Sunday\!" Val1=\!"1\!"/&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;What I tried is the following:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Parse XML( Test,
			On Element( "Table", Start Tag( New Table( XML Attr( "Table" ) ) ) ),
			On Element("Rule",End Tag( New Column( XML Attr( "DayName" ), Set Values( Parse( XML Text() ) ) ) ) )
		 );&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp; I know, I wold have to add one more rule using On Element to parse the "Val1" attribute, but that is not working, what I would like the output to be is :&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 643px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/12752iBA1D347E681EFDE1/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 10 Oct 2018 18:15:09 GMT</pubDate>
    <dc:creator>uday_guntupalli</dc:creator>
    <dc:date>2018-10-10T18:15:09Z</dc:date>
    <item>
      <title>Parse XML Help</title>
      <link>https://community.jmp.com/t5/Discussions/Parse-XML-Help/m-p/78626#M36483</link>
      <description>&lt;P&gt;All,&amp;nbsp;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;I have some XML, I would like to parse using JSL. I am not familiar with XML, so pardon my ignorance.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;&amp;lt;Table&amp;gt;&amp;lt;Rule DayName=\!"Sunday\!" Val1=\!"1\!"/&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;What I tried is the following:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Parse XML( Test,
			On Element( "Table", Start Tag( New Table( XML Attr( "Table" ) ) ) ),
			On Element("Rule",End Tag( New Column( XML Attr( "DayName" ), Set Values( Parse( XML Text() ) ) ) ) )
		 );&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp; I know, I wold have to add one more rule using On Element to parse the "Val1" attribute, but that is not working, what I would like the output to be is :&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 643px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/12752iBA1D347E681EFDE1/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Oct 2018 18:15:09 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Parse-XML-Help/m-p/78626#M36483</guid>
      <dc:creator>uday_guntupalli</dc:creator>
      <dc:date>2018-10-10T18:15:09Z</dc:date>
    </item>
    <item>
      <title>Re: Parse XML Help</title>
      <link>https://community.jmp.com/t5/Discussions/Parse-XML-Help/m-p/78678#M36501</link>
      <description>&lt;P&gt;test data&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Test =
"\[
&amp;lt;Table&amp;gt;
    &amp;lt;Rule DayName="Sunday" Val1="1"/&amp;gt;
    &amp;lt;Rule DayName="Monday" Val1="2"/&amp;gt;
    &amp;lt;Rule DayName="Tuesday" Val1="3"/&amp;gt;
&amp;lt;/Table&amp;gt;
]\";
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You can get what you asked for like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;
Parse XML( Test,
    On Element( "Table", Start Tag( dt1 = New Table( XML Attr( "Table" ) ) ) ),
    On Element( "Rule", End Tag( New Column( XML Attr( "DayName" ), Set Values( Eval List( {XML Attr( "Val1" )} ) ) ) ) )
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="one way" style="width: 622px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/12757i8E4AE6EC93382F61/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="one way" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;one way&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;But I think a better intepretation of the file&amp;nbsp;might look like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Parse XML( Test,
    On Element( "Table", Start Tag( dt2 = New Table( XML Attr( "Table" ), New Column( "DayName" ), New Column( "Val1" ) ) ) ),
    On Element(
        "Rule",
        End Tag(
            dt2 &amp;lt;&amp;lt; addrow( 1 );
            dt2:DayName = XML Attr( "DayName" );
            dt2:Val1 = XML Attr( "Val1" );
        )
    )
);
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Another way" style="width: 477px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/12758iD446F353EC8B85E2/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture2.PNG" alt="Another way" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Another way&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;(You don't want the parse(...); the example in the scripting index that uses it also has a JSL matrix in the XML file that needs the parse. Your example has a single number, in quotation marks. You could use the num() function to make the conversion so the column would be numeric.&amp;nbsp; &amp;nbsp;dt2:Val1 =&lt;EM&gt;&lt;STRONG&gt;num&lt;/STRONG&gt;&lt;/EM&gt;( XML Attr( "Val1" ));&amp;nbsp; )&lt;/P&gt;</description>
      <pubDate>Thu, 11 Oct 2018 01:46:08 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Parse-XML-Help/m-p/78678#M36501</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2018-10-11T01:46:08Z</dc:date>
    </item>
  </channel>
</rss>

