Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old March 5th, 2007, 02:25 PM
gusse.net
Guest
 
Posts: n/a
Default using XmlTextWriter

if there are no data when writing an element is creates the tag like this

<customer/>

but i would like it to write

<customer>
</customer>

any property i can set or something else i could do ??



  #2  
Old March 5th, 2007, 03:05 PM
Martin Honnen
Guest
 
Posts: n/a
Default Re: using XmlTextWriter

gusse.net wrote:
Quote:
if there are no data when writing an element is creates the tag like this
>
<customer/>
>
but i would like it to write
>
<customer>
</customer>
>
any property i can set or something else i could do ??
<customer/>
is an emtpy element while
<customer>
</customer>
is not an empty element but rather an element that has a text node with
white space as its child node. So you would need to write out the white
space with WriteElementString for instance

xmlWriter.WriteElementString("customer", "\r\n\t");

But usually if the element is meant to be empty you should make sure
that is marked up as empty (e.g. <customer/or <customer></customer>),
introducing white space content changes the semantics.

--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles