Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: TransformXML files stored as USC-2 rather than UTF-8

From: "Anthony Jones" <Ant@------------.--->
To: NULL
Date: 9/14/2006 2:28:00 PM


"Nick" <Nick@d...> wrote in message
news:81A53C1C-A7D3-4B86-AD67-0D54D0C68FB1@m......
> The code I am using is
>
>     Application.ExportXML _
>         ObjectType:=acExportTable, _
>         DataSource:="Testlet_Entry", _
>         DataTarget:=strTempXML, _
>         Encoding:=acUTF8, _
>         WhereCondition:="Testlet_Id=4350", _
>         AdditionalData:=objOrderInfo
>
> This produces strTempXML in UTF-8 format, followed by
>
>     Application.TransformXML strTempXML, _
>         strXSLDirectory & "Testlet_Entry_Out.xsl", strSourceDirectory &
> "Testlet_Entry.xml"

Here is a VBScript version ot TransformXML :-

Function TransformXML(sFileIn, sXSLFile, sFileOut)

Dim domIn : Set domIn = GetDOM(sFileIn)
Dim domXSL : Set domXSL = GetDOM(sXSLFile)
Dim domOut : Set domOut = GetDOM("")

domIn.transformNodeToObject domXSL, domOut
domOut.save(sFileOut)

End Function

Function GetDOM(sFile)

Set GetDOM = CreateObject("MSXML2.DOMDocument.3.0")
GetDOM.async = false
If sFile <> "" Then GetDOM.load sFile

End Function

What happens if you use this function instead?



>
> Which transforms strTempXML in UTF-8 format into Testlet_Entry.xml in
USC-2
> format.  The XSL Testlet_Entry_Out.xsl is as follows.
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> version="1.0">
> <xsl:output method="xml" encoding="utf-8" media-type="text/xml"
indent="yes"/>
>
> <xsl:template match="dataroot">
> <test>
>                            <xsl:apply-templates select="Testlet_Entry"/>
> </test>
> </xsl:template>
>
>
> "Anthony Jones" wrote:
>
> >
> > "Nick" <Nick@d...> wrote in message
> > news:7EFEC7B0-C48C-40A5-A432-BFF08C5A4F24@m......
> > > I am trying to export tables in access to transformed XML.  I am using
> > >
> > > Application.ExportXML
> > >
> > > followed by
> > >
> > > Application.TransformXML
> > >
> > > The file produced from export is UTF-8 Cookie, but when I transform it
> > with
> > > Application.TransformXML  with a style sheet that starts with the
> > following I
> > > get a USC-2 file instead of the required UTF-8 file.
> > >
> > > <?xml version="1.0" encoding="UTF-8"?>
> > > <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> > > version="1.0">
> > > <xsl:output method="xml" encoding="utf-8" media-type="text/xml"
> > indent="yes"/>
> > >
> > > I am determining the encoding of the file from a text editor.
> > >
> > > I have tried using MSXML2 and XMLWriter
> > >
> > >     Dim XMLDoc As MSXML2.DOMDocument
> > >     Dim XSLDoc As MSXML2.FreeThreadedDOMDocument
> > >     Dim XSLProcessor As MSXML2.IXSLProcessor
> > > Dim Str = New Stream
> > >
> > > to set the encoding but they all require a stream data type to read
the
> > file
> > > that I do not seem to be able to access in the VBA access.
> > >
> > > All the documentation
> > >
> > > 1) Set the encoding for TransformXML
> > > 2) Set the default encoding to UTF-8
> > > 3) How to use streaming in VBA
> > > 4) Any other ideas?
> >
> >
> > We really need to see the code where you actually generate the output as
> > save it to the file.
> >
> >
> > >
> >
> >
> >




transparent
Print
Mail
Like It
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