我在解析下面的xml中的xml属性(Mon,tue和其他类似的)时遇到问题
> <Root>
> <Details Timing="09-10 AM" Mon="Lecture/G:All
C:MTH402/R:33-608
S:K1305"
> Tue="Lecture/G:All
C:ECO310/R:33-608
S:K1305"
> Thu="Practical/G:2
C:CSE427/R:34-304
S:K1305"
> Sat="Lecture/G:All
C:ELQ171/R:33-501
S:K10G2" />
> </Root>
//生成日志的代码,但日志中只显示时间
protected void porcesssxml(File file)
{
DocumentBuilderFactory documentBuilderFactory=DocumentBuilderFactory.newInstance();
DocumentBuilder documentBuilder=documentBuilderFactory.newDocumentBuilder();
Document xmlDocument=documentBuilder.parse(file);
Element rootElement= xmlDocument.getDocumentElement();
NodeList nodeList1=rootElement.getElementsByTagName("Details");
Node currenttag=null;
for(int i=0;i<nodeList1.getLength();i++)
{ currenttag =nodeList1.item(i);
Log.d("test",currenttag.getAttributes().item(0).getTextContent());//display timing
Log.d("test",currenttag.getAttributes().item(1).getTextContent()); //display mon
}