Package org.apache.xerces.dom

Examples of org.apache.xerces.dom.AttrImpl


                // 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;
                    boolean specified = attributes.isSpecified(i);
                    attrImpl.setSpecified(specified);
                    // identifier registration
                    if (attributes.getType(i).equals("ID")) {
                        fDocumentImpl.putIdentifier(attrValue, el);
                    }
                }
View Full Code Here


                // REVISIT: Check for uniqueness of element name? -Ac

                // create attribute and set properties
                boolean nsEnabled = fNamespaceAware;
                AttrImpl attr;
                if (nsEnabled) {
                    String namespaceURI = null;
                    // DOM Level 2 wants all namespace declaration attributes
                    // to be bound to "http://www.w3.org/2000/xmlns/"
                    // So as long as the XML parser doesn't do it, it needs to
                    // done here.
                    if (attributeName.startsWith("xmlns:") ||
                        attributeName.equals("xmlns")) {
                        namespaceURI = NamespaceContext.XMLNS_URI;
                    }
                    attr = (AttrImpl)fDocumentImpl.createAttributeNS(namespaceURI,
                                                                attributeName);
                }
                else {
                    attr = (AttrImpl)fDocumentImpl.createAttribute(attributeName);
                }
                attr.setValue(defaultValue.toString());
                attr.setSpecified(false);

                // add default attribute to element definition
                if (nsEnabled){
                    elementDef.getAttributes().setNamedItemNS(attr);
                }
View Full Code Here

        final NamedNodeMap attrMap = currentElement.getAttributes();
       
        final int oldLength = attrMap.getLength();
        // If it's a Xerces DOM store type information for attributes, set idness, etc..
        if (fDocumentImpl != null) {
            AttrImpl attr;
            for (int i = 0; i < oldLength; ++i) {
                attr = (AttrImpl) attrMap.item(i);
               
                // write type information to this attribute
                AttributePSVI attrPSVI = (AttributePSVI) attributes.getAugmentations(i).getItem (Constants.ATTRIBUTE_PSVI);
                if (attrPSVI != null) {
                    if (processAttributePSVI(attr, attrPSVI)) {
                        ((ElementImpl) currentElement).setIdAttributeNode (attr, true);
                    }
                }
            }
        }
       
        final int newLength = attributes.getLength();
        // Add default/fixed attributes
        if (newLength > oldLength) {
            if (fDocumentImpl == null) {
                for (int i = oldLength; i < newLength; ++i) {
                    attributes.getName(i, fAttributeQName);
                    currentElement.setAttributeNS(fAttributeQName.uri, fAttributeQName.rawname, attributes.getValue(i));
                }
            }
            // If it's a Xerces DOM store type information for attributes, set idness, etc..
            else {
                for (int i = oldLength; i < newLength; ++i) {
                    attributes.getName(i, fAttributeQName);
                    AttrImpl attr = (AttrImpl) fDocumentImpl.createAttributeNS(fAttributeQName.uri,
                            fAttributeQName.rawname, fAttributeQName.localpart);
                    attr.setValue(attributes.getValue(i));
                   
                    // write type information to this attribute
                    AttributePSVI attrPSVI = (AttributePSVI) attributes.getAugmentations(i).getItem (Constants.ATTRIBUTE_PSVI);
                    if (attrPSVI != null) {
                        if (processAttributePSVI(attr, attrPSVI)) {
                            ((ElementImpl) currentElement).setIdAttributeNode (attr, true);
                        }
                    }
                    attr.setSpecified(false);
                    currentElement.setAttributeNode(attr);
                }
            }
        }
    }
View Full Code Here

                // 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;
                    boolean specified = attributes.isSpecified(i);
                    attrImpl.setSpecified(specified);
        // identifier registration
        if (attributes.getType(i).equals("ID")) {
                        fDocumentImpl.putIdentifier(attrValue, el);
                    }
                }
View Full Code Here

                // REVISIT: Check for uniqueness of element name? -Ac

                // create attribute and set properties
                boolean nsEnabled = fNamespaceAware;
                AttrImpl attr;
                if (nsEnabled) {
                    String namespaceURI = null;
                    // DOM Level 2 wants all namespace declaration attributes
                    // to be bound to "http://www.w3.org/2000/xmlns/"
                    // So as long as the XML parser doesn't do it, it needs to
                    // done here.
                    if (attributeName.startsWith("xmlns:") ||
                        attributeName.equals("xmlns")) {
                        namespaceURI = NamespaceContext.XMLNS_URI;
                    }
                    attr = (AttrImpl)fDocumentImpl.createAttributeNS(namespaceURI,
                                                                attributeName);
                }
                else {
                    attr = (AttrImpl)fDocumentImpl.createAttribute(attributeName);
                }
                attr.setValue(defaultValue.toString());
                attr.setSpecified(false);

                // add default attribute to element definition
                if (nsEnabled){
                    elementDef.getAttributes().setNamedItemNS(attr);
                }
View Full Code Here

    {
      localElement = this.fDocumentImpl.createElementNS(paramQName.uri, paramQName.rawname, paramQName.localpart);
      for (j = 0; j < i; j++)
      {
        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);
            }
          }
          else
          {
            localAttrImpl.setType(localObject);
            if (((XSSimpleType)localObject).isIDType())
              ((ElementImpl)localElement).setIdAttributeNode(localAttrImpl, true);
          }
        }
        localAttrImpl.setSpecified(paramXMLAttributes.isSpecified(j));
      }
    }
    append(localElement);
    this.fCurrentNode = localElement;
    if (this.fFragmentRoot == null)
View Full Code Here

                // 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);
View Full Code Here

                // REVISIT: Check for uniqueness of element name? -Ac

                // create attribute and set properties
                boolean nsEnabled = fNamespaceAware;
                AttrImpl attr;
                if (nsEnabled) {
                    String namespaceURI = null;
                    // DOM Level 2 wants all namespace declaration attributes
                    // to be bound to "http://www.w3.org/2000/xmlns/"
                    // So as long as the XML parser doesn't do it, it needs to
                    // done here.
                    if (attributeName.startsWith ("xmlns:") ||
                    attributeName.equals ("xmlns")) {
                        namespaceURI = NamespaceContext.XMLNS_URI;
                    }
                    attr = (AttrImpl)fDocumentImpl.createAttributeNS (namespaceURI,
                    attributeName);
                }
                else {
                    attr = (AttrImpl)fDocumentImpl.createAttribute (attributeName);
                }
                attr.setValue (defaultValue.toString ());
                attr.setSpecified (false);
                attr.setIdAttribute ("ID".equals (type));

                // add default attribute to element definition
                if (nsEnabled){
                    elementDef.getAttributes ().setNamedItemNS (attr);
                }
View Full Code Here

        {
          ((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");
View Full Code Here

      {
        localElementDefinitionImpl = this.fDocumentImpl.createElementDefinition(paramString1);
        ((DocumentTypeImpl)this.fDocumentType).getElements().setNamedItem(localElementDefinitionImpl);
      }
      boolean bool = this.fNamespaceAware;
      AttrImpl localAttrImpl;
      if (bool)
      {
        String str = null;
        if ((paramString2.startsWith("xmlns:")) || (paramString2.equals("xmlns")))
          str = NamespaceContext.XMLNS_URI;
        localAttrImpl = (AttrImpl)this.fDocumentImpl.createAttributeNS(str, paramString2);
      }
      else
      {
        localAttrImpl = (AttrImpl)this.fDocumentImpl.createAttribute(paramString2);
      }
      localAttrImpl.setValue(paramXMLString1.toString());
      localAttrImpl.setSpecified(false);
      localAttrImpl.setIdAttribute("ID".equals(paramString3));
      if (bool)
        localElementDefinitionImpl.getAttributes().setNamedItemNS(localAttrImpl);
      else
        localElementDefinitionImpl.getAttributes().setNamedItem(localAttrImpl);
    }
View Full Code Here

TOP

Related Classes of org.apache.xerces.dom.AttrImpl

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.