---
title: "常见异常解决"
author: "gavin213"
date: "2010-03-07T10:10:17Z"
tags: []
categories: ["企业架构"]
slug: "untitled"
draft: false
lastmod: "2010-03-07T10:10:17Z"
id: 609544
url: "https://gavin213.iteye.com/blog/609544"
---

1.Error on line 2 of document  : The processing instruction target matching "\[xX]\[mM]\[lL]" is not allowed. Nested exception: The processing instruction target matching "\[xX]\[mM]\[lL]" is not allowed.

   产生原因：常见于XML报文解析，产生原因在要解析的XML报文头前面包含“空格”，也就是在“&lt;?xml version="1.0" encoding="utf-8" ?&gt;” 之前存在空格。排查很简单，在eclipse中新建一个XML文件，把你要解析的XML复制到新建的文件，eclipse会自动产生提示。

   解决方法：删除空格或者程序trim()过滤。