Question & Answer
Question
XML Syntax Rules
Answer
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.
Incorrect:
<body>See Spot run.<body>See Spot catch the ball.
Correct:
<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>.
Incorrect:
<Body>See Spot run.</body>
Correct:
<body>See Spot run.</body>
All XML elements must be properly nested
Impropernesting of tags makes no sense to XML.
Incorrect:
<b><i>This text is bold and italic.</b></i>
Correct:
<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.
Example:
<root>??<child>????<subchild>.....</subchild>??</child></root>
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.
Incorrect:
<?xml version= ?1.0? encoding=?ISO-8859-1??><note date=05/05/05><to>Dick</to><from>Jane</from></note>
Correct:
<?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.
Was this topic helpful?
Document Information
More support for:
Sterling Total Payments for Financial Services
Software version:
All Versions
Document number:
758453
Modified date:
08 December 2018
UID
ibm10758453