Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old November 9th, 2006, 02:35 AM
Terry Olsen
Guest
 
Posts: n/a
Default How to create this with XmlTextWriter

Is this even possible using XmlTextWriter? Or would I need to use an
XmlDocument?

I need to create the following XML:

<?xml version="1.0"?>
<AccessRequest xml:lang="en-US">
<AccessLicenseNumber>YOURACCESSLICENSENUMBER</AccessLicenseNumber>
<UserId>YOURUSERID</UserId>
<Password>YOURPASSWORD</Password>
</AccessRequest>


When I use the XmlTextWriter, I always get this as the first line:
<?xml version="1.0" encoding="utf-16"?>

I also need help adding the: xml:lang="en-US" to the AccessRequest element.

Thanks a bunch!


  #2  
Old November 9th, 2006, 02:35 AM
Terry Olsen
Guest
 
Posts: n/a
Default Re: How to create this with XmlTextWriter

Actually, I figured out how to do the xml:lang attribute. Now how do I get
rid of the encoding attribute in the first line?

"Terry Olsen" <tolsen64@hotmail.comwrote in message
news:OcYBem6AHHA.4592@TK2MSFTNGP03.phx.gbl...
Quote:
Is this even possible using XmlTextWriter? Or would I need to use an
XmlDocument?
>
I need to create the following XML:
>
<?xml version="1.0"?>
<AccessRequest xml:lang="en-US">
<AccessLicenseNumber>YOURACCESSLICENSENUMBER</AccessLicenseNumber>
<UserId>YOURUSERID</UserId>
<Password>YOURPASSWORD</Password>
</AccessRequest>
>
>
When I use the XmlTextWriter, I always get this as the first line:
<?xml version="1.0" encoding="utf-16"?>
>
I also need help adding the: xml:lang="en-US" to the AccessRequest
element.
>
Thanks a bunch!
>

  #3  
Old November 9th, 2006, 10:45 AM
Oleg Tkachenko [MVP]
Guest
 
Posts: n/a
Default Re: How to create this with XmlTextWriter

Terry Olsen wrote:
Quote:
Actually, I figured out how to do the xml:lang attribute. Now how do I get
rid of the encoding attribute in the first line?
You can set UTF-8, which is default XML encoding. You can also
completely get rid of XML declaration by not calling
WriteStartDocument() method.

--
Oleg Tkachenko [XML MVP, MCPD]
http://blog.tkachenko.com | http://www.XmlLab.Net | http://www.XLinq.Net
 

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