Package org.apache.xerces.xni.psvi

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


    * The following information will be available at the endElement call:
    * nil, specified, normalized value, member type, validity, error codes,
    * default
    */
    public void printPSVIStartElement(Augmentations augs) {
        ElementPSVI elemPSVI =(ElementPSVI)augs.getItem(Constants.ELEMENT_PSVI);
        if (elemPSVI != null) {

            // REVISIT: Should we store the values till end element call?
            printElement("psv:validationContext",elemPSVI.getValidationContext());

            XSTypeDefinition type = elemPSVI.getTypeDefinition();
            short definationType = type.getTypeCategory();
            if (definationType == XSTypeDecl.SIMPLE_TYPE) {
                printElement("psv:typeDefinitionType","simple");
            }
            else if (definationType == XSTypeDecl.COMPLEX_TYPE) {
                printElement("psv:typeDefinitionType","complex");
            }
            printElement("psv:typeDefinitionNamespace ",type.getNamespace());
            printElement("psv:typeDefinitionAnonymous",String.valueOf(type.getIsAnonymous()));
            printElement("psv:typeDefinitionName",type.getName());

            XSSimpleTypeDefinition memtype = elemPSVI.getMemberTypeDefinition();
            if (memtype != null) {
                printElement("psv:memberTypeDefinitionAnonymous",String.valueOf(memtype.getIsAnonymous()));
                printElement("psv:memberTypeDefinitionName",memtype.getName());
                printElement("psv:memberTypeDefinitionNamespace",memtype.getNamespace());
            }
           
            XSNotationDeclaration notation = elemPSVI.getNotation();
            if (notation != null) {
                printElement("psv:notationSystem",notation.getSystemId());
                printElement("psv:notationPublic",notation.getPublicId());
            }
        }
View Full Code Here


    * The following information will be available at the endElement call:
    * nil, specified, normalized value, member type, validity, error codes,
    * default
    */
    public void printPSVIEndElement(Augmentations augs) {
        ElementPSVI elemPSVI = (ElementPSVI)augs.getItem(Constants.ELEMENT_PSVI);
        if (elemPSVI != null) {


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


            short validity = elemPSVI.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");
            }
            //revisit
            StringList errorCode = elemPSVI.getErrorCodes();
            if (errorCode != null) {
                for (int i=0;i<errorCode.getLength();i++) {
                    fErrorBuffer.append(errorCode.item(i));
                }
                printElement("psv:schemaErrorCode",fErrorBuffer.toString());
                fErrorBuffer.setLength(0);
            }
            else {
                printElement("psv:schemaErrorCode","");
            }
            //printElement("psv:nil", String.valueOf(elemPSVI.getIsNil()));
            printElement("psv:schemaNormalizedValue",elemPSVI.getSchemaNormalizedValue());
            String specified = elemPSVI.getIsSchemaSpecified()?"schema":"infoset";
            printElement("psv:schemaSpecified",specified);

        }
    }
View Full Code Here

                // normalized value for element is stored in schema_normalize_value property
                // of PSVI element.
                // REVISIT: should this happen here? why not in schema validator?
                // REVISIT: how to determine whether the value is trustable?
                if (fNormalizeData && augs != null) {
                    ElementPSVI elemPSVI = (ElementPSVI)augs.getItem(Constants.ELEMENT_PSVI);
                    if (elemPSVI != null) {
                        value = elemPSVI.getSchemaNormalizedValue();
                    }
                }

                int length = 0;
                if (value != null) {
View Full Code Here

                String value = null;
                // normalized value for element is stored in schema_normalize_value property
                // of PSVI element.
                if (fNormalizeData && augs != null) {
                    ElementPSVI elemPSVI = (ElementPSVI)augs.getItem(Constants.ELEMENT_PSVI);
                    if (elemPSVI != null) {
                        value = elemPSVI.getSchemaNormalizedValue();
                    }
                }
                if (value == null) {
                     value = text.toString();
                }
                Node child = fCurrentNode.getLastChild();
                if (child != null && child.getNodeType() == Node.TEXT_NODE) {
                    // collect all the data into the string buffer.
                    if (fFirstChunk) {
                        if (fDocumentImpl != null) {
                            fStringBuffer.append(((TextImpl)child).removeData());
                        } else {
                            fStringBuffer.append(((Text)child).getData());
                            ((Text)child).setNodeValue(null);
                        }
                        fFirstChunk = false;
                    }
                    fStringBuffer.append(value);
                }
                else {
                   fFirstChunk = true;
                   Text textNode = fDocument.createTextNode(value);
                   fCurrentNode.appendChild(textNode);
                }
              
            }
        }
        else {
            // The Text and CDATASection normalization is taken care of within
            // the DOM in the deferred case.
            if (fInCDATASection && fCreateCDATANodes) {
                if (fCurrentCDATASectionIndex == -1) {
                    int cs = fDeferredDocumentImpl.
                        createDeferredCDATASection(text.toString());

                    fDeferredDocumentImpl.appendChild(fCurrentNodeIndex, cs);
                    fCurrentCDATASectionIndex = cs;
                    fCurrentNodeIndex = cs;
                }
                else {
                    int txt = fDeferredDocumentImpl.
                        createDeferredTextNode(text.toString(), false);
                    fDeferredDocumentImpl.appendChild(fCurrentNodeIndex, txt);
                }
            } else if (!fInDTD) {
                // if type is union (XML Schema) it is possible that we receive
                // character call with empty data
                if (text.length == 0) {
                    return;
                }

                String value = null;
                // normalized value for element is stored in schema_normalize_value property
                // of PSVI element.
                if (fNormalizeData && augs != null) {
                    ElementPSVI elemPSVI = (ElementPSVI)augs.getItem(Constants.ELEMENT_PSVI);
                    if (elemPSVI != null) {
                        value = elemPSVI.getSchemaNormalizedValue();
                    }
                }

                if (value == null) {
                     value = text.toString();
View Full Code Here

        }
        if (!fDeferNodeExpansion) {
           
            // REVISIT: Should this happen after we call the filter?
            if (fStorePSVI && augs != null) {
                ElementPSVI elementPSVI = (ElementPSVI)augs.getItem(Constants.ELEMENT_PSVI);
                if (elementPSVI != null) {
                    ((PSVIElementNSImpl)fCurrentNode).setPSVI(elementPSVI);
                }
            }
           
View Full Code Here

        printIndent();
        fOut.print("characters(");
        fOut.print("text=");
        printQuotedString(text.ch, text.offset, text.length);
        if (augs != null) {
            ElementPSVI element = (ElementPSVI)augs.getItem(Constants.ELEMENT_PSVI);
            fOut.print(" schemaNormalized=");
            printQuotedString(element.getSchemaNormalizedValue());
        }
       
        fOut.println(')');
        fOut.flush();
View Full Code Here

    * The following information will be available at the endElement call:
    * nil, specified, normalized value, member type, validity, error codes,
    * default
    */
    public void printPSVIStartElement(Augmentations augs) {
        ElementPSVI elemPSVI =(ElementPSVI)augs.getItem(Constants.ELEMENT_PSVI);
        if (elemPSVI != null) {

            // REVISIT: Should we store the values till end element call?
        }
    }
View Full Code Here

    * The following information will be available at the endElement call:
    * nil, specified, normalized value, member type, validity, error codes,
    * default
    */
    public void printPSVIEndElement(Augmentations augs) {
        ElementPSVI elemPSVI = (ElementPSVI)augs.getItem(Constants.ELEMENT_PSVI);
        if (elemPSVI != null) {

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

            short validity = elemPSVI.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");
            }

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

            XSTypeDefinition type = elemPSVI.getTypeDefinition();
            short definationType = type.getTypeCategory();
            if (definationType == XSTypeDecl.SIMPLE_TYPE) {
                printElement("psv:typeDefinitionType","simple");
            }
            else if (definationType == XSTypeDecl.COMPLEX_TYPE) {
                printElement("psv:typeDefinitionType","complex");
            }
            printElement("psv:typeDefinitionNamespace ",type.getNamespace());
            printElement("psv:typeDefinitionAnonymous",String.valueOf(type.getIsAnonymous()));
            printElement("psv:typeDefinitionName",type.getName());

            XSSimpleTypeDefinition memtype = elemPSVI.getMemberTypeDefinition();
            if (memtype != null) {
                printElement("psv:memberTypeDefinitionAnonymous",String.valueOf(memtype.getIsAnonymous()));
                printElement("psv:memberTypeDefinitionName",memtype.getName());
                printElement("psv:memberTypeDefinitionNamespace",memtype.getNamespace());
            }

            XSNotationDeclaration notation = elemPSVI.getNotation();
            if (notation != null) {
                printElement("psv:notationSystem",notation.getSystemId());
                printElement("psv:notationPublic",notation.getPublicId());
            }

            //revisit
            StringList errorCode = elemPSVI.getErrorCodes();
            if (errorCode != null) {
                for (int i=0;i<errorCode.getLength();i++) {
                    fErrorBuffer.append(errorCode.item(i));
                }
                printElement("psv:schemaErrorCode",fErrorBuffer.toString());
                fErrorBuffer.setLength(0);
            }
            else {
                printElement("psv:schemaErrorCode","");
            }
            //printElement("psv:nil", String.valueOf(elemPSVI.getIsNil()));
            printElement("psv:schemaNormalizedValue",elemPSVI.getSchemaNormalizedValue());
            String specified = elemPSVI.getIsSchemaSpecified()?"schema":"infoset";
            printElement("psv:schemaSpecified",specified);

        }
    }
View Full Code Here

                String value = null;
                // normalized value for element is stored in schema_normalize_value property
                // of PSVI element.
                if (fNormalizeData && augs != null) {
                    ElementPSVI elemPSVI = (ElementPSVI)augs.getItem(Constants.ELEMENT_PSVI);
                    if (elemPSVI != null) {
                        value = elemPSVI.getSchemaNormalizedValue();
                    }
                }
                if (value == null) {
                     value = text.toString();
                }
                Node child = fCurrentNode.getLastChild();
                if (child != null && child.getNodeType() == Node.TEXT_NODE) {
                    Text textNode = (Text)child;
                    textNode.appendData(value);
                }
                else {
                    Text textNode = fDocument.createTextNode(value);
                    fCurrentNode.appendChild(textNode);
                }
            }
        }
        else {
            // The Text and CDATASection normalization is taken care of within
            // the DOM in the deferred case.
            if (fInCDATASection && fCreateCDATANodes) {
                if (fCurrentCDATASectionIndex == -1) {
                    int cs = fDeferredDocumentImpl.
                        createDeferredCDATASection(text.toString());

                    fDeferredDocumentImpl.appendChild(fCurrentNodeIndex, cs);
                    fCurrentCDATASectionIndex = cs;
                    fCurrentNodeIndex = cs;
                }
                else {
                    int txt = fDeferredDocumentImpl.
                        createDeferredTextNode(text.toString(), false);
                    fDeferredDocumentImpl.appendChild(fCurrentNodeIndex, txt);
                }
            } else if (!fInDTD) {
                if (DEBUG_EVENTS) {                   
                   System.out.println("==>currentNode: type="+fDeferredDocumentImpl.getNodeType(fCurrentNodeIndex)+
                                      "; name="+fDeferredDocumentImpl.getNodeName(fCurrentNodeIndex));
                }
                // if type is union (XML Schema) it is possible that we receive
                // character call with empty data
                if (text.length == 0) {
                    return;
                }

                String value = null;
                // normalized value for element is stored in schema_normalize_value property
                // of PSVI element.
                if (fNormalizeData && augs != null) {
                    ElementPSVI elemPSVI = (ElementPSVI)augs.getItem(Constants.ELEMENT_PSVI);
                    if (elemPSVI != null) {
                        value = elemPSVI.getSchemaNormalizedValue();
                    }
                }

                if (value == null) {
                     value = text.toString();
View Full Code Here

                // normalized value for element is stored in schema_normalize_value property
                // of PSVI element.
                // REVISIT: should this happen here? why not in schema validator?
                // REVISIT: how to determine whether the value is trustable?
                if (fNormalizeData && augs != null) {
                    ElementPSVI elemPSVI = (ElementPSVI)augs.getItem(Constants.ELEMENT_PSVI);
                    if (elemPSVI != null) {
                        value = elemPSVI.getSchemaNormalizedValue();
                    }
                }

                int length = 0;
                if (value != null) {
View Full Code Here

TOP

Related Classes of org.apache.xerces.xni.psvi.ElementPSVI

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.