You are here: Reference > JavaScript > client-side > HTML DOM > objects > nodes and tags > xml

xml object

Browser support:
Defines XML data content in a HTML page.
The xml element allows authors to insert XML content directly into the document.

Syntax:

Methods that return the object:
document.createElement ("xml")
If you want to see the HTML objects by categories, please visit this page.
HTML page for this element: xml

Possible members:

Properties
Methods
Events
Style properties
attributes
Represents a collection of attribute nodes that belong to an element.
behaviorUrns
Represents a collection of the Uniform Resource Names for all behaviors attached to an element.
canHaveChildren
Retrieves a Boolean value that indicates whether the element can contain child elements.
canHaveHTML
Retrieves a Boolean value that indicates whether the element can contain HTML formatted text.
childNodes
Represents a collection of all nodes that are direct descendants of an element.
currentStyle
Represents the computed style settings for an element.
firstChild
Returns a reference to the first child of the current element.
id
Sets or retrieves a unique identifier for the object.
innerHTML
Sets or retrieves the inner HTML content (the source code between the opening and closing tags) of an element.
isContentEditable
Returns a Boolean value that indicates whether the contents of the object are editable by the user.
isDisabled
Returns a Boolean value that indicates whether the object is disabled.
isMultiLine
Returns a Boolean value that indicates whether the contents of an element can be multiline or not.
isTextEdit
Returns a Boolean value that indicates whether the createTextRange method can be used for the element.
language
Sets or retrieves the scripting language for the current element. Use it only for the script element.
lastChild
Returns a reference to the last child of the current element.
localName
9
Returns the local part of the qualified name of the current node.
namespaceURI
9
Sets or returns the namespace URI of the current node.
nextElementSibling
9
Returns a reference to the next child element of the current element's parent.
nextSibling
Returns a reference to the next child of the current element's parent.
nodeName
Returns the name of the current node.
nodeType
Returns an integer that indicates the type of the node.
nodeValue
Sets or returns the value of the current node.
outerHTML
Sets or retrieves the outer HTML content (the source code including the opening and closing tags) of an element.
outerText
Sets or returns the text content of an element including the text content of its descendants.
ownerDocument
Returns the document object that contains the current node.
parentElement
Returns the parent element of the object in the DOM hierarchy.
parentNode
Returns the parent element of the current node in the DOM hierarchy.
parentTextEdit
Returns the closest ancestor element of the current element in the DOM hierarchy that can be used to create a TextRange object.
previousElementSibling
9
Returns a reference to the previous child element of the current element's parent.
previousSibling
Returns a reference to the previous node of the current element's parent.
readyState
Returns a string value that represents the state of the object.
recordset
Sets or retrieves a reference to the default record set in a data source.
runtimeStyle
Represents the overridden style settings for an element.
scopeName
Retrieves the local name of the namespace declared for the current element.
sourceIndex
Returns the position of the current object in the all collection of the document.
src
Sets or retrieves the location of an associated file for an object.
style
Represents the inline style settings for an element or a CSS rule.
tagName
Returns the tag name of the current element.
tagUrn
Sets or retrieves the Uniform Resource Name (URN) of the namespace declared for the current element.
uniqueID
Returns the unique identifier generated by the browser for the object.
XMLDocument
9
Returns a reference to the XMLDocument object that represents the contents of an xml element.

Example HTML code 1:

This example illustrates the use of the xml element:
<xml>
  <fruits>
     <apple>$5</apple>
     <pear>$10.50</pear>
     <peach>$23.30</peach>
  </fruits>
</xml>
Did you find this example helpful? yes no

Example HTML code 2:

This example shows how to use the xml element to create a dynamic table in Internet Explorer:
<head>
    <xml id="movies">
        <?xml version="1.0"?>
        <movies>
            <movie>
                <name>Clark Kent</name>
                <jobtitle>Superman</jobtitle>
                <born>1966</born>
            </movie>
            <movie>
                <name>Lois Lane</name>
                <jobtitle>Reporter</jobtitle>
                <born>1964</born>
            </movie>
            <movie>
                <name>Fred Flintstone</name>
                <jobtitle>Caveman</jobtitle>
                <born>1970</born>
            </movie>
            <movie>
                <name>Barney Rubble</name>
                <jobtitle>Caveman</jobtitle>
                <born>1972</born>
            </movie>
        </movies>
    </xml>
</head>
<body>
    <table width="100%" cellpadding="0px" cellspacing="2px" border="1px" datasrc="#movies" datapagesize="1" id="myTable">
        <thead>
            <tr>
                <th>Name</th>
                <th>Jobtitle</th>
                <th>Born</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td><span datafld="name"></span></td>
                <td><span datafld="jobtitle"></span></td>
                <td><span datafld="born"></span></td>
            </tr>
        </tbody>
    </table>

    <input type="button" onclick="myTable.firstPage ()" value="|< First " />
    <input type="button" onclick="myTable.previousPage ()" value="< Previous " />
    <input type="button" onclick="myTable.nextPage ()" value=" Next >" />
    <input type="button" onclick="myTable.lastPage ()" value=" Last >|" />
</body>
Did you find this example helpful? yes no

External links:

User Contributed Comments

Post Content

Post Content