Package org.apache.xerces.xni.psvi

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


                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


  public void endElement(QName element, Augmentations augs) throws XNIException {
    if (DEBUG_EVENTS) {
      System.out.println("==>endElement: " + element);
    }

    ElementPSVI elementPSVI = (ElementPSVI) augs.getItem(Constants.ELEMENT_PSVI);
    if (elementPSVI != null) {
      ElementImpl elementNode = (ElementImpl) fCurrentNode;
      if (fPSVI) {
        ((PSVIElementNSImpl) fCurrentNode).setPSVI(elementPSVI);
      }
      // include element default content (if one is available)
      String normalizedValue = elementPSVI.getSchemaNormalizedValue();
      if ((fConfiguration.features & DOMConfigurationImpl.DTNORMALIZATION) != 0) {
                if (normalizedValue !=null)
            elementNode.setTextContent(normalizedValue);
      }
      else {
View Full Code Here

                }
            }
            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 =
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

        }
        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

        //          each character. However, it also says:
        // "Each character is a logically separate information item,
        //  but XML applications are free to chunk characters into larger
        //  groups as necessary or desirable"
        //  XSV outputs each character separately.
        ElementPSVI elemPSVI = (ElementPSVI)augs.getItem(Constants.ELEMENT_PSVI);
       
        checkForChildren();
        if (elemPSVI != null) {
            if (!elemPSVI.getIsSchemaSpecified()){  // value was specified in the instance!
                printIndentTag("<character>");
                printElement("characterCode", text.toString());
                printElement("elementContentWhitespace", "false");
                printUnIndentTag("</character>");
            }
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?
            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

     *                   Thrown by handler to signal an error.
     */
    public void endElement(QName element, Augmentations augs) throws XNIException{
        if (fPSVI) {
       
            ElementPSVI elementPSVI = (ElementPSVI)augs.getItem(Constants.ELEMENT_PSVI);
            if (elementPSVI != null) {
               
                ((PSVIElementNSImpl)fCurrentNode).setPSVI(elementPSVI);
                if (elementPSVI.getIsSchemaSpecified()) {
                    // default value from XML Schema.
                    fCurrentNode.setNodeValue(elementPSVI.getSchemaDefault());
                }
            }
        }
    }
View Full Code Here

        //          each character. However, it also says:
        // "Each character is a logically separate information item,
        //  but XML applications are free to chunk characters into larger
        //  groups as necessary or desirable"
        //  XSV outputs each character separately.
        ElementPSVI elemPSVI = (ElementPSVI)augs.getItem(Constants.ELEMENT_PSVI);
       
        checkForChildren();
        if (elemPSVI != null) {
            if (!elemPSVI.getIsSchemaSpecified()){  // value was specified in the instance!
                printIndentTag("<character>");
                printElement("characterCode", text.toString());
                printElement("elementContentWhitespace", "false");
                printUnIndentTag("</character>");
            }
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.