XMLTextWriter: Help

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
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.
 
Back
Top