Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - MXXML Writer creates only empty files >Thread Next - Re: MXXML Writer creates only empty files Re: MXXML Writer creates only empty filesTo: NULL Date: 8/3/2005 1:47:00 PM Hi,
I'm not that familiar with these Interfaces you are using but; Reading
this:
>Using msgbox wrt.output shows the generated xml.
Wouldn't this solve the issue?
- xDoc.loadXml( wrt.output ) at the end instead of "wrt.output =
xmlDoc"
Hope this helps,
Marvin Smit.
On 3 Aug 2005 03:39:15 -0700, "Thomas" <thomas_80844@y...> wrote:
>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 = False
> wrt.output = xmlDoc
> wrt.Encoding = "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 = False
>
> wrt.output = xmlDoc
> wrt.Encoding = "UTF-8"
> wrt.indent = True
> wrt.omitXMLDeclaration = False
>
> Set cnth = wrt
> Set dtdh = wrt
> Set lexh = wrt
> Set dech = wrt
> Set errh = wrt
>
> cnth.startDocument
> cnth.processingInstruction "xml", "version='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: äÄöÖüÜß"
> cnth.endElement "", "", "title"
> cnth.endElement "", "", "book"
> cnth.endDocument
> wrt.flush
> xmlDoc.Save ("sample.xml")
>End Sub
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
