Problem Reading XML Files

Post any question you may have in regards to GoAnywhere Director and let our talented support staff and other users assist you.
2 posts Page 1 of 1

TViens

Posts: 3
Joined: Fri Aug 01, 2014 10:26 am

Post by TViens » Tue Nov 04, 2014 2:53 pm
Assistance please. I have been trying to read in fields from and XML file. In the log the variables for the fields are assigned odd values. I also tried using a template and modifying it read a simple XML file. Values from the XML are not returned the way that I expected.

I get interesting output in the log files when trying to read the values out.

11/4/14 2:51:38 PM INFO Data parsed successfully and the rowset variable(s) 'xmlData' were created
11/4/14 2:51:38 PM INFO Finished task 'xmlRead 1.0 (Read XML File)'
11/4/14 2:51:38 PM INFO Executing task 'print 1.0'
11/4/14 2:51:38 PM INFO ------------------
com.linoma.dpa.tasks.xmlread.XMLRowSet@6f8c468f
11/4/14 2:51:38 PM INFO Finished task 'print 1.0'




My simple project looks like this.
Code: Select all
<project name="xml3" mainModule="Main" version="2.0" logLevel="verbose">

	<module name="Main">

		<xmlRead label="Read XML File" file="/data/cloverleaf_test/test_ftp/settings.xml" defaultDateFormat="yyyy-MM-dd" defaultTimeFormat="HH:mm:ss" defaultTimestampFormat="MM/dd/yyyy HH:mm:ss.SSS" version="1.0">
			<rowset name="xmlData">
				<column index="1" value="/settings/archiving/daystokeep" name="COLUMN1" type="INTEGER" />
				<column index="2" value="/settings/archiving/daystokeep" name="COLUMN2" type="CHAR" />
				<column index="3" value="/settings/archiving/daystokeep" name="COLUMN3" type="DATE" />
			</rowset>
		</xmlRead>


		<print version="1.0">
			<![CDATA[------------------
${xmlData}

------------------]]>
		</print>

	</module>

</project>
My XML file is simple.
ettings>
<archiving>
<daystokeep>30</daystokeep>
</archiving>
<alerts>
<alert name="filenotfound">
<threshold>
<interval>1</interval>
<duration>day</duration>
</threshold>
<notification>
<email>[email protected]</email>
</notification>
</alert>

</alerts>
</settings>

Support_Rick

Support Specialist
Posts: 590
Joined: Tue Jul 17, 2012 2:12 pm
Location: Phoenix, AZ

Post by Support_Rick » Mon Nov 10, 2014 12:56 pm
Ted,

Just do a ForEach over the Rowset that has been read then address each Field as a sub-value of that rowset...

ForEach ${XMLData} -- ThisRec
SetVariable ... Days2Keep = ${ThisRec[1]}
.
.
.
/ForEach
Rick Elliott
Lead Solutions Consultant
(402) 944.4242
(800) 949-4696
2 posts Page 1 of 1