我正在尝试扫描Aadhar卡数据,并试图将给定的数据解析到我的应用程序中。我得到的响应如下。
QR-Code:<?xml version="1.0" encoding="UTF-8"?> <PrintLetterBarcodeData uid=“xxxxxxx” name=“xx” gender=“XXXX” yob=“xxxx” co="S/O: XXXX” house=“XXXX house” street="null" lm="null" loc="null" vtc=“xxx” po=“xxx” dist=“xxx” subdist=“xxx” state=“xxx” pc=“xxx” dob=“xxxx-xx-xx”/>
我需要修剪内容QR-Code:<?xml version="1.0" encoding="UTF-8"?>.
可能吗?
答案 0 :(得分:0)
使用“:”分割,然后解析剩余的XML
String[] data = result.split(":");
String xml = data[1];
答案 1 :(得分:0)
public String trimStart(String qrCodeScanResponse){
return qrCodeScanResponse.replace("QR-Code:<?xml version=\"1.0\" encoding=\"UTF-8\"?>","");
}