Microsoft HomeproductssearchsupportshopWrite Us   Microsoft Home
Magazine
 |  Community
 |  Workshop
 |  Tools & Samples
 |  Training
 |  Site Info

Workshop  |  XML (Extensible Markup Language)

Frequently Asked Questions


Printing this FAQ?

General Questions about Extensible Markup Language (XML)

Technical Questions

What is the difference between well-formed XML and valid XML?

Well-formed XML documents must contain matching start and end tags, and tags cannot overlap. For example, the following example is well-formed:
<?xml version="1.0"?>
<person>
  <name>John Doe</name>
  <occupation>Software Engineer</occupation>
</person>
Whereas, this example is not well-formed (<name> and <occupation> tags overlap, and there is no <person> end tag):
<?xml version="1.0"?>
<person>
  <name>John Doe
  <occupation>Software Engineer
  </name>
  </occupation>
Valid XML documents must conform to a Document Type Definition (DTD). The following example is a valid XML document that conforms to person.dtd:
<?xml version="1.0"?>
<!DOCTYPE PERSON SYSTEM "person.dtd">
<person>
  <name>John Doe</name>
  <occupation>Software Engineer</occupation>
</person>
All valid XML documents are well-formed; however, a well-formed document is not valid unless it conforms to a DTD.

Should XML in the XML processing instruction (PI) be in uppercase or lowercase letters?

XML in the XML processing instruction (PI), and its attributes, must be in lowercase letters, for example:
<?xml version="1.0"?>

Are quotes required for attribute values in XML documents?

Yes. Unlike in HTML, all attribute values must be quoted in XML documents. the following example shows a correctly quoted certified attribute for the <occupation> element:
<?xml version="1.0"?>
<person>
  <name>John Doe</name>
  <occupation certified="Y">Software Engineer</occupation>
</person>
The following example shows an incorrectly specified certified attribute (not quoted) for the <occupation> element.
<?xml version="1.0"?>
<person>
  <name>John Doe</name>
  <occupation certified=Y>Software Engineer</occupation>
</person>
Attributes may be quoted using single quotes (for example, certified='Y') or double quotes (for example, certified="Y"). Quotes must be used in matching pairs.

Is </> a valid XML end tag?

No. XML does not allow </> as an end tag. Matching start and end tags must be present, for example:

SGML, from which XML is derived, allows </> as a valid end tag.

Can XML tags be mixed with text?

Yes. If the content model for the element is MIXED -- that is, it contains the #PCDATA keyword -- then the elements can have text interspersed between them.

In the following example, the XML data for the <person> element is valid because the person element contains the #PCDATA keyword:

<?xml version="1.0" ?>
<!DOCTYPE person [
<!ELEMENT person (#PCDATA|lastname|firstname)>
<!ELEMENT lastname (#PCDATA)>
<!ELEMENT firstname (#PCDATA)>
]>
<person>
  My first name is <firstname>John</firstname>
  and my last name is <lastname>Smith</lastname>
</person>

Back to topBack to top

Extensible Markup Language (XML): Frequently Asked Questions
http://www.microsoft.com/workshop/xml/support/faq.asp
First posted: 11/04/1998
Last updated: 11/04/1998

© 1998 Microsoft Corporation. All rights reserved. Terms of use.

 

Magazine Home
Ask Jane
DHTML Dude
Extreme XML
For Starters
More or Hess
Servin' It Up
Site Lights
Web Men Talking
Member Community Home
Benefits: Freebies & Discounts
Benefits: Promote Your Site
Benefits: Connect with Your Peers
Benefits at a Glance
Online Special-Interest Groups
Your Membership
SBN Stores
Join Now
Workshop Home
Essentials
Content & Component Delivery
Component Development
Data Access & Databases
Design
DHTML, HTML & CSS
Extensible Markup Language (XML)
Languages & Development Tools
Messaging & Collaboration
Networking, Protocols & Data Formats
Reusing Browser Technology
Security & Cryptography
Server Technologies
Streaming & Interactive Media
Web Content Management
Workshop Index
Tools & Samples Home
Tools
Samples, Headers, Libs
Images
Sounds
Style Sheets
Web Fonts
Training Home
SBN Live Seminars
SBN Live Chats
Courses
Peer Support
CD-ROM Training
Books & Training Kits
Certification
SBN Home
New to SBN?
What's New on SBN
Site Map
Site Search
Glossary
Write Us
About This Site