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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XML serialisation and output format

Status
Not open for further replies.

Silverstone

Programmer
Apr 26, 2005
6
GB
I'm pretty new to C# so bear with me if any of this is obvious!

I'm writing a windows form which is bound to an XML data source. The destination for this XML is an IBM z\OS Mainframe as script in testing an application. (Not my choice!)

I've got it all coded and working fine but there are two issues:

1) The newly created XML file has moved one of the elements moved to a different position in the layout, even though the schema has it in the correct place. I'm not certain this will cause an issue, however knowing how touchy Mainframes are it may well be.

I've hunted around but can't see any way of changing the way it does this. Using XSD.exe to produce a DataSet for the XML produces the same results. This seems to be something within the serialisation process but I'm stuck as to how to proceed.

2) When elements contain no data the XML file is writing tags out as:
<TagName />
but the touchy mainframe requires them to be:
<TagName></TagName>

I've had a look but can't see anything that will affect this, anyone able to help?
 
drop the datasource and manage the xml yourself. Using a XmlDocument object you can navigate the xml document using xpath queries. for forward only reading/wrinting you can use the XmlReader/Writer. This is useful depending on the size fo the document as well.

by default a self closing tag is used for empty nodes. you can override this setting when you create an XmlWriter to produce the open & close tabs separately.

Jason Meckley
Programmer
Specialty Bakers, Inc.

faq855-7190
faq732-7259
 
Perfect, thanks. I've got it working as needed now. I actually expected using the writer to be harder than it was!

Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top