Examples of XmlSchemaCollection


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

        wsdlInterface.setUnresolved(false);
        wsdlInterface.setRemotable(true);
        PortType portType = (PortType)def.getAllPortTypes().values().iterator().next();
        wsdlInterface.setPortType(portType);

        readInlineSchemas(wsdlFactory, wsdlDefinition, def, new XmlSchemaCollection());

        try {
            for (Operation op : iface.getOperations()) {
                javax.wsdl.Operation wsdlOp = portType.getOperation(op.getName(), null, null);
                WSDLOperationIntrospectorImpl opx =
View Full Code Here

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

    public static List<WrapperElement> getWrappedElement(ToolContext context, QName partElement) {
        List<WrapperElement> qnames = new ArrayList<WrapperElement>();
       
        ServiceInfo serviceInfo = (ServiceInfo)context.get(ServiceInfo.class);
        XmlSchemaCollection schema = serviceInfo.getXmlSchemaCollection();
      
        XmlSchemaElement elementByName = schema.getElementByQName(partElement);
       
        //is elementByName is null,it could be generate from serviceInfo, we need read the schema element
        //into schemaCollection
        if (elementByName == null) {
            Map<String, Element> maps = CastUtils.cast((Map<?, ?>)context.get(ToolConstants.SCHEMA_MAP));
            if (maps != null) {
                for (Element ele : maps.values()) {
                    schema.read(ele);
                }
                elementByName = schema.getElementByQName(partElement);
            }
        }

        XmlSchemaComplexType type = (XmlSchemaComplexType)elementByName.getSchemaType();
View Full Code Here

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

        return qnames;
    }
   
    public static boolean isSchemaFormQualified(ToolContext context, QName partElement) {
        ServiceInfo serviceInfo = (ServiceInfo)context.get(ServiceInfo.class);
        XmlSchemaCollection schemaCol = serviceInfo.getXmlSchemaCollection();

        for (int i = 0; i < schemaCol.getXmlSchemas().length; i++) {
            XmlSchema schema = schemaCol.getXmlSchemas().clone()[i];
            if (schema.getElementByName(partElement) != null) {
                return schema.getElementFormDefault().getValue().equals(XmlSchemaForm.QUALIFIED);
            }
        }
        return false;
View Full Code Here

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

        //
        // If we are on windows we may have spaces in the uri
        // which need to be escaped.
        //
        baseURI = baseURI.replaceAll(" ", "%20");
        XmlSchemaCollection schemaCol = new XmlSchemaCollection();
        schemaCol.setBaseUri(baseURI);
        NodeList nodes = document.getElementsByTagNameNS(
            WSDLConstants.NU_SCHEMA_XSD, "schema");
        for (int x = 0; x < nodes.getLength(); x++) {
            Node schemaNode = nodes.item(x);
            Element schemaEl = (Element) schemaNode;
            String tns = schemaEl.getAttribute("targetNamespace");
            try {
                schemaCol.read(schemaEl, tns);
            } catch (RuntimeException ex) {
                LOG.log(Level.WARNING, "SCHEMA_READ_FAIL", tns);
                //
                // Couldn't find schema... check if it's relative to wsdl.
                // XXX - Using setBaseUri() on the XmlSchemaCollection,
                // only seems to work for the first imported xsd... so pass
                // in the baseURI here.
                //
                try {
                    schemaCol.read(schemaEl, baseURI);
                } catch (RuntimeException ex2) {
                    LOG.log(Level.WARNING, "SCHEMA_READ_FAIL", baseURI);
                    continue;
                }
            }
View Full Code Here

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

        Schema schema = serviceInfo.getProperty(Schema.class.getName(), Schema.class);
        if (schema == null) {
            SchemaFactory factory = SchemaFactory.newInstance(
                XMLConstants.W3C_XML_SCHEMA_NS_URI);
            List<Source> schemaSources = new ArrayList<Source>();
            final XmlSchemaCollection sc = serviceInfo.getXmlSchemaCollection();
            for (SchemaInfo schemaInfo : serviceInfo.getSchemas()) {
                Source source = new DOMSource(schemaInfo.getElement());
                if (source != null) {
                    source.setSystemId(schemaInfo.getElement().getBaseURI());
                    schemaSources.add(source);
                }
            }
            try {
                factory.setResourceResolver(new LSResourceResolver() {
                    public LSInput resolveResource(String type, String namespaceURI, String publicId,
                                                   String systemId, String baseURI) {
                        for (XmlSchema sch : sc.getXmlSchemas()) {
                            if (namespaceURI.equals(sch.getTargetNamespace())) {
                                LSInputImpl impl = new LSInputImpl();
                                InputStream ins = null;
                                try {
                                    URL url = new URL(sch.getSourceURI());
View Full Code Here

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

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

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

     
       
        //these qnames are *not* there in these schemas
View Full Code Here

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

                "layoutComponentType");
        QName ELEMENT_QNAME = new QName("http://soapinterop.org/types",
                "foo");

        InputStream is = new FileInputStream(Resources.asURI("SimpleContentRestriction.xsd"));
        XmlSchemaCollection schema = new XmlSchemaCollection();
        schema.read(new StreamSource(is), null);

        XmlSchemaType simpleType = schema.getTypeByQName(TYPE_QNAME);
        assertNotNull(simpleType);

        XmlSchemaElement elem = schema.getElementByQName(ELEMENT_QNAME);
        assertNotNull(elem);

        XmlSchemaType type = elem.getSchemaType();
        assertNotNull(type);
    }
View Full Code Here

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

        assertNotNull(type);
    }

    public void testSimpleTypeRestrictionWithoutNamespace() throws Exception {
      InputStream is = new FileInputStream(Resources.asURI("includedWithoutNamespace.xsd"));
      XmlSchemaCollection schema = new XmlSchemaCollection();
      schema.read(new StreamSource(is), null);
      XmlSchemaType principalId = schema.getTypeByQName(new QName("", "XdwsPrincipalId"));
      assertNotNull(principalId);
      XmlSchemaSimpleType groupId = (XmlSchemaSimpleType)schema.getTypeByQName(new QName("", "XdwsGroupId"));
      assertNotNull(groupId);
      QName baseName = ((XmlSchemaSimpleTypeRestriction)groupId.getContent()).getBaseTypeName();

      assertEquals(principalId.getQName(), baseName);
    }
View Full Code Here

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

        fac.setNamespaceAware(true);

        String strUri = Resources.asURI("WSCOMMONS-377/importing.wsdl");
        Document doc = fac.newDocumentBuilder().parse(strUri);

        XmlSchemaCollection xsColl = new XmlSchemaCollection();
        xsColl.setBaseUri(Resources.TEST_RESOURCES + "/WSCOMMONS-377");

        NodeList nodesSchema = doc.getElementsByTagNameNS(Constants.URI_2001_SCHEMA_XSD, "schema");
        XmlSchema[] schemas = new XmlSchema[nodesSchema.getLength()];

        String systemIdBase = "urn:schemas";
        for (int i = 0; i < nodesSchema.getLength(); i++)
            schemas[i] = xsColl.read((Element)nodesSchema.item(i), systemIdBase + i);
    }
View Full Code Here

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

    Map<QName, MessageInfo> messages;
    List<SchemaInfo> schemas = new ArrayList<SchemaInfo>(4);
    private XmlSchemaCollection xmlSchemaCollection;

    public ServiceInfo() {
        xmlSchemaCollection = new XmlSchemaCollection();
    }
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.