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

Re: XML attributes

From: L. David Baron <dbaron@fas.harvard.edu>
Date: Fri, 21 May 1999 17:35:48 -0400 (EDT)
Message-Id: <199905212135.RAA30481@login1.fas.harvard.edu>
To: tioneb3279@yahoo.fr, www-dom@w3.org
On Thu, 20 May 1999 03:28:38 -0700 (PDT), BENOIT CAMREDON
(tioneb3279@yahoo.fr) wrote:
> I begin to learn XML and DOM. I would like to know, how can I modifie
> the attribute "name" in this programm :
> # <story>
> # <page name="Hello">
> # <\page>
> # <\story>
> I want to modifie this attribute in JavaScript. The document beyond is
> contained in a frame which is called by an other XML files (a XUL file).

The frames bit is the hard part, because (I think) frames aren't very
well specified in DOM Level 1.  And the fact that it's XML complicates
things further.

Thus the part I'm not sure about is how to get a variable holding the
object for the element.  That also depends on the context.  You could
use document.getElementsByName or some other method.  It would help
to see the context around the piece of XML you provide.

Once you have a variable holding the object for the page element
(called, say, pageElem), you could do:

nameAttr = pageElem.getAttributeNode("name");
pageElem.value = "your new value goes here";

If this is a question about the XUL being used in Mozilla, it might be
better to ask this question in one of the Mozilla groups to get a
better answer for the part I don't know.

Received on Friday, 21 May 1999 17:35:53 UTC

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