Package org.apache.xerces.xs

Examples of org.apache.xerces.xs.AttributePSVI


    for (int i = 0; i < attrCount; i++) {
      attributes.getName(i, fAttrQName);
      Attr attr = null;

      attr = currentElement.getAttributeNodeNS(fAttrQName.uri, fAttrQName.localpart);
            AttributePSVI attrPSVI =
        (AttributePSVI) attributes.getAugmentations(i).getItem(Constants.ATTRIBUTE_PSVI);

      if (attrPSVI != null) {
                //REVISIT: instead we should be using augmentations:
                // to set/retrieve Id attributes
                XSTypeDefinition decl = attrPSVI.getMemberTypeDefinition();
                boolean id = false;
                if (decl != null){
                    id = ((XSSimpleType)decl).isIDType();
                } else{
                    decl = attrPSVI.getTypeDefinition();
                    if (decl !=null){
                       id = ((XSSimpleType)decl).isIDType();
                    }
                }
                if (id){
                    ((ElementImpl)currentElement).setIdAttributeNode(attr, true);
                }
               
        if (fPSVI) {
          ((PSVIAttrNSImpl) attr).setPSVI(attrPSVI);
        }
        if ((fConfiguration.features & DOMConfigurationImpl.DTNORMALIZATION) != 0) {
          // datatype-normalization
          // NOTE: The specified value MUST be set after we set
          //       the node value because that turns the "specified"
          //       flag to "true" which may overwrite a "false"
          //       value from the attribute list.
          boolean specified = attr.getSpecified();
          attr.setValue(attrPSVI.getSchemaNormalizedValue());
          if (!specified) {
            ((AttrImpl) attr).setSpecified(specified);
          }
        }
      }
View Full Code Here


                            if (fCurrentStep[i] == steps.length) {
                                fMatched[i] = MATCHED_ATTRIBUTE;
                                int j=0;
                                for(; j<i && ((fMatched[j] & MATCHED) != MATCHED); j++);
                                if(j==i) {
                                    AttributePSVI attrPSVI = (AttributePSVI)attributes.getAugmentations(aIndex).getItem(Constants.ATTRIBUTE_PSVI);
                                    fMatchedString = attrPSVI.getActualNormalizedValue();
                                    matched(fMatchedString, false);
                                }
                            }
                            break;
                        }
View Full Code Here

  public String getSchemaDeterminedID(XMLAttributes paramXMLAttributes, int paramInt)
    throws XNIException
  {
    Augmentations localAugmentations = paramXMLAttributes.getAugmentations(paramInt);
    AttributePSVI localAttributePSVI = (AttributePSVI)localAugmentations.getItem("ATTRIBUTE_PSVI");
    if (localAttributePSVI != null)
    {
      Object localObject = localAttributePSVI.getMemberTypeDefinition();
      if (localObject != null)
        localObject = localAttributePSVI.getTypeDefinition();
      if ((localObject != null) && (((XSSimpleType)localObject).isIDType()))
        return localAttributePSVI.getSchemaNormalizedValue();
    }
    return (String)null;
  }
View Full Code Here

      {
        paramXMLAttributes.getName(j, this.fAttributeQName);
        AttrImpl localAttrImpl = (AttrImpl)this.fDocumentImpl.createAttributeNS(this.fAttributeQName.uri, this.fAttributeQName.rawname, this.fAttributeQName.localpart);
        localAttrImpl.setValue(paramXMLAttributes.getValue(j));
        localElement.setAttributeNodeNS(localAttrImpl);
        AttributePSVI localAttributePSVI = (AttributePSVI)paramXMLAttributes.getAugmentations(j).getItem("ATTRIBUTE_PSVI");
        if (localAttributePSVI != null)
        {
          if (this.fStorePSVI)
            ((PSVIAttrNSImpl)localAttrImpl).setPSVI(localAttributePSVI);
          Object localObject = localAttributePSVI.getMemberTypeDefinition();
          if (localObject == null)
          {
            localObject = localAttributePSVI.getTypeDefinition();
            if (localObject != null)
            {
              localAttrImpl.setType(localObject);
              if (((XSSimpleType)localObject).isIDType())
                ((ElementImpl)localElement).setIdAttributeNode(localAttrImpl, true);
View Full Code Here

      if ((paramInt < 0) || (this.fAttributes.getLength() <= paramInt))
        throw new IndexOutOfBoundsException(Integer.toString(paramInt));
      Augmentations localAugmentations = this.fAttributes.getAugmentations(paramInt);
      if (localAugmentations == null)
        return null;
      AttributePSVI localAttributePSVI = (AttributePSVI)localAugmentations.getItem("ATTRIBUTE_PSVI");
      return getTypeInfoFromPSVI(localAttributePSVI);
    }
View Full Code Here

                attributes.getName (i, fAttrQName);
                Attr attr = createAttrNode (fAttrQName);

                String attrValue = attributes.getValue (i);

                AttributePSVI attrPSVI =(AttributePSVI) attributes.getAugmentations (i).getItem (Constants.ATTRIBUTE_PSVI);
                if (fStorePSVI && attrPSVI != null){
                    ((PSVIAttrNSImpl) attr).setPSVI (attrPSVI);
                }


                attr.setValue (attrValue);
                el.setAttributeNode (attr);
                // NOTE: The specified value MUST be set after you set
                //       the node value because that turns the "specified"
                //       flag to "true" which may overwrite a "false"
                //       value from the attribute list. -Ac
                if (fDocumentImpl != null) {
                    AttrImpl attrImpl = (AttrImpl) attr;
                    Object type = null;
                    boolean id = false;

                    // REVISIT: currently it is possible that someone turns off
                    // namespaces and turns on xml schema validation
                    // To avoid classcast exception in AttrImpl check for namespaces
                    // however the correct solution should probably disallow setting
                    // namespaces to false when schema processing is turned on.
                    if (attrPSVI != null && fNamespaceAware) {
                        // XML Schema
                        type = attrPSVI.getMemberTypeDefinition ();
                        if (type == null) {
                            type = attrPSVI.getTypeDefinition ();
                            if (type != null) {
                                id = ((XSSimpleType) type).isIDType ();
                                attrImpl.setType (type);
                            }
                        }
                        else {
                            id = ((XSSimpleType) type).isIDType ();
                            attrImpl.setType (type);
                        }
                    }
                    else {
                        // DTD
                        boolean isDeclared = Boolean.TRUE.equals (attributes.getAugmentations (i).getItem (Constants.ATTRIBUTE_DECLARED));
                        // For DOM Level 3 TypeInfo, the type name must
                        // be null if this attribute has not been declared
                        // in the DTD.
                        if (isDeclared) {
                            type = attributes.getType (i);
                            id = "ID".equals (type);
                        }
                        attrImpl.setType (type);
                    }

                    if (id) {
                        ((ElementImpl) el).setIdAttributeNode (attr, true);
                    }

                    attrImpl.setSpecified (attributes.isSpecified (i));
                    // REVISIT: Handle entities in attribute value.
                }
            }
            setCharacterData (false);

            if (augs != null) {
                ElementPSVI elementPSVI = (ElementPSVI)augs.getItem (Constants.ELEMENT_PSVI);
                if (elementPSVI != null && fNamespaceAware) {
                    XSTypeDefinition type = elementPSVI.getMemberTypeDefinition ();
                    if (type == null) {
                        type = elementPSVI.getTypeDefinition ();
                    }
                    ((ElementNSImpl)el).setType (type);
                }
            }


            // filter nodes
            if (fDOMFilter != null && !fInEntityRef) {
                if (fRoot.rawname == null) {
                    // fill value of the root element
                    fRoot.setValues(element);
                } else {
                    short code = fDOMFilter.startElement(el);
                    switch (code) {
                        case LSParserFilter.FILTER_INTERRUPT :
                            {
                                throw abort;
                            }
                        case LSParserFilter.FILTER_REJECT :
                            {
                                fFilterReject = true;
                                fRejectedElement.setValues(element);
                                return;
                            }
                        case LSParserFilter.FILTER_SKIP :
                            {
                                fSkippedElemStack.push(element);
                                return;
                            }
                        default : {}
                    }
                }
            }
            fCurrentNode.appendChild (el);
            fCurrentNode = el;
        }
        else {
            Object type = null;
            if (augs != null) {
                ElementPSVI elementPSVI = (ElementPSVI)augs.getItem (Constants.ELEMENT_PSVI);
                if (elementPSVI != null) {
                    type = elementPSVI.getMemberTypeDefinition ();
                    if (type == null) {
                        type = elementPSVI.getTypeDefinition ();
                    }
                }
            }

            int el =
            fDeferredDocumentImpl.createDeferredElement (fNamespaceAware ?
            element.uri : null,
            element.rawname,
            type);
            int attrCount = attributes.getLength ();
            for (int i = 0; i < attrCount; i++) {
                // set type information
                AttributePSVI attrPSVI = (AttributePSVI)attributes.getAugmentations (i).getItem (Constants.ATTRIBUTE_PSVI);
                boolean id = false;

                // REVISIT: currently it is possible that someone turns off
                // namespaces and turns on xml schema validation
                // To avoid classcast exception in AttrImpl check for namespaces
                // however the correct solution should probably disallow setting
                // namespaces to false when schema processing is turned on.
                if (attrPSVI != null && fNamespaceAware) {
                    // XML Schema
                    type = attrPSVI.getMemberTypeDefinition ();
                    if (type == null) {
                        type = attrPSVI.getTypeDefinition ();
                        if (type != null){
                            id = ((XSSimpleType) type).isIDType ();
                        }
                    }
                    else {
View Full Code Here

    for (int j = 0; j < i; j++)
    {
      paramXMLAttributes.getName(j, this.fAttrQName);
      Attr localAttr = null;
      localAttr = localElement.getAttributeNodeNS(this.fAttrQName.uri, this.fAttrQName.localpart);
      AttributePSVI localAttributePSVI = (AttributePSVI)paramXMLAttributes.getAugmentations(j).getItem("ATTRIBUTE_PSVI");
      if (localAttributePSVI == null)
        continue;
      Object localObject = localAttributePSVI.getMemberTypeDefinition();
      boolean bool1 = false;
      if (localObject != null)
      {
        bool1 = ((XSSimpleType)localObject).isIDType();
      }
      else
      {
        localObject = localAttributePSVI.getTypeDefinition();
        if (localObject != null)
          bool1 = ((XSSimpleType)localObject).isIDType();
      }
      if (bool1)
        ((ElementImpl)localElement).setIdAttributeNode(localAttr, true);
      if (this.fPSVI)
        ((PSVIAttrNSImpl)localAttr).setPSVI(localAttributePSVI);
      if ((this.fConfiguration.features & 0x2) == 0)
        continue;
      boolean bool2 = localAttr.getSpecified();
      localAttr.setValue(localAttributePSVI.getSchemaNormalizedValue());
      if (bool2)
        continue;
      ((AttrImpl)localAttr).setSpecified(bool2);
    }
  }
View Full Code Here

      for (m = 0; m < i; m++)
      {
        paramXMLAttributes.getName(m, this.fAttrQName);
        localObject2 = createAttrNode(this.fAttrQName);
        localObject3 = paramXMLAttributes.getValue(m);
        AttributePSVI localAttributePSVI2 = (AttributePSVI)paramXMLAttributes.getAugmentations(m).getItem("ATTRIBUTE_PSVI");
        if ((this.fStorePSVI) && (localAttributePSVI2 != null))
          ((PSVIAttrNSImpl)localObject2).setPSVI(localAttributePSVI2);
        ((Attr)localObject2).setValue((String)localObject3);
        boolean bool3 = paramXMLAttributes.isSpecified(m);
        if ((!bool3) && ((k != 0) || ((this.fAttrQName.uri != null) && (this.fAttrQName.prefix == null))))
        {
          ((Element)localObject1).setAttributeNodeNS((Attr)localObject2);
          k = 1;
        }
        else
        {
          ((Element)localObject1).setAttributeNode((Attr)localObject2);
        }
        if (this.fDocumentImpl == null)
          continue;
        AttrImpl localAttrImpl = (AttrImpl)localObject2;
        Object localObject4 = null;
        boolean bool4 = false;
        if ((localAttributePSVI2 != null) && (this.fNamespaceAware))
        {
          localObject4 = localAttributePSVI2.getMemberTypeDefinition();
          if (localObject4 == null)
          {
            localObject4 = localAttributePSVI2.getTypeDefinition();
            if (localObject4 != null)
            {
              bool4 = ((XSSimpleType)localObject4).isIDType();
              localAttrImpl.setType(localObject4);
            }
          }
          else
          {
            bool4 = ((XSSimpleType)localObject4).isIDType();
            localAttrImpl.setType(localObject4);
          }
        }
        else
        {
          boolean bool5 = Boolean.TRUE.equals(paramXMLAttributes.getAugmentations(m).getItem("ATTRIBUTE_DECLARED"));
          if (bool5)
          {
            localObject4 = paramXMLAttributes.getType(m);
            bool4 = "ID".equals(localObject4);
          }
          localAttrImpl.setType(localObject4);
        }
        if (bool4)
          ((ElementImpl)localObject1).setIdAttributeNode((Attr)localObject2, true);
        localAttrImpl.setSpecified(bool3);
      }
      setCharacterData(false);
      if (paramAugmentations != null)
      {
        localObject2 = (ElementPSVI)paramAugmentations.getItem("ELEMENT_PSVI");
        if ((localObject2 != null) && (this.fNamespaceAware))
        {
          localObject3 = ((ItemPSVI)localObject2).getMemberTypeDefinition();
          if (localObject3 == null)
            localObject3 = ((ItemPSVI)localObject2).getTypeDefinition();
          ((ElementNSImpl)localObject1).setType((XSTypeDefinition)localObject3);
        }
      }
      if ((this.fDOMFilter != null) && (!this.fInEntityRef))
        if (this.fRoot.rawname == null)
        {
          this.fRoot.setValues(paramQName);
        }
        else
        {
          int n = this.fDOMFilter.startElement((Element)localObject1);
          switch (n)
          {
          case 4:
            throw abort;
          case 2:
            this.fFilterReject = true;
            this.fRejectedElement.setValues(paramQName);
            return;
          case 3:
            this.fSkippedElemStack.push(paramQName.clone());
            return;
          }
        }
      this.fCurrentNode.appendChild((Node)localObject1);
      this.fCurrentNode = ((Node)localObject1);
    }
    else
    {
      localObject1 = null;
      if (paramAugmentations != null)
      {
        ElementPSVI localElementPSVI = (ElementPSVI)paramAugmentations.getItem("ELEMENT_PSVI");
        if (localElementPSVI != null)
        {
          localObject1 = localElementPSVI.getMemberTypeDefinition();
          if (localObject1 == null)
            localObject1 = localElementPSVI.getTypeDefinition();
        }
      }
      int j = this.fDeferredDocumentImpl.createDeferredElement(this.fNamespaceAware ? paramQName.uri : null, paramQName.rawname, localObject1);
      k = paramXMLAttributes.getLength();
      for (m = k - 1; m >= 0; m--)
      {
        AttributePSVI localAttributePSVI1 = (AttributePSVI)paramXMLAttributes.getAugmentations(m).getItem("ATTRIBUTE_PSVI");
        boolean bool1 = false;
        if ((localAttributePSVI1 != null) && (this.fNamespaceAware))
        {
          localObject1 = localAttributePSVI1.getMemberTypeDefinition();
          if (localObject1 == null)
          {
            localObject1 = localAttributePSVI1.getTypeDefinition();
            if (localObject1 != null)
              bool1 = ((XSSimpleType)localObject1).isIDType();
          }
          else
          {
View Full Code Here

                    break;
                  this.fMatched[i] = 3;
                  for (int i2 = 0; (i2 < i) && ((this.fMatched[i2] & 0x1) != 1); i2++);
                  if (i2 != i)
                    break;
                  AttributePSVI localAttributePSVI = (AttributePSVI)paramXMLAttributes.getAugmentations(i1).getItem("ATTRIBUTE_PSVI");
                  this.fMatchedString = localAttributePSVI.getActualNormalizedValue();
                  matched(this.fMatchedString, localAttributePSVI.getActualNormalizedValueType(), localAttributePSVI.getItemValueTypes(), false);
                  break;
                }
              }
              if ((this.fMatched[i] & 0x1) == 1)
                continue;
View Full Code Here

        {
          paramXMLAttributes.getName(k, this.fAttributeQName);
          localObject = (AttrImpl)this.fDocumentImpl.createAttributeNS(this.fAttributeQName.uri, this.fAttributeQName.rawname, this.fAttributeQName.localpart);
          ((AttrImpl)localObject).setValue(paramXMLAttributes.getValue(k));
          localElement.setAttributeNodeNS((Attr)localObject);
          AttributePSVI localAttributePSVI = (AttributePSVI)paramXMLAttributes.getAugmentations(k).getItem("ATTRIBUTE_PSVI");
          if ((localAttributePSVI != null) && (processAttributePSVI((AttrImpl)localObject, localAttributePSVI)))
            ((ElementImpl)localElement).setIdAttributeNode((Attr)localObject, true);
          ((AttrImpl)localObject).setSpecified(false);
        }
  }
View Full Code Here

TOP

Related Classes of org.apache.xerces.xs.AttributePSVI

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.