android 需要从Aadhar扫描数据中修剪xml内容

k75qkfdt  于 2023-01-19  发布在  Android
关注(0)|答案(3)|浏览(96)

我正在尝试扫描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"?>.可以吗?

y1aodyip

y1aodyip1#

使用“:“拆分,然后解析剩余的XML

String[] data = result.split(":");
    String xml = data[1];
lvmkulzt

lvmkulzt2#

public String trimStart(String qrCodeScanResponse){
    return qrCodeScanResponse.replace("QR-Code:<?xml version=\"1.0\" encoding=\"UTF-8\"?>","");
}
pbossiut

pbossiut3#

// 'c' contains your xml data
var currLoanXml = c;
var uid = $(currLoanXml).filter('PrintLetterBarcodeData').attr('uid');
document.getElementById('aadhar').value=uid;

这里我选择了uid编号,您可以根据需要选择任何属性

相关问题