简体   繁体   中英

How to create xml root tag which starts with digit in java. Please suggest me any solution

How to create xml root tag which starts with digit in java using DOM pareser

<6tag>
  <abc>1</abc>
  <cde>2</cde>
</6tag>

XML tag names should not begin with a digit, but may contain a digit.

[4]     NameStartChar ::=   ":" | [A-Z] | "_" | [a-z] | 
                        [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x2FF] | [#x370-#x37D] | 
                        [#x37F-#x1FFF] | [#x200C-#x200D] | [#x2070-#x218F] | 
                        [#x2C00-#x2FEF] | [#x3001-#xD7FF] | [#xF900-#xFDCF] | 
                        [#xFDF0-#xFFFD] | [#x10000-#xEFFFF]

[4a]    NameChar   ::=      NameStartChar | "-" | "." | [0-9] | 
                        #xB7 | [#x0300-#x036F] | [#x203F-#x2040]

[5]     Name       ::=      NameStartChar (NameChar)*

Got the answer from here

The Java XML standards discourage the use of numbers in XML tags, probably because of software compatibility. However, they are legal to use, but not as a first character, as I read at the W3School .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM