![]() |
CopperSpice API
2.0.0
|
Using the CsXml library requires a basic understanding of XML namespaces. The following is only a brief introduction.
Namespaces are a were introduced into XML to allow a modular design to assist with resolving naming conflicts within XML documents. Namespaces are defined using a URI like http://www.example.com/placeholder/book/. This does not mean data is available at this address, the URI is simply used to provide a unique name.
There are three different places where the name title is used. When processing this document you will encounter problems because every use of title should be displayed in a different manner. The solution is to have some way of identifying the first occurrence as the "title of a book" and distinguish it from the "chapter title".
In the following example the prefix book is a namespace which is applied to the title tag. Before a namespace can be used it must be declared.
A namespace is declared with "xmlns: followed by some text". This namespace can then be applied to elements and attributes by using the text followed by a colon as a prefix. In this example there are two declared namespaces. The first one uses a prefix of book and is then used by specifying book:title or book:author. The default namespace is used for bookX and chapterX.
The default namespace applies only to elements without a prefix. There is no default namespce for an attribute.
The placeholder namespace has the same namespace URI as the default namespace. The following explains why this namespace was added in the book:author element.
More information on XML namespaces can be found at http://www.w3.org/TR/REC-xml-names/.
The following terms are used to distinguish the parts of names within the context of namespaces.
Elements without a colon like chapterX do not have a namespace prefix. In this case the local part and the qualified name are identical.