IBM Support

XML Syntax Rules

Question & Answer


XML Syntax Rules


XML Syntax Rules

You mustfollow these rules when you create XML syntax:

  • All XML elements must have a closing tag.
  • XML tags are case sensitive.
  • All XML elements must be properly nested.
  • All XML documents must have a root element.
  • Attribute values must always be quoted.

All XML elements must have a closing tag

Itis illegal to omit the closing tag when you are creating XML syntax.XML elements must have a closing tag.


<body>See Spot run.<body>See Spot catch the ball.


<body>See Spot run.</body><body>See Spot catch the ball.</body>

XML tags are case sensitive

When you createXML documents the tag <Body> is different from the tag <body>.


<Body>See Spot run.</body>


<body>See Spot run.</body>

All XML elements must be properly nested

Impropernesting of tags makes no sense to XML.


<b><i>This text is bold and italic.</b></i>


<b><i>This text is bold and italic.</i></b>

All XML documents must have a root element

AllXML documents must contain a single tag pair to define a root element.All other elements must be within this root element. All elementscan have sub elements (child elements). Sub elements must be correctlynested within their parent element.



Attribute values must always be quoted

Itis illegal to omit quotation marks around attribute values. XML elementscan have attributes in name/value pairs; however the attribute valuemust always be quoted.


<?xml version= ?1.0? encoding=?ISO-8859-1??><note date=05/05/05><to>Dick</to><from>Jane</from></note>


<?xml version= ?1.0? encoding=?ISO-8859-1??><note date=?05/05/05?><to>Dick</to><from>Jane</from></note>

In the incorrect document the date attributein the note element is not quoted.


[{"Business Unit":{"code":"BU055","label":"Cognitive Applications"},"Product":{"code":"SS73G6","label":"Sterling Total Payments for Financial Services"},"Component":"","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"All Versions","Edition":"","Line of Business":{"code":"","label":""}}]

Document Information

Modified date:
08 December 2018