Package org.apache.ws.jaxme.xs.xml

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


      mySchema.add(factory.newXSAttributeGroup(mySchema, attributeGroup));
    } else if (pChild instanceof XsTTopLevelElement) {
      XsTTopLevelElement element = (XsTTopLevelElement) pChild;
      mySchema.add(factory.newXSElement(mySchema, element));
    } else if (pChild instanceof XsTAttribute) {
      XsTAttribute attribute = (XsTAttribute) pChild;
      mySchema.add(factory.newXSAttribute(mySchema, attribute));
    } else if (pChild instanceof XsENotation) {
      XsENotation notation = (XsENotation) pChild;
      mySchema.add(factory.newXSNotation(mySchema, notation));
    } else {
View Full Code Here


    /** Creates a new attribute.
     */
    protected void createAttribute(XsGAttrDecls pAttrDecls, DTDAttribute pAttribute)
            throws SAXException {
        XsTAttribute attr = pAttrDecls.createAttribute();
        attr.setName(new XsNCName(getLocalPart(pAttribute.getName())));
        String type = pAttribute.getType();
        XsQName qName;
        if ("CDATA".equals(type)) {
          qName = XSString.getInstance().getName();
        } else if ("ID".equals(type)) {
          qName = XSID.getInstance().getName();
        } else if ("IDREF".equals(type)) {
            qName = XSIDREF.getInstance().getName();
        } else if ("IDREFS".equals(type)) {
            qName = XSIDREFs.getInstance().getName();
        } else if ("ENTITY".equals(type)) {
            qName = XSEntity.getInstance().getName();
        } else if ("ENTITIES".equals(type)) {
            qName = XSEntities.getInstance().getName();
        } else if ("NMTOKEN".equals(type)) {
            qName = XSNMToken.getInstance().getName();
        } else if ("NMTOKENS".equals(type)) {
            qName = XSNMTokens.getInstance().getName();
        } else {
            if (type.startsWith("NOTATION"&&
                Character.isWhitespace(type.charAt("NOTATION".length()))) {
              qName = XSNotation.getInstance().getName();
            } else {
              qName = XSNMToken.getInstance().getName();
            }
            XsTLocalSimpleType simpleType = attr.createSimpleType();
            XsERestriction restriction = simpleType.createRestriction();
            restriction.setBase(new XsQName(qName.getNamespaceURI(), qName.getLocalName(), "xs"));
            if (type.startsWith("(")) {
              type = type.substring(1).trim();
            } else {
              throw new SAXParseException("The enumeration in the type of attribute "
                                            + pAttribute.getName()
                                            + " must begin with an '('.",
                                            pAttribute.getLocator());
            }
            if (type.endsWith(")")) {
                type = type.substring(0, type.length()-1).trim();
            } else {
                throw new SAXParseException("The enumeration in the type of attribute "
                                            + pAttribute.getName()
                                            + " must begin with an '('.",
                                            pAttribute.getLocator());
            }
            StringTokenizer st = new StringTokenizer(type, "|");
            if (!st.hasMoreTokens()) {
              throw new SAXParseException("The enumeration in the type of attribute "
                                            + pAttribute.getName()
                                            + " contains no tokens.",
                                            pAttribute.getLocator());
            }
            while (st.hasMoreTokens()) {
                String token = st.nextToken().trim();
                if ("".equals(token)) {
                  throw new SAXParseException("The enumeration in the type of attribute "
                                                + pAttribute.getName()
                                                + " contains an empty token.",
                                                pAttribute.getLocator());
                }
                XsEEnumeration enumeration = restriction.createEnumeration();
                enumeration.setValue(token);
            }
            qName = null;
        }
        if (qName != null) {
            attr.setType(new XsQName(qName.getNamespaceURI(), qName.getLocalName(), "xs"));
        }
    }
View Full Code Here

      super.validate();
      jaxbProperty = (JAXBProperty) XSUtil.getSingleAppinfo(getAnnotations(), JAXBProperty.class);
    }

    if (jaxbProperty == null) {
      XsTAttribute attr = (XsTAttribute) getXsObject();
      if (attr.getRef() != null) {
        JAXBAttribute refAttr = (JAXBAttribute) getXSSchema().getAttribute(attr.getRef());
        if (refAttr != null) {
          jaxbProperty = refAttr.getJAXBProperty();
        }
      }
    } else {
View Full Code Here

      mySchema.add(factory.newXSAttributeGroup(mySchema, attributeGroup));
    } else if (pChild instanceof XsTTopLevelElement) {
      XsTTopLevelElement element = (XsTTopLevelElement) pChild;
      mySchema.add(factory.newXSElement(mySchema, element));
    } else if (pChild instanceof XsTAttribute) {
      XsTAttribute attribute = (XsTAttribute) pChild;
      mySchema.add(factory.newXSAttribute(mySchema, attribute));
    } else if (pChild instanceof XsENotation) {
      XsENotation notation = (XsENotation) pChild;
      mySchema.add(factory.newXSNotation(mySchema, notation));
    } else {
View Full Code Here

      mySchema.add(factory.newXSAttributeGroup(mySchema, attributeGroup));
    } else if (pChild instanceof XsTTopLevelElement) {
      XsTTopLevelElement element = (XsTTopLevelElement) pChild;
      mySchema.add(factory.newXSElement(mySchema, element));
    } else if (pChild instanceof XsTAttribute) {
      XsTAttribute attribute = (XsTAttribute) pChild;
      mySchema.add(factory.newXSAttribute(mySchema, attribute));
    } else if (pChild instanceof XsENotation) {
      XsENotation notation = (XsENotation) pChild;
      mySchema.add(factory.newXSNotation(mySchema, notation));
    } else {
View Full Code Here

      mySchema.add(factory.newXSAttributeGroup(mySchema, attributeGroup));
    } else if (pChild instanceof XsTTopLevelElement) {
      XsTTopLevelElement element = (XsTTopLevelElement) pChild;
      mySchema.add(factory.newXSElement(mySchema, element));
    } else if (pChild instanceof XsTAttribute) {
      XsTAttribute attribute = (XsTAttribute) pChild;
      mySchema.add(factory.newXSAttribute(mySchema, attribute));
    } else if (pChild instanceof XsENotation) {
      XsENotation notation = (XsENotation) pChild;
      mySchema.add(factory.newXSNotation(mySchema, notation));
    } else {
View Full Code Here

    /** Creates a new attribute.
     */
    protected void createAttribute(XsGAttrDecls pAttrDecls, DTDAttribute pAttribute)
            throws SAXException {
        XsTAttribute attr = pAttrDecls.createAttribute();
        attr.setName(new XsNCName(getLocalPart(pAttribute.getName())));
        String type = pAttribute.getType();
        XsQName qName;
        if ("CDATA".equals(type)) {
          qName = XSString.getInstance().getName();
        } else if ("ID".equals(type)) {
          qName = XSID.getInstance().getName();
        } else if ("IDREF".equals(type)) {
            qName = XSIDREF.getInstance().getName();
        } else if ("IDREFS".equals(type)) {
            qName = XSIDREFs.getInstance().getName();
        } else if ("ENTITY".equals(type)) {
            qName = XSEntity.getInstance().getName();
        } else if ("ENTITIES".equals(type)) {
            qName = XSEntities.getInstance().getName();
        } else if ("NMTOKEN".equals(type)) {
            qName = XSNMToken.getInstance().getName();
        } else if ("NMTOKENS".equals(type)) {
            qName = XSNMTokens.getInstance().getName();
        } else {
            if (type.startsWith("NOTATION"&&
                Character.isWhitespace(type.charAt("NOTATION".length()))) {
              qName = XSNotation.getInstance().getName();
            } else {
              qName = XSNMToken.getInstance().getName();
            }
            XsTLocalSimpleType simpleType = attr.createSimpleType();
            XsERestriction restriction = simpleType.createRestriction();
            restriction.setBase(new XsQName(qName.getNamespaceURI(), qName.getLocalName(), "xs"));
            if (type.startsWith("(")) {
              type = type.substring(1).trim();
            } else {
              throw new SAXParseException("The enumeration in the type of attribute "
                                            + pAttribute.getName()
                                            + " must begin with an '('.",
                                            pAttribute.getLocator());
            }
            if (type.endsWith(")")) {
                type = type.substring(0, type.length()-1).trim();
            } else {
                throw new SAXParseException("The enumeration in the type of attribute "
                                            + pAttribute.getName()
                                            + " must begin with an '('.",
                                            pAttribute.getLocator());
            }
            StringTokenizer st = new StringTokenizer(type, "|");
            if (!st.hasMoreTokens()) {
              throw new SAXParseException("The enumeration in the type of attribute "
                                            + pAttribute.getName()
                                            + " contains no tokens.",
                                            pAttribute.getLocator());
            }
            while (st.hasMoreTokens()) {
                String token = st.nextToken().trim();
                if ("".equals(token)) {
                  throw new SAXParseException("The enumeration in the type of attribute "
                                                + pAttribute.getName()
                                                + " contains an empty token.",
                                                pAttribute.getLocator());
                }
                XsEEnumeration enumeration = restriction.createEnumeration();
                enumeration.setValue(token);
            }
            qName = null;
        }
        if (qName != null) {
            attr.setType(new XsQName(qName.getNamespaceURI(), qName.getLocalName(), "xs"));
        }
    }
View Full Code Here

    for (int i = 0;  i < allAttributes.length;  i++) {
      Object o = allAttributes[i];
      if (o == null) {
        throw new NullPointerException("Null attribute detected.");
      } else if (o instanceof XsTAttribute) {
        XsTAttribute xsTAttr = (XsTAttribute) o;
        if (XsTAttribute.PROHIBITED.equals(xsTAttr.getUse())) {
          continue;
        }
        XSAttribute attribute = pObject.getXSSchema().getXSObjectFactory().newXSAttribute(pObject, xsTAttr);
        attribute.validate();
        attributes.add(attribute);
View Full Code Here

      mySchema.add(factory.newXSAttributeGroup(mySchema, attributeGroup));
    } else if (pChild instanceof XsTTopLevelElement) {
      XsTTopLevelElement element = (XsTTopLevelElement) pChild;
      mySchema.add(factory.newXSElement(mySchema, element));
    } else if (pChild instanceof XsTAttribute) {
      XsTAttribute attribute = (XsTAttribute) pChild;
      mySchema.add(factory.newXSAttribute(mySchema, attribute));
    } else if (pChild instanceof XsENotation) {
      XsENotation notation = (XsENotation) pChild;
      mySchema.add(factory.newXSNotation(mySchema, notation));
    } else {
View Full Code Here

    /** Creates a new attribute.
     */
    protected void createAttribute(XsGAttrDecls pAttrDecls, DTDAttribute pAttribute)
            throws SAXException {
        XsTAttribute attr = pAttrDecls.createAttribute();
        attr.setName(new XsNCName(getLocalPart(pAttribute.getName())));
        String type = pAttribute.getType();
        XsQName qName;
        if ("CDATA".equals(type)) {
          qName = XSString.getInstance().getName();
        } else if ("ID".equals(type)) {
          qName = XSID.getInstance().getName();
        } else if ("IDREF".equals(type)) {
            qName = XSIDREF.getInstance().getName();
        } else if ("IDREFS".equals(type)) {
            qName = XSIDREFs.getInstance().getName();
        } else if ("ENTITY".equals(type)) {
            qName = XSEntity.getInstance().getName();
        } else if ("ENTITIES".equals(type)) {
            qName = XSEntities.getInstance().getName();
        } else if ("NMTOKEN".equals(type)) {
            qName = XSNMToken.getInstance().getName();
        } else if ("NMTOKENS".equals(type)) {
            qName = XSNMTokens.getInstance().getName();
        } else {
            if (type.startsWith("NOTATION"&&
                Character.isWhitespace(type.charAt("NOTATION".length()))) {
              qName = XSNotation.getInstance().getName();
            } else {
              qName = XSNMToken.getInstance().getName();
            }
            XsTLocalSimpleType simpleType = attr.createSimpleType();
            XsERestriction restriction = simpleType.createRestriction();
            restriction.setBase(new XsQName(qName.getNamespaceURI(), qName.getLocalName(), "xs"));
            if (type.startsWith("(")) {
              type = type.substring(1).trim();
            } else {
              throw new SAXParseException("The enumeration in the type of attribute "
                                            + pAttribute.getName()
                                            + " must begin with an '('.",
                                            pAttribute.getLocator());
            }
            if (type.endsWith(")")) {
                type = type.substring(0, type.length()-1).trim();
            } else {
                throw new SAXParseException("The enumeration in the type of attribute "
                                            + pAttribute.getName()
                                            + " must begin with an '('.",
                                            pAttribute.getLocator());
            }
            StringTokenizer st = new StringTokenizer(type, "|");
            if (!st.hasMoreTokens()) {
              throw new SAXParseException("The enumeration in the type of attribute "
                                            + pAttribute.getName()
                                            + " contains no tokens.",
                                            pAttribute.getLocator());
            }
            while (st.hasMoreTokens()) {
                String token = st.nextToken().trim();
                if ("".equals(token)) {
                  throw new SAXParseException("The enumeration in the type of attribute "
                                                + pAttribute.getName()
                                                + " contains an empty token.",
                                                pAttribute.getLocator());
                }
                XsEEnumeration enumeration = restriction.createEnumeration();
                enumeration.setValue(token);
            }
            qName = null;
        }
        if (qName != null) {
            attr.setType(new XsQName(qName.getNamespaceURI(), qName.getLocalName(), "xs"));
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.ws.jaxme.xs.xml.XsTAttribute

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.