QA


Q&A

Q.

When a name clash occurs in an XML document, why can't an XML processor resolve it by looking at the scope of the elements and attributes, as opposed to requiring namespaces?

A.

Although it is technically possible for an XML processor to resolve an element or attribute based solely on its scope, it isn't a good idea to put that much faith in the processor. Besides, there are some situations where this simply isn't possible. For example, what if the element causing the name clash is the root element in a document? Because it has a global scope, there is no way to determine the schema to which it belongs.

Q.

Do I have to use a namespace to uniquely identify the elements and attributes in my custom markup language?

A.

No. In fact, if you plan on using your XML documents internally and never sharing them with others, there really is no pressing need to declare a unique namespace. However, if you choose to incorporate multiple XML-based markup languages within a single document or application, you'll need to use namespaces to keep things straight and not confuse the XML processor.




Sams Teach Yourself XML in 24 Hours
Sams Teach Yourself XML in 24 Hours, Complete Starter Kit (3rd Edition)
ISBN: 067232797X
EAN: 2147483647
Year: 2005
Pages: 266

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net