[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

MSV: tag name xxxxx is not allowed. Possible tag names are: ...

msv tag
I am trying MSV package msv.20030225.zip to to do "Node Level Validation"
The DOMVerifier example actually does not work on "Node Level".
See the comments below in the code.
Does anybody have the same problem and know a solution?
public class DOMVerifier {
    public static void main(String[] args) throws Exception {
        if (args.length < 2) {
            System.out.println("Usage: DOMVerifier <schema> <instance> ...");
        // setup JARV and compile a schema.
        VerifierFactory factory = new com.sun.msv.verifier.jarv.TheFactoryImpl();
        Verifier verifier = factory.compileSchema(args[0]).newVerifier();
        // instead, you can call factory.newVerifier(args[0])
        // this will result in the same behavior.
        // setup JAXP
        DocumentBuilderFactory domf = DocumentBuilderFactory.newInstance();
        DocumentBuilder builder = domf.newDocumentBuilder();
        for (int i = 1; i < args.length; i++) {
            // parse a document into a DOM.
            Document dom = builder.parse(new File(args[i]));
            // performs the validation on the whole tree.
            // instead, you can pass an Element to the verify method, too.
            // e.g.,  verifier.verify(dom.getDocumentElement())
            if (verifier.verify(dom))
                System.out.println("valid  :" + args[i]);
                System.out.println("invalid:" + args[i]);
            // or you can pass an Element to validate that subtree
            //No, that does not work
            //For example, if you try the following code
            // you always get an exception saying
            //tag name xxxxx is not allowed. Possible tag names are: ...

            if (verifier.verify(dom.getFirstChild().getFirstChild()))
                System.out.println("valid  " );
                System.out.println("invalid" );


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.

Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.