开发者

create XML element with "$XYZ"

I am using java to create a root element the string resolves as shown below.

Element root = doc.createElement("$XYZ");

i get and exception

org.w3c.dom.DOMException: INVALID_CHARACTER_ERR: An invalid or illegal XML character is specified. 
    at com.sun.org.apache.xerces.internal.dom.CoreDocumentImpl.createElement(Core开发者_运维百科DocumentImpl.java:618)

any advice on how do i create the element?


The '$' symbol is not allowed in the xml, therefore you are getting your exception.

'XYZ' would be allowed, but '$XYZ' is not allowed as it contains the '$'

You can see the w3 spec on the starting character here

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜