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

Indenting XML in a string

Sorry if this seems like a newbie question, because I *am* rather new
to XML

I have a string with XML content

string s = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?><Service
xmlns=\"uri://sumthing\">.........</Service>";

where '.....' is some more xml content

When printing this string to an ASPX page, I need the output to be
properly indented, presentable. I researched on Google a bit, saw
something about XMLTextWriter having a Formatting property which can be
set to 'Indented', but I don't know how to implement that.

Any pointers in this direction? Very much appreciated!

Nov 30 '06 #1
3 1719
ak***********@gmail.com wrote:
Sorry if this seems like a newbie question, because I *am* rather new
to XML

I have a string with XML content

string s = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?><Service
xmlns=\"uri://sumthing\">.........</Service>";

where '.....' is some more xml content

When printing this string to an ASPX page, I need the output to be
properly indented, presentable. I researched on Google a bit, saw
something about XMLTextWriter having a Formatting property which can be
set to 'Indented', but I don't know how to implement that.
What exactly does your ASPX page do, does it send only the XML as
text/xml or application/xml? Or do you send HTML as text/html and
somewhere in that HTML document you want to show the XML?
--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Nov 30 '06 #2
Thanks for the quick response Martin!

Actually it's more complicated than that. I abstracted a bit. What
actually happens is, I have an XMLDocument, a node of which contains
the XML string I mentioned before. This XML string will be displayed
through an XSLT using a TEXTAREA and <xsl:value-of select=

Martin Honnen wrote:
ak***********@gmail.com wrote:
Sorry if this seems like a newbie question, because I *am* rather new
to XML

I have a string with XML content

string s = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?><Service
xmlns=\"uri://sumthing\">.........</Service>";

where '.....' is some more xml content

When printing this string to an ASPX page, I need the output to be
properly indented, presentable. I researched on Google a bit, saw
something about XMLTextWriter having a Formatting property which can be
set to 'Indented', but I don't know how to implement that.

What exactly does your ASPX page do, does it send only the XML as
text/xml or application/xml? Or do you send HTML as text/html and
somewhere in that HTML document you want to show the XML?
--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Nov 30 '06 #3
ak***********@gmail.com wrote:
Actually it's more complicated than that. I abstracted a bit. What
actually happens is, I have an XMLDocument, a node of which contains
the XML string I mentioned before. This XML string will be displayed
through an XSLT using a TEXTAREA and <xsl:value-of select=
If you have an XSLT to generate the output then using e.g.
<xsl:output indent="yes"/>
and not xsl:value-of but rather xsl:apply-templates and an XML indentity
transformation for that XML should help. But only if there is really XML
inside the node and not escaped stuff in a CDATA section.

--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Nov 30 '06 #4

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

Similar topics

0
by: David Ehmer | last post by:
Appreciate any ideas about what might be happening with these pages in IE5.2 Mac. In summary the 2nd paragraph or list item is indenting to the right. paragraphs of list items after the 2nd...
2
by: RobG | last post by:
Some posters have been critical of the lack of formatting in some posts. Pleae be aware that posting through the Google group's web interface removes *all* leading white space - tabs, spaces, the...
9
by: bob | last post by:
What tool do most of you people use to indent your code? Doing so by hand is a bit tedious, I think.
1
by: sh4r4d | last post by:
Can any tell how this automatic C indenting done in some editors like Vim, Emacs (in C-mode), because I want to change my program which now give result after seeing full grammer, while these...
102
by: Skybuck Flying | last post by:
Sometime ago on the comp.lang.c, I saw a teacher's post asking why C compilers produce so many error messages as soon as a closing bracket is missing. The response was simply because the compiler...
2
by: Leon Friesema | last post by:
Hiyall! I have a RichTextBox inside a UserControl which should be able to indent a block off text (or UnIndent for that matter) like the SourceEditor of VS2003 or WinWord does. All controls on...
7
by: Harrie | last post by:
Hi group, I want to indent existing XML files so they are more readable (at least to me). At this moment I'm looking at the XML files OpenOffice.org's Writer application produces in it's zipped...
0
by: D. Shane Fowlkes | last post by:
The Smart Indenting "feature" is driving me absolutlely crazy in VWD. Problem: VWD in Code View insists on tabbing a lot of my code over to it's own liking and effects mainly my comments in the...
4
by: Christopher | last post by:
How would I go about indenenting for each level of recursion, if I am trying to output the contents of a class which contains its own type? where AttributeGroupMap is typdef...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
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: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
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...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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.