Package org.apache.xmlbeans

Examples of org.apache.xmlbeans.SchemaTypeSystem


        Collection errors = new ArrayList();
        XmlOptions xmlOptions = new XmlOptions();
        xmlOptions.setErrorListener(errors);
        XmlObject[] schemas = new XmlObject[] {xmlObject};
        SchemaTypeLoader schemaTypeLoader = XmlBeans.loadXsd(new XmlObject[] {});
        SchemaTypeSystem schemaTypeSystem;
        try {
            schemaTypeSystem = XmlBeans.compileXsd(schemas, schemaTypeLoader, xmlOptions);
            if (errors.size() > 0) {
                throw new DeploymentException("Could not compile schema type system: errors: " + errors);
            }
View Full Code Here


        Collection errors = new ArrayList();
        XmlOptions xmlOptions = new XmlOptions();
        xmlOptions.setErrorListener(errors);
        XmlObject[] schemas = new XmlObject[] {xmlObject};
        SchemaTypeLoader schemaTypeLoader = XmlBeans.loadXsd(new XmlObject[] {});
        SchemaTypeSystem schemaTypeSystem;
        try {
            schemaTypeSystem = XmlBeans.compileXsd(schemas, schemaTypeLoader, xmlOptions);
            if (errors.size() > 0) {
                throw new DeploymentException("Could not compile schema type system: errors: " + errors);
            }
View Full Code Here

        boolean result = true;

        // build the in-memory type system
        XmlErrorWatcher errorListener = new XmlErrorWatcher(outerErrorListener);
        SchemaTypeSystem system = loadTypeSystem(name, xsdFiles, wsdlFiles, configFiles, cpResourceLoader, download, noUpa, noPvr, mdefNamespaces, baseDir, sourcesToCopyMap, errorListener);
        if (errorListener.hasError())
            result = false;
        long finish = System.currentTimeMillis();
        if (!quiet)
            System.out.println("Time to build schema type system: " + ((double)(finish - start) / 1000.0) + " seconds" );
View Full Code Here

       

        XmlObject[] schemas = (XmlObject[])sdocs.toArray(new XmlObject[0]);
       
        // step 2: compile all the schemas
        SchemaTypeSystem typeSystem;
        Collection compErrors = new ArrayList();
        XmlOptions schemaOptions = new XmlOptions();
        schemaOptions.setErrorListener(compErrors);
        schemaOptions.setCompileDownloadUrls();
        if (nopvr)
            schemaOptions.setCompileNoPvrRule();
        if (noupa)
            schemaOptions.setCompileNoUpaRule();
       
        try
        {
            typeSystem = XmlBeans.compileXsd(schemas, XmlBeans.getBuiltinTypeSystem(), schemaOptions);
        }
        catch (XmlException e)
        {
            System.out.println("Schema invalid");
            if (compErrors.isEmpty())
                System.out.println(e.getMessage());
            else for (Iterator i = compErrors.iterator(); i.hasNext(); )
                System.out.println(i.next());
            return;
        }
       
        // step 3: go through all the types, and note their base types and namespaces
        Map prefixes = new HashMap();
        prefixes.put("http://www.w3.org/XML/1998/namespace", "xml");
        prefixes.put("http://www.w3.org/2001/XMLSchema", "xs");
        System.out.println("xmlns:xs=\"http://www.w3.org/2001/XMLSchema\"");
       
        // This will be a map of (base SchemaType -> Collection of directly dervied types)
        Map childTypes = new HashMap();
       
        // breadthfirst traversal of the type containment tree
        List allSeenTypes = new ArrayList();
        allSeenTypes.addAll(Arrays.asList(typeSystem.documentTypes()));
        allSeenTypes.addAll(Arrays.asList(typeSystem.attributeTypes()));
        allSeenTypes.addAll(Arrays.asList(typeSystem.globalTypes()));

        for (int i = 0; i < allSeenTypes.size(); i++)
        {
            SchemaType sType = (SchemaType)allSeenTypes.get(i);
           
View Full Code Here

  }

  public Type validate( Context context ) throws XmlException
  {
    String name = context.getCursor().getName().getLocalPart();
    SchemaTypeSystem sts = XmlBeans.compileXsd( new XmlObject[] { XmlObject.Factory
        .parse( "<schema xmlns=\"http://www.w3.org/2001/XMLSchema\"><element name=\"" + name + "\">" + xsd
            + "</element></schema>" ) }, XmlBeans.getBuiltinTypeSystem(), null );
    SchemaTypeLoader stl = XmlBeans.typeLoaderUnion( new SchemaTypeLoader[] { sts, XmlBeans.getBuiltinTypeSystem() } );
    if( !stl.parse( context.getCursor().xmlText(), null, null ).validate() )
      throw new XmlException( "Element '" + name + "' does not validate for custom type!" );
View Full Code Here

      // schemas.add( soapVersion.getSoapEncodingSchema());
      // schemas.add( soapVersion.getSoapEnvelopeSchema());
      schemas.addAll( defaultSchemas.values() );

      SchemaTypeSystem sts = XmlBeans.compileXsd( schemas.toArray( new XmlObject[schemas.size()] ),
          XmlBeans.getBuiltinTypeSystem(), options );

      return sts;
      // return XmlBeans.typeLoaderUnion(new SchemaTypeLoader[] { sts,
      // XmlBeans.getBuiltinTypeSystem() });
View Full Code Here

  public Collection<String> getDefinedNamespaces() throws Exception
  {
    Set<String> namespaces = new HashSet<String>();

    SchemaTypeSystem schemaTypes = getSchemaTypeSystem();
    if( schemaTypes != null )
    {
      namespaces.addAll( SchemaUtils.extractNamespaces( getSchemaTypeSystem(), true ) );
    }
View Full Code Here

  }

  private boolean isMixed( Context context )
  {
    QName name = context.getCursor().getName();
    SchemaTypeSystem sts;
    try
    {
      sts = XmlBeans.compileXsd( new XmlObject[] { XmlObject.Factory
          .parse( "<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" xmlns=\"" + name.getNamespaceURI()
              + "\" targetNamespace=\"" + name.getNamespaceURI() + "\">" + "<xs:element name=\""
View Full Code Here

          SchemaType schemaType = parentXmlObject.schemaType();
          Node parentNode = elm.getParentNode();

          if( schemaType.isNoType() )
          {
            SchemaTypeSystem typeSystem = wsdlRequest.getOperation().getInterface().getWsdlContext()
                .getSchemaTypeSystem();
            SchemaGlobalElement schemaElement = typeSystem.findElement( new QName( parentNode.getNamespaceURI(),
                parentNode.getLocalName() ) );
            if( schemaElement != null )
            {
              schemaType = schemaElement.getType();
            }
View Full Code Here

        XmlOptions xmlOptions = new XmlOptions();
        xmlOptions.setErrorListener(errors);
        xmlOptions.setEntityResolver(new JarEntityResolver());
        XmlObject[] schemas = (XmlObject[]) schemaList.toArray(new XmlObject[schemaList.size()]);
        try {
            SchemaTypeSystem schemaTypeSystem = XmlBeans.compileXsd(schemas, basicTypeSystem, xmlOptions);
            if (errors.size() > 0) {
                boolean wasError = false;
                for (Iterator iterator = errors.iterator(); iterator.hasNext();) {
                    XmlError xmlError = (XmlError) iterator.next();
                    if(xmlError.getSeverity() == XmlError.SEVERITY_ERROR) {
View Full Code Here

TOP

Related Classes of org.apache.xmlbeans.SchemaTypeSystem

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.