Customize your own XML namespace?

How to customize your own XML namespace?

+6
xml xml-namespaces
source share
3 answers

Just define the namespace in the root tag (or where you need the namespace). Example:

<root xmlns:ns="some_identifier"> 

ns , and the identifier can be (almost) anything. See this quote :

What are the names of the dot names in the dot?

One of the confusing things about all this is that namespace names are URLs; it’s easy to assume that since they are web addresses, they must be the address of something. They are not; these are URLs, but the namespace design doesn't care what (if anything) they point to. Think of an XML.com programmer looking for book titles; which works fine without a namespace name pointing to anything.

The reason the W3C decided to use URLs as namespace names is because they contain domain names (for example, www.xml.com) that work all over the world over the Internet.

The Wikipedia article is also quite informative.

I hope you know that you need namespaces to distinguish tags with the same name.

+9
source share

Like this:

 <?xml version="1.0" encoding="UTF-8"?> <someTag xmlns="your_very_own_xmlns"/> 

To be serious: namespaces must be unique in the world, so they usually form URIs. But this is not a necessity. This is great if you own a domain and use it as a namespace, but you don’t have one. Of course, you will run into problems if someone else uses the same namespaces that are not unique. The use of domain names guarantees that this does not happen.

+3
source share

In XSD, you can define a custom XML schema (with an xml namespace).

http://www.w3schools.com/Schema/schema_howto.asp

0
source share

All Articles