473,326 Members | 2,134 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

XMLTextWriter: Help

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

Mar 7 '07 #1
1 1041
Manny Chohan wrote:
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.

--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Mar 8 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Jain, Pranay Kumar | last post by:
Hello Everyone, I have written a simple app. that converts the dataset into excelspreadsheet. The App. uses the following architecture. First it generates the dataset with corresponding...
2
by: Jesper Stocholm | last post by:
I use an XmlTextWriter to generate xml data. The declaration is: System.Text.StringBuilder sb = new System.Text.StringBuilder(); System.IO.StringWriter sw = new System.IO.StringWriter(sb);...
3
by: Magnus | last post by:
can anyone help me on how to create and manipulate a xmttextwriter without having to craete a physical file. I have an application that should return data in xml. But I do not want to create a...
4
by: H Lee | last post by:
Hi, I'm an XML newbie, and not sure if this is the appropriate newsgroup to post my question, so feel free to suggest other newgroups where I should post this message if this is the case. I'm...
1
by: Riko Eksteen | last post by:
Hi I'm reading an xml file into an XmlDocument, adding some nodes, and writing it back out. I would like the nodes I add to assume the same level of indeting as the rest of the document. (I load...
2
by: Steve | last post by:
I'm an XML newb. I'm serializing a class and when I inspect the xml file, all the data is on one line rather than being nested and indented Is that normal? <code> StreamWriter sw = new...
4
by: Einar Høst | last post by:
Hi, I'm having weird problems using StringWriter and XmlTextWriter. My code looks like this: StringWriter sw = new StringWriter(CultureInfo.InvariantInfo); XmlTextWriter xtw = new...
4
by: John Salerno | last post by:
I thought I might use the XML functions in C# to help me do some repetitive typing in an XHTML file, but I'm stuck. Here's what I have before I just stopped: void WriteXMLFile() { string path...
5
by: Gilgamesh | last post by:
Hello, How do I use this class to create an XML document without saving it into a file? I need to store the XML documen into a string so it could be passed as a parameter to another class....
2
by: fmancina | last post by:
Hi, I am employing the XmlTextWriter class to generate an XML document. Everything works fine, until I have to write an attribute to an element which contains a value. Examples below: //...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.