Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


MXXMLWriter creates only empty files

From: "Thomas" <thomas.wahle@-------.-->
To: NULL
Date: 8/3/2005 3:21:00 AM
I'am using vba to create an xml file from excel. This works fine,
except writing the result into a file.

Using msgbox wrt.output shows the generated xml.

But

  Dim xmlDoc As New MSXML2.DOMDocument30
  xmlDoc.validateOnParse =3D False
  wrt.output =3D xmlDoc
  wrt.Encoding =3D "UTF-8"
  ...
  xmlDoc.Save ("sample.xml")

creates an empty file!?

Any hint would be appreciated!

Thomas

Here the complete code:

Private Sub text_xml()
    Dim cnth As IVBSAXContentHandler
    Dim dtdh As IVBSAXDTDHandler
    Dim lexh As IVBSAXLexicalHandler
    Dim dech As IVBSAXDeclHandler
    Dim errh As IVBSAXErrorHandler

    Dim atrs As New SAXAttributes30
    Dim rdr As New SAXXMLReader30
    Dim wrt As New MXXMLWriter30

    Dim xmlDoc As New MSXML2.DOMDocument30
    xmlDoc.validateOnParse =3D False

    wrt.output =3D xmlDoc
    wrt.Encoding =3D "UTF-8"
    wrt.indent =3D True
    wrt.omitXMLDeclaration =3D False

    Set cnth =3D wrt
    Set dtdh =3D wrt
    Set lexh =3D wrt
    Set dech =3D wrt
    Set errh =3D wrt

    cnth.startDocument
    cnth.processingInstruction "xml", "version=3D'1.0'"
    lexh.startDTD "MyDTD", "", "http://eureka.sample/mydtd.dtd"
    lexh.endDTD

    atrs.addAttribute "", "", "cover", "", "hard"
    cnth.startElement "", "", "book", atrs
    atrs.Clear
    cnth.startElement "", "", "title", atrs
    cnth.Characters "Some special characters: =E4=C4=F6=D6=FC=DC=DF"
    cnth.endElement "", "", "title"
    cnth.endElement "", "", "book"
    cnth.endDocument
    wrt.flush
    xmlDoc.Save ("sample.xml")
   =20
End Sub



transparent
Print
Mail
Digg
delicious
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent