Parsing XML file
Hi,
I am trying to obtain information inside the XML file Testff.xml.
Below is the contents of the XML file:
<?xml version="1.0" encoding="UTF-8"?>
<NotesImport xsi:noNamespaceSchemaLocation="G:/USERS/user uploading id/BUSFIL~1/logNotesImportv2.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Facility>
<FacilityID>8</FacilityID>
<FacilityName>THE x</FacilityName>
<DateDataExtracted>2015-05-05</DateDataExtracted>
<TimeDataExtracted>23:55:00</TimeDataExtracted>
<LogNote>
<SSN>000-00-0000</SSN>
<LogNoteID>20150505065022</LogNoteID>
<DateContacted>2015-05-05</DateContacted>
<DateEntered>2015-05-05</DateEntered>
<WhoContacted>21</WhoContacted>
<ContactType>114</ContactType>
<Confidential>F</Confidential>
<InputWorker>jhjh67</InputWorker>
<Description>The Service Plan was revised</Description>
<LogNoteUnit>2</LogNoteUnit>
</LogNote>
<LogNote>
<SSN>000-00-0000</SSN>
<LogNoteID>201505050650232</LogNoteID>
<DateContacted>2015-05-03</DateContacted>
<DateEntered>2015-05-03</DateEntered>
<WhoContacted>23</WhoContacted>
<ContactType>113</ContactType>
<Confidential>F</Confidential>
<InputWorker>jhj3</InputWorker>
<Description>The revised</Description>
<LogNoteUnit>3</LogNoteUnit>
</LogNote>
</Facility>
</NotesImport>
When trying to read the file, the XML attributes are not in the file output.
I am trying to get the value for the LogNoteID.
Below is the code being used.
<cffile action="read" file="D:\CFMISC\Bus\Testff.xml" variable="MyXmlCode">
<CFSET MyXml = XmlParse(MyXmlCode)>
<CFSET xnCompany = MyXML.XmlRoot>
#xnCompany#
<CFSET sCompanyName = xnCompany.XmlAttributes["LogNoteID"]>
Output of the xnCompany value:
8 THE x 2015-05-05 23:55:00 000-00-0000 20150505065022 2015-05-05 2015-05-05 21 114 F jhjh67 The Service Plan was revised 2 000-00-0000 201505050650232 2015-05-03 2015-05-03 23 113 F jhj3 The revised 3
When I tried to access the LogNoteID, I am receiving the message,
Element LogNoteID is undefined in a Java object of type class coldfusion.xml.XmlAttrMap.
How would the XML attributes appear in the output and how to access the LogNoteID value?
Thanks,
Mike
