Package org.exolab.castor.xml.schema.writer

Examples of org.exolab.castor.xml.schema.writer.SchemaWriter


    public static void marshalSchema(Schema schema, Writer writer)
                                     throws IOException,
                                     SAXException {

       SchemaWriter.enable = true;
       SchemaWriter sw = new SchemaWriter(writer);
       sw.write(schema);

    } //-- marshalSchema
View Full Code Here


            verbose("--> Writing XML Schema: " + fileName);

            File         output = new File(_outputRootFile, fileName);
            FileWriter   writer = new FileWriter(output);
           
            SchemaWriter schemaWriter = new SchemaWriter();
            schemaWriter.setSchemaContext(new SchemaContextImpl());
            schemaWriter.setDocumentHandler(new PrintWriter(writer, true));
           
            schemaWriter.write(schema);
            writer.close();
        } catch (Exception e) {
            if (!checkExceptionWasExpected(e, FailureStepType.WRITE_SCHEMA)) {
                fail("Failed to write Schema '" + url + "' to disk: " + e.toString());
            }
View Full Code Here

        // org.castor.xmlctf.xmldiff.XMLDiff to get the final result.

        // 1. generate schema and product a xml content, write it in a temporary file
        File targetedOutput = File.createTempFile("doTest", "xmlctf");
        Writer writer = new BufferedWriter(new FileWriter(targetedOutput));
        SchemaWriter swriter = new SchemaWriter(writer);
        swriter.write(_schema);

        // 2. load expected schema
        URL expectedUrl = this.getClass().getResource(expected);
        File expectedSchemaFile = new File(expectedUrl.toURI());
View Full Code Here

     * @throws IOException If there's a problem related to writing to the given {@link Writer} instance.
     * @throws SAXException If there's a problem related to SAX streaming.
     */
    public void serializeSchema(Writer dstWriter, Schema schema)
            throws IOException, SAXException {
        SchemaWriter schemaWriter = new SchemaWriter(dstWriter);
        schemaWriter.write(schema);
    }
View Full Code Here

    public static void marshalSchema(Schema schema, Writer writer)
                                     throws IOException,
                                     SAXException {

       SchemaWriter.enable = true;
       SchemaWriter sw = new SchemaWriter(writer);
       sw.write(schema);

    } //-- marshalSchema
View Full Code Here

        try {
            XMLInstance2Schema xi2s = new XMLInstance2Schema();
            Schema schema = xi2s.createSchema(args[0]);
           
            Writer dstWriter = null;
            SchemaWriter schemaWriter = null;
            if (args.length > 1) {
                dstWriter = new FileWriter(args[1]);
            }
            else {
                dstWriter = new PrintWriter(System.out, true);
            }
            schemaWriter = new SchemaWriter(dstWriter);
            schemaWriter.write(schema);
            dstWriter.flush();
        }
        catch(Exception ex) {
            ex.printStackTrace();
        }
View Full Code Here



       SchemaWriter.enable = true;

       SchemaWriter sw = new SchemaWriter(writer);

       sw.write(schema);



    } //-- marshalSchema
View Full Code Here

   {
      // create a string writer
      StringWriter writer = new StringWriter();

      // create the schema writer
      SchemaWriter schemaWriter = new SchemaWriter(writer);

      // write the schema into the source
      schemaWriter.write(schema);

      // return the content of the writer
      return writer.toString();
   }
View Full Code Here

TOP

Related Classes of org.exolab.castor.xml.schema.writer.SchemaWriter

Copyright © 2018 www.massapicom. 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.