07-11-2007 12:00 PM - edited 03-14-2019 01:03 AM
I?ve set up an xml file with the below format and I am trying to figure out how to
Traverse it so I can process each date. I?m not sure what the syntax is. I can get the first one with no
Problem. Any help is much appreciated.
<?xml version="1.0" encoding="utf-8" ?>
<!--
Holiday.xml
-->
<Holidays>
<Holiday>
<Name>New Year</Name>
<Date>01/01/2007</Date>
</Holiday>
<Holiday>
<Name>Memorial Day</Name>
<Date>05/31/2007</Date>
</Holiday>
<Holiday>
<Name>Fourth of July</Name>
<Date>07/04/2007</Date>
</Holiday>
<Holiday>
<Name>Labor Day</Name>
<Date>09/03/2007</Date>
</Holiday>
<Holiday>
<Name>Thanksgiving</Name>
<Date>11/22/2007</Date>
</Holiday>
<Holiday>
<Name>Thanksgiving Observance</Name>
<Date>11/23/2007</Date>
</Holiday>
<Holiday>
<Name>Christmas</Name>
<Date>12/31/2007</Date>
</Holiday>
</Holidays>
07-11-2007 09:38 PM
I think Cisco publish a version of this. Perhaps the easiest thing is to search Cisco.com for it.
All you have to do is change the XML names to
{
// increment
holidayEntryNum++;
String s = new String();
s = "Holiday" + holidayEntryNum;
return s;
}
then look for
"/descendant::Holidays/child::" + Holiday
with your Get XML Document step. And of course, loop until dates match.
Regards,
Geoff
07-12-2007 05:41 AM
I have already redone it that way, and it works well. But, I would think there would be a way to interate through it when using
Thanks for the response, I appreciate it.
Joanne
07-12-2007 05:45 AM
You should't use that script/xml-file as it is ineffiecient.
Instead create the current date in your script (such as '25-12-07'and add the letter-prefix A or some other letter..) and then parse this xml-file instead:
It is more efficient (if if doesn't find anything, its not a holiday) and gives you a few more options (as illustrated).
rgds
johnny
07-12-2007 05:47 AM
Thank, Johnny, good idea.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide