---
title: "The element type \"xxx\" must be terminated by the matching end-tag 解决"
author: "wobfei"
date: "2011-08-06T11:06:47Z"
tags: []
categories: ["编程语言"]
slug: "the-element-type-xxx-must-be-terminated-by-the-matching-end-tag"
draft: false
lastmod: "2011-08-06T11:06:47Z"
id: 1134316
url: "https://wobfei.iteye.com/blog/1134316"
---

查看系统日志时，发现读取xml 流时抛出了“The element type "description" must be terminated by the matching end-tag "&lt;/description&gt;". Nested exception”错误。

 

查看对应url的流内容，如下

```
	<?xml version="1.0" encoding="gb2312" ?>
	<goods>
		<ID>ebb1fb1f-80c2-493a-bced-0a07ef28fcd5</ID>
		<title>大大声</title>
		<description>大叔大叔的</description>
		<price>3.00</price><totalNumber>1</totalNumber>
		<sign>d813eab3585e8559d6e12604818588ee</sign>
	</goods>
```

 

手工检查感觉应没有问题，使用本地eclipse进行debug调试，发现可以成功解析。

 

经过排查最终发现。使用eclipse与使用服务器的默认编码格式不一致。。即使用eclipse时默认是UTF-8的，可以将内容成功解析。。

 

解决方法是：将xml中的encoding修改为utf-8，按照指定的encodeing进行解析就可以了。