[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Programatically Generate Well-Formed XML with .NET

Subject: RE: Programatically Generate Well-Formed XML with .NET
From: "Houghton,Andrew" <houghtoa@xxxxxxxx>
Date: Fri, 27 Jun 2008 12:27:55 -0400
RE:  Programatically Generate Well-Formed XML with .NET
> From: Ronnie Royston [mailto:rhroyston@xxxxxxxxx]
> Sent: Friday, June 27, 2008 12:22 PM
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  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.

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.