I'm trying to use windows's task scheduler xml file. For anyone who doesn't know, xml file looks like this:
<?xml version="1.0" encoding="UTF-16"?>
<Tasks>
<!-- \job1 -->
<Task version="1.2"
xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
<RegistrationInfo>
<Date>2013-08-03T13:07:36.8791439</Date>
<Author>pc\laptop</Author>
</RegistrationInfo>
...
<!-- \job2 -->
<Task version="1.2"
......
I need to assign "job1" value to an array. To do this I did this java code:
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setIgnoringComments(false);
NodeList jobList = el.getElementsByTagName("Tasks");
NodeList ndList = el.getElementsByTagName("Task");
for (int i = 0; i < ndList.getLength(); i++) {
Node childNode2 = jobList.item(i);
Node childNode = ndList.item(i);
if (childNode2.getNodeType() == Node.COMMENT_NODE) {
//Element jElement = (Element) childNode2;
//jElement.toString();
System.out.println(childNode2.getNodeType());
}
if (childNode.getNodeType() == Node.ELEMENT_NODE) {
Element eElement = (Element) childNode;
System.out.println("Date : " + getTagValue("Date", eElement));
//some other codes....
}
But I cannot reach that comment area. Second thing is how can I walk in that comment areas. How do I write a for loop for example?