Examples of XmlSchema


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

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

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

    }
View Full Code Here

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

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

        XmlSchemaCollection schemaCol = new XmlSchemaCollection();
        XmlSchema schema = schemaCol.read(doc, file.toURI().toURL().toString());
        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

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

    @Test
    public void testImportWithKnownNamespace() {
        XmlSchemaCollection schemaCol = new XmlSchemaCollection();
        schemaCol.getKnownNamespaceMap().put("http://www.w3.org/XML/1998/namespace",
                new XmlSchemaCollection().read(new InputSource(Resources.asURI("xml.xsd"))));
        XmlSchema schema = schemaCol.read(new InputSource(Resources.asURI("knownNamespace.xsd")));
        List<XmlSchemaExternal> externals = schema.getExternals();
        assertEquals(1, externals.size());
        XmlSchemaImport schemaImport = (XmlSchemaImport)externals.get(0);
        assertEquals("http://www.w3.org/XML/1998/namespace", schemaImport.getNamespace());
        XmlSchema schema2 = schemaImport.getSchema();
        assertNotNull(schema2);
    }
View Full Code Here

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

            }
            n = n.getNextSibling();
        }
        SchemaInfo schema = new SchemaInfo(ns);
        schema.setSystemId(systemId);
        XmlSchema xmlSchema;
        synchronized (d) {
            xmlSchema = col.read(d, systemId, null);
            schema.setSchema(xmlSchema);
        }
        serviceInfo.addSchema(schema);
View Full Code Here

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

   
    private void addCorbaTypes(Definition definition) throws Exception {       
        Iterator s = xmlSchemaList.iterator();
           
        while (s.hasNext()) {
            XmlSchema xmlSchemaTypes = (XmlSchema)s.next();
               
            Iterator schemas = xmlSchemaTypes.getIncludes().getIterator();
            while (schemas.hasNext()) {
                Object obj = schemas.next();
                if (obj instanceof XmlSchemaExternal) {
                    XmlSchemaExternal extSchema = (XmlSchemaExternal) obj;
                    addCorbaTypes(extSchema.getSchema());
View Full Code Here

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

            List<XmlSchema> xmlSchemaList) throws Exception {
        XmlSchemaType schemaType = null;

        Iterator i = xmlSchemaList.iterator();
        while (i.hasNext()) {
            XmlSchema xmlSchemaType = (XmlSchema) i.next();

            if (part.getElementName() != null) {
                XmlSchemaElement schemaElement = xmlSchemaType
                        .getElementByName(part.getElementName());
                if (schemaElement == null) {
                    QName elName = part.getElementName();
                    String prefix = definition.getPrefix(elName
                            .getNamespaceURI());
                    QName name = new QName(elName.getNamespaceURI(), prefix
                            + ":" + elName.getLocalPart(), prefix);
                    schemaElement = xmlSchemaType.getElementByName(name);
                }
                if (schemaElement != null) {
                    if (schemaElement.getSchemaType() != null) {
                        schemaType = schemaElement.getSchemaType();
                    }
                }
            } else {
                if (part.getTypeName() != null) {
                    schemaType = xmlSchemaType
                            .getTypeByName(part.getTypeName());

                    // Endpoint reference types will give a null schemaType
                    // here, so we need to
                    // go through the list of imports to find the definition for
                    // an Endpoint
                    // reference type.

                    if (schemaType == null
                            && xmlSchemaType.getIncludes().getCount() > 0) {
                        XmlSchemaObjectCollection includes = xmlSchemaType
                                .getIncludes();
                        Iterator includeIter = includes.getIterator();
                        while (includeIter.hasNext()) {
                            Object obj = includeIter.next();
                            if (!(obj instanceof XmlSchemaImport)) {
                                continue;
                            }
                            XmlSchemaImport xmlImport = (XmlSchemaImport) obj;
                            if (xmlImport.getNamespace().equals(
                                    part.getTypeName().getNamespaceURI())) {
                                XmlSchema importSchema = xmlImport.getSchema();
                                schemaType = importSchema.getTypeByName(part
                                        .getTypeName());
                            }
                        }
                    }
View Full Code Here

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

            List<XmlSchema> xmlSchemaList) throws Exception {
        XmlSchemaElement schemaElement = null;

        Iterator i = xmlSchemaList.iterator();
        while (i.hasNext()) {
            XmlSchema xmlSchemaType = (XmlSchema) i.next();
            if (part.getElementName() != null) {
                schemaElement = xmlSchemaType.getElementByName(part
                        .getElementName());
                if (schemaElement == null) {
                    QName elName = part.getElementName();
                    String prefix = definition.getPrefix(elName
                            .getNamespaceURI());
                    QName name = new QName(elName.getNamespaceURI(), prefix
                            + ":" + elName.getLocalPart(), prefix);
                    schemaElement = xmlSchemaType.getElementByName(name);
                }
                if (schemaElement != null) {
                    return schemaElement;
                }
            }
View Full Code Here

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

            // This is used to produce the correct object reference type.
            List<XmlSchema> schemaList = wsdlToCorbaBinding.getHelper().getXMLSchemaList();
            Iterator<XmlSchema> schemaIterator = schemaList.iterator();
            XmlSchemaObject schemaObj = null;
            while (schemaIterator.hasNext()) {
                XmlSchema s = schemaIterator.next();
                XmlSchemaObjectTable schemaTable = s.getElements();
                schemaObj = schemaTable.getItem(typeName);
                if (schemaObj != null) {
                    break;
                }
            }
View Full Code Here

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

    private void visitDefaultTypeObjectReference(AST node) {
        // Even though we don't need to add a schema definition for a default endpoint
        // type, we still need to create a schema type so that the visitor knows what
        // kind of parameter this is.  For a default endpoint, we'll just provide a
        // reference to a WS addressing EndpointReferenceType.
        XmlSchema wsaSchema = new XmlSchema(ReferenceConstants.WSADDRESSING_NAMESPACE, schemas);
        XmlSchemaType objectType = new XmlSchemaType(wsaSchema);
        objectType.setName(ReferenceConstants.WSADDRESSING_LOCAL_NAME);
        setSchemaType(objectType);
       
        // Build and assign the corba:object to the visitor
View Full Code Here

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

            throw new RuntimeException("[ObjectReferenceVisitor: No binding available for endpoint]");
        }

        // Create a schema namespace for WS addressing and use it to create an endpoint
        // reference type.  This will be used as the type for our endpoint reference.
        XmlSchema wsaSchema = new XmlSchema(ReferenceConstants.WSADDRESSING_NAMESPACE, schemas);
        XmlSchemaType wsaType = new XmlSchemaType(wsaSchema);
        wsaType.setName(ReferenceConstants.WSADDRESSING_LOCAL_NAME);

        // Check to see if we have already defined an element for this reference type.  If
        // we have, then there is no need to add it to the schema again.
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.