W3C home > Mailing lists > Public > www-dom@w3.org > October to December 2000

Re: to retrieve the processing instruction

From: Philippe Le Hegaret <plh@w3.org>
Date: Wed, 20 Dec 2000 17:57:31 +0100
Message-ID: <3A40E4FB.5E7E4072@w3.org>
To: "R. Mark Volkmann" <mark.volkmann@home.com>
CC: Sridhar Gopal Manavarthe <sridhar.gopal@wipro.com>, www-dom@w3.org
"R. Mark Volkmann" wrote:
> Here are two Java methods you can add to your code that will do it.
> 
> [...]
>             if (node instanceof ProcessingInstruction &&

node instanceof ProcessingInstruction is dangerous here and make expectation
on the underlying DOM implementation. Nothing prevents a DOM implementation
to implement several DOM interfaces in the same class.
Instead, I would suggest using
 if (node.getNodeType() == Node.PROCESSING_INSTRUCTION_NODE &&

Philippe
Received on Wednesday, 20 December 2000 11:58:29 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:13:48 GMT