PDA

View Full Version : progratically add attributes to PI or Document


wac
12-10-2004, 06:08 PM
Is it valid to programatically add attributes to the processing instruction or the Document node? I want to hang some stuff into the DOM so that I can use it later during processing. I know I can try it and see if it works, but what I'm concerned about is if this is not a standard behavior, it may break later.

Alex Vincent
12-11-2004, 04:48 AM
Um, as far as I know, processing instructions and documents don't have attributes. Even the XML stylesheet PI has pseudo-attributes.

wac
12-13-2004, 03:18 PM
But they are subclasses of Node and Element which do have setters and getters for attributes. That's why I was wondering what would happen if I used them. I'll experiment.

Alex Vincent
12-15-2004, 07:26 AM
:) Of Node, yes. Of Element, no.