OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to specify a Processing Instruction? (better: howtocontrolencoding on saving)



P.S.  This is my code, maybe you see something I did wrong.  I know I used
LoadXML...instead of Load as you described, but I get an error when I use
Load.  The Msgbox in the If statement catches the error as "Could not Open
XML Access License Request." and then the line AccessLicXml.replaceChild pi,
AccessLicXml.childNodes.Item(0) further fails because AccessLicXml is empty.

    Dim AccessLicXml As MSXML2.DOMDocument
    Dim XmlRoot As IXMLDOMElement
    Dim XmlString
    Dim MyPageDoc As PageWindow
    Dim MyDocObject As FPHTMLDocument
    Dim ShippingLoc As String
    Dim ReqXmlStr As String
    GetPath FpApp.ActiveWeb.RootFolder, ShippingLoc, False
    ShippingLoc = ShippingLoc & "/ups/accesslicensereq.xml"
    'ShippingLoc = ShippingLoc & "/ups/ups.xml"
    FpApp.ActiveWeb.LocateFile(ShippingLoc).Edit
    Set MyDocObject = FpApp.ActivePageWindow.ActiveDocument
    Set AccessLicXml = New MSXML2.DOMDocument
    ReqXmlStr = MyDocObject.DocumentHTML
    Set MyPageDoc = FpApp.ActivePageWindow
    MyPageDoc.Close
    If Not AccessLicXml.loadXML(ReqXmlStr) Then
        MsgBox "Could not Open XML Access License Request", vbOKOnly +
vbCritical, "SalesCart Error"
    End If

    'Dim pi As IXMLDOMProcessingInstruction
    Set pi = AccessLicXml.createProcessingInstruction("xml", "version='1.0'
encoding='ISO-8859-1'")
    AccessLicXml.replaceChild pi, AccessLicXml.childNodes.Item(0)
    MsgBox (AccessLicXml.xml)

Anyway, I'm either totally lost or none of this stuff is working the way
everyone says.

Thank You very much.
Michael Barber
ComCity Corporation
6690 Amador Plaza Rd., Suite 115
Dublin CA
925-556-6940
Fax: 925-556-6945

DISCLAIMER:  This e-mail contains proprietary information some or all of
which may be legally privileged.  It is for the intended recipient(s) only.
If an addressing or transmission error has misdirected this e-mail, please
notify the author by replying to this e-mail.  If you are not the intended
recipient you must not use, disclose, distribute, copy, print, or reply on
this e-mail.

----- Original Message -----
From: ComCity <mikeb@comcity.com>
To: <s.livingstone@btinternet.com>; <xml-dev@lists.xml.org>
Sent: Wednesday, August 29, 2001 5:45 PM
Subject: Re: How to specify a Processing Instruction? (better: how
tocontrolencoding on saving)


> Well this does not work for me.  I'm in VB, and not VB Script, but if I do
> this and the PI is not changed and remains
> <?xml version="1.0"?>
>
> The
> <?xml version="1.0" encoding="ISO-8859-1"?>
> does not show up.
>
> I'm using MSXML 3.0, sp1 I believe.
>
> Am I going in sane, why does none of this stuff work for me.
>
> Thank You very much.
> Michael Barber
> ComCity Corporation
> 6690 Amador Plaza Rd., Suite 115
> Dublin CA
> 925-556-6940
> Fax: 925-556-6945
>
> DISCLAIMER:  This e-mail contains proprietary information some or all of
> which may be legally privileged.  It is for the intended recipient(s)
only.
> If an addressing or transmission error has misdirected this e-mail, please
> notify the author by replying to this e-mail.  If you are not the intended
> recipient you must not use, disclose, distribute, copy, print, or reply on
> this e-mail.
>
> ----- Original Message -----
> From: <s.livingstone@btinternet.com>
> To: <xml-dev@lists.xml.org>
> Sent: Wednesday, August 29, 2001 3:34 PM
> Subject: RE: How to specify a Processing Instruction? (better: how
> tocontrolencoding on saving)
>
>
> The following same changes the file test.xml:
>
> <?xml version="1.0" encoding="UTF-8" ?>
> <steven>©</steven>
>
> and changes the encoding as follows:
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <steven>©</steven>
>
> The script is..
>
> set xmlDoc = server.createobject("Msxml2.DOMDocument.3.0")
> xmlDoc.async = false
> xmlDoc.validateOnParse = true
> xmlDoc.load(server.MapPath("test.xml"))
>
> set pi = xmlDoc.createProcessingInstruction("xml", "version='1.0'
> encoding='ISO-8859-1'")
> xmlDoc.replaceChild pi,xmlDoc.childNodes.item(0)
>
> xmlDoc.save(server.MapPath("test.xml"))
>
> Whether standard or not, it works.
>
> Cheers,
> Steven
> Author, Pro XML2e
>
> -----------------------------------------------------------------
> The xml-dev list is sponsored by XML.org <http://www.xml.org>, an
> initiative of OASIS <http://www.oasis-open.org>
>
> The list archives are at http://lists.xml.org/archives/xml-dev/
>
> To subscribe or unsubscribe from this elist use the subscription
> manager: <http://lists.xml.org/ob/adm.pl>
>
>