XML Namespaces (continued) |
|||
The syntax for declaring an XML namespace is: xmlns:prefix=”namespaceURI” A namespace declaration begins with xmlns, which is an acronym for XML namespace. The declaration also contains a prefix and a namespaceURI and is placed after the prolog in an XML document. In the code snippet on the right, consider the following namespace declaration: xmlns:example=”http://www.mysite.com/partner” The prefix is example and the namespaceURI is the path name or uniform resource locator (URL), http://www.mysite.com/partner. Note that the namespaceURI can be any unique set of characters. For example, in the following code snippet, the namespaceURI is anyvalue: <s:name xmlns:s=”anyvalue”>
The prefix is appended to the element to provide unique names to the elements. The syntax to append the prefix is: <prefix:tagname>content</prefix:tagname> For example, in the following code snippet, example is the prefix and organizationname is the tagname: <example:organizationname> XYZ </example:organizationname>
|
|
||
Click the Next button to continue. |