Examples of ErrorHandlerImpl


Examples of com.sun.msv.verifier.util.ErrorHandlerImpl

               
                XMLReader r = factory.newSAXParser().getXMLReader();
                Verifier v = new Verifier(
                    new REDocumentDeclaration(grammar),
//                    new REDocumentDeclaration(grammar.getTopLevel(),localPool),
                    new ErrorHandlerImpl() );
                r.setContentHandler(v);
                try
                {
                    r.parse(fileName);
                    if(!v.isValid()) throw new Error();
View Full Code Here

Examples of com.sun.msv.verifier.util.ErrorHandlerImpl

     */
    static IVerifier createVerifier( Grammar g ) {
        if( g instanceof XMLSchemaGrammar )
            return new IDConstraintChecker(
                (XMLSchemaGrammar)g,
                new ErrorHandlerImpl() );
        else
            return new com.sun.msv.verifier.Verifier(
                new REDocumentDeclaration(g),
                new ErrorHandlerImpl() );
    }
View Full Code Here

Examples of com.sun.msv.verifier.util.ErrorHandlerImpl

        // check the validity of generated document.
        DOM2toSAX2 d2s = new DOM2toSAX2();
        Verifier v = new Verifier(
          new REDocumentDeclaration(grammar),
          debug?
            (ErrorHandler)new ErrorHandlerImpl():
            (ErrorHandler)new IgnoreErrorHandler() );
        d2s.setContentHandler(v);
        d2s.traverse(dom);
       
        if( createError && !v.isValid() )  break;
View Full Code Here

Examples of com.sun.msv.verifier.util.ErrorHandlerImpl

   
    public PSVIRecorder( Grammar grammar, XalanNodeAssociationManager _manager ) {
        verifier = new TypeDetector(
            new REDocumentDeclaration(grammar),
            this,
            new ErrorHandlerImpl() );
        this.manager = _manager;
    }
View Full Code Here

Examples of com.sun.msv.verifier.util.ErrorHandlerImpl

        SAXParserFactory factory = SAXParserFactory.newInstance();
        factory.setNamespaceAware(true);
        XMLReader reader = factory.newSAXParser().getXMLReader();
       
        // create an instance of verifier,
        TypeDetector verifier = new TypeDetector(grammar, new ErrorHandlerImpl() );
       
        // configure a pipeline so that the verifier will receive SAX events first.
        reader.setContentHandler(verifier);
       
        // then set your application handler to verifier.
View Full Code Here

Examples of com.sun.msv.verifier.util.ErrorHandlerImpl

     */
    static IVerifier createVerifier( Grammar g ) {
        if( g instanceof XMLSchemaGrammar )
            return new IDConstraintChecker(
                (XMLSchemaGrammar)g,
                new ErrorHandlerImpl() );
        else
            return new com.sun.msv.verifier.Verifier(
                new REDocumentDeclaration(g),
                new ErrorHandlerImpl() );
    }
View Full Code Here

Examples of com.thaiopensource.xml.sax.ErrorHandlerImpl

     */
    public static String validate(File schema, File xml) throws Exception {
        InputSource in = ValidationDriver.uriOrFileInputSource(schema.getAbsolutePath());
        PropertyMapBuilder properties = new PropertyMapBuilder();
      ByteArrayOutputStream error = new ByteArrayOutputStream();
        ErrorHandlerImpl eh = new ErrorHandlerImpl(new BufferedWriter(new OutputStreamWriter(error)));
        ValidateProperty.ERROR_HANDLER.put(properties, eh);
        SchemaReader schemaReader = new AutoSchemaReader();
        ValidationDriver driver = new ValidationDriver(properties.toPropertyMap(), schemaReader);
        if (driver.loadSchema(in)) {
            if (driver.validate(ValidationDriver.uriOrFileInputSource(xml.getAbsolutePath()))) {
View Full Code Here

Examples of com.thaiopensource.xml.sax.ErrorHandlerImpl

  public static void main(String[] args) throws Exception {
    generateXSDFromDTD(new File("rc-config.dtd"), new File("rc-config.xsd"));
  }
 
  public static void generateXSDFromDTD(File input, File output) throws Exception {
    ErrorHandlerImpl eh = new ErrorHandlerImpl();
    OutputFormat of = new XsdOutputFormat();
    InputFormat inFormat = new DtdInputFormat();
    SchemaCollection sc = inFormat.load(
        UriOrFile.toUri(input.getAbsolutePath()), new String[0], "xsd", eh);
   
View Full Code Here

Examples of com.thaiopensource.xml.sax.ErrorHandlerImpl

   * @param input XML file (input)
   * @param output DTD file (output)
   * @throws Exception
   */
  public static void generateDTDFromXML(File input,File output) throws Exception {
    ErrorHandlerImpl eh = new ErrorHandlerImpl();
    OutputFormat of = new DtdOutputFormat();
    InputFormat inFormat = new XmlInputFormat();
    SchemaCollection sc = inFormat.load(
        UriOrFile.toUri(input.getAbsolutePath()), new String[0], "dtd", eh);
   
View Full Code Here

Examples of com.thaiopensource.xml.sax.ErrorHandlerImpl

   * @param input XML file (input)
   * @param output XSD file (output)
   * @throws Exception
   */
  public static void generateXSDFromXML(File input,File output) throws Exception {
    ErrorHandlerImpl eh = new ErrorHandlerImpl();
    OutputFormat of = new XsdOutputFormat();
    InputFormat inFormat = new XmlInputFormat();
    SchemaCollection sc = inFormat.load(
        UriOrFile.toUri(input.getAbsolutePath()), new String[0], "xsd", eh);
   
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.