made the data_source element optional in the XML schema

This commit is contained in:
Samuel H. Kenyon 2014-04-27 18:30:58 -04:00
parent 16bbb27735
commit 11b05c47ea
2 changed files with 11 additions and 6 deletions

View File

@ -103,20 +103,25 @@ public class ExternalResultsXML implements ExternalResultsParser {
return resultsData;
}
/**
*
* @param root
* @throws Exception
*/
private void parseDataSource(Element root ) throws Exception {
NodeList nodeList = root.getElementsByTagName(DATASRC_EL);
final int numNodes = nodeList.getLength();
if (numNodes == 0) {
throw new Exception("Error: No data source specified in XML file.");
}
for(int index = 0; index < numNodes; ++index) {
Element el = (Element)nodeList.item(index);
resultsData.addDataSource(el.getTextContent());
}
}
/**
*
* @param root
*/
private void parseArtifacts(Element root ) {
NodeList nodeList = root.getElementsByTagName(ARTLIST_EL);
final int numNodes = nodeList.getLength();

View File

@ -3,7 +3,7 @@
<xs:element name="autopsy_results">
<xs:complexType>
<xs:sequence>
<xs:element name="data_source" type="xs:string" />
<xs:element minOccurs="0" name="data_source" type="xs:string" />
<xs:element name="artifacts">
<xs:complexType>
<xs:sequence>