Table 1


MethodDescription
createElement Takes the name of the element you want to create and returns a new element of the type specified. An exception is raised if the specified name contains an invalid character.
createAttribute Takes the name of an attribute and returns an attribute object. An element can use the attribute instance by calling the setAttribute method. An exception is raised if the specified name contains an invalid character.
createDocument-Fragment Creates an empty DocumentFragment object.
createTextNode Takes a string and creates a text node.
createComment Takes a comment string and returns a comment node.
createCDATASection Takes a string of data to be used in a CDATA section and re-turns a CDATA object. An exception is raised if the document is an HTML document and not an XML document.
createProcessing-Instruction Takes a string representing the target portion of a processing instruction and returns a ProcessingInstruction object. An exception occurs if an invalid character is given, or the source document is an HTML document.
createEntityReference Takes a name and returns an entity reference object. An exception is raised if the name contains an invalid character, or if the source document is an HTML document.
getElementsByTag-Name Takes a string that can be used to match elements and returns a NodeList of those elements. The wildcard character ('*') can be used to match all elements.