Package org.apache.ws.jaxme.xs

Examples of org.apache.ws.jaxme.xs.XSSchema


            "  </xs:annotation>\n" +
            "</xs:schema>";

            InputSource isource = new InputSource(new StringReader(schemaSource));
            isource.setSystemId("testSimpleKey.xsd");
            XSSchema schema = pParser.parse(isource);
    }
View Full Code Here


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

        InputSource isource = new InputSource(new StringReader(schemaSource));
        isource.setSystemId("testSimpleTypeRestriction2.xsd");
        XSSchema schema = pParser.parse(isource);
        XSType[] types = schema.getTypes();
        assertEquals(2, types.length);
        assertEquals(new XsQName("http://asi.sbc.com/cpsosasos/trouble/data", "NameTypeType"),
                     types[1].getName());
        XSSimpleType nameTypeType = assertSimpleType(types[1]);
        assertUnionType(nameTypeType);
View Full Code Here

            "<schema xmlns='http://www.w3.org/2001/XMLSchema'>\n" +
            "  <annotation><appinfo>foo</appinfo></annotation>\n" +
            "</schema>\n";
        InputSource isource = new InputSource(new StringReader(schemaSource));
        isource.setSystemId("testSimpleTypeRestriction2.xsd");
        XSSchema schema = pParser.parse(isource);
        XSAnnotation[] annotations = schema.getAnnotations();
        assertEquals(1, annotations.length);
        XSAppinfo[] appinfos = annotations[0].getAppinfos();
        assertEquals(1, appinfos.length);
        Object[] childs = appinfos[0].getChilds();
        assertEquals(1, childs.length);
View Full Code Here

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

        InputSource isource = new InputSource(new StringReader(schemaSource));
        isource.setSystemId("testElementReferenceGlobal.xsd");
        XSSchema schema = pParser.parse(isource);
        XSElement[] elements = schema.getElements();
        assertEquals(2, elements.length);
        assertEquals(new XsQName("http://ws.apache.org/jaxme/test/recursion", "Attribute"), elements[0].getName());
        assertTrue(elements[0].isGlobal());
        assertEquals(new XsQName("http://ws.apache.org/jaxme/test/recursion", "AttributeList"), elements[1].getName());
        assertTrue(elements[1].isGlobal());
View Full Code Here

          }
        }

        if (!generateTypesafeEnumClass  &&  pType.isGlobal()) {
          XsQName[] qNames = new XsQName[]{XSNMToken.getInstance().getName()};
          XSSchema xsSchema = xsType.getXSSchema();
          if (xsSchema instanceof JAXBSchema) {
            JAXBSchema jaxbSchema = (JAXBSchema) xsSchema;
            JAXBGlobalBindings globalBindings = jaxbSchema.getJAXBGlobalBindings();
            if (globalBindings != null) {
              qNames = globalBindings.getTypesafeEnumBase();
View Full Code Here

      return;
    } else {
      isValidated = true;
    }

    XSSchema schema = getXSSchema();
    XSObjectFactory factory = schema.getXSObjectFactory();

    XSType myType;
    if (isReference()) {
      XSElement element = schema.getElement(getName());
      if (element == null) {
        throw new LocSAXException("Invalid element reference: " + getName() + " is not defined.",
                                     getLocator());
      }
      element.validate();
      myType = element.getType();
    } else {
      XsTElement element = getXsTElement();
      if (isInnerSimpleType()) {
        myType = factory.newXSType(this, element.getSimpleType());
      } else if (isInnerComplexType()) {
        myType = factory.newXSType(this, element.getComplexType());
      } else {
        XsQName typeName = element.getType();
        if (typeName == null) {
          throw new LocSAXException("Invalid element: Either of its 'type' or 'ref' attributes or its 'simpleType' or 'complexType' children must be set.",
                                       getLocator());
        }
        myType = schema.getType(typeName);
        if (myType == null) {
          throw new LocSAXException("Invalid element: The type " + typeName + " is not defined.",
                                       getLocator());
        }
      }
View Full Code Here

      keyReferences = NO_KEY_REFS;

      return;
    }

    XSSchema schema = getXSSchema();
    XSObjectFactory factory = schema.getXSObjectFactory();
    List constraints = new ArrayList(1);
    List refKeys  = new ArrayList(1);

    for ( int i=0; i<numRawConstraints; i++ ) {
      XsTIdentityConstraint raw = rawConstraints[i];

      if ( raw instanceof XsEKeyref ) {
        XSKeyRef keyRef = factory.newXSKeyRef( this, (XsEKeyref) raw );

        refKeys.add( keyRef );
        schema.add( keyRef );
      } else if ( raw instanceof XsEKey ) {
        XSIdentityConstraint ic = factory.newXSIdentityConstraint(
          this,
          (XsEKey) raw
        );

        constraints.add( ic );
        schema.add( ic );
      } else if( raw instanceof XsEUnique ) {
        XSIdentityConstraint ic = factory.newXSIdentityConstraint(
          this,
          (XsEUnique) raw
        );

        constraints.add( ic );
        schema.add( ic );
      }
    }

    int numConstraints = constraints.size();
    if ( numConstraints == 0 ) {
View Full Code Here

   {
      InputSource source = new InputSource(schema);

      XSParser xsParser = new XSParser();
      xsParser.setValidating(false);
      XSSchema xsSchema = xsParser.parse(source);

      this.provider = provider instanceof GenericObjectModelProvider ?
         (GenericObjectModelProvider)provider : new DelegatingObjectModelProvider(provider);

      this.root = root;

      //stack.push(document);
      content.startDocument();

      if(rootQNames.isEmpty())
      {
         XSElement[] elements = xsSchema.getElements();
         for(int i = 0; i < elements.length; ++i)
         {
            log.info("marshalling " + elements[i].getName().getLocalName());
            //processElement(elements[i], addedAttributes, 1);
            processElement(elements[i], 1, true);
         }
      }
      else
      {
         for(int i = 0; i < rootQNames.size(); ++i)
         {
            QName qName = (QName)rootQNames.get(i);
            XsQName rootName = new XsQName(qName.getNamespaceURI(), qName.getLocalPart(), qName.getPrefix());

            final XSElement xsRoot = xsSchema.getElement(rootName);
            if(xsRoot == null)
            {
               throw new IllegalStateException("Root element not found: " + rootName);
            }
View Full Code Here

            InputSource source = new InputSource(mapping.schemaUrl);

            XSParser xsParser = new XSParser();
            xsParser.setValidating(false);
            XSSchema xsSchema;
            try
            {
               xsSchema = xsParser.parse(source);
            }
            catch(Exception e)
            {
               log.error(e);
               throw new IllegalStateException(e.getMessage());
            }

            XsQName rootName = new XsQName(mapping.namespaceUri, mapping.root);
            XSElement root = xsSchema.getElement(rootName);
            // name with the prefix
            rootName = root.getName();

            String rootPrefix = rootName.getPrefix();
            String rootQName = (rootPrefix == null || rootPrefix.length() == 0 ?
View Full Code Here

   {
      InputSource source = new InputSource(schema);

      XSParser xsParser = new XSParser();
      xsParser.setValidating(false);
      XSSchema xsSchema = xsParser.parse(source);

      this.provider = provider instanceof GenericObjectModelProvider ?
         (GenericObjectModelProvider)provider : new DelegatingObjectModelProvider(provider);

      this.root = root;

      //stack.push(document);
      content.startDocument();

      if(rootQNames.isEmpty())
      {
         XSElement[] elements = xsSchema.getElements();
         for(int i = 0; i < elements.length; ++i)
         {
            log.info("marshalling " + elements[i].getName().getLocalName());
            //processElement(elements[i], addedAttributes, 1);
            processElement(elements[i], null, 1);
         }
      }
      else
      {
         for(int i = 0; i < rootQNames.size(); ++i)
         {
            QName qName = (QName)rootQNames.get(i);
            XsQName rootName = new XsQName(qName.getNamespaceURI(), qName.getLocalPart(), qName.getPrefix());

            final XSElement xsRoot = xsSchema.getElement(rootName);
            if(xsRoot == null)
            {
               throw new IllegalStateException("Root element not found: " + rootName);
            }
View Full Code Here

TOP

Related Classes of org.apache.ws.jaxme.xs.XSSchema

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.