[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: How to specify a Processing Instruction? (better: howtocontrolencodi

  • From: Chris Bayes <chris@b...>
  • To: 'ComCity' <mikeb@c...>, xml-dev@l...
  • Date: Thu, 30 Aug 2001 04:00:28 +0100

selectsinglenode processing instruction
Mike,
It seems to be happening because you are getting the xml from a
FrontPageEditor.FPHTMLDocument object. FP normalises all space although
I'm not positive that FP would do that here ;-). Goto Tools/Page
Options/HTML Source and make sure the Reformat HTML using the rules
below is unchecked.
Here is a little javascript to show you what you need to do and that it
isn't an xml problem

var xmlSource = new ActiveXObject("MSXML2.DOMDocument.4.0");
var xmlNew = new ActiveXObject("MSXML2.DOMDocument.4.0");
xmlSource.async = false;
xmlSource.load("toolbar.xml");
xmlNew.loadXML("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?><foo/>");
var lictext =
xmlSource.selectSingleNode("/AccessLicenseRequest/AccessLicenseProfile/A
ccessLicenseText");
xmlNew.selectSingleNode("/foo").appendChild(lictext);
xmlNew.save("new.xml");

C:>cscript above.js

New.xml is saved with the required white space and encoding.

Ciao Chris
P.s. your original UPS document is invalid. It is declared as 
<?xml version="1.0"?> and yet contains "UPS ONLINER TOOLS ACCESS USER
TERMS".
R is invalid in a utf-8 document.

XML/XSL Portal
http://www.bayes.co.uk/xml


> -----Original Message-----
> From: ComCity [mailto:mikeb@c...] 
> Sent: 30 August 2001 01:52
> To: s.livingstone@b...; xml-dev@l...
> Subject: Re: How to specify a Processing Instruction? 
> (better: how tocontrolencoding 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.
> 


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.