473,394 Members | 1,703 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,394 software developers and data experts.

Write XML with formating

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.

Nov 19 '05 #1
2 1090
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.

Nov 19 '05 #2
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.


Nov 19 '05 #3

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

Similar topics

0
by: rodrigo guerra | last post by:
where i can change the code formating that visual studio does in the code.... like if i type: if ( ) { .... } visual studio changes to:
0
by: Welman Jordan | last post by:
Hello, I would like to write a simple forum for my site, which enables some formating, like , , and some other BBS format code. For example, the user inputs this string in a multiline...
11
by: A.M | last post by:
Hi, I found print much more flexible that write method. Can I use print instead of file.write method? Thank you,
3
by: Smiley | last post by:
Hi, I know how to do confitional formating in Excel by clicking the wizard. Is this possible in MS Access ? If so, please directly where to look. I found example but nothing as to how to do it....
12
tolkienarda
by: tolkienarda | last post by:
hi all I am working on a content management service and i need some help keeping formating. what i am doing is recreating my site in an admin side and all of the articles on the site will...
1
by: Shawn Northrop | last post by:
I just read an article on kirupa.com about incorporating mySQL and PHP with flash. I am dynamically loading conent into a flash movie and am not sure how to format. In my php code i have: $y = "";...
0
by: Fonix | last post by:
I'm trying to make table border with pyExcelerator. As i can see there is only cell formating!? If i'm wrong pls tell me what is method to make more then one cell to have same format, other then...
2
by: sitko | last post by:
Hi, I'm in the process of converting a VB.net program into a C program so it can run on a unix like machine. I've been moving along at a nice pace, but this conversion has stumped me. I need...
6
by: sitko | last post by:
Hi, I've continued with my VB->C conversion, and have it working on the Linux box, now I'm going back and getting it to work on the Windows box. Something strange occurred and I thought I'd...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.