How to create attributes in an XML document

20+ years of Proud Existence in Web, Intranet, Mobile App development in India


How to create attributes in an XML document?

XML attributes can be thought of as HTML attributes, but in the case of XML, you can define these attributes and their values.


<?xml version=”1.0″?>
<books>
   <book ISBN=”0321173481″ author=”Michael R. Sweet”>
      <title>OpenGL Programming Guide Fourth Edition</title>
      <location department=”Development” room=”107″ />
      <publisher>Addison-Wesley</publisher>
      <year>2004</year>
   </book>
   <book ISBN=”0849371643″ author=”Gerald Farin”>
      <title>Curves and Surfaces for CAGD: A Practical Guide</title>
      <location department=”Development” room=”116″ />
      <publisher>Academic Press</publisher>
      <year>2002</year>
   </book>
   <book ISBN=”1558606696″ author=”David Rogers”>
      <title>An Introduction to NURBS: With Historical Perspective</title>
      <location department=”Development” room=”120″ />
      <publisher>Academic Press</publisher>
      <year>2001</year>
   </book>
   <book ISBN=”1568810849″ author=”Gerald Farin”>
      <title>NURBS: From Projective Geometry to Practical Use</title>
      <location department=”Development” room=”126″ />
      <publisher>A K Peters</publisher>
      <year>1999</year>
   </book>
</books>