xsl-list
[Top] [All Lists]

RE: [xsl] Programatically Generate Well-Formed XML with .NET

2008-06-27 09:28:22
From: Ronnie Royston [mailto:rhroyston(_at_)gmail(_dot_)com]
Sent: Friday, June 27, 2008 12:22 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Programatically Generate Well-Formed XML with .NET

I'm using VBA to write a file with a .xml extension on to my
harddrive.  Basically, I'm using the Range.Text method in Excel VBA as
the selector and a stream output method to write out a text file.  The
problem is that it is not consistently writing well-formed XML.  After
running my crummy program, a browser often chokes on the result with

"Whitespace is not allowed at this location. Error processing resource
'file:///C:/Saxon/bin/mySkus.xml'. Line 58, Position..."

here is a copy/paste of my line 58.
<sku quantity="1" description="XMediusFAX Express Server 50 Users & 2
Channels *Server Supplied by Benchmark">XM-EXP-50</sku>

You need to quote &, <, and > in your VBA code before writing it out:

string = VBA.replace(string,"&","&amp;");  ' Needs to be done first.
string = VBA.replace(string,"<","&lt;");
string = VBA.replace(string,">","&gt;");


Andy.



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>