Expected tag name.Got '?' instead.(HTML doesn't support processing instructions.)
2016-12-05 17:08
3415 查看
在用api调试工具postman时,返回的xml数据报错:
Expected tag name.Got ‘?’ instead.(HTML doesn’t support processing instructions.)
如图:
![](https://oscdn.geek-share.com/Uploads/Images/Content/202005/31/1d149499a9ffbc383ffd6ac31f7d253a)
错误的字面意思是:预期的标签名。用问号代替。(html不支持处理指令。)
先来熟悉XML的组成:
l 一个XML文件分为如下几部分内容:
• 文档声明
• 元素
• 属性
• 注释
• CDATA区 、特殊字符
• 处理指令(processing instruction)
XML语法-文档声明
l 在编写XML文档时,需要先使用文档声明,声明XML文档的类型。
l 最简单的声明语法:
l 用encoding属性说明文档的字符编码:
l 用standalone属性说明文档是否独立:
其他的都不再赘述了,一般都知道。本错误的关键词就是处理指令
处理指令,简称PI (processing instruction)。处理指令用来指挥解析引擎如何解析XML文档内容。
例如,在XML文档中可以使用xml-stylesheet指令,通知XML解析引擎,应用css文件显示xml文档内容。
发生错误,提示html不支持处理指令,那就对了,这个服务端api接口返回的文档是xml格式的数据,并不是html格式的,那么在用postman解析Body的时候,就要选择解析格式为XML。如图:
![](https://oscdn.geek-share.com/Uploads/Images/Content/202005/31/696bb87047415bde7a39dd9989c0cae3)
选择XML后就没有错误了。xml当然能够解析xml的处理指令即第一行的标签前后带问号的文档声明。
Expected tag name.Got ‘?’ instead.(HTML doesn’t support processing instructions.)
如图:
<?xml version="1.0"?>这xml第一行有什么错误呢?
错误的字面意思是:预期的标签名。用问号代替。(html不支持处理指令。)
先来熟悉XML的组成:
l 一个XML文件分为如下几部分内容:
• 文档声明
• 元素
• 属性
• 注释
• CDATA区 、特殊字符
• 处理指令(processing instruction)
XML语法-文档声明
l 在编写XML文档时,需要先使用文档声明,声明XML文档的类型。
l 最简单的声明语法:
<?xmlversion="1.0" ?>
l 用encoding属性说明文档的字符编码:
<?xmlversion="1.0" encoding="GB2312" ?>
l 用standalone属性说明文档是否独立:
<?xmlversion="1.0" encoding="GB2312" standalone="yes" ?>
其他的都不再赘述了,一般都知道。本错误的关键词就是处理指令
处理指令,简称PI (processing instruction)。处理指令用来指挥解析引擎如何解析XML文档内容。
例如,在XML文档中可以使用xml-stylesheet指令,通知XML解析引擎,应用css文件显示xml文档内容。
<?xml version="1.0"?>
发生错误,提示html不支持处理指令,那就对了,这个服务端api接口返回的文档是xml格式的数据,并不是html格式的,那么在用postman解析Body的时候,就要选择解析格式为XML。如图:
选择XML后就没有错误了。xml当然能够解析xml的处理指令即第一行的标签前后带问号的文档声明。
相关文章推荐
- python TypeError: Expected int32, got list containing Tensors of type '_Message' instead.
- js正则:匹配一个html的tagname的开始标签,主要是解决包含&lt;&gt;(正则的效率问题建议不使用)
- solr异常--Expected mime type application/octet-stream but got text/html.
- TypeError: Expected int32, got list containing Tensors of type '_Message' instead.
- 使用svm 函数predict 报错predict ValueError: Expected 2D array, got 1D array instead:
- TypeError: Expected int32, got list containing Tensors of type '_Message' instead.
- HTML 通过ID、class、tagName(标签名字)获取 DOM
- ValueError: Expected 2D array, got 1D array instead 问题解决
- TypeError: Expected int32, got list containing Tensors of type '_Message' instead.
- sklearn的Expected 2D array, got 1D array instead: 和reshape函数
- solr6.3通过solrj连接solr服务时 Expected mime type application/octet-stream but got text/html解决方案
- Expected int32, got list containing Tensors of type '_Message' instead.
- Solr 6.3 Expected mime type application/octet-stream but got text/html解决方法
- Solr4.6 Expected content type application/octet-stream but got text/html 解决办法
- TypeError: Expected int32, got list containing Tensors of type '_Message' instead.解决方法
- ReducedHTMLParser:558 Invalid tag found: unexpected input while looking for attr name or '/>' 错误
- es function_score expected field name but got [START_OBJECT]
- Expected mime type application/octet-stream but got text/html.
- python 使用sk_learn 遇到 问题ValueError: Expected 2D array, got 1D array instead:
- solrj6.2异常--Expected mime type application/octet-stream but got text/html.