single line XML file

Roland Hall

Usenet Archive
Joined
Nov 4, 2003
Messages
964
Reaction score
0
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

Usenet Archive
Joined
Dec 2, 1999
Messages
1,606
Reaction score
0
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.
 

Roland Hall

Usenet Archive
Joined
Nov 4, 2003
Messages
964
Reaction score
0
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.
 

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

No members online now.

Forum statistics

Threads
548,049
Messages
3,104,246
Members
248,133
Latest member
DujonT

Latest Threads

Top