What is the Role of an Element in the DOM
it is receiving wide support in the Java community as a viable interface between
the DOM and work with XML. Some of the computer and scripting languages you might
consider while working with the DOM and XML may include, but are not limited to,
Thinking about objects
An element doesnt need to contain any data to be considered a legitimate object. The img element is a good example of a familiar element from HTML that doesnt contain any data. Rather, it contains properties in the form of attributes such as src, which describes where the object is located. An images actual data is contained in a separated file that is referred to via the src attribute. The img element, or objects, always remains the same, but it can contain different properties, and these properties can be changed on the fly through scripts.
Try inputting the following code within an HTML file:
<img src = />
If you load this HTML file into a browser, youll get a broken-image icon. Thats because youre dealing with an object that has properties that mean nothing to the browser. In fact, its properties refer to a resource that contains no data. Its still an object, though, and thus, it is also an element. You might want to change the src attribute value to something that makes sense to a browser, such as src =http://www.somedomainhere.com.
This is why the DOM is so important to XML. The DOM consists of object interfaces and their properties, which you can manipulate with script. Objects have become extremely important in the computer world. By manipulating them in script, you can turn static Web page into dynamic Web pages. To better understand how an element can be considered an object, review the following tag:
<p style = font-family:serif> this a Paragraph </P>
The p element consists of a number of parts that help describe it as an object. This element consists of data made up of a string (This is a Paragraph). String is computer-talk for a series of one or more text characters. This element also consists of an attribute, style, which has the value font-family:serif assigned to it.
Within the DOM, the most commonly used interface is the element interface. The element interface contains properties and methods that make it possible to access an elements attributes. From a technical perspective, an attribute isnt a child of anything. Therefore, the developers of the DOM built a series of interfaces within the DOM that contain properties and methods that developers can use to access element attributes. There are actually several other interfaces, but theyre beyond the scope.
Writing Well-Formed Documents
Now that you know all the rules of creating elements and how they fit into the document, we are going to look at ways to ensure that your documents are well formed. Well also take a look at how to manage your element content through validation. Theres a difference between these two:
A well formed document is a document that follows the core rules of XML.
| Generating XML Document Using Java servlet | How to Design a XML Document Easily | Implementing Object Based Methodology in SGML | Understanding Advanced XML Concepts | Understanding Class Loaders in Java | Understanding The Basic Reasons for Development of XML | Understanding Various Methods of Formatting XML Data | Understanding XML Based Web Protocols | Working With ebXML An Indepth Overview | XML Database Program Knowing the Basic Concepts |
Copyright - © 2004 - 2017 - All Rights Reserved.