Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

When I serialize an object to xml I am having some problem

Status
Not open for further replies.

psshastri

Programmer
Apr 2, 2005
2
US
Hi,
When I am serializing my object to xml file in c#, my file is like this.
This line <?xml version="1.0" encoding="utf-16"?>
repeating after every element.My main element is lot
after the </Lot> ends again the above line is repeating.
So when I am deserializing my xml file, it is showing some error.How to avoid the line <?xml version="1.0" encoding="utf-16"?>
multiple times.


<?xml version="1.0" encoding="utf-16"?>
<Lot xmlns:xsd=" xmlns:xsi=" <LSNNumber>206005</LSNNumber>
<Number>ES4-E5L-177-7</Number>
<NBReferenceNumber>TA9-223TST-222</NBReferenceNumber>
<MCRank>4</MCRank>
<SubmissionDate>2/3/2004 9:25:37 AM</SubmissionDate>
<SubmittedBy>RZX4486</SubmittedBy>
<Containers>
<Container>
<Number />
<MCRank>0</MCRank>
</Container>
</Containers>
</Lot><?xml version="1.0" encoding="utf-16"?>
<Lot xmlns:xsd=" xmlns:xsi=" <LSNNumber />
<Number />
<NBReferenceNumber />
<MCRank>4</MCRank>
<SubmissionDate>2/3/2004 9:24:16 AM</SubmissionDate>
<SubmittedBy>RZX4486</SubmittedBy>
<Containers>
<Container>
<Number />
<MCRank>0</MCRank>
</Container>
</Containers>
</Lot><?xml version="1.0" encoding="utf-16"?>
<Lot xmlns:xsd=" xmlns:xsi=" <LSNNumber />
<Number />
<NBReferenceNumber />
<MCRank>4</MCRank>
<SubmissionDate>2/3/2004 9:22:24 AM</SubmissionDate>
<SubmittedBy>RZX4486</SubmittedBy>
<Containers>
<Container>
<Number />
<MCRank>0</MCRank>
</Container>
</Containers>
</Lot>
 
Looks like a loop problem. Where's the code that generates this file? This output doesn't tell us anything.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top