This discussion is archived
0 Replies Latest reply: Oct 23, 2012 1:26 PM by 970265 RSS

parsing qstat -xml through jaxb and xsd

970265 Newbie
Currently Being Moderated
Hi,
at the Lyon Computing center (ccin2p3.fr) we use Grid Engine (SGE 6.2u6_17) as batch system. To interface it with our data processing pipeline, I have been looking into unmarshaling the xml using JAXB and the provided xsd file. The xsd I used to generate the JAXB classes was supplied in the distribution. However, when trying to unmarshal the file, I get a number of errors. One seemingly being associated with the fact that <job_info> appears once as root-element and once as element node inside that root-element. Not running any jobs returns the following xml:

<?xml version='1.0'?>
<job_info xmlns:xsd="http://gridengine.sunsource.net/source/browse/*checkout*/gridengine/source/dist/util/resources/schemas/qstat/qstat.xsd?revision=1.11">
<queue_info>
</queue_info>
<job_info>
</job_info>
</job_info>

Can anyone provide some hints as to what to do in order to process the output of qstat -xml (-ext)?

Thanks a lot in advance,

In addition, below the code I used for the unmarshaling
package testapp;
import java.io.File;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;

public class TestApp {

public static void main (String [] args) {
try {
JAXBContext jc = JAXBContext.newInstance ("grid.xml.qstat");

Unmarshaller u = jc.createUnmarshaller ();

File f = new File ("qstat.xml");
JAXBElement element = (JAXBElement) u.unmarshal (f);

} catch (JAXBException e) {
e.printStackTrace ();
}
}
}

which then throws:
javax.xml.bind.UnmarshalException: unexpected element (uri:"", local:"job_info"). Expected elements are <{http://gridengine.sunsource.net/source/browse/*checkout*/gridengine/source/dist/util/resources/schemas/qstat/qstat.xsd?revision=1.11}job_info>

Edited by: 967262 on Oct 23, 2012 1:24 PM

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points