W3C home > Mailing lists > Public > www-dom@w3.org > April to June 2001

Re: XML & CreateProcessingInstruction

From: Joseph Kesselman <keshlam@us.ibm.com>
Date: Thu, 28 Jun 2001 11:22:56 -0400
To: "Jayashree Krishnamoorthy" <jayashree.krish@mphasis.com>
Cc: <www-dom@w3.org>
Message-ID: <OF2C2E3978.ED6C16FB-ON85256A79.0053D87F@pok.ibm.com>

>    Document doc =

Don't do that; it's not only nonportable but isn't really supported.
Instead, obtain the DOMImplmentation obect (which currently does require a
nonportable step):
and then use
     Document doc=domImpl.createDocument(...);
Note that createDocument forces you to create the root element.

Then, after you create the ProcessingInstruction node, remember to insert
or append it as a child of some other node; otherwise it won't be part of
your document tree. In this case, what you probably want to do is insert it
as a child of the Document node, before the Document Element:

     ProcessingInstruction myPI = doc.createProcessingInstruction
("xml-stylesheet"," type=\"text/xsl\"

Joe Kesselman  / IBM Research
Received on Thursday, 28 June 2001 11:23:40 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:08 UTC