File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change 66import java .nio .charset .StandardCharsets ;
77import java .util .ArrayList ;
88import java .util .List ;
9+ import java .util .Map ;
910
1011import org .apache .commons .io .IOUtils ;
1112
1415import lombok .Data ;
1516import lombok .extern .slf4j .Slf4j ;
1617import me .chanjar .weixin .common .api .WxConsts ;
18+ import me .chanjar .weixin .common .util .XmlUtils ;
1719import me .chanjar .weixin .common .util .xml .XStreamCDataConverter ;
1820import me .chanjar .weixin .cp .config .WxCpConfigStorage ;
1921import me .chanjar .weixin .cp .util .crypto .WxCpCryptUtil ;
3638public class WxCpXmlMessage implements Serializable {
3739 private static final long serialVersionUID = -1042994982179476410L ;
3840
41+ /**
42+ * 使用dom4j解析的存放所有xml属性和值的map.
43+ */
44+ private Map <String , Object > allFieldsMap ;
45+
3946 ///////////////////////
4047 // 以下都是微信推送过来的消息的xml的element所对应的属性
4148 ///////////////////////
@@ -349,7 +356,9 @@ public class WxCpXmlMessage implements Serializable {
349356 protected static WxCpXmlMessage fromXml (String xml ) {
350357 //修改微信变态的消息内容格式,方便解析
351358 xml = xml .replace ("</PicList><PicList>" , "" );
352- return XStreamTransformer .fromXml (WxCpXmlMessage .class , xml );
359+ final WxCpXmlMessage xmlMessage = XStreamTransformer .fromXml (WxCpXmlMessage .class , xml );
360+ xmlMessage .setAllFieldsMap (XmlUtils .xml2Map (xml ));
361+ return xmlMessage ;
353362 }
354363
355364 protected static WxCpXmlMessage fromXml (InputStream is ) {
You can’t perform that action at this time.
0 commit comments