开发者

How to define a namespace in XML?

开发者 https://www.devze.com 2023-04-10 13:34 出处:网络
I use Eclipse for J2EE programming. In the HTML code, we can us开发者_JS百科e the JSF (or any other) namespaces using the xmlns attribute. Once you specify a namespace using the xmlns attribute, say x

I use Eclipse for J2EE programming. In the HTML code, we can us开发者_JS百科e the JSF (or any other) namespaces using the xmlns attribute. Once you specify a namespace using the xmlns attribute, say xmlns:f="...", and when you type <f: you automatically get the tags under the f namespace.

I want to define my own namespace with a list of tags and attributes for every tag.

How do I define it?


If it's just the namespace, all you need to do is pick a URL that is guaranteed to be unique and use it as your namespace. A common convention is to use a URL under a domain you own, e.g. http://www.idiotguy.com/my-super-xml-namespace.

The namespace by itself doesn't say anything about the document structure though; for that, you need to write a DTD or XSD and link your document to it.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号