Code Comments
Programming Forum and web based access to our favorite programming groups.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.
Post Follow-up to this messageIf 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. > >
Post Follow-up to this message"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
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.