Components of an XML document : Sundar 3.Elements Elements are basic units used to identify and describe the data in XML. Elements are represented in Tag. Example : XML document must always have a root element.A root element contains all other elements in the document. authors element contains all other elements in an XML and it is the root element. XML document can contain only one root element. 4.Content content refers to the information represented by the elements of an XML document. Example : Harry Potter is the content . XML enables us to declare and use elements that can contain different types of information.An element can contain : 1.character or data content 2.Element content 3.combination or mixed content Example for character or data content (textual information ) -------------------------------------------------------- Example for Element content (contains other elements) -------------------------------------------- Elements can contain other elements. this other elements are called child elements. author element contains FirstName and LastName elements. Example for Combination or mixed content : (textual as well as other elements) ------------------------------------------------------------------- The product is available in two colors Attributes : ------------------------ Attributes provide additional information about the elements in which they are declared. An attribute consists of name-value pair. Example : ProdId ="P001" is an attribute. Elements can have one or more attributes. Element is used to represent definable unit. An attribute is used to represent data that further qualifies the element. Example: font element can have an attribute color to specify the font color. In this case color attribute further qualifies the font element. Entities : An Entity is a name that is associated with a block of data, such as chunk of text or a reference to an external file that contains textual orm binary information. certain characters, such as <>) symbol & used to display the ampersand (&) symbol " used to display the double quote( " ) symbol Example : entity (< ) replaced with the < symbol in the above statement. Comments : Comments are statements to explain the XML code. They used to provide documentation information about the XML file. The parser ignores comment entries during code execution. Comments are created using an opening angular bracket followed by an exclamation mark and two hyphens. This is followed by the text that comprises the comment. Comments are closed using two hyphens followed by a closing angular bracket. Example : Rules for creating well formed XML documents : The rules that govern the well formed XML document are 1.Every start tag must have an end tag. 2.Empty tags must be closed using a forward slash. Example : |
Tuesday, July 17, 2007
Some Basic infos in XML
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment