delta one handle kitchen faucets

« Home »
Sep 24th, 2012 Comments: 0

XML Tags

Tags
Plurk
Share this

Tags

Most elements consist of a pair of opening and closing tags but there is another type of tag that can be used in XML documents.  The solo tag is used for elements that do not contain any text.  So instead of using the pair of tags, a modified opening tag is used.  In this case, a slash is used after the name of the element.  This tells the XML processor that the element has no data between opening and closing tags and that it has been completed.  The following example shows the syntax of this type of tag:

Example: <element />

Another thing to keep in mind when creating an XML document is that each XML tags must be closed in the order in which it was opened. So if another XML tag is opened inside another element it must be closed before the outer element is closed. If this rule is not followed, the XML processor will register an error.  Below are two examples of incorrect and then correct ways to nest XML elements.

Example: INCORRECT

<email>

<to>Mommy

<from>Daddy</to></from>

<body>I love you!</body>

</email>

 

Example: CORRECT

<email>

<to>Mommy</to>

<from>Daddy</from>

<body>I love you!</body>

</email>

 

Though not required, the following practices are common:

  • Start a new line before placing a new tag.
  • If using a nested tag, indent the line to make it stand out.

 

Also, keep in mind that XML tags are case-sensitive.  So the tag <Man> is not the same as the tag <man>.  In addition to this, opening and closing tags must use the same case.  Examples of incorrect and correct case use is shown below:

 

Example: INCORRECT

<Name>This is not right</name>

 

Example: CORRECT

<name>This is not right</name>

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>