我正在尝试扫描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"?>.
有可能吗?
使用“:”拆分然后解析剩余的XML
String[] data = result.split(":");
String xml = data[1];
public String trimStart(String qrCodeScanResponse){
return qrCodeScanResponse.replace("QR-Code:<?xml version=\"1.0\" encoding=\"UTF-8\"?>","");
}