For Programmers: Free Programming Magazines  


Home > Archive > ASP > December 2004 > single line XML file









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author single line XML file
Roland Hall

2004-12-28, 3:55 am

I'm at a loss of how to put in LFs in an XML file.

A brief example:

dim objXML, pi, root, zones

set objXML = CreateObject("MSXML2.DOMDocument.4.0")
objXML.async = false

set pi = objXML.createProcessingInstruction("xml", "version='1.0'
encoding='ISO-8859-1'")
objXML.insertBefore pi, objXML.firstChild

set root = objXML.createElement("freight")
objXML.appendChild(root)

set zones = objXML.createNode(1, "zones", "")
root.appendChild(zones)
..
..
..

When the file is written I get this:
<?xml version="1.0" encoding="ISO-8859-1"?>
<freight><zones><...></zones><zones><...></zones>...</freight>

My goal is:
<?xml version="1.0" encoding="ISO-8859-1"?>
<freight>
<zones>
<...>
</zones>
<zones>
<...>
</zones>
..
..
..
</freight>

When I open a raw XML file into IE, it takes forever, and sometimes crashes
trying to read the file. I'm not sure if it is due to the extremely long
line it is trying to parse. I can open an XML file in Wordpad quick enough
but the long line still exists and it will not display the end of the line
unless I manually add line feeds. Notepad will not show it either.


Mark Schupp

2004-12-28, 3:55 pm

If you want to control the format of the raw xml you will probably have to
build it as a string and embed the CrLf characters where you want them (and
tabs too if you really want it readable).

Or you can run it through an XSL conversion the way that IE does when you
open an XML file. Not sure of the XSL code to do that though.

--
--Mark Schupp
Head of Development
Integrity eLearning
www.ielearning.com


"Roland Hall" <nobody@nowhere> wrote in message
news:e33u4WI7EHA.2156@TK2MSFTNGP10.phx.gbl...
> I'm at a loss of how to put in LFs in an XML file.
>
> A brief example:
>
> dim objXML, pi, root, zones
>
> set objXML = CreateObject("MSXML2.DOMDocument.4.0")
> objXML.async = false
>
> set pi = objXML.createProcessingInstruction("xml", "version='1.0'
> encoding='ISO-8859-1'")
> objXML.insertBefore pi, objXML.firstChild
>
> set root = objXML.createElement("freight")
> objXML.appendChild(root)
>
> set zones = objXML.createNode(1, "zones", "")
> root.appendChild(zones)
> .
> .
> .
>
> When the file is written I get this:
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <freight><zones><...></zones><zones><...></zones>...</freight>
>
> My goal is:
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <freight>
> <zones>
> <...>
> </zones>
> <zones>
> <...>
> </zones>
> .
> .
> .
> </freight>
>
> When I open a raw XML file into IE, it takes forever, and sometimes
> crashes
> trying to read the file. I'm not sure if it is due to the extremely long
> line it is trying to parse. I can open an XML file in Wordpad quick
> enough
> but the long line still exists and it will not display the end of the line
> unless I manually add line feeds. Notepad will not show it either.
>
>



Roland Hall

2004-12-28, 3:55 pm

"Mark Schupp" wrote in message news:O9WKEhP7EHA.3124@TK2MSFTNGP11.phx.gbl...
: If you want to control the format of the raw xml you will probably have to
: build it as a string and embed the CrLf characters where you want them
(and
: tabs too if you really want it readable).
:
: Or you can run it through an XSL conversion the way that IE does when you
: open an XML file. Not sure of the XSL code to do that though.

Hi Mark. Thanks for responding.

I'm familiar enough with XSL but I thought that was only for delivery to the
client. I have some files the client will eventually see but there is no
need for them to see the rate table. I just thought perhaps I was missing
something creating a two line file. I doubt I want to write strings as I
did before, and add what I read was line-feeds [no carriage returns] but one
would think MSFT would have included it if that is the norm.

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com