在 XML 的属性名称中转义正斜杠

Vir*_*ade 3 java xml jaxb apache-camel xml-parsing

我正在将 XML 字符串转换为文档,然后再对其进行操作。我从第三方 API 收到 XML。

这是我的 XML

<Student full/part="part" name="Some Name" dob="2000-08-01" totalMarks="565" science="9" maths="8" registration="987654"  class="distinction" />
Run Code Online (Sandbox Code Playgroud)

这是我得到的例外

org.apache.camel.TypeConversionException: Error during type conversion from type: java.lang.String to the required type: org.w3c.dom.Document with value  due org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 64; Attribute name "full" associated with an element type "Student" must be followed by the ' = ' character.
Run Code Online (Sandbox Code Playgroud)

现在我没有定义,我只是从这个 XML 中检索属性值。即明天这个元素类型可能是来自学生的老师,但我只是把诸如注册、班级甚至“完整/部分”等属性的值放在一起。

我想知道哪个 org.w3c.dom.Document 在给定元素类型的这个 XML 属性名称中容忍这个正斜杠。

kjh*_*hes 6

名称的XML的属性(或XML的元素

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

不能包含/字符:

[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]

没有允许的逃逸机制。