Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Write XML with formating

Reply
Thread Tools

Write XML with formating

 
 
David
Guest
Posts: n/a
 
      03-06-2005
Hi,

My asp.net application is writing a few xml files based on certain criteria.
the application works like this.
1. read an xml template using LoadXML.
2. manipulate the xml and add certain values
3. write the xml out to a file.

now i am achieveing this no problem, however when i write the xml to file it
basically come out as a single long string.
upon opening the file in IE it is formatted beautifully.

I would like to write the xml to file in the formated fashion, is this
possible.
I don't want to have to hardcode xml attribute names in case the schema of
the XML template changes.
I merely want to read XML from a formatted template, manipulate it and then
write it to a file and keep the formatting / indentation.

any help is appreciated.


cheers

martin.



 
Reply With Quote
 
 
 
 
=?Utf-8?B?S29zdGFkaW4gS29zdG92?=
Guest
Posts: n/a
 
      03-06-2005
Hi!
It's the IE that formats the XML, as you have noticed. So if you want to see
the XML formatted, you have to write some code to see it formatted. But your
wish to "write the xml to file in the formated fashion" sounds like to write
one html page formatted (with the images, tables...) in a file instead of
saving the tags in the file...
See, the thing is that you must follow some rules, so your browser can
understand what is written in the file

Hope that helps!
Regards,
Kostadin Kostov

"David" wrote:

> Hi,
>
> My asp.net application is writing a few xml files based on certain criteria.
> the application works like this.
> 1. read an xml template using LoadXML.
> 2. manipulate the xml and add certain values
> 3. write the xml out to a file.
>
> now i am achieveing this no problem, however when i write the xml to file it
> basically come out as a single long string.
> upon opening the file in IE it is formatted beautifully.
>
> I would like to write the xml to file in the formated fashion, is this
> possible.
> I don't want to have to hardcode xml attribute names in case the schema of
> the XML template changes.
> I merely want to read XML from a formatted template, manipulate it and then
> write it to a file and keep the formatting / indentation.
>
> any help is appreciated.
>
>
> cheers
>
> martin.
>
>
>
>

 
Reply With Quote
 
 
 
 
Matt Berther
Guest
Posts: n/a
 
      03-06-2005
Hello David,

Assuming you're using an XmlWriter, you can set the Formatting property to
Indented and IndentLevel to some value (probably 2 or 4).

--
Matt Berther
http://www.mattberther.com

> Hi,
>
> My asp.net application is writing a few xml files based on certain
> criteria.
> the application works like this.
> 1. read an xml template using LoadXML.
> 2. manipulate the xml and add certain values
> 3. write the xml out to a file.
> now i am achieveing this no problem, however when i write the xml to
> file it
> basically come out as a single long string.
> upon opening the file in IE it is formatted beautifully.
> I would like to write the xml to file in the formated fashion, is this
> possible.
> I don't want to have to hardcode xml attribute names in case the
> schema of
> the XML template changes.
> I merely want to read XML from a formatted template, manipulate it and
> then
> write it to a file and keep the formatting / indentation.
> any help is appreciated.
>
> cheers
>
> martin.
>




 
Reply With Quote
 
 
 
Reply

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 On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Different results parsing a XML file with XML::Simple (XML::Sax vs. XML::Parser) Erik Wasser Perl Misc 5 03-05-2006 10:09 PM
formating the XML response in webservice Draggi ASP .Net Web Services 1 12-29-2005 12:20 PM
Help on date formating John Carnahan ASP .Net 1 11-19-2003 11:29 PM
Formating text Dmitri Manushin ASP .Net 0 08-14-2003 02:34 PM
automatic code formating... rodrigo guerra ASP .Net 0 07-05-2003 06:46 AM



Advertisments