Package org.apache.ws.commons.schema

Examples of org.apache.ws.commons.schema.XmlSchemaCollection


    public void testAppInfo() throws Exception{
        DocumentBuilder b = DocumentBuilderFactory.newInstance().newDocumentBuilder();
        Document pureDOMDocument = b.parse(new FileInputStream(Resources.asURI("appInfo.xsd")));

        InputStream is = new FileInputStream(Resources.asURI("appInfo.xsd"));
        XmlSchemaCollection schema = new XmlSchemaCollection();
        XmlSchema s = schema.read(new StreamSource(is), null);
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        s.write(baos);

        Document serialzedDoument = b.parse(new ByteArrayInputStream(baos.toByteArray()));
        XMLUnit.compareXML(pureDOMDocument,serialzedDoument);
View Full Code Here


        DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
        documentBuilderFactory.setNamespaceAware(true);
        Document doc = documentBuilderFactory.newDocumentBuilder().
                parse(Resources.asURI("importBase.xsd"));

        XmlSchemaCollection schemaCol = new XmlSchemaCollection();
        schemaCol.setBaseUri(Resources.TEST_RESOURCES);
        XmlSchema schema = schemaCol.read(doc,null);
        assertNotNull(schema);

        // attempt with slash now
        schemaCol = new XmlSchemaCollection();
        schemaCol.setBaseUri(Resources.TEST_RESOURCES + "/");
        schema = schemaCol.read(doc,null);
        assertNotNull(schema);
    }
View Full Code Here

        DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
        documentBuilderFactory.setNamespaceAware(true);
        Document doc = documentBuilderFactory.newDocumentBuilder().
                parse(file.toURL().toString());

        XmlSchemaCollection schemaCol = new XmlSchemaCollection();
        XmlSchema schema = schemaCol.read(doc,file.toURL().toString(),null);
        assertNotNull(schema);

    }
View Full Code Here

                "\t\t\t\t</xsd:complexType>\n" +
                "\t\t\t</xsd:element>\n" +
                "\n" +
                "\t\t</xsd:schema>";
        org.xml.sax.InputSource schemaInputSource = new InputSource(new StringReader(schema));
        XmlSchemaCollection xsc = new XmlSchemaCollection();
        xsc.setBaseUri(Resources.TEST_RESOURCES);

        //Set the namespaces explicitly
        NamespaceMap prefixmap = new NamespaceMap(namespaceMapFromWSDL);
        xsc.setNamespaceContext(prefixmap);
        XmlSchema schemaDef = xsc.read(schemaInputSource, null);
        StringWriter sw = new StringWriter();
        schemaDef.write(sw);
               
        assertXMLEqual(sw.toString(), schema);
    }
View Full Code Here

        DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
        documentBuilderFactory.setNamespaceAware(true);
        Document doc = documentBuilderFactory.newDocumentBuilder().
                parse(file.toURL().toString());

        XmlSchemaCollection schemaCol = new XmlSchemaCollection();
        XmlSchema schema = schemaCol.read(doc,file.toURL().toString(),null);
        assertNotNull(schema);

        assertNotNull(schema.getTypeByName(new QName("http://soapinterop.org/xsd2","SOAPStruct")));
        assertNotNull(schema.getElementByName(new QName("http://soapinterop.org/xsd2","SOAPWrapper")));
    }
View Full Code Here

        DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
        documentBuilderFactory.setNamespaceAware(true);
        Document doc = documentBuilderFactory.newDocumentBuilder().
                parse(file.toURL().toString());

        XmlSchemaCollection schemaCol = new XmlSchemaCollection();
        XmlSchema schema = schemaCol.read(doc,file.toURL().toString(),null);
        assertNotNull(schema);

        assertNotNull(schema.getTypeByName(new QName("http://soapinterop.org/xsd2","SOAPStruct")));
        assertNull(schema.getElementByName(new QName("http://soapinterop.org/xsd2","SOAPWrapper")));
    }
View Full Code Here

        DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
        documentBuilderFactory.setNamespaceAware(true);
        Document doc = documentBuilderFactory.newDocumentBuilder().
                parse(file.toURL().toString());

        XmlSchemaCollection schemaCol = new XmlSchemaCollection();
        schemaCol.setSchemaResolver(new CatalogURIResolver(catalogManager));
        XmlSchema schema = schemaCol.read(doc,file.toURL().toString(),null);
        assertNotNull(schema);

        assertNotNull(schema.getTypeByName(new QName("http://soapinterop.org/xsd2","SOAPStruct")));
        assertNotNull(schema.getElementByName(new QName("http://soapinterop.org/xsd2","SOAPWrapper")));
    }
View Full Code Here

                                getSchemaAsString(schema)
                                , options));

            }

            XmlSchemaCollection extras = new XmlSchemaCollection();
            // add the third party schemas
            //todo perhaps checking the namespaces would be a good idea to
            //make the generated code work efficiently
            for (int i = 0; i < additionalSchemas.length; i++) {
                completeSchemaList.add(extras.read(additionalSchemas[i]));
                topLevelSchemaList.add(XmlObject.Factory.parse(
                        additionalSchemas[i]
                        , null));
            }
View Full Code Here

            this.schema_namespace_prefix = SCHEMA_NAMESPACE_PRFIX;
        }
        Hashtable prefixmap = new Hashtable();
        prefixmap.put(this.schema_namespace_prefix, this.schemaTargetNameSpace);

        XmlSchemaCollection schemaCollection = new XmlSchemaCollection();

        schema = new XmlSchema(this.schemaTargetNameSpace, schemaCollection);
        schema.setElementFormDefault(new XmlSchemaForm(XmlSchemaForm.QUALIFIED));
        schema.setPrefixToNamespaceMap(prefixmap);
        this.typeTable = new TypeTable();
View Full Code Here

        DocumentBuilder builder =  documentBuilderFactory.newDocumentBuilder();
        Document doc = builder.parse(new File(fileName));

        //now read it to a schema
        XmlSchemaCollection schemaCol =  getSchemaReader();
        currentSchema = schemaCol.read(doc,null);

        outputFolder = new File(TEMP_OUT_FOLDER);
        if (outputFolder.exists()){
            if (outputFolder.isFile()){
                outputFolder.delete();
View Full Code Here

TOP

Related Classes of org.apache.ws.commons.schema.XmlSchemaCollection

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.