我无法读取分支编号。
XML:
<NODE>
<EMPLOYEENUMBER EMPLOYEENUMBER="1334350"/>
<BranchNumber BRANCHCUSTOMERNUMBER ="400823482"/>
<BR AfterImage="51" BeforeImage=""/>
<DEALNO="6698398" BeforeImage=""/>
<SEQ AfterImage="0" BeforeImage=""/>
<TRAD AfterImage="PHSS" BeforeImage=""/>
<VDATE AfterImage="2017-04-07 00:00:00.0" BeforeImage=""/>
<CUST AfterImage="10075222" BeforeImage=""/>
<BROK AfterImage="" BeforeImage=""/>
<BROKCCY AfterImage="UGX" BeforeImage=""/>
<BROKAMT AfterImage="0.0000" BeforeImage=""/>
<PHONCI AfterImage="0" BeforeImage=""/>
<PORT AfterImage="CSPO" BeforeImage=""/>
<COST AfterImage="30000003" BeforeImage=""/>
<ODATE AfterImage="2017-03-02 00:00:00.0" BeforeImage=""/>
<DEALDATE AfterImage="2017-03-02 00:00:00.0" BeforeImage=""/>
<DEALTIME AfterImage="06:12" BeforeImage=""/>
<IOPER AfterImage="RAMU" BeforeImage=""/>
<VOPER AfterImage="RAMU" BeforeImage=""/>
<BROKCDATE AfterImage="" BeforeImage=""/>
<CUSTCDATE AfterImage="" BeforeImage=""/>
<PHONECDATE AfterImage="" BeforeImage=""/>
<DEALTEXT AfterImage="" BeforeImage=""/>
<PHONETEXT AfterImage="" BeforeImage=""/>
<PS AfterImage="S" BeforeImage=""/>
<PRODCODE AfterImage="XYZ" BeforeImage=""/>
</NODE>
爪哇:
for (int temp = 0; temp < nList.getLength(); temp++) {
Node nNode = nList.item(temp);
System.out.println("\nCurrent Element :" + nNode.getNodeName());
if (nNode.getNodeType() == Node.ELEMENT_NODE) {
Element eElement = (Element) nNode;
System.out.println(" EMPLOYEENUMBER: " + eElement.getAttribute("EMPLOYEENUMBER"));
System.out.println("BRANCHCUSTOMERNUMBER : " + eElement.getAttribute("BRANCHCUSTOMERNUMBER"));
}
}
如果我读'BRANCHCUSTOMERNUMBER',它就是空的。
答案 0 :(得分:-1)
您可以尝试以下代码。
public static double distance(Location start, Location end) {
try {
double distance = start.distanceTo(end);
DecimalFormat decimalFormat = new DecimalFormat("#.#");
DecimalFormatSymbols custom = new DecimalFormatSymbols();
custom.setDecimalSeparator('.');
decimalFormat.setDecimalFormatSymbols(custom);
double distanceFormated =
Double.parseDouble(decimalFormat.format(distance));
return distanceFormated;
} catch (Exception e) {
e.printStackTrace();
}
return 0;
}