Hello all,
Sample XML:
I need to return the values for each field as a string...
This is code trying to read (only included first field to keep post relatively small...but I have a string var and a call for each field)
that call is returning null for MFPDate. I've tried various XPaths, but still not returning data....
What am I doing wrong?
Thank you...
Sample XML:
HTML:
<?xml version="1.0" encoding="UTF-8"?>
<Agility Agility_ID="123456789ABC">
<Header COMMENTS="" AUTHOR="" TimeCreated="10:42:55" DateCreated="2016-05-17" Version="1"/>
<Objects ObjID="1337342975-24074-17649-151-16">
<Object ObjID="402038167-45027-19640-142-118">
<Documents>
<Document ObjID="1300430482-61699-18065-175-67" DocRef="1268500120-35637-19485-140-116.dat" Name="81d5d835-c104-4e33-90df-f3fe79691c95_DONE_1.tif" Type="tif"/>
</Documents>
<Fields>
<Field Name="MFPDate" Value="2014-02-12"/>
<Field Name="MFPTime" Value="15:22:15-05:00"/>
<Field Name="MFPReceivedTime" Value="2/12/2014 2:35:34 PM"/>
<Field Name="MFPName" Value="NPI3A89DA"/>
<Field Name="MFPIP" Value="10.242.35.85"/>
<Field Name="MFPSerialNumber" Value="JPDCDDV11T"/>
<Field Name="MFPModel" Value="HP Color LaserJet CM4540 MFP"/>
<Field Name="MFPFirmware" Value="2300338_378093"/>
<Field Name="MFPPageCount" Value="4"/>
<Field Name="MFPDuplexMode" Value="True"/>
<Field Name="MFPFileSize" Value="35966"/>
<Field Name="DomainUserID" Value="Domain\528436801"/>
<Field Name="SRF" Value="18"/>
<Field Name="CLIENTNAME" Value="SMITH, BILL"/>
<Field Name="DOCUMENTTYPE" Value="Transition Checklist"/>
<Field Name="SUBMISSIONTYPE" Value="MFRP"/>
<Field Name="ACCOUNTNO" Value=""/>
<Field Name="PRODUCTTYPE" Value="Business Deposit Account"/>
<Field Name="RECORDSERIES" Value=""/>
<Field Name="CMDocumentTypeId" Value="Transition Checklist"/>
<Field Name="SCANTIME" Value="2014-02-12-14.35.38.000000"/>
<Field Name="SUBMISSIONEN" Value="MFRP-EN"/>
<Field Name="SUBMISSIONFR" Value="MFRP-FR"/>
<Field Name="DOCGUID" Value="{1F635AF0-2DFF-4685-B611-A588C298D6D8}"/>
</Fields>
</Object>
</Objects>
</Agility>
This is code trying to read (only included first field to keep post relatively small...but I have a string var and a call for each field)
{ MFPDate = string.Empty; List<string> Document = new List<string>(); try { if (!String.IsNullOrEmpty(XML_String)) { XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(XML_String); if (xmlDoc != null) { //<Batch> related information MFPDate = (xmlDoc.SelectSingleNode("/Agility/Objects/Object/Fields/Field[1]@Value").Value); } } } catch (Exception exception) { Logger.Instance().Error(exception); Success = false; } } } }
that call is returning null for MFPDate. I've tried various XPaths, but still not returning data....
What am I doing wrong?
Thank you...
Last edited by a moderator: