All,
I have some XML, I would like to parse using JSL. I am not familiar with XML, so pardon my ignorance.
What I tried is the following: 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() ) ) ) ) )
); 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 : Re: Parse XML Helptest data
Test =
"\[
]\";
You can get what you asked for like this:
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" )} ) ) ) ) )
);
one wayone wayone way
But I think a better intepretation of the file might look like this:
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 << addrow( 1 );
dt2:DayName = XML Attr( "DayName" );
dt2:Val1 = XML Attr( "Val1" );
)
)
);
Another wayAnother wayAnother way
(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. dt2:Val1 =num( XML Attr( "Val1" )); )