Using the same xml and xsl files, the result of the xmlTransform.Transform
is different depending if a xmlTextwriter or a StringWriter is used. In the
first case, the output file is as expected, but in the second case, a new
<metatag is added, and the existing ones loose the /closing tag; that
means xmDocument.LoadXml(Stringbuilder.ToString) fails.
The code is:
#If 1 Then 'Good
objXMLWriter = New Xml.XmlTextWriter(sPathDoc, Nothing)
objTransform.Transform(objXPathDocument, Nothing, objXMLWriter, Nothing)
objXMLWriter.Close()
Docum.Load(sPathDoc)
#Else 'Fails
sb = New Text.StringBuilder
objXMLStream = New System.IO.StringWriter(sb)
objTransform.Transform(objXPathDocument, Nothing, objXMLStream, Nothing)
objXMLStream.Close()
Docum.LoadXml(sb.ToString)
#End If
Alfons Puig