FileDocCategorySizeDatePackage
TestXSD.javaAPI DocApache Axis 1.42397Sat Apr 22 18:57:28 BST 2006test.wsdd

TestXSD

public class TestXSD extends TestCase
Make sure that WSDD.xsd is up-to-date

Fields Summary
static final String
JAXP_SCHEMA_LANGUAGE
static final String
W3C_XML_SCHEMA
static final String
JAXP_SCHEMA_SOURCE
DocumentBuilderFactory
dbf
Constructors Summary
public TestXSD(String name)


       
        super(name);
    
Methods Summary
private voidcheckValidity(java.io.File f)

        System.out.println("========== Checking " + f.getAbsolutePath() + "=================");
        DocumentBuilder db = dbf.newDocumentBuilder();
        Document doc = db.parse(f);
        assertTrue(doc != null);
    
public static voidmain(java.lang.String[] args)

        TestXSD tester = new TestXSD("TestXSD");
        tester.setUp();
        tester.testWSDD();
    
private voidrecurse(java.io.File f)

        if (f.isDirectory()) {
            File[] files = f.listFiles();
            for (int i = 0; i < files.length; i++) {
                recurse(files[i]);
            }
        } else if (f.getName().endsWith(".wsdd")) {
            checkValidity(f);
        }
    
protected voidsetUp()

        String schemaSource = "wsdd/WSDD.xsd";

        // Set namespaceAware to true to get a DOM Level 2 tree with nodes
        // containing namesapce information.  This is necessary because the
        // default value from JAXP 1.0 was defined to be false.
        dbf.setNamespaceAware(true);

        dbf.setValidating(true);
        dbf.setAttribute(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA);
        // Specify other factory configuration settings
        File f = new File(schemaSource);
        dbf.setAttribute(JAXP_SCHEMA_SOURCE, f.toURL().toExternalForm());
    
public static junit.framework.Testsuite()

        return new TestSuite(TestXSD.class);
    
public voidtestWSDD()

        File f = new File(".");
        recurse(f);