Question DataSet from XML (missing field)

dariofil

New member
Joined
May 10, 2010
Messages
3
Programming Experience
Beginner
Interesting problem;

This is the XML output of my command in a web browser.

I need to get the MachineID value.



VB.NET:
<?xml version="1.0" encoding="UTF-8" ?> 
- <Response>
 <Code>0</Code> 
 <Message>OK</Message> 
- <Data>
- <MachineCode>
 <MachineCode>4C92-DGF-9EBB974-A861E*77DB5E/95C1-MKEY-15BCA4</MachineCode> 
 </MachineCode>
 </Data>
 </Response>

Then i load this XML to DataSet, and write it a file;



VB.NET:
dim dsGetMachineCode AS DataSet
 dsGetMachineCode.ReadXml("http://" + ServerAddress + ":8601/Interface/Server/GetMachineCode?responseformat=xml&authuser=" + Username + "&authpass=" + Password)
      dsGetMachineCode.WriteXml("c:\machine.txt")


The Machine.TXT file contents missing the MACHINECODE Value :-(

How is this possible?


VB.NET:
<?xml version="1.0" standalone="yes"?>
<Response>
 <Code>0</Code>
 <Message>OK</Message>
 <Data>
  <MachineCode>
   <MachineCode />
  </MachineCode>
 </Data>
</Response>

The only thing i can see is that the MACHINECODE Element, and MACHINECODE value are the same name.
 
Last edited:
The only thing i can see is that the MACHINECODE Element, and MACHINECODE value are the same name.
In terms of xml that is two (nested) MachineCode ELEMENTs, where the second element has a text node containing what you refer to as 'value'. The first should be parsed as a table, and the second as a column of that table, but DataSet won't handle it and will think of the second element as a circular reference to the table. The xml structure is not good and DataSet will not be able to parse the schema by its own, go for the xml tools for example XmlDocument.
 
Back
Top