}
try {
NamePool pool = new NamePool();
catalogConfig = new EnterpriseConfiguration();
catalogConfig.setNamePool(pool);
catalogConfig.setHostLanguage(Configuration.XML_SCHEMA);
parser = catalogConfig.getSourceParser();
xlinkHref = pool.allocate("", "http://www.w3.org/1999/xlink", "href");
int testCaseFP = pool.allocate("", "", "testcase") & NamePool.FP_MASK;
NameTest testCaseNT = new NameTest(Type.ELEMENT, testCaseFP, pool);
int commentFP = pool.allocate("", "", "comment") & NamePool.FP_MASK;
NameTest commentNT = new NameTest(Type.ELEMENT, commentFP, pool);
NameTest testSetRefNT = elementNameTest(pool, "testSetRef");
NameTest testGroupNT = elementNameTest(pool, "testGroup");
NameTest testSetNT = elementNameTest(pool, "testSet");
NameTest schemaTestNT = elementNameTest(pool, "schemaTest");
NameTest instanceTestNT = elementNameTest(pool, "instanceTest");
NameTest schemaDocumentNT = elementNameTest(pool, "schemaDocument");
NameTest instanceDocumentNT = elementNameTest(pool, "instanceDocument");
NameTest expectedNT = elementNameTest(pool, "expected");
NameTest currentNT = elementNameTest(pool, "current");
int validityAtt = pool.allocate("", "", "validity") & NamePool.FP_MASK;
int nameAtt = pool.allocate("", "", "name") & NamePool.FP_MASK;
int contributorAtt = pool.allocate("", "", "contributor") & NamePool.FP_MASK;
int setAtt = pool.allocate("", "", "set") & NamePool.FP_MASK;
int groupAtt = pool.allocate("", "", "group") & NamePool.FP_MASK;
int statusAtt = pool.allocate("", "", "status") & NamePool.FP_MASK;
int bugzillaAtt = pool.allocate("", "", "bugzilla") & NamePool.FP_MASK;
int targetNamespaceAtt = pool.allocate("", "", "targetNamespace") & NamePool.FP_MASK;
int schemaVersionAtt = pool.allocate("saxon", NamespaceConstant.SAXON, "schemaVersion") & NamePool.FP_MASK;
DocumentInfo catalog = catalogConfig.buildDocument(
new StreamSource(new File(testSuiteDir + "/suite.xml"))
);
results = new BufferedWriter(new FileWriter(new File(testSuiteDir + "/SaxonResults"
+ Version.getProductVersion() + ".xml")));
results.write("<testSuiteResults xmlns='" + testNS + "' xmlns:saxon='http://saxon.sf.net/' " +
"suite='TS_2006' " +
"processor='Saxon-EE (Java) 9.2' submitDate='2007-01-05' publicationPermission='public'>\n");
DocumentInfo exceptionsDoc = catalogConfig.buildDocument(
new StreamSource(new File(testSuiteDir + "/exceptions.xml"))
);
AxisIterator exceptionTestCases = exceptionsDoc.iterateAxis(Axis.DESCENDANT, testCaseNT);
while (true) {
NodeInfo testCase = (NodeInfo)exceptionTestCases.next();
if (testCase == null) {
break;
}
String set = testCase.getAttributeValue(setAtt);
String group = testCase.getAttributeValue(groupAtt);
String comment = getChildElement(testCase, commentNT).getStringValue();
exceptions.put(set + "#" + group, comment);
}
long startTime = (new Date()).getTime();
AxisIterator testSets = catalog.iterateAxis(Axis.DESCENDANT, testSetRefNT);
while (true) {
NodeInfo testSetRef = (NodeInfo)testSets.next();
if (testSetRef == null) {
break;
}
DocumentInfo testSetDoc = getLinkedDocument(testSetRef, catalogConfig, false);
NodeInfo testSetElement = getChildElement(testSetDoc, testSetNT);
if (testSetElement == null) {
System.err.println("test set doc has no TestSet child: " + testSetDoc.getBaseURI());
continue;
}
String testSetName = testSetElement.getAttributeValue(nameAtt);
System.err.println("Test set " + testSetName);
if (testSetPattern != null && !testSetPattern.matcher(testSetName).matches()) {
continue;
}
if (contributor != null && !contributor.equals(testSetElement.getAttributeValue(contributorAtt))) {
continue;
}
boolean allow11throughout = "1.1".equals(testSetElement.getAttributeValue(schemaVersionAtt));
AxisIterator testGroups = testSetElement.iterateAxis(Axis.CHILD, testGroupNT);
while (true) {
NodeInfo testGroup = (NodeInfo)testGroups.next();
if (testGroup == null) {
break;
}
boolean allow11here = "1.1".equals(testGroup.getAttributeValue(schemaVersionAtt));
String testGroupName = testGroup.getAttributeValue(nameAtt);
String exception = (String)exceptions.get(testSetName + "#" + testGroupName);
if (testGroupPattern != null && !testGroupPattern.matcher(testGroupName).matches()) {
continue;
}
System.err.println("TEST SET " + testSetName + " GROUP " + testGroupName);
if (onwards) {
testGroupPattern = null;
testSetPattern = null;
}
EnterpriseConfiguration testConfig = new EnterpriseConfiguration();
testConfig.setHostLanguage(Configuration.XML_SCHEMA);
testConfig.setValidationWarnings(true);
if (allow11throughout || allow11here) {
testConfig.setConfigurationProperty(FeatureKeys.XSD_VERSION, "1.1");
}
AxisIterator schemaTests = testGroup.iterateAxis(Axis.CHILD, schemaTestNT);
boolean schemaQueried = false;
String bugzillaRef = null;