Lists Home |
Date Index |
> I'm using vb and the MSXML2 object model to create XML documents in code.
> I've noticed that the XML is constructed all on one line... I'd like to
> somehow insert line breaks (and possibly add other formating like tabs),
> into my XML while creating with MSXML2. Is this possible?
Not without writing a bunch of custom code. You are really talking about
pretty-printing, right? Most processing systems provide some kind of
prettyprinting, but not that would do everything you ask for. That is a job
for either a special serializer or for some post-processing after the
serializer emits the xml.
To put it another way, prettyprinters usually do not wrap lines, so you
would have to add that ability or do it in postprocessing.
Of course, if your xml is simple and you know where line breaks should go,
you may be able to insert them into element character data as you create it,
before putting it into an element. If you use attributes to hold the text,
you have to expect your line feeds and tabs to get normalized away.