Home to Document Object Model | Up to Core
Prev Text | Next DocumentFragment


Document
Object (inherits from Node).

This object represents and contains an entire document. It provides the factory methods required to create all types of child Node (see the create* methods). Nodes created this way have their ownerDocument set to the document used to create them.

A document node may have the following child nodes:

doctype
Attribute (read only, DocumentType)

See DocumentType and DOMImplementation for details. Returns the DocumentType node of the document.

documentElement
Attribute (read only, Element)

Returns the root Element of the document. For example, in a valid XHTML document, this will be the element with a tagName of "HTML" (see also getElementsByTagName* methods).

implementation
Attribute (read only, DOMImplementation)

See DOMImplementation for details. Returns the DOMImplementation in use by the document.

createAttribute
Method
ECMAScript binding: createAttribute(name) (returns Attr; name is a string; can raise DOMException)

Creates an Attr node with the nodeName attribute set to name and localName, prefix and namespaceURI set to null. The value is the empty string. The attribute can be applied to an element using that object's setAttributeNode method. See also createAttributeNS.

This method allows values to be set on attributes on elements. Take this HTML markup:

<UL type="compact">
</UL>
The "UL" element has an attribute called "type" with a value of "compact". This could be coded
var ULele = document.createElement("UL");
var typeAttr = document.createAttribute("type");
typeAttr.value = "compact";
ULele.setAttributeNode(typeAttr);

The exceptions thrown are:

INVALID_CHARACTER_ERR
name contains an illegal character.

createAttributeNS
Method (only present if feature "XML" is present at version "2.0")
ECMAScript binding: createAttributeNS(namespaceURI, qualifiedName) (returns Attr; namespaceURI and qualifiedName are strings; can raise DOMException)

Creates an Attr node with the nodeName and name set to qualifiedName, namespaceURI set to namespaceURI and prefix and localName extracted from qualifiedName. The value is the empty string. The attribute can be applied to an element using that object's setAttributeNode method. See also createAttribute.

This method allows values to be set on attributes on elements. Take this XML markup:

<nsn:myList xmlns:nsn="http://my.website.com/nsn" nsn:type="compact"/>
The "nsn:myList" element has an attribute called "nsn:type" (URI="http://my.website.com/nsn") with a value of "compact". This could be coded
var myListEle = document.createElement("myList");
var typeAttr = document.createAttributeNS("http://my.website.com/nsn", "nsn:type");
typeAttr.value = "compact";
myListEle.setAttributeNode(typeAttr);

The exceptions thrown are:

INVALID_CHARACTER_ERR
qualifiedName contains an illegal character.
NAMESPACE_ERR
qualfiedName is otherwise malformed (e.g. has a prefix but the namespaceURI is null).

createCDATASection (only present if feature "XML" is present at version "2.0")
Method
ECMAScript binding: createCDATASection(data) (returns CDATASection; data is a string; can raise DOMException)

Creates a CDATASection node with the value set to data. Characters within the node are not parsed for markup, so do not need to be escaped. CDATA Sections are used in markup like this:

<script><![CDATA[if (a < b) foo()]]></script>

The "<" in the script will not be parsed by the markup processor. To create the CDATA section, the following could be coded:

var CDATAnode = document.createCDATASection("if (a < b) foo()");

The exceptions thrown are:

NOT_SUPPORTED_ERR
This document type does not support CDATASection nodes (e.g. HTML documents).

createComment
Method
ECMAScript binding: createComment(data) (returns Comment; data is a string)

Creates a Comment node with the value set to data. Comment nodes represent the

<!-- Comment text -->
markup. The data in the example would be " Comment text " (with the surrounding blanks).

createDocumentFragment
Method
ECMAScript binding: createDocumentFragment() (returns DocumentFragment)

See DocumentFragment for use and examples.

createElement
Method
ECMAScript binding: createElement(tagname) (returns Element; tagname is astrings; can raise DOMException)

Creates an Element node with the tagName set to tagname. namespaceURI, prefix and localName are null. See also createElementNS.

For example, to create an HTML unordered list element, one would code

var ULele = document.createElement("UL");
The equivalent markup, obviously, would be
<UL>
</UL>
or, in XHTML or XML
<UL/>

The exceptions thrown are:

INVALID_CHARACTER_ERR
tagname contains an illegal character.

createElementNS
Method (only present if feature "XML" is present at version "2.0")
ECMAScript binding: createElementNS(namespaceURI, qualifiedName) (returns Element; namespaceURI and qualifiedName are strings; can raise DOMException)

Creates an Element node with the nodeName and tagName set to qualifiedName, namespaceURI set to namespaceURI and prefix and localName extracted from qualifiedName. See also createElement.

For example,

<nsn:myList xmlns:nsn="http://my.website.com/nsn"/>
could be coded as
var myListEle = document.createElementNS("http://my.website.com/nsn", "nsn:myList");

The exceptions thrown are:

INVALID_CHARACTER_ERR
qualifiedName contains an illegal character.
NAMESPACE_ERR
qualfiedName is otherwise malformed (e.g. has a prefix but the namespaceURI is null).
WRONG_DOCUMENT_ERR
doctype is referenced in another Document object or was created under a different DOMImplementation.

createEntityReference
Method
ECMAScript binding: createEntityReference(name) (returns EntityReference; name is a string; can raise DOMException)

See EntityReference and Entity for use and examples.

The exceptions thrown are:

INVALID_CHARACTER_ERR
name contains an illegal character.
NOT_SUPPORTED_ERR
This document type does not support Entity references (e.g. HTML documents).

createProcessingInstruction
Method
ECMAScript binding: createProcessingInstruction(target, data) (returns ProcessingInstruction; target and data are a strings; can raise DOMException)

See ProcessingInstruction for use and examples.

The exceptions thrown are:

INVALID_CHARACTER_ERR
target contains an illegal character.
NOT_SUPPORTED_ERR
This document type does not support processing instructions (e.g. HTML documents).

createTextNode
Method
ECMAScript binding: createTextNode(data) (returns Text; data is a string)

See Text for use and examples. Text nodes hold text for Elements and Attrs.

getElementById
Method (only present if feature "Core" is present at version "2.0")
ECMAScript binding: getElementById(elementId) (returns Element; elementId is a string)

Returns the Element with an Attr named "ID" whose value is elementID, if present in the document. Otherwise, null.

Note that "ID" attributes should be unique within a document. Should this rule be violated, the behaviour of this method is undefined.

Note, also, that it's actually up to the implementation to decide what attribute to use as the ID. It's not necessarily one named "ID".

getElementsByTagName
Method
ECMAScript binding: getElementsByTagName(tagname) (returns NodeList; tagname is a string)

Returns a NodeList containing Elements with the given tagname (or an empty list if none is present). "*" matches everything.

getElementsByTagNameNS
Method (only present if feature "Core" is present at version "2.0")
ECMAScript binding: getElementsByTagNameNS(namespaceURI, localName) (returns NodeList; namespaceURI and localName are strings)

Returns a NodeList containing Elements with the given namespaceURI and localName (or an empty list if none is present). "*" matches everything and can be specified for either or both parameters.

importNode
Method (only present if feature "Core" is present at version "2.0")
ECMAScript binding: importNode(importedNode, deep) (returns Node; importedNode is a Node, deep is Boolean; can raise DOMException)

The standard is actually crystal clear on this method. It says:

Imports a node from another document to this document. The returned node has no parent; (parentNode is null). The source node is not altered or removed from the original document; this method creates a new copy of the source node.

For all nodes, importing a node creates a node object owned by the importing document, with attribute values identical to the source node's nodeName and nodeType, plus the attributes related to namespaces (prefix, localName, and namespaceURI). As in the cloneNode operation on a Node, the source node is not altered.

Additional information is copied as appropriate to the nodeType, attempting to mirror the behavior expected if a fragment of XML or HTML source was copied from one document to another, recognizing that the two documents may have different DTDs in the XML case.

importedNode is the source node referred to above. deep is true to request recursion.

The exceptions thrown are:

NOT_SUPPORTED_ERR
This document type does not support the node type being imported.

Document is the fifth album by the pop/rock group R.E.M. and is probably the one that launched them into the spotlight. Released in 1987, it features the well-known Its the End of the World As We Know It (And I Feel Fine), as well as the top ten single The One I Love. As a result of the success of this album, it would turn out to be their final disc on the independent I.R.S. record label; they would sign with Warner Bros. in 1988.

This album is really strong from beginning to end. It varies pop and rock styles, none more clear than the differences between the driven Its the End of the World As We Know It (And I Feel Fine) and the very mellow The One I Love. The album covers a lot of themes, including capitalism, government, love, and the nature of freedom itself. It is unquestionably one of R.E.M.'s better albums; some of the non-single tracks are absolutely fantastic (Exhuming McCarthy comes to mind).

As with most of their other discs, this album was produced by Scott Litt and R.E.M. and every song was written by R.E.M. It totals thirty nine minutes and forty six seconds in length over eleven tracks.

The album opens with Finest Worksong (3:48), a strong rock song about revolt. I take the song to be about workers striking, and in fact I have heard it played at worker's strikes, but there is plenty of ambivalence in the lyrics to allow one to make up his or her own mind. It has a very strong "arena rock" feel to it as it sounds constructed to come off well in a large stadium. It is very strong way to open the album.

Welcome to the Occupation (2:48) is a song about how a government has taken over a nation, a government that the singer disagrees with. This album's major theme is dissatisfaction with many elements of America, and this rather mellow tune is a strong example of the theme. It seems as though Michael Stipe is singing that the current US government is being oppressive, using some of the stronger connotations of occupation to get the idea across.

The third track is perhaps my favorite R.E.M. track of all. Exhuming McCarthy (3:19) is a rollicking number with horns and a catchy beat. The song is about capitalism, at least in the form it takes in the United States, and how the result of the matter is that unless you are a "businessman" or born into a rich family, you are forced into the middle or lower classes. The jazzy feel of the song and the wonderful chorus "You're sharpening stones/walking on coals/until you prove your business acumen" come together to make one truly great song. The song's title (and some samples) refer to Joseph McCarthy and his famous 1950's campaign against communism in the United States.

Disturbance at the Heron House (3:33) is about a political rally that has everyone up in arms at the huge turnout, but in the end the organizers realize that the people only turned out to eat and then go home; much of the crowd is just there to fill their bellies. The song's main musical feature is the guitarwork, which helps build this song into more than a sum of its parts.

Strange (2:32) is a pretty generic song and is perhaps the low point on the album, although the music is very catchy and upbeat. The lyrics are just repeated lines about how there is something unusual happening, but there's no elaboration, just repetition. Thankfully, this is one of the shortest tracks on the album; it's definitely filler. It's followed, though, by a killer one-two punch.

Its The End of the World As We Know It (And I Feel Fine) (4:07) has been used so many times in so many films and other pop cultural fashions that it's well known to pretty much everyone. I think the song has much the same concept as Billy Joel's We Didn't Start The Fire, but draws a different, more pessimistic conclusion that things are on a downhill slide. The message is a nice contrast to the percussion-driven rock music that fills the song. It's safe, probably, to call this one a modern classic.

The band's first major hit, though, was the achingly simple The One I Love (3:17), about leaving behind a trail of broken hearts after using them as emotional crutches. Few songs as simple and mellow as this one are able to come off so gorgeously well; it is precisely that reason why this was R.E.M.'s breakthrough song.

Fireplace (3:24) is a mellow song that sounds as though it would fit greatly on their later album Automatic for the People. What exactly the song is about is pretty interpretive, but I take it to be about getting fed up with the boring, menial tasks of everyday life. The mellow sound hides a guitar just under the surface that sounds as though it is literally begging to explode out, but is somehow constrained. Another strong track on an album full of them.

The ninth track is Lightnin' Hopkins (3:18), an interesting track if for nothing else than the chanting and Michael Stipe's odd vocals. The lyrics seem to be about the weird things one finds on the wrong side of the tracks, but as with many songs, it's all interpretive. The song drives along steadily with some subtle but nice work on the bass.

King of Birds (4:07) is a mellow track about the difficulties of coming up with new ideas and progress. It's standard R.E.M. fare, though the backing vocals throughout much of the song adds a nice touch, dropping away almost perfectly where it seems as though it should. Very pleasant but unsurprising music, and could probably be called filler on an album of this strength.

Oddfellows Local 151 (5:21) closes out the album with its longest track. It drives along lazily, about a man named Peewee who seems to be some sort of sideway preacher of ideas; as usual, though, the lyrics have plenty of ambivalence to let you draw your own conclusions. The music slowly fades to black at the end, closing out the group's breakthrough album.

As with the breakthrough albums of many great bands (The Beatles with Rubber Soul; U2 with The Unforgettable Fire, and so forth), this album is unquestionably a strong one, with some truly amazing tracks in there. If you only know of R.E.M.'s later mainstream stuff, such as Automatic For The People or Monster, this is a great place to start to hear what their earlier sound was like. This is definitely one of the classic albums of the 1980s.

Doc"u*ment (?), n. [LL. documentum, fr. docere to teach: cf. F. document. See Docile.]

1.

That which is taught or authoritatively set forth; precept; instruction; dogma.

[Obs.]

Learners should not be too much crowded with a heap or multitude of documents or ideas at one time.
I. Watts.

2.

An example for instruction or warning.

[Obs.]

They were forth with stoned to death, as a document to others.
Sir W. Raleigh.

3.

An original or official paper relied upon as the basis, proof, or support of anything else; -- in its most extended sense, including any writing, book, or other instrument conveying information in the case; any material substance on which the thoughts of men are represented by any species of conventional mark or symbol.

Saint Luke . . . collected them from such documents and testimonies as he . . . judged to be authentic.
Paley.

 

© Webster 1913.


Doc"u*ment, v. t.

1.

To teach; to school.

[Obs.]

I am finely documented by my own daughter.
Dryden.

2.

To furnish with documents or papers necessary to establish facts or give information; as, a a ship should be documented according to the directions of law.

 

© Webster 1913.

Log in or registerto write something here or to contact authors.