Click here to Skip to main content
15,507,385 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
XML
Hi there,
i've a problem with a strange xml and I don't know how to deserialize it.

This is the xml:

<pre lang="xml">
<?xml version="1.0" encoding="UTF-8"?>
<CRMMessage language="en_US" currency="USD" isTrustedSAT="false" hostversion="1.00">
<RequestCode>GetCustomer</RequestCode>
<ResponseCode>A</ResponseCode>
<ResultSet>
<ResultSetMetaData>
<RSColumn name="PRIMARYPOSREF" type="string" nullable="true"></RSColumn>
<RSColumn name="ACTIVE" type="boolean" nullable="false"></RSColumn>
<RSColumn name="firstName" type="string" nullable="true"></RSColumn>
<RSColumn name="LastName" type="string" nullable="true"></RSColumn>
<RSColumn name="postalCode" type="string" nullable="true"></RSColumn>
<RSColumn name="city" type="string" nullable="true"></RSColumn>
<RSColumn name="county" type="string" nullable="true"></RSColumn>
<RSColumn name="addressline1" type="string" nullable="true"></RSColumn>
<RSColumn name="addressline2" type="string" nullable="true"></RSColumn>
<RSColumn name="organizationname" type="string" nullable="true"></RSColumn>
</ResultSetMetaData>
<Rows>
<Row id="168209">
<Col />
<Col>1</Col>
<Col>John</Col>
<Col>Doe</Col>
<Col />
<Col />
<Col />
<Col />
<Col />
<Col />
</Row>
</Rows>
</ResultSet>
</CRMMessage>

</pre>

The xml will return always one row.

Thanks for your help.
Davide.
Posted
Comments
Sergey Alexandrovich Kryukov 13-Nov-13 12:01pm    
First of all, how did you end up with this strange XML (what's so strange?)? Perhaps you rather need to do both serialization and deserialization? Generally, those operations are symmetric and hence should be done in a single place. If is not so, most likely you are solving a wrong problem, which you simply should not solve.
—SA
tgrt 13-Nov-13 15:26pm    
The XML you provided only has one row (id 168209). So always having one row is the correct behavior.
Fred Flams 14-Nov-13 4:58am    
You should post that as an answer, since the provided XML really does contain only one row....
I know that sound silly, since the clues were there since the beginning...
Davide Ardizzola 14-Nov-13 5:23am    
I've not understand what you mean.
tgrt 14-Nov-13 8:18am    
I would, but then it would just get downvoted. I think he's saying that the XML will always return one row, but the problem is that he doesn't know how to deserialize the XML.

1 solution

I've solved making the classes with this tool: Simple XML to Code.

Bye!
Davide.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900