1. 程式人生 > >The processing instruction target matching "[xX][mM][lL]" is not allowed

The processing instruction target matching "[xX][mM][lL]" is not allowed

問題背景

今天除錯eas的ws介面,發現報錯“The processing instruction target matching “[xX][mM][lL]” is not allowed”

解決方案

仔細檢查XML,發現String strXml = " <?xml version='1.0'開頭是不允許有空格的,可能是我用sublime text列模式修改導致。

也就是說格式化為XML的String,開頭不能有空格,手工修改即可,或者可以加個trim()去掉頭尾的空格即可。

		String    	strXml = "<?xml version='1.0' encoding='utf-8' standalone='yes'?>"+
		"<Request> "+
		"    <BillType>310</BillType> "+
		"    <BizType>210</BizType> "+
		"    <TransactionType>010</TransactionType> "+
		"    <SyncSystem>E3</SyncSystem> "
		//.....