Academic Tutorials



English | French | Portugese | German | Italian
Google

Home Source Codes E-Books Downloads Contact Us About Us

XML Tutorial
XML Introduction
XML How to use
XML Syntax
XML Elements
XML Attributes
XML Validation
XML Validator
XML Browsers
XML Viewing
XML CSS
XML XSL
XML Data Island
XML Parser
XML in Real Life
XML Namespaces
XML CDATA
XML Encoding
XML Server
XML Application
XML HTTP Request
XML Save Data
XML Behaviors
XML Technologies
XML Editors
XML Summary
XML as Data Source

HTML Tutorials
HTML Tutorial
XHTML Tutorial
CSS Tutorial
TCP/IP Tutorial
XML Tutorials
XML Tutorial
XSL Tutorial
XSLT Tutorial
DTD Tutorial
Schema Tutorial
XForms Tutorial
XSL-FO Tutorial
XML DOM Tutorial
XLink Tutorial
XQuery Tutorial
XPath Tutorial
XPointer Tutorial
RDF Tutorial
SOAP Tutorial
WSDL Tutorial
RSS Tutorial
WAP Tutorial
Web Services Tutorial
Browser Scripting
JavaScript Tutorial
VBScript Tutorial
AJAX Tutorial
DHTML Tutorial
HTML DOM Tutorial
WMLScript Tutorial
E4X Tutorial
Server Scripting
ASP Tutorial
PHP Tutorial
PERL Tutorial
SQL Tutorial
ADO Tutorial
.NET (dotnet)
Microsoft.Net
XML Web Services
ASP.Net
.Net Mobile
C# : C Sharp
ADO.NET
VB.NET
Multimedia
SVG Tutorial
Flash Tutorial
Media Tutorial
SMIL Tutorial
Web Building
Web Browsers
Web Hosting
W3C Tutorial
Web Building
Web Quality
Web Semantic
Web Careers
Java Tutorials
Java Tutorial
JSP Tutorial
Servlets Tutorial
Struts Tutorial
EJB Tutorial
JMS Tutorial
JMX Tutorial
Programming Langauges
C Tutorial
C++ Tutorial
Visual Basic Tutorial
Data Structures Using C
Soft Skills
Communication Skills
Time Management
Project Management
Team Work
Leadership Skills
Corporate Communication
Negotiation Skills


XML Attributes
Previous Next


An attribute appears within the opening tag of an element. XML Attributes are similar to HTML attributes.

Attributes are used to provide extra information about elements.



Syntax of XML Attribute

XML requires that all XML attributes must have a value. This means all attributes have to be equal to something! Below is the correct way to create a XML attribute .


XML Code:

<student active="true">
   <name>Sam</name>
   <grade>A</grade>
</student>

The attribe active is valid because it has value true. Here is an example of shorthand that is sometimes used in HTML, but is not valid XML.

XML Code:

<student active>
    <name>Sam</name>
    <grade>A</grade>
</student>

This XML attribute is wrong because it does not consist any value.



XML Attribute Quotation Usage

Both the single quote ' and the double quote " are perfectly fine to use in XML documents.

The only instances when you might want to use one quotation over the other is if your attribute value contains a quotation or apostrophe of its own. Below some real world examples.

XML Code:

<student nickname='Rob "The Dog"'>
    <name>Robert</name>
    <grade>A+</grade>
</student>

XML Code:

<student group="Pete's Pandas">
    <name>Robert</name>
    <grade>A+</grade>
</student>



Try to avoid using attributes?
Should you avoid using attributes?

Some problems generated by using attributes

  • attributes cannot contain multiple values (child elements can)


  • future changes attributes are not easily expandable


  • attributes cannot show the structures (child elements can)


  • Nanipulating attributes are more difficult by program code


  • attribute values are not easy to test against a Document Type Definition (DTD) - which is used to define the legal elements of an XML document

If you use attributes as containers for data, you end up with documents that are difficult to read and maintain. Try to use elements to describe data. Use attributes only to provide information that is not relevant to the data.

Don't end up like this (this is not how XML should be used):


<company day="10" month="10" year="2004"
to="VYOM" from="TCS" heading="Reminder"
body="Employee Details">
</note>


Share And Enjoy:These icons link to social bookmarking sites where readers can share and discover new web pages.
  • blinkbits
  • BlinkList
  • blogmarks
  • co.mments
  • connotea
  • del.icio.us
  • De.lirio.us
  • digg
  • Fark
  • feedmelinks
  • Furl
  • LinkaGoGo
  • Ma.gnolia
  • NewsVine
  • Netvouz
  • RawSugar
  • Reddit
  • scuttle
  • Shadows
  • Simpy
  • Smarking
  • Spurl
  • TailRank
  • Wists
  • YahooMyWeb

Previous Next

Keywords: xml file create code dtd, xml file create code dtd xsd, xml documents, xml file


HTML Quizes
HTML Quiz
XHTML Quiz
CSS Quiz
TCP/IP Quiz
XML Quizes
XML Quiz
XSL Quiz
XSLT Quiz
DTD Quiz
Schema Quiz
XForms Quiz
XSL-FO Quiz
XML DOM Quiz
XLink Quiz
XQuery Quiz
XPath Quiz
XPointer Quiz
RDF Quiz
SOAP Quiz
WSDL Quiz
RSS Quiz
WAP Quiz
Web Services Quiz
Browser Scripting Quizes
JavaScript Quiz
VBScript Quiz
AJAX Quiz
DHTML Quiz
HTML DOM Quiz
WMLScript Quiz
E4X Quiz
Server Scripting Quizes
ASP Quiz
PHP Quiz
PERL Quiz
SQL Quiz
ADO Quiz
.NET (dotnet) Quizes
Microsoft.Net Quiz
XML Web Services Quiz
ASP.Net Quiz
.Net Mobile Quiz
C# : C Sharp Quiz
ADO.NET Quiz
VB.NET Quiz
Multimedia Quizes
SVG Quiz
Flash Quiz
Media Quiz
SMIL Quiz
Web Building  Quizes
Web Browsers Quiz
Web Hosting Quiz
W3C Quiz
Web Building Quiz
Web Quality Quiz
Web Semantic Quiz
Web Careers Quiz
Java Quizes
Java Quiz
JSP Quiz
Servlets Quiz
Struts Quiz
EJB Quiz
JMS Quiz
JMX Quiz
Programming Langauges Quizes
C Quiz
C++ Quiz
Visual Basic Quiz
Data Structures Using C Quiz
Soft Skills Quizes
Communication Skills Quiz
Time Management Quiz
Project Management Quiz
Team Work Quiz
Leadership Skills Quiz
Corporate Communication Quiz
Negotiation Skills Quiz

Privacy Policy
Copyright © 2003-2008 Vyom Technosoft Pvt. Ltd., All Rights Reserved.