Examples of XsQName


Examples of org.apache.ws.jaxme.xs.xml.XsQName

    groups.put(name, pGroup);
    replace(oldGroup, pGroup);
  }

  public void add(XSAttributeGroup pGroup) throws SAXException {
    XsQName name = pGroup.getName();
    if (name == null) {
      throw new LocSAXException("A global attribute group must have a 'name' attribute.", pGroup.getLocator());
    }
    if (attributeGroups.containsKey(name)) {
      throw new LocSAXException("A global attribute group " + name + " is already defined.", pGroup.getLocator());
View Full Code Here

Examples of org.apache.ws.jaxme.xs.xml.XsQName

    attributeGroups.put(name, pGroup);
    addChild(pGroup);
  }

  public void redefine(XSAttributeGroup pGroup) throws SAXException {
    XsQName name = pGroup.getName();
    if (name == null) {
      throw new LocSAXException("A global attribute group must have a 'name' attribute.", pGroup.getLocator());
    }
    Object oldGroup = attributeGroups.get(name);
    if (!attributeGroups.containsKey(name)) {
View Full Code Here

Examples of org.apache.ws.jaxme.xs.xml.XsQName

    attributeGroups.put(name, pGroup);
    replace(oldGroup, pGroup);
  }

  public void add(XSAttribute pAttribute) throws SAXException {
    XsQName name = pAttribute.getName();
    if (name == null) {
      throw new LocSAXException("A global attribute must have a 'name' attribute.", pAttribute.getLocator());
    }
    if (attributes.containsKey(name)) {
      throw new LocSAXException("A global attribute " + name + " is already defined.", pAttribute.getLocator());
View Full Code Here

Examples of org.apache.ws.jaxme.xs.xml.XsQName

    attributes.put(name, pAttribute);
    addChild(pAttribute);
  }

  public void add(XSElement pElement) throws SAXException {
    XsQName name = pElement.getName();
    if (name == null) {
      throw new LocSAXException("A global attribute group must have a 'name' attribute.", pElement.getLocator());
    }
    if (elements.containsKey(name)) {
      throw new LocSAXException("A global group " + name + " is already defined.", pElement.getLocator());
View Full Code Here

Examples of org.apache.ws.jaxme.xs.xml.XsQName

  public XSType getRestrictedType() {
    throw new IllegalStateException("This is a basic list type and not a restriction of another simple type.");
  }

  public XSListTypeImpl(XSType pOwner, XsEList pBaseList) throws SAXException {
    XsQName itemTypeName = pBaseList.getItemType();
    if (itemTypeName == null) {
      XsTLocalSimpleType simpleType = pBaseList.getSimpleType();
      if (simpleType == null) {
        throw new LocSAXException("You must either set the 'itemType' attribute or add a 'simpleType' element.",
                                   pBaseList.getLocator());
View Full Code Here

Examples of org.apache.ws.jaxme.xs.xml.XsQName

      namespaces.add(uri);

      // Now handle all elements with the namespace uri
      for (int j = i;  j < myParticles.length;  j++) {
        child = myParticles[j];
        XsQName name = child.getObjectSG().getName();
        if (!name.getNamespaceURI().equals(uri)) {
          continue;
        }
        jm.addIf(j == i, JavaSource.getQuoted(name.getLocalName()), ".equals(", pLocalName, ")");

        List validStates = new ArrayList();
        if (child.isMultiple()) {
          validStates.add(new Integer(j+3));
        }
View Full Code Here

Examples of org.apache.ws.jaxme.xs.xml.XsQName

        namespacePrefix = schema.getTargetNamespacePrefix();
      } else {
        namespace = null;
        namespacePrefix = null;
      }
      this.name = new XsQName(namespace, myName.toString(), namespacePrefix);
    }

    xsAnnotation = pBaseAttribute.getAnnotation();
  }
View Full Code Here

Examples of org.apache.ws.jaxme.xs.xml.XsQName

    } else if (isInnerSimpleType()) {
      XsTLocalSimpleType innerSimpleType = getXsTAttribute().getSimpleType();
      myType = getXSSchema().getXSObjectFactory().newXSType(this, innerSimpleType);
      myType.validate();
    } else {
      XsQName typeName = getXsTAttribute().getType();
      if (typeName == null) {
        typeName = XSAnySimpleType.getInstance().getName();
      }
      myType = getXSSchema().getType(typeName);
      if (myType == null) {
View Full Code Here

Examples of org.apache.ws.jaxme.xs.xml.XsQName

  public XSUnionTypeImpl(XSType pOwner,
                          XsEUnion pBaseUnion) throws SAXException {
    XsQName[] names = pBaseUnion.getMemberTypes();
    if (names != null) {
      for (int i = 0;  i < names.length;  i++) {
        XsQName name = names[i];
        XSType type = pOwner.getXSSchema().getType(name);
        if (type == null) {
          throw new LocSAXException("Unknown member type: " + name, pBaseUnion.getLocator());
        }
        type.validate();
View Full Code Here

Examples of org.apache.ws.jaxme.xs.xml.XsQName

      throw new IllegalStateException("Expected a simple type");
    }
    XSSimpleType simpleType = pType.getSimpleType();
    if (simpleType.isAtomic()) {
      if (pType.isGlobal()) {
        XsQName myName = pType.getName();
        if (myName.equals(XSEntity.getInstance().getName())      ||
            myName.equals(XSNotation.getInstance().getName())    ||
            myName.equals(XSGYearMonth.getInstance().getName())  ||
            myName.equals(XSGYear.getInstance().getName())       ||
            myName.equals(XSGMonthDay.getInstance().getName())   ||
            myName.equals(XSGMonth.getInstance().getName())      ||
            myName.equals(XSGDay.getInstance().getName())) {
          throw new SAXException("The type " + myName + " is not supported.");
        } else if (myName.equals(XSIDREF.getInstance().getName())) {
          return new IDREFSG(pFactory, pSchema, pType);
        } else if (myName.equals(XSID.getInstance().getName())) {
          return new IDSG(pFactory, pSchema, pType);
        } else if (myName.equals(XSByte.getInstance().getName())) {
          return new ByteSG(pFactory, pSchema, pType);
        } else if (myName.equals(XSShort.getInstance().getName())) {
          return new ShortSG(pFactory, pSchema, pType);
        } else if (myName.equals(XSInt.getInstance().getName())) {
          return new IntSG(pFactory, pSchema, pType);
        } else if (myName.equals(XSLong.getInstance().getName())) {
          return new LongSG(pFactory, pSchema, pType);
        } else if (myName.equals(XSUnsignedByte.getInstance().getName())  ||
                    myName.equals(XSUnsignedShort.getInstance().getName())) {
          return new UnsignedShortSG(pFactory, pSchema, pType);
        } else if (myName.equals(XSUnsignedInt.getInstance().getName())) {
          return new UnsignedIntSG(pFactory, pSchema, pType);
        } else if (myName.equals(XSInteger.getInstance().getName())             ||
                    myName.equals(XSNonPositiveInteger.getInstance().getName())  ||
                    myName.equals(XSNegativeInteger.getInstance().getName())     ||
                    myName.equals(XSUnsignedLong.getInstance().getName())        ||
                    myName.equals(XSPositiveInteger.getInstance().getName())     ||
                    myName.equals(XSNonNegativeInteger.getInstance().getName())) {
          return new IntegerSG(pFactory, pSchema, pType);
        } else if (myName.equals(XSDecimal.getInstance().getName())) {
          return new DecimalSG(pFactory, pSchema, pType);
        } else if (myName.equals(XSQName.getInstance().getName())) {
          return new QNameSG(pFactory, pSchema, pType);
        } else if (myName.equals(XSDouble.getInstance().getName())) {
          return new DoubleSG(pFactory, pSchema, pType);
        } else if (myName.equals(XSFloat.getInstance().getName())) {
          return new FloatSG(pFactory, pSchema, pType);
        } else if (myName.equals(XSHexBinary.getInstance().getName())) {
          return new HexBinarySG(pFactory, pSchema, pType);
        } else if (myName.equals(XSBase64Binary.getInstance().getName())) {
          return new Base64BinarySG(pFactory, pSchema, pType);
        } else if (myName.equals(XSBoolean.getInstance().getName())) {
          return new BooleanSG(pFactory, pSchema, pType);
        } else if (myName.equals(XSDate.getInstance().getName())) {
          return new DateSG(pFactory, pSchema, pType);
        } else if (myName.equals(XSDateTime.getInstance().getName())) {
          return new DateTimeSG(pFactory, pSchema, pType);
        } else if (myName.equals(XSTime.getInstance().getName())) {
          return new TimeSG(pFactory, pSchema, pType);
        } else if (myName.equals(XSDuration.getInstance().getName())) {
          return new DurationSG(pFactory, pSchema, pType);
        } else if (myName.equals(XSAnySimpleType.getInstance().getName())     ||
                    myName.equals(XSString.getInstance().getName())            ||
                    myName.equals(XSAnyURI.getInstance().getName())            ||
                    myName.equals(XSNormalizedString.getInstance().getName())  ||
                    myName.equals(XSToken.getInstance().getName())             ||
                    myName.equals(XSLanguage.getInstance().getName())          ||
                    myName.equals(XSName.getInstance().getName())              ||
                    myName.equals(XSNMToken.getInstance().getName())           ||
                    myName.equals(XSNCName.getInstance().getName())) {
          return new StringSG(pFactory, pSchema, pType);
        }
      }

      SimpleTypeSGChain result = newSimpleTypeSG(pController, pFactory, pSchema, simpleType.getRestrictedType());

      result = new SimpleTypeRestrictionSG(result, pType, simpleType);

      if (simpleType.getEnumerations().length > 0) {
        boolean generateTypesafeEnumClass = false;
        String className = null;
        String packageName = null;

        if (simpleType instanceof JAXBSimpleType) {
          JAXBSimpleType jaxbSimpleType = (JAXBSimpleType) simpleType;
          JAXBTypesafeEnumClass jaxbTypesafeEnumClass = jaxbSimpleType.getJAXBTypesafeEnumClass();
          if (jaxbTypesafeEnumClass != null) {
            generateTypesafeEnumClass = true;
            className = jaxbTypesafeEnumClass.getName();
          }
        }

        if (!generateTypesafeEnumClass) {
          XSEnumeration[] enumerations = simpleType.getEnumerations();
          for (int i = 0;  i < enumerations.length;  i++) {
            XSEnumeration enumeration = enumerations[i];
            if (enumeration instanceof JAXBEnumeration) {
              JAXBEnumeration jaxbEnumeration = (JAXBEnumeration) enumeration;
              if (jaxbEnumeration.getJAXBTypesafeEnumMember() != null) {
                generateTypesafeEnumClass = true;
                break;
              }
            }
          }
        }

        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();
            }
          }

          for (XSType restrType = xsType;  !generateTypesafeEnumClass;  ) {
            restrType = restrType.getSimpleType().getRestrictedType();
            if (restrType.isGlobal()) {
              for (int i = 0;  i < qNames.length;  i++) {
                if (qNames[i].equals(restrType.getName())) {
                  generateTypesafeEnumClass = true;
                  break;
                }
              }
              if (XSAnySimpleType.getInstance().getName().equals(restrType.getName())) {
                break;
              }
            }
          }
        }

        if (xsType instanceof JAXBType) {
          JAXBSchemaBindings jaxbSchemaBindings = ((JAXBType) xsType).getJAXBSchemaBindings();
          if (jaxbSchemaBindings != null) {
            JAXBSchemaBindings.Package jaxbPackage = jaxbSchemaBindings.getPackage();
            if (jaxbPackage != null) {
              packageName = jaxbPackage.getName();
            }
          }
        }
        if (packageName == null) {
          XsQName qName = pController.getName();
          packageName = AbstractContext.getPackageNameFromURI(pController.getLocator(), qName.getNamespaceURI());
        }

        if (generateTypesafeEnumClass) {
          if (className == null) {
            XsQName qName = pType.isGlobal() ? pType.getName() : pController.getName();
            className = AbstractContext.getClassNameFromLocalName(pController.getLocator(),
                                                                  qName.getLocalName(),
                                                                  pSchema) + "Class";
          }
          result = new EnumerationSG(result, JavaQNameImpl.getInstance(packageName, className), pType);
        }
      }
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.