XMLTextWriter: Help

G

Guest

Hello Guys, I need to generate the following in XML

<CrossRef Affiliate="Sabre" Code="XX12334"/>
<CrossRef Affiliate="Galileo" Code="XX45678"/>
<CrossRef Affiliate="Worldspan" Code="YY123456"/>
<CrossRef Affiliate="Amadeus" Code="YY78495"/>


I have the Following code:

tw.WriteStartElement("CrossRef");
tw.WriteAttributeString("Affiliate",GDSDetails["Description"].ToString().TrimEnd());
tw.WriteAttributeString("Code",GDSDetails["GDShotelNumber"].ToString().TrimEnd());
tw.WriteEndElement();

but this is generating white space at the end of the elment:
<CrossRef Affiliate="Sabre" Code="XXXX" />
<CrossRef Affiliate="Galileo" Code="XXXX" />
<CrossRef Affiliate="Worldspan" Code="XXXX" />
<CrossRef Affiliate="Amadeus" Code="XXXXX" />

Could someone please help me with this?

Thanks in advance.

Manny
 
M

Martin Honnen

Manny said:
Hello Guys, I need to generate the following in XML

<CrossRef Affiliate="Sabre" Code="XX12334"/>
but this is generating white space at the end of the elment:
<CrossRef Affiliate="Sabre" Code="XXXX" />
^^
That single space before the /> is a problem? Why? In terms of XML it
does not matter whether you have <element/> or <element />, the
semantics are the same, it is an empty element having no child nodes.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,053
Latest member
BrodieSola

Latest Threads

Top