本文整理汇总了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);
}
}
}
示例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();
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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
}
}
示例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('}');
}
示例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;
}
}
}
}
示例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);
}
}
示例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);
}
}
示例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");
}
}
示例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");
}
}
}