Skip to content

Commit d991d25

Browse files
hansonrhansonr
authored andcommitted
adds DOM2 interfaces
1 parent 7f9cb7d commit d991d25

File tree

134 files changed

+11224
-3281
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

134 files changed

+11224
-3281
lines changed
Lines changed: 87 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,38 @@
1+
/*
2+
* Copyright (c) 2000 World Wide Web Consortium,
3+
* (Massachusetts Institute of Technology, Institut National de
4+
* Recherche en Informatique et en Automatique, Keio University). All
5+
* Rights Reserved. This program is distributed under the W3C's Software
6+
* Intellectual Property License. This program is distributed in the
7+
* hope that it will be useful, but WITHOUT ANY WARRANTY; without even
8+
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
9+
* PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
10+
* details.
11+
*/
12+
113
package org.w3c.dom;
214

315
/**
4-
* The <code>Attr</code> interface represents an attribute in an
5-
* <code>Element</code> object.Typically the allowable values for the
6-
* attribute are defined in a documenttype definition.
16+
* The <code>Attr</code> interface represents an attribute in an
17+
* <code>Element</code> object. Typically the allowable values for the
18+
* attribute are defined in a document type definition.
719
* <p><code>Attr</code> objects inherit the <code>Node</code> interface, but
820
* since they are not actually child nodes of the element they describe, the
921
* DOM does not consider them part of the document tree. Thus, the
10-
* <code>Node</code> attributes <code>parentNode</code>,
11-
* <code>previousSibling</code>, and <code>nextSibling</code> have a null
12-
* value for <code>Attr</code> objects. The DOM takes the view that
13-
* attributes are properties of elements rather than having a separate
14-
* identity from the elements they are associated with; this should make it
15-
* more efficient to implement such features as default attributes associated
16-
* with all elements of a given type. Furthermore, <code>Attr</code> nodes
17-
* may not be immediate children of a <code>DocumentFragment</code>. However,
18-
* they can be associated with <code>Element</code> nodes contained within a
19-
* <code>DocumentFragment</code>. In short, users and implementors of the DOM
20-
* need to be aware that <code>Attr</code> nodes have some things in common
21-
* with other objects inheriting the <code>Node</code> interface, but they
22-
* also are quite distinct.
22+
* <code>Node</code> attributes <code>parentNode</code> ,
23+
* <code>previousSibling</code> , and <code>nextSibling</code> have a
24+
* <code>null</code> value for <code>Attr</code> objects. The DOM takes the
25+
* view that attributes are properties of elements rather than having a
26+
* separate identity from the elements they are associated with; this should
27+
* make it more efficient to implement such features as default attributes
28+
* associated with all elements of a given type. Furthermore,
29+
* <code>Attr</code> nodes may not be immediate children of a
30+
* <code>DocumentFragment</code> . However, they can be associated with
31+
* <code>Element</code> nodes contained within a <code>DocumentFragment</code>
32+
* . In short, users and implementors of the DOM need to be aware that
33+
* <code>Attr</code> nodes have some things in common with other objects
34+
* inheriting the <code>Node</code> interface, but they also are quite
35+
* distinct.
2336
* <p> The attribute's effective value is determined as follows: if this
2437
* attribute has been explicitly assigned any value, that value is the
2538
* attribute's effective value; otherwise, if there is a declaration for
@@ -29,45 +42,69 @@
2942
* has been explicitly added. Note that the <code>nodeValue</code>
3043
* attribute on the <code>Attr</code> instance can also be used to retrieve
3144
* the string version of the attribute's value(s).
32-
* <p>In XML, where the value of an attribute can contain entity references,
45+
* <p> In XML, where the value of an attribute can contain entity references,
3346
* the child nodes of the <code>Attr</code> node provide a representation in
3447
* which entity references are not expanded. These child nodes may be either
3548
* <code>Text</code> or <code>EntityReference</code> nodes. Because the
3649
* attribute type may be unknown, there are no tokenized attribute values.
50+
* <p>See also the <a href='http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510'>Document Object Model (DOM) Level 2 Specification</a>.
3751
*/
3852
public interface Attr extends Node {
39-
/**
40-
* Returns the name of this attribute.
41-
*/
42-
public String getName();
43-
/**
44-
* If this attribute was explicitly given a value in the original document,
45-
* this is <code>true</code>; otherwise, it is <code>false</code>. Note
46-
* that the implementation is in charge of this attribute, not the user. If
47-
* the user changes the value of the attribute (even if it ends up having
48-
* the same value as the default value) then the <code>specified</code>
49-
* flag is automatically flipped to <code>true</code>. To re-specify the
50-
* attribute as the default value from the DTD, the user must delete the
51-
* attribute. The implementation will then make a new attribute available
52-
* with <code>specified</code> set to <code>false</code> and the default
53-
* value (if one exists).
54-
* <br>In summary: If the attribute has an assigned value in the document
55-
* then <code>specified</code> is <code>true</code>, and the value is the
56-
* assigned value. If the attribute has no assigned value in the document
57-
* and has a default value in the DTD, then <code>specified</code> is
58-
* <code>false</code>, and the value is the default value in the DTD. If
59-
* the attribute has no assigned value in the document and has a value of
60-
* #IMPLIED in the DTD, then the attribute does not appear in the
61-
* structure model of the document.
62-
*/
63-
public boolean getSpecified();
64-
/**
65-
* On retrieval, the value of the attribute is returned as a string.
66-
* Character and general entity references are replaced with their values.
67-
* <br>On setting, this creates a <code>Text</code> node with the unparsed
68-
* contents of the string.
69-
*/
70-
public String getValue();
71-
public void setValue(String value);
53+
/**
54+
* Returns the name of this attribute.
55+
*/
56+
public String getName();
57+
58+
/**
59+
* If this attribute was explicitly given a value in the original
60+
* document, this is <code>true</code> ; otherwise, it is
61+
* <code>false</code> . Note that the implementation is in charge of this
62+
* attribute, not the user. If the user changes the value of the
63+
* attribute (even if it ends up having the same value as the default
64+
* value) then the <code>specified</code> flag is automatically flipped
65+
* to <code>true</code> . To re-specify the attribute as the default
66+
* value from the DTD, the user must delete the attribute. The
67+
* implementation will then make a new attribute available with
68+
* <code>specified</code> set to <code>false</code> and the default value
69+
* (if one exists).
70+
* <br> In summary: If the attribute has an assigned value in the document
71+
* then <code>specified</code> is <code>true</code> , and the value is
72+
* the assigned value. If the attribute has no assigned value in the
73+
* document and has a default value in the DTD, then
74+
* <code>specified</code> is <code>false</code> , and the value is the
75+
* default value in the DTD. If the attribute has no assigned value in
76+
* the document and has a value of #IMPLIED in the DTD, then the
77+
* attribute does not appear in the structure model of the document. If
78+
* the <code>ownerElement</code> attribute is <code>null</code> (i.e.
79+
* because it was just created or was set to <code>null</code> by the
80+
* various removal and cloning operations) <code>specified</code> is
81+
* <code>true</code> .
82+
*/
83+
public boolean getSpecified();
84+
85+
/**
86+
* On retrieval, the value of the attribute is returned as a string.
87+
* Character and general entity references are replaced with their
88+
* values. See also the method <code>getAttribute</code> on the
89+
* <code>Element</code> interface.
90+
* <br> On setting, this creates a <code>Text</code> node with the unparsed
91+
* contents of the string. I.e. any characters that an XML processor
92+
* would recognize as markup are instead treated as literal text. See
93+
* also the method <code>setAttribute</code> on the <code>Element</code>
94+
* interface.
95+
* @exception DOMException
96+
* NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
97+
*/
98+
public String getValue();
99+
public void setValue(String value)
100+
throws DOMException;
101+
102+
/**
103+
* The <code>Element</code> node this attribute is attached to or
104+
* <code>null</code> if this attribute is not in use.
105+
* @since DOM Level 2
106+
*/
107+
public Element getOwnerElement();
108+
72109
}
73110

sources/net.sf.j2s.java.core/src/org/w3c/dom/CDATASection.java

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,48 @@
1+
/*
2+
* Copyright (c) 2000 World Wide Web Consortium,
3+
* (Massachusetts Institute of Technology, Institut National de
4+
* Recherche en Informatique et en Automatique, Keio University). All
5+
* Rights Reserved. This program is distributed under the W3C's Software
6+
* Intellectual Property License. This program is distributed in the
7+
* hope that it will be useful, but WITHOUT ANY WARRANTY; without even
8+
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
9+
* PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
10+
* details.
11+
*/
12+
113
package org.w3c.dom;
214

315
/**
4-
* CDATA sections are used to escape blocks of text containing characters
16+
* CDATA sections are used to escape blocks of text containing characters
517
* that would otherwise be regarded as markup. The only delimiter that is
618
* recognized in a CDATA section is the "]]&gt;" string that ends the CDATA
7-
* section. CDATA sections can not be nested. The primary purpose is for
19+
* section. CDATA sections cannot be nested. Their primary purpose is for
820
* including material such as XML fragments, without needing to escape all
921
* the delimiters.
10-
* <p>The <code>DOMString</code> attribute of the <code>Text</code> node holds
11-
* the text that is contained by the CDATA section. Note that this may
22+
* <p> The <code>DOMString</code> attribute of the <code>Text</code> node
23+
* holds the text that is contained by the CDATA section. Note that this may
1224
* contain characters that need to be escaped outside of CDATA sections and
1325
* that, depending on the character encoding ("charset") chosen for
1426
* serialization, it may be impossible to write out some characters as part
15-
* of a CDATA section.
16-
* <p> The <code>CDATASection</code> interface inherits the
27+
* of a CDATA section.
28+
* <p> The <code>CDATASection</code> interface inherits from the
1729
* <code>CharacterData</code> interface through the <code>Text</code>
1830
* interface. Adjacent <code>CDATASections</code> nodes are not merged by use
19-
* of the Element.normalize() method.
31+
* of the <code>normalize</code> method of the <code>Node</code> interface.
32+
* Because no markup is recognized within a <code>CDATASection</code> ,
33+
* character numeric references cannot be used as an escape mechanism when
34+
* serializing. Therefore, action needs to be taken when serializing a
35+
* <code>CDATASection</code> with a character encoding where some of the
36+
* contained characters cannot be represented. Failure to do so would not
37+
* produce well-formed XML. One potential solution in the serialization
38+
* process is to end the CDATA section before the character, output the
39+
* character using a character reference or entity reference, and open a new
40+
* CDATA section for any further characters in the text node. Note, however,
41+
* that some code conversion libraries at the time of writing do not return
42+
* an error or exception when a character is missing from the encoding,
43+
* making the task of ensuring that data is not corrupted on serialization
44+
* more difficult.
45+
* <p>See also the <a href='http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510'>Document Object Model (DOM) Level 2 Specification</a>.
2046
*/
2147
public interface CDATASection extends Text {
2248
}

0 commit comments

Comments
 (0)