Examples of XmlSchemaCollection


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();
      XmlSchema s = schema.read(new StreamSource(is), null);
      XmlSchemaType principalId = schema.getTypeByQName(new QName("", "XdwsPrincipalId"));
      assertNotNull(principalId);
      XmlSchemaType groupId = schema.getTypeByQName(new QName("", "XdwsGroupId"));
      assertNotNull(groupId);
      assertEquals(groupId.getBaseSchemaType(), principalId);
    }
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("twoSchemas.wsdl"));

        XmlSchemaCollection schemaCol = new XmlSchemaCollection();
    NodeList schemaNodes = doc.getElementsByTagNameNS("http://www.w3.org/2001/XMLSchema","schema");
        for (int j = 0; j < schemaNodes.getLength(); j++) {
          Node schemaNode = schemaNodes.item(j);
          if("schema".equals(schemaNode.getLocalName())){
            schemaCol.read((Element)schemaNode);
          }
        }
       
        assertNotNull(schemaCol.getElementByQName(new QName("http://tns.demo.org","elem1")));

    }
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("twoSchemas-ref.wsdl"));

        XmlSchemaCollection schemaCol = new XmlSchemaCollection();
    NodeList schemaNodes = doc.getElementsByTagNameNS("http://www.w3.org/2001/XMLSchema","schema");
        for (int j = 0; j < schemaNodes.getLength(); j++) {
          Node schemaNode = schemaNodes.item(j);
          if("schema".equals(schemaNode.getLocalName())){
            schemaCol.read((Element)schemaNode);
          }
        }

        XmlSchemaElement elementByQName = schemaCol.getElementByQName(new QName("http://tns.demo.org", "elem1"));
        assertNotNull(elementByQName);
       
    }
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("externalAttributes.xsd"));

           XmlSchemaCollection schemaCol = new XmlSchemaCollection();
           XmlSchema s = schemaCol.read(doc.getDocumentElement());

           //check the meta data
           Map metaInfoMap = s.getMetaInfoMap();
           assertNotNull(metaInfoMap);
View Full Code Here

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

       

    }

    public XmlSchema loadSchema(File f) throws Exception {
        XmlSchemaCollection col = new XmlSchemaCollection();
        col.setBaseUri(f.getPath());
        XmlSchema xmlSchema = col.read(new FileReader(f), null);
        return xmlSchema;
    }
View Full Code Here

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

import java.io.FileInputStream;

public class CircularSchemaTest extends TestCase
{
    public void testCircular() throws Exception {
        XmlSchemaCollection schemas = new XmlSchemaCollection();
        File file = new File(Resources.asURI("circular/a.xsd"));
        InputSource source = new InputSource(new FileInputStream(file));
        source.setSystemId(file.toURL().toString());
       
        schemas.read(source, null);
       
        XmlSchema[] xmlSchemas = schemas.getXmlSchemas();
        assertNotNull(xmlSchemas);
        assertEquals(3, xmlSchemas.length);
    }
View Full Code Here

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

             "</simpleType>\n" +
             "</element>\n" +
             "</schema> ";

    public void testLocalUnnamedSimpleType() throws Exception {
        XmlSchemaCollection schema = new XmlSchemaCollection();
        schema.read(new StreamSource(new ByteArrayInputStream(schemaXML.getBytes())), null);
    }
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("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

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

        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

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

                "\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
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.