当前位置: 首页>>代码示例>>Java>>正文


Java Augmentations.getItem方法代码示例

本文整理汇总了Java中org.apache.xerces.xni.Augmentations.getItem方法的典型用法代码示例。如果您正苦于以下问题:Java Augmentations.getItem方法的具体用法?Java Augmentations.getItem怎么用?Java Augmentations.getItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.xerces.xni.Augmentations的用法示例。


在下文中一共展示了Augmentations.getItem方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: endElement

import org.apache.xerces.xni.Augmentations; //导入方法依赖的package包/类
public void endElement(QName element, Augmentations augs)
        throws XNIException {
    final Node currentElement = fDOMValidatorHelper.getCurrentElement();
    // Write type information to this element
    if (augs != null && fDocumentImpl != null) {
        ElementPSVI elementPSVI = (ElementPSVI)augs.getItem(Constants.ELEMENT_PSVI);
        if (elementPSVI != null) {
            if (fStorePSVI) {
                ((PSVIElementNSImpl) currentElement).setPSVI(elementPSVI);
            }
            XSTypeDefinition type = elementPSVI.getMemberTypeDefinition();
            if (type == null) {
                type = elementPSVI.getTypeDefinition();
            }
            ((ElementNSImpl) currentElement).setType(type);
        }
    }
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:19,代码来源:DOMResultAugmentor.java

示例2: endElement

import org.apache.xerces.xni.Augmentations; //导入方法依赖的package包/类
public void endElement(QName element, Augmentations augs)
        throws XNIException {
    // write type information to this element
    if (augs != null && fDocumentImpl != null) {
        ElementPSVI elementPSVI = (ElementPSVI)augs.getItem(Constants.ELEMENT_PSVI);
        if (elementPSVI != null) {
            if (fStorePSVI) {
                ((PSVIElementNSImpl)fCurrentNode).setPSVI(elementPSVI);
            }
            XSTypeDefinition type = elementPSVI.getMemberTypeDefinition();
            if (type == null) {
                type = elementPSVI.getTypeDefinition();
            }
            ((ElementNSImpl)fCurrentNode).setType(type);
        }
    }
    
    // adjust current node reference
    if (fCurrentNode == fFragmentRoot) {
        fCurrentNode = null;
        fFragmentRoot = null;
        return;
    }
    fCurrentNode = fCurrentNode.getParentNode();
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:26,代码来源:DOMResultBuilder.java

示例3: getAttributeType

import org.apache.xerces.xni.Augmentations; //导入方法依赖的package包/类
private TypeInfo getAttributeType( int index ) {
    checkStateAttribute();
    if (index < 0 || fAttributes.getLength() <= index) {
        throw new IndexOutOfBoundsException(Integer.toString(index));
    }
    Augmentations augs = fAttributes.getAugmentations(index);
    if (augs == null) {
        return null;
    }
    AttributePSVI psvi = (AttributePSVI)augs.getItem(Constants.ATTRIBUTE_PSVI);
    return getTypeInfoFromPSVI(psvi);
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:13,代码来源:ValidatorHandlerImpl.java

示例4: getAttributePSVI

import org.apache.xerces.xni.Augmentations; //导入方法依赖的package包/类
AttributePSVI getAttributePSVI(int index) {
    if (fAttributes != null) {
        Augmentations augs = fAttributes.getAugmentations(index);
        if (augs != null) {
            return (AttributePSVI) augs.getItem(Constants.ATTRIBUTE_PSVI);
        }
    }
    return null;
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:10,代码来源:ValidatorHandlerImpl.java

示例5: getAttributePSVIByName

import org.apache.xerces.xni.Augmentations; //导入方法依赖的package包/类
AttributePSVI getAttributePSVIByName(String uri, String localname) {
    if (fAttributes != null) {
        Augmentations augs = fAttributes.getAugmentations(uri, localname);
        if (augs != null) {
            return (AttributePSVI) augs.getItem(Constants.ATTRIBUTE_PSVI);
        }
    }
    return null;
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:10,代码来源:ValidatorHandlerImpl.java

示例6: getSchemaDeterminedID

import org.apache.xerces.xni.Augmentations; //导入方法依赖的package包/类
/**
 * Returns the schema-determined-ID.
 * 
 * 
 * @param attributes
 * @param index
 * @return A String containing the schema-determined ID. 
 * @throws XNIException
 */
public String getSchemaDeterminedID(XMLAttributes attributes, int index)
throws XNIException {
    Augmentations augs = attributes.getAugmentations(index);
    AttributePSVI attrPSVI = (AttributePSVI) augs
    .getItem(Constants.ATTRIBUTE_PSVI);
    
    if (attrPSVI != null) {
        // An element or attribute information item is a schema-determined 
        // ID if and only if one of the following is true:]
        
        // 1. It has a [member type definition] or [type definition] property 
        // whose value in turn has [name] equal to ID and [target namespace] 
        // equal to http://www.w3.org/2001/XMLSchema;
        
        // 2. It has a [base type definition] whose value has that [name] and [target namespace];
        
        // 3. It has a [base type definition] whose value has a [base type definition] 
        // whose value has that [name] and [target namespace], and so on following 
        // the [base type definition] property recursively;
        
        XSTypeDefinition typeDef = attrPSVI.getMemberTypeDefinition();
        if (typeDef != null) {
            typeDef = attrPSVI.getTypeDefinition();
        }
        
        // 
        if (typeDef != null && ((XSSimpleType) typeDef).isIDType()) {
            return attrPSVI.getSchemaNormalizedValue();
        }
        
        // 4 & 5 NA
    }
    
    return null;
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:45,代码来源:ShortHandPointer.java

示例7: processPSVIStartElement

import org.apache.xerces.xni.Augmentations; //导入方法依赖的package包/类
private void processPSVIStartElement(Augmentations augs) {
    if (augs == null)
        return;
    ElementPSVI elemPSVI =
        (ElementPSVI)augs.getItem(Constants.ELEMENT_PSVI);
    if (elemPSVI != null) {
        // Should we store the values till end element call? -- AY
        // I don't think so -- PJM
    }
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:11,代码来源:PSVIWriter.java

示例8: printAugmentations

import org.apache.xerces.xni.Augmentations; //导入方法依赖的package包/类
/** Prints augmentations. */
protected void printAugmentations(Augmentations augs) {
    fOut.print("augs={");
    java.util.Enumeration keys = augs.keys();
    while (keys.hasMoreElements()) {
        String key = (String)keys.nextElement();
        Object value = augs.getItem(key);
        fOut.print(key);
        fOut.print('#');
        fOut.print(String.valueOf(value));
    }
    fOut.print('}');
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:14,代码来源:DocumentTracer.java

示例9: characters

import org.apache.xerces.xni.Augmentations; //导入方法依赖的package包/类
/**
 * Called when the parser encounters character or CDATA content.
 * Characters may be reported in more than one chunk, so we gather all
 * contiguous chunks together and process them in one block.
 */
@Override
public void characters(XMLString text, Augmentations augs)
        throws XNIException {
  if(!readCharacterStatus) {
    if(reposInfo != null) {
      HTMLEventInfo evInfo = (augs == null) ? null : (HTMLEventInfo)augs
              .getItem(AUGMENTATIONS);
      if(evInfo == null) {
        Err.println("Warning: could not determine proper repositioning "
                + "info for character chunk \""
                + new String(text.ch, text.offset, text.length)
                + "\" near offset " + charactersStartOffset
                + ".  Save preserving format may give incorret results.");
      }
      else {
        // NekoHTML numbers lines and columns from 1, not 0
        int line = evInfo.getBeginLineNumber() - 1;
        int col = evInfo.getBeginColumnNumber() - 1;
        charactersStartOffset = lineOffsets[line] + col;
        if(DEBUG_CHARACTERS) {
          Out.println("characters: line = " + line + " (offset " +
              lineOffsets[line] + "), col = " + col + " : file offset = " +
              charactersStartOffset);
        }
      }
    }

    contentBuffer = new StringBuilder();
  }
  readCharacterStatus = true;

  boolean canAppendWS = (contentBuffer.length() == 0 || !Character
          .isWhitespace(contentBuffer.charAt(contentBuffer.length() - 1)));
  // we must collapse
  // whitespace down to a single space, to mirror the normal
  // HtmlDocumentFormat.
  for(int i = text.offset; i < text.offset + text.length; ++i) {
    if(!Character.isWhitespace(text.ch[i])) {
      contentBuffer.append(text.ch[i]);
      canAppendWS = true;
    }
    else {
      if(canAppendWS) {
        contentBuffer.append(' ');
        canAppendWS = false;
      }
    }
  }
}
 
开发者ID:GateNLP,项目名称:gate-core,代码行数:55,代码来源:NekoHtmlDocumentHandler.java

示例10: endElement

import org.apache.xerces.xni.Augmentations; //导入方法依赖的package包/类
/**
 * The end of an element.
 * 
 * @param element The name of the element.
 * @param augs    Additional information that may include infoset augmentations
 *                
 * @exception XNIException
 *                   Thrown by handler to signal an error.
 */
public void endElement(QName element, Augmentations augs) throws XNIException {
    if (DEBUG_EVENTS) {
        System.out.println("==>endElement: " + element);
    }

    if (augs != null) {
        ElementPSVI elementPSVI = (ElementPSVI) augs.getItem(Constants.ELEMENT_PSVI);
        if (elementPSVI != null) {
            ElementImpl elementNode = (ElementImpl) fCurrentNode;
            if (fPSVI) {
                ((PSVIElementNSImpl) fCurrentNode).setPSVI(elementPSVI);
            }
            // Updating the TypeInfo for this element.
            if (elementNode instanceof ElementNSImpl) {
                XSTypeDefinition type = elementPSVI.getMemberTypeDefinition();
                if (type == null) {
                    type = elementPSVI.getTypeDefinition();
                }
                ((ElementNSImpl) elementNode).setType(type);
            }
            // 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 {
                // NOTE: this is a hack: it is possible that DOM had an empty element
                // and validator sent default value using characters(), which we don't 
                // implement. Thus, here we attempt to add the default value.
                String text = elementNode.getTextContent();
                if (text.length() == 0) {
                    // default content could be provided
                    if (normalizedValue !=null)
                        elementNode.setTextContent(normalizedValue);
                }
            }
            return;
        }
    }
    // DTD; elements have no type.
    if (fCurrentNode instanceof ElementNSImpl) { 
        ((ElementNSImpl) fCurrentNode).setType(null);
    }
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:55,代码来源:DOMNormalizer.java

示例11: characters

import org.apache.xerces.xni.Augmentations; //导入方法依赖的package包/类
/**
 * Character content.
 * 
 * @param text The content.
 *
 * @param augs   Additional information that may include infoset augmentations
 *
 * @throws XNIException Thrown by handler to signal an error.
 */
public void characters(XMLString text, Augmentations augs) throws XNIException {

    boolean callNextCharacters = true;

    // REVISIT: [Q] Is there a more efficient way of doing this?
    //          Perhaps if the scanner told us so we don't have to
    //          look at the characters again. -Ac
    boolean allWhiteSpace = true;
    for (int i=text.offset; i< text.offset+text.length; i++) {
        if (!isSpace(text.ch[i])) {
            allWhiteSpace = false;
            break;
        }
    }
    // call the ignoreableWhiteSpace callback
    // never call ignorableWhitespace if we are in cdata section
    if (fInElementContent && allWhiteSpace && !fInCDATASection) {
        if (fDocumentHandler != null) {
            fDocumentHandler.ignorableWhitespace(text, augs);
            callNextCharacters = false;
        }
    }

    // validate
    if (fPerformValidation) {
        if (fInElementContent) {
            if (fGrammarBucket.getStandalone() &&
                fDTDGrammar.getElementDeclIsExternal(fCurrentElementIndex)) {
                if (allWhiteSpace) {
                    fErrorReporter.reportError( XMLMessageFormatter.XML_DOMAIN,
                                                "MSG_WHITE_SPACE_IN_ELEMENT_CONTENT_WHEN_STANDALONE",
                                                null, XMLErrorReporter.SEVERITY_ERROR);
                }
            }
            if (!allWhiteSpace) {
                charDataInContent();
            }
            
            // For E15.2
            if (augs != null && augs.getItem(Constants.CHAR_REF_PROBABLE_WS) == Boolean.TRUE) {
                fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN, 
                                           "MSG_CONTENT_INVALID_SPECIFIED",
                                           new Object[]{ fCurrentElement.rawname, 
                                               fDTDGrammar.getContentSpecAsString(fElementDepth),
                                               "character reference"},
                                           XMLErrorReporter.SEVERITY_ERROR);                
            }
        }

        if (fCurrentContentSpecType == XMLElementDecl.TYPE_EMPTY) {
            charDataInContent();
        }
    }

    // call handlers
    if (callNextCharacters && fDocumentHandler != null) {
        fDocumentHandler.characters(text, augs);
    }

}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:70,代码来源:XMLDTDValidator.java

示例12: processPSVIEndElement

import org.apache.xerces.xni.Augmentations; //导入方法依赖的package包/类
private void processPSVIEndElement(Augmentations augs) {
    if (augs == null)
        return;
    ElementPSVI elemPSVI =
        (ElementPSVI)augs.getItem(Constants.ELEMENT_PSVI);
    if (elemPSVI != null) {

        processPSVISchemaInformation(elemPSVI);
        sendElementEvent(
            "psv:validationAttempted",
            this.translateValidationAttempted(
                elemPSVI.getValidationAttempted()));
        // Would rather getValidationContext() return element info item.
        // This is non the same as XSV.
        sendElementEvent(
            "psv:validationContext",
            elemPSVI.getValidationContext());

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

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

        processPSVITypeDefinitionRef(
            "psv:typeDefinition",
            elemPSVI.getTypeDefinition());
        processPSVITypeDefinitionRef(
            "psv:memberTypeDefinition",
            elemPSVI.getMemberTypeDefinition());
        // A value for nil is not necessary, since we output declaration, instead.
        // See http://www.w3.org/TR/xmlschema-1/#section-Element-Declaration-Information-Set-Contributions.
        sendElementEvent("psv:nil");

        sendIndentedElement("psv:declaration");
        processPSVIElementRef(
            "psv:elementDeclaration",
            elemPSVI.getElementDeclaration());
        sendUnIndentedElement("psv:declaration");
        processPSVIElementRef("psv:notation", elemPSVI.getNotation());
        // idref table does not have to be exposed, and is not exposed
        sendElementEvent("psv:idIdrefTable");
        // identity constraint table does not have to be exposed, and is not exposed
        sendElementEvent("psv:identityConstraintTable");
    }
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:54,代码来源:PSVIWriter.java

示例13: processPSVIAttribute

import org.apache.xerces.xni.Augmentations; //导入方法依赖的package包/类
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");
        }
    }
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:48,代码来源:PSVIWriter.java


注:本文中的org.apache.xerces.xni.Augmentations.getItem方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。