Java Code Examples for org.apache.ws.commons.schema.XmlSchema#write()

The following examples show how to use org.apache.ws.commons.schema.XmlSchema#write() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractXsdEmitterTester.java    From legstar-core2 with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * Helper that checks a result XML schema against an expected one.
 * 
 * @param expected the expected XML Schema (without the schema element for
 *            simplicity)
 * @param xsd the XML schema result
 * @param withLegStarAnnotations true if LegStar annotations are to be added
 */
public void check(final String expected, final XmlSchema xsd,
        final boolean withLegStarAnnotations) {
    if (_log.isDebugEnabled()) {
        StringWriter writer = new StringWriter();
        xsd.write(writer);
        _log.debug("result:\n" + writer.toString());
    }
    try {
        assertXMLEqual(
                getExpectedXMLSchema(expected, withLegStarAnnotations),
                xsd.getSchemaDocument());
    } catch (Exception e) {
        _log.error("XSD check failed", e);
        org.junit.Assert.fail();
    }
}
 
Example 2
Source File: XsdUtil.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
private static void processSchema(XmlSchema schema, OutputStream outputStream,
                                  String contextRoot, org.wso2.micro.core.transports.CarbonHttpRequest request) {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    schema.write(baos);
    RequestProcessorUtil.writeDocument(baos, outputStream, "annotated-xsd.xsl", contextRoot,
                                       isXSDAnnotated(request));
}
 
Example 3
Source File: WSDLGenerationTester.java    From cxf with Apache License 2.0 5 votes vote down vote up
public File writeSchema(File targetDir, File schemaFile) throws Exception {
    File bkFile = new File(targetDir, "bk_" + schemaFile.getName());
    FileWriter writer = new FileWriter(bkFile);
    FileReader reader = new FileReader(schemaFile);
    XmlSchema schema = schemaCol.read(reader);
    schema.write(writer);
    reader.close();
    writer.close();
    writer = null;
    reader = null;
    return bkFile;
}
 
Example 4
Source File: WadlGenerator.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Override
public void write(StringBuilder sb) {
    for (XmlSchema xs : coll.getXmlSchemas()) {
        if (xs.getItems().isEmpty() || Constants.URI_2001_SCHEMA_XSD.equals(xs.getTargetNamespace())) {
            continue;
        }
        StringWriter writer = new StringWriter();
        xs.write(writer);
        sb.append(writer.toString());
    }
}