实体名称必须紧跟在'&'在实体中;错误
What causes a "The entity name must immediately follow the '&' in the entity" error?
{
"code" : "messaging.config.beans.ImportFailed",
"message" : "Failed to import the bundle : com.apigee.repository.RepositoryException: javax.xml.bind.UnmarshalException'n - with linked exception:'n[org.xml.sax.SAXParseException: The entity name must immediately follow the '&' in the entity reference.]",
"contexts" : [ ], "cause" : {
"message" : "javax.xml.bind.UnmarshalException'n - with linked exception:'n[org.xml.sax.SAXParseException: The entity name must immediately follow the '&' in the entity reference.]",
"contexts" : [ ],
"cause" : {
"contexts" : [ ],
"cause" : {
"message" : "The entity name must immediately follow the '&' in the entity reference.",
"contexts" : [ ]
}
}
}
}
每次我尝试上传到apigee时,我都会收到这个错误。我几乎检查了所有的&符号。有人知道如何获得更多的信息吗?
检查您的条件和条件流&&——虽然你可以使用&&在UI中(因为它可以帮助您将"&&"转换为"and"),如果您直接通过Management API部署,则不能使用双&号。
通过UI部署
<Condition>(1 = 1) && (2 = 2)</Condition>
将显示成功,但如果您随后检查代码(可能需要刷新),您将看到它变成了
<Condition>(1 = 1) and (2 = 2)</Condition>
但是,如果您尝试使用&&通过管理API,你得到错误:
{
"code" : "messaging.config.beans.ImportFailed",
"message" : "Failed to import the bundle : com.apigee.repository.RepositoryException: javax.xml.bind.UnmarshalException'n - with linked exception:'n[org.xml.sax.SAXParseException: The entity name must immediately follow the '&' in the entity reference.]",
"contexts" : [ ],
"cause" : {
"message" : "javax.xml.bind.UnmarshalException'n - with linked exception:'n[org.xml.sax.SAXParseException: The entity name must immediately follow the '&' in the entity reference.]",
"contexts" : [ ],
"cause" : {
"contexts" : [ ],
"cause" : {
"message" : "The entity name must immediately follow the '&' in the entity reference.",
"contexts" : [ ]
}
}
}
到目前为止,导致这种解析错误的最常见原因是XML文本中的某个地方存在未编码的&号。您需要在XML中对&符号进行编码。您可以使用&
或&
(与&符号等效的Unicode),或者您可以将其嵌入CDATA
节中。
您说您已经检查了几乎所有的&符号——除了检查其余符号的明显建议之外,如果您在XSL转换中使用参数,我会确保您发送进来的数据没有未编码的&符号。您可能需要运行JavaScript或其他代码策略,在转换之前对输入参数中的任何&符号进行编码。
已经解决了。&符号已经包含在属性文件中,因此在maven构建过程中,&符号将包含在最终zip/jar文件的XML中。
容易出错
相关文章:
- Node.js v6.2.0类扩展不是函数错误
- Jquery菜单操作不稳定,定位不正确,存在一般错误
- document.open/document.write没有正确地清除chrome中的文档——这是chrome的错误吗
- 试图在引导模式内动态生成图表,得到offsetWidth错误
- 为什么会出现错误;未捕获的类型错误:undefined不是函数;
- 我如何修复包含在captcha的addthis中的错误
- Sails Js请求实体过大错误
- JavaScript:在 XMLSerializer 错误地解析实体后,用 html 160 实体替换三个空格
- RegEx导致无限循环/错误-请求的实体太大
- CRM Outlook 客户端在浏览商机相关实体时引发错误
- 未知的目标实体属性错误
- 加载具有相关数据的实体时出现 Breezejs 错误
- 在Toast中显示错误和异常,或使用MVC4和实体框架的类似方法
- 请求实体太大-谷歌地图方向错误413
- 微风似乎得到我的实体属性的旧值(从服务器获取),当它成为空-可能的错误
- 解决错误413请求实体太大
- 当通过file_put_contents将base64图像发送到文件夹时,从ajax获得413请求实体太大错误
- 微风1.4.13 -错误时加载实体
- 实体名称必须紧跟在'&'在实体中;错误
- SAPUI5创建带有日期的OData实体——生成以CX_SXML_PARSE_ERROR结束的错误请求负载