single line XML file

R

Roland Hall

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.
 
M

Mark Schupp

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.
 
R

Roland Hall

in message : 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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top