Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

XML VB DOM

46 views
Skip to first unread message

rdclk23

unread,
Aug 19, 2002, 2:29:31 PM8/19/02
to
I have created an XML file using the Microsoft DOM, and all of the
nodes / elements are strung together as one very long line when viewed
in an editor. When the XML file is parsed, the line / column error
messages all say line 2, column # (very large).... How can I put in
carriage returns when I create the XML file so that each element is on
a new line?

Rich

mike...@yahoo.co.uk

unread,
Aug 1, 2012, 9:17:24 AM8/1/12
to
Hi Rich,

That doesnt sound right to me, try your file in this xml editor / parser, http://www.liquid-technologies.com/xml-editor.aspx

Joe Kesselman

unread,
Aug 1, 2012, 9:59:35 AM8/1/12
to
On 8/1/2012 9:17 AM, mike...@yahoo.co.uk wrote:
> On Monday, August 19, 2002 7:29:31 PM UTC+1, rdclk23 wrote:
>> I have created an XML file using the Microsoft DOM, and all of the
>> nodes / elements are strung together as one very long line when viewed
>> in an editor. When the XML file is parsed, the line / column error
>> messages all say line 2, column # (very large)....

Remember, whitespace in an XML document is part of the document's
content, and adding whitespace changes that content -- potentially
changing the results of processing that document. As a result, XML tools
tend not to indent/pretty-print the XML unless you explicitly instruct
them to do so.

I haven't worked with the Microsoft implementation in an age and a half,
so I can't advise you on whether there's an easy switch you can turn on
to force pretty-printing. But before doing so, you do have to look at
the application which will be consuming this document and make sure it
can tolerate that whitespace.

If you want to do this in a more controlled manner, your DOM application
needs to insert explicit text nodes to represent the whitespace. (That's
essentially what the pretty-printer does.)



--
Joe Kesselman,
http://www.love-song-productions.com/people/keshlam/index.html

{} ASCII Ribbon Campaign | "may'ron DaroQbe'chugh vaj bIrIQbej" --
/\ Stamp out HTML mail! | "Put down the squeezebox & nobody gets hurt."

Peter Flynn

unread,
Aug 4, 2012, 3:10:52 PM8/4/12
to
On 01/08/12 14:59, Joe Kesselman wrote:
> On 8/1/2012 9:17 AM, mike...@yahoo.co.uk wrote:
>> On Monday, August 19, 2002 7:29:31 PM UTC+1, rdclk23 wrote:
>>> I have created an XML file using the Microsoft DOM, and all of the
>>> nodes / elements are strung together as one very long line when viewed
>>> in an editor. When the XML file is parsed, the line / column error
>>> messages all say line 2, column # (very large)....
>
> Remember, whitespace in an XML document is part of the document's
> content, and adding whitespace changes that content -- potentially
> changing the results of processing that document. As a result, XML tools
> tend not to indent/pretty-print the XML unless you explicitly instruct
> them to do so.
>
> I haven't worked with the Microsoft implementation in an age and a half,
> so I can't advise you on whether there's an easy switch you can turn on
> to force pretty-printing. But before doing so, you do have to look at
> the application which will be consuming this document and make sure it
> can tolerate that whitespace.
>
> If you want to do this in a more controlled manner, your DOM application
> needs to insert explicit text nodes to represent the whitespace. (That's
> essentially what the pretty-printer does.)

Unzip the file and locate document.xml.
Open this in a web browser: it will display it pretty-printed.

///Peter


0 new messages