Examples of AttributePSVI


Examples of org.apache.xerces.xni.psvi.AttributePSVI

    }

    private void processPSVIAttribute(Augmentations augs) {
        if (augs == null)
            return;
        AttributePSVI attrPSVI =
            (AttributePSVI)augs.getItem(Constants.ATTRIBUTE_PSVI);
        if (attrPSVI != null) {
            sendElementEvent(
                "psv:validationAttempted",
                this.translateValidationAttempted(
                    attrPSVI.getValidationAttempted()));
            // Would rather getValidationContext() return element info item.
            // This is not the same as XSV.
            sendElementEvent(
                "psv:validationContext",
                attrPSVI.getValidationContext());

            sendElementEvent(
                "psv:validity",
                this.translateValidity(attrPSVI.getValidity()));

            processPSVISchemaErrorCode(attrPSVI.getErrorCodes());
            sendElementEvent(
                "psv:schemaNormalizedValue",
                attrPSVI.getSchemaNormalizedValue());
            sendElementEvent(
                "psv:schemaSpecified",
                attrPSVI.getIsSchemaSpecified() ? "schema" : "infoset");
            sendElementEvent("psv:schemaDefault", attrPSVI.getSchemaDefault());

            processPSVITypeDefinitionRef(
                "psv:typeDefinition",
                attrPSVI.getTypeDefinition());
            processPSVITypeDefinitionRef(
                "psv:memberTypeDefinition",
                attrPSVI.getMemberTypeDefinition());

            if (attrPSVI.getAttributeDeclaration() == null) {
                sendElementEvent("psv:declaration");
            }
            else {
                sendIndentedElement("psv:declaration");
                processPSVIAttributeDeclarationRef(
                    attrPSVI.getAttributeDeclaration());
                sendUnIndentedElement("psv:declaration");
            }
        }
    }
View Full Code Here

Examples of org.apache.xerces.xni.psvi.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

Examples of org.apache.xerces.xni.psvi.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

Examples of org.apache.xerces.xni.psvi.AttributePSVI

                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
                        type = attributes.getType(i);
            attrImpl.setType(type);
            id = (type.equals("ID")) ? true : false;
          }
               
          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) {
                short code = fDOMFilter.startElement(el);
                switch (code) {
                    case DOMBuilderFilter.FILTER_INTERRUPT:{
                        throw new RuntimeException("The normal processing of the document was interrupted.");
                    }  
                    case DOMBuilderFilter.FILTER_REJECT:{
                        fFilterReject = true;
                        fRejectedElement.setValues(element);
                        return;
                    }
                    case DOMBuilderFilter.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

Examples of org.apache.xerces.xni.psvi.AttributePSVI

        }
    }

    public void printPSVIAttribute(Augmentations augs) {
        AttributePSVI attrPSVI =(AttributePSVI)augs.getItem(Constants.ATTRIBUTE_PSVI);
        if (attrPSVI !=null) {

            printElement("psv:validationContext",attrPSVI.getValidationContext());

            short validity = attrPSVI.getValidity();
            if (validity == ItemPSVI.VALIDITY_NOTKNOWN) {
                printElement("psv:validity","unknown");
            }
            else if (validity == ItemPSVI.VALIDITY_VALID) {
                printElement("psv:validity","valid");
            }
            else if (validity == ItemPSVI.VALIDITY_INVALID) {
                printElement("psv:validity","invalid");
            }

            short validation = attrPSVI.getValidationAttempted();
            if (validation == ItemPSVI.VALIDATION_NONE) {
                printElement("psv:validationAttempted","none");
                return;
            }
            else if (validation == ItemPSVI.VALIDATION_FULL) {
                printElement("psv:validationAttempted","full");
            }

            StringList errorCode = attrPSVI.getErrorCodes();
            if (errorCode == null) {
                printElement("psv:schemaErrorCode","");
            }
            else {
                for (int i=0;i<errorCode.getLength();i++) {
                    fErrorBuffer.append(errorCode.item(i));
                }               
                printElement("psv:schemaErrorCode",fErrorBuffer.toString());
                fErrorBuffer.setLength(0);

            }

            printElement("psv:schemaNormalizedValue",attrPSVI.getSchemaNormalizedValue());
            printElement("psv:schemaSpecified", (attrPSVI.getIsSchemaSpecified())?"schema":"infoset");

            XSTypeDefinition type = attrPSVI.getTypeDefinition();
            XSSimpleTypeDefinition memtype = attrPSVI.getMemberTypeDefinition();
            short definationType = type.getTypeCategory();
            if (definationType == XSTypeDefinition.SIMPLE_TYPE) {
                printElement("psv:typeDefinitionType","simple");
            }
View Full Code Here

Examples of org.apache.xerces.xni.psvi.AttributePSVI

        }
    }

    public void printPSVIAttribute(Augmentations augs) {
        AttributePSVI attrPSVI =(AttributePSVI)augs.getItem("ATTR_PSVI");
        if (attrPSVI !=null) {

            short validation = attrPSVI.getValidationAttempted();
            if (validation == ItemPSVI.NO_VALIDATION) {
                printElement("psv:validationAttempted","none");
            }
            else if (validation == ItemPSVI.FULL_VALIDATION) {
                printElement("psv:validationAttempted","full");
            }

            printElement("psv:validationContext",attrPSVI.getValidationContext());

            short validity = attrPSVI.getValidity();
            if (validity == ItemPSVI.UNKNOWN_VALIDITY) {
                printElement("psv:validity","unknown");
            }
            else if (validity == ItemPSVI.VALID_VALIDITY) {
                printElement("psv:validity","valid");
            }
            else if (validity == ItemPSVI.INVALID_VALIDITY) {
                printElement("psv:validity","invalid");
            }

            //REVISIT
            String [] errorCode = attrPSVI.getErrorCodes();
            int  errorCount = errorCode.length;
            if (errorCount == 0) {
                printElement("psv:schemaErrorCode","");
            }
            else {
                for (int i=errorCount-1;i< errorCount; ++i) {
                    fErrorBuffer.append(errorCode[i]);
                    fErrorBuffer.append(" ");
                }
                printElement("psv:schemaErrorCode",fErrorBuffer.toString());
                fErrorBuffer.setLength(0);

            }

            printElement("psv:schemaNormalizedValue",attrPSVI.schemaNormalizedValue());
            printElement("psv:schemaSpecified", (attrPSVI.schemaSpecified())?"infoset":"schema");

            short definationType = attrPSVI.getTypeDefinitionType();
            if (definationType == XSTypeDecl.SIMPLE_TYPE) {
                printElement("psv:typeDefinitionType","simple");
            }

            printElement("psv:typeDefinitionNamespace",attrPSVI.getTypeNamespace());
            printElement("psv:typeDefinitionAnonymous",String.valueOf(attrPSVI.isTypeAnonymous()));
            printElement("psv:typeDefinitionName",(attrPSVI.isTypeAnonymous())?null:attrPSVI.getTypeName());
            printElement("psv:memberTypeDefinitionAnonymous",String.valueOf(attrPSVI.isMemberTypeAnonymous()));
            printElement("psv:memberTypeDefinitionName",(attrPSVI.isMemberTypeAnonymous())?null:attrPSVI.getMemberTypeName());
            printElement("psv:memberTypeDefinitionNamespace",attrPSVI.getMemberTypeNamespace());

        }
    }
View Full Code Here

Examples of org.apache.xerces.xni.psvi.AttributePSVI

        }
    }

    public void printPSVIAttribute(Augmentations augs) {
        AttributePSVI attrPSVI =(AttributePSVI)augs.getItem(Constants.ATTRIBUTE_PSVI);
        if (attrPSVI !=null) {

            short validation = attrPSVI.getValidationAttempted();
            if (validation == ItemPSVI.VALIDATION_NONE) {
                printElement("psv:validationAttempted","none");
            }
            else if (validation == ItemPSVI.VALIDATION_FULL) {
                printElement("psv:validationAttempted","full");
            }

            printElement("psv:validationContext",attrPSVI.getValidationContext());

            short validity = attrPSVI.getValidity();
            if (validity == ItemPSVI.VALIDITY_UNKNOWN) {
                printElement("psv:validity","unknown");
            }
            else if (validity == ItemPSVI.VALIDITY_VALID) {
                printElement("psv:validity","valid");
            }
            else if (validity == ItemPSVI.VALIDITY_INVALID) {
                printElement("psv:validity","invalid");
            }

            StringList errorCode = attrPSVI.getErrorCodes();
            if (errorCode == null) {
                printElement("psv:schemaErrorCode","");
            }
            else {
                for (int i=0;i<errorCode.getLength();i++) {
                    fErrorBuffer.append(errorCode.item(i));
                }               
                printElement("psv:schemaErrorCode",fErrorBuffer.toString());
                fErrorBuffer.setLength(0);

            }

            printElement("psv:schemaNormalizedValue",attrPSVI.getSchemaNormalizedValue());
            printElement("psv:schemaSpecified", (attrPSVI.getIsSchemaSpecified())?"schema":"infoset");

            XSTypeDefinition type = attrPSVI.getTypeDefinition();
            XSSimpleTypeDefinition memtype = attrPSVI.getMemberTypeDefinition();
            short definationType = type.getTypeCategory();
            if (definationType == XSTypeDecl.SIMPLE_TYPE) {
                printElement("psv:typeDefinitionType","simple");
            }
View Full Code Here

Examples of org.apache.xerces.xni.psvi.AttributePSVI

                for (int i = len - 1; i >= 0; i--) {
                    attributes.getName(i, fQName);
                    // change attribute value to normalized value
                    // REVISIT: should this happen here? why not in schema validator?
                    if (fNormalizeData) {
                        AttributePSVI attrPSVI = (AttributePSVI)attributes.getAugmentations(i).getItem(Constants.ATTRIBUTE_PSVI);
                        if (attrPSVI != null &&
                            attrPSVI.getValidationAttempted() == AttributePSVI.VALIDATION_FULL) {
                            attributes.setValue(i, attrPSVI.getSchemaNormalizedValue());
                        }
                    }

                    if ((fQName.prefix != null && fQName.prefix.equals("xmlns")) ||
                        fQName.rawname.equals("xmlns")) {
View Full Code Here

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

Examples of org.apache.xerces.xs.AttributePSVI

                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) {
                short code = fDOMFilter.startElement (el);
                switch (code) {
                    case LSParserFilter.FILTER_INTERRUPT:{
                        throw new RuntimeException ("The normal processing of the document was interrupted.");
                    }
                    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
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.