如何包含?和/在 XML 标记中 [英] How to include ? and / in XML tag

查看:28
本文介绍了如何包含?和/在 XML 标记中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一个带有以下标签的 XML

<Customer_In_Rental?>否</Customer_In_Rental?>

? 不被接受,因此我尝试了

即使在此之后,XML 的格式也不是很好.

如何在我的 XML 标记中使用 ?.同样,我还需要使用 /

<四/六>否

感谢任何快速帮助.

解决方案

组件名称的 W3C XML BNF:

<块引用>

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]NameChar ::= NameStartChar |"-" |."|[0-9] |#xB7 |[#x0300-#x036F] |[#x203F-#x2040]名称 ::= NameStartChar (NameChar)*

您必须找到表达意图的替代方式.

对于 ?,请考虑使用 BooleanPredicate 后缀,或者简单地省略并允许名称本身或模式传达布尔意图.

对于 /,考虑 -_.

I need to have an XML with below tag

<Customer_In_Rental?>No</Customer_In_Rental?>

The ? is not accepted, hence I tried it like

<Customer_In_Rental&#63;>No</Customer_In_Rental&#63;>

the XML is not well-formed even after this.

How to use ? in my XML tag. Similarly, I need to use / also

<Four/Six>No</Four/Six>

any quick help is appreciated.

解决方案

Neither ? nor / are allowed in XML tags per the W3C XML BNF for component names:

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]
NameChar      ::= NameStartChar | "-" | "." | [0-9] | #xB7 | [#x0300-#x036F] |
                  [#x203F-#x2040]
Name          ::= NameStartChar (NameChar)*

You'll have to find alternatives means of expressing your intent.

For ?, consider a Boolean or Predicate suffix, or simply omit and allow the name itself or a schema to communicate the boolean intent.

For /, consider - or _.

这篇关于如何包含?和/在 XML 标记中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆