Examples of AttributeElement


Examples of org.jibx.schema.elements.AttributeElement

     */
    public boolean visit(AttributeElement node) {
        if (node.getUse() != AttributeElement.PROHIBITED_USE) {
           
            // check for direct definition (rather than reference)
            AttributeElement refattr = node.getReference();
            if (refattr == null) {
                if (node.getType() == null) {
                   
                    // create a group for the embedded definition
                    buildStructure(false, node);
View Full Code Here

Examples of org.jibx.schema.elements.AttributeElement

            case SchemaBase.ATTRIBUTE_TYPE:
            {
                if (isIgnored()) {
                    delete = true;
                } else {
                    AttributeElement attr = ((AttributeElement)component);
                    if (m_overrideType != null) {
                        attr.setType(m_overrideType);
                    }
                    QName type = attr.getType();
                    if (type == null) {
                        AttributeElement ref = attr.getReference();
                        if (ref != null) {
                            delete = !checkReference(ref);
                        } else if (!attr.isInlineType()) {
                            attr.setType(SchemaTypes.ANY_SIMPLE_TYPE.getQName());
                        }
                    } else {
                        QName repl = replaceAndReference(type, vctx);
                        if (repl == null) {
                            // TODO optionally make sure the attribute is optional?
                            delete = true;
                        } else if (repl != type) {
                            attr.setType(repl);
                        }
                    }
                }
                break;
            }
           
            case SchemaBase.ATTRIBUTEGROUP_TYPE:
            {
                if (component instanceof AttributeGroupRefElement) {
                    delete = !checkReference(((AttributeGroupRefElement)component).getReference());
                }
                break;
            }
           
            case SchemaBase.ELEMENT_TYPE:
            {
                ElementElement elem = ((ElementElement)component);
                if (isIgnored()) {
                   
                    // reference or definition determines handling
                    QName ref = elem.getRef();
                    if (ref == null) {
                       
                        // definition, just delete all content
                        for (int i = 0; i < elem.getChildCount(); i++) {
                            elem.detachChild(i);
                        }
                        elem.compactChildren();
                       
                    } else {
                       
                        // reference may be to other namespace, so convert to qualified name string
                        StringBuffer buff = new StringBuffer();
                        buff.append('{');
                        if (ref.getUri() != null) {
                            buff.append(ref.getUri());
                        }
                        buff.append('}');
                        buff.append(ref.getName());
                        elem.setName(buff.toString());
                        elem.setRef(null);
                       
                    }
                    elem.setType(SchemaTypes.ANY_TYPE.getQName());
View Full Code Here

Examples of org.jibx.schema.elements.AttributeElement

            {
               
                case SchemaBase.ATTRIBUTE_TYPE:
                {
                    // set the attribute type to the specified type
                    AttributeElement attr = (AttributeElement)parent;
                    attr.setType(derive.getBase());
                    return true;
                }
               
                case SchemaBase.COMPLEXTYPE_TYPE:
                {
View Full Code Here

Examples of org.jibx.schema.elements.AttributeElement

                   
                } else if (comp.type() == SchemaBase.ATTRIBUTE_TYPE) {
                   
                    // value is an attribute, set the name directly
                    value.setEffectiveStyle(NestingAttributes.ATTRIBUTE_STYLE);
                    AttributeElement attr = (AttributeElement)comp;
                    if (SchemaUtils.isOptionalAttribute(attr)) {
                        // TODO: this is needed because the optional status doesn't inherit downward for embedded items, as
                        // when a simpleType is nested inside an optional attribute. should the code be changed to
                        // inherit instead?
                        value.setUsage(PropertyAttributes.OPTIONAL_USAGE);
View Full Code Here

Examples of org.jibx.schema.elements.AttributeElement

     *
     * @param qname name
     * @param def attribute definition
     */
    public void registerAttribute(QName qname, AttributeElement def) {
        AttributeElement dupl = m_nameRegister.registerAttribute(qname, def);
        if (dupl != null) {
            addError("Duplicate name " + qname, def);
        }
    }
View Full Code Here

Examples of org.jibx.schema.elements.AttributeElement

        for (int i = 0; i < comps.size(); i++) {
            IComponent comp = (IComponent)comps.get(i);
            if (comp instanceof ValueElement) {
               
                // simple attribute definition
                AttributeElement attr = new AttributeElement();
                attr.setName(comp.getName());
                QName qname = getSimpleTypeQName(comp);
                if (qname == null) {
                    attr.setTypeDefinition(buildSimpleType(comp));
                } else {
                    setAttributeType(qname, attr, hold);
                }
                if (!comp.isOptional()) {
                    attr.setUse(AttributeElement.REQUIRED_USE);
                }
                addItemDocumentation((ValueElement)comp, attr);
                attrs.add(attr);
               
            } else if (comp instanceof ContainerElementBase) {
View Full Code Here

Examples of uk.co.brunella.osgi.bdt.repository.model.AttributeElement

  private AttributeElement[] parseAttribute(String value) {
    if (value == null) {
      return null;
    }
    List<AttributeElement> elements = new ArrayList<AttributeElement>();
    AttributeElement element = null;
    Tokenizer tokenizer = new Tokenizer(value);
    int type = tokenizer.next();
    while (type != Tokenizer.EOF && type != Tokenizer.ERROR) {
      if (type == Tokenizer.VALUE) {
        if (element == null) {
          element = new AttributeElement();
          elements.add(element);
        }
        element.addValue(tokenizer.getValue());
      } else if (type == Tokenizer.ATTRIBUTE) {
        element.addAttribute(tokenizer.getName(), tokenizer.getValue());
      } else if (type == Tokenizer.DIRECTIVE) {
        element.addDirective(tokenizer.getName(), tokenizer.getValue());
      } else if (type == Tokenizer.SEPARATOR) {
        element = null;
      }
      type = tokenizer.next();
    }
View Full Code Here

Examples of uk.co.brunella.osgi.bdt.repository.model.AttributeElement

    if (elements == null) {
      requireBundles = new RequireBundle[0];
    } else {
      requireBundles = new RequireBundle[elements.length];
      for (int i = 0; i < elements.length; i++) {
        AttributeElement element = elements[i];
        String name = element.getValues().get(0);
        VersionRange versionRange;
        String[] versionString = element.getAttributes().get(BUNDLE_VERSION_ATTRIBUTE);
        if (versionString == null || versionString.length != 1) {
          versionRange = VersionRange.parseVersionRange("");
        } else {
          versionRange = VersionRange.parseVersionRange(versionString[0]);
        }
        String[] visibility = element.getDirectiveValues(VISIBILITY_DIRECTIVE);
        boolean reexport = true;
        if (visibility != null && visibility.length == 1) {
          reexport = VISIBILITY_REEXPORT.equals(visibility[0]);
        }
        String[] resolution = element.getDirectiveValues(RESOLUTION_DIRECTIVE);
        boolean mandatory = true;
        if (resolution != null && resolution.length == 1) {
          mandatory = RESOLUTION_MANDATORY.equals(resolution[0]);
        }
        requireBundles[i] = new RequireBundle(this, name, versionRange, reexport, mandatory);
View Full Code Here

Examples of uk.co.brunella.osgi.bdt.repository.model.AttributeElement

    if (elements == null) {
      exportPackages = new ExportPackage[0];
    } else {
      exportPackages = new ExportPackage[elements.length];
      for (int i = 0; i < elements.length; i++) {
        AttributeElement element = elements[i];
        String packageName = element.getValues().get(0);
        Version version;
        String[] versionString = element.getAttributes().get(VERSION_ATTRIBUTE);
        if (versionString == null || versionString.length != 1) {
          versionString = element.getAttributes().get(PACKAGE_SPECIFICATION_VERSION);
        }
       
        if (versionString == null || versionString.length != 1) {
          version = Version.parseVersion("");
        } else {
          version = Version.parseVersion(versionString[0]);
        }
        ExportPackage exportPackage = new ExportPackage(this, packageName, version);
        exportPackage.addDirective(Constants.INCLUDE_DIRECTIVE, element.getDirectiveValues(Constants.INCLUDE_DIRECTIVE));
        exportPackage.addDirective(Constants.EXCLUDE_DIRECTIVE, element.getDirectiveValues(Constants.EXCLUDE_DIRECTIVE));
        exportPackages[i] = exportPackage;
      }
    }
  }
View Full Code Here

Examples of uk.co.brunella.osgi.bdt.repository.model.AttributeElement

    if (elements == null) {
      importPackages = new ImportPackage[0];
    } else {
      importPackages = new ImportPackage[elements.length];
      for (int i = 0; i < elements.length; i++) {
        AttributeElement element = elements[i];
        String packageName = element.getValues().get(0);
        VersionRange versionRange;
        String[] versionString = element.getAttributes().get(VERSION_ATTRIBUTE);
       
        if (versionString == null || versionString.length != 1) {
          versionRange = VersionRange.parseVersionRange("");
        } else {
          versionRange = VersionRange.parseVersionRange(versionString[0]);
        }
        String[] resolution = element.getDirectiveValues(RESOLUTION_DIRECTIVE);
        boolean mandatory = true;
        if (resolution != null && resolution.length == 1) {
          mandatory = RESOLUTION_MANDATORY.equals(resolution[0]);
        }
        importPackages[i] = new ImportPackage(this, packageName, versionRange, mandatory);
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.