XML Parser for colon-separated tags? [closed]

2019-03-04 09:07发布

If I have colon separated xml tags like <my:tag>, which library provides easy parsing and value manipulation? What do I have to look for?

标签: java xml parsing
1条回答
对你真心纯属浪费
2楼-- · 2019-03-04 09:54

The my before the colon is a namespace prefix, and there should be an attribute xmlns:my on either the same element or one of its enclosing elements somewhere higher up which associates a namespace URI with the prefix. All the standard Java XML technologies support namespaces (SAX, DOM and StAX provided with the JRE as well as third party libraries like JDOM and XOM), the thing you need to remember is that you generally refer to elements in any API using the namespace URI and local name (the bit after the colon), not the prefix specifically.

查看更多
登录 后发表回答