Package org.apache.uima.cas.impl
Class XCASDeserializer.XCASDeserializerHandler
java.lang.Object
org.xml.sax.helpers.DefaultHandler
org.apache.uima.cas.impl.XCASDeserializer.XCASDeserializerHandler
- All Implemented Interfaces:
ContentHandler,DTDHandler,EntityResolver,ErrorHandler
- Enclosing class:
XCASDeserializer
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intprivate static final intprivate intprivate StringBufferprivate final CASImplprivate static final intprivate Stringprivate TOPprivate FSDataprivate static final Stringprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate intthe fsId read from the _id attributeprivate final RedBlackTree<XCASDeserializer.FSInfo> Map from extId to FSInfo (including fs)private TOPprivate final List<XCASDeserializer.FSInfo> private final IntVectorMap external SofaNum -> internal sofaNum internal sofaNums also used to index indexRepositories -> ref to FsIndexRepositoryImplprivate final List<FSIndexRepository> map from index -> indexRepository, [0] = base view, [1] initial view, [2 +] other viewsprivate Locatorprivate intprivate static final intprivate static final intprivate OutOfTypeSystemDataprivate static final Stringprivate final IntVectorprivate static final intprivate intprivate static final Stringmap for index -> cas views, -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateXCASDeserializerHandler(CASImpl aCAS, OutOfTypeSystemData ootsData) -
Method Summary
Modifier and TypeMethodDescriptionprivate voidaddArrayElement(String content) private voidaddToOutOfTypeSystemData(String typeName, Attributes attrs) voidcharacters(char[] chars, int start, int length) private XCASParsingExceptioncreateException(int code) private XCASParsingExceptioncreateException(int code, String arg) private final booleanvoidvoidendElement(String nsURI, String localName, String qualifiedName) voidvoidprivate voidprivate voidfinalizeArrayRefValue(int extId, int pos, FSArray fs) Same as above, but specialized for array values, not feature slot valuesprivate voidfinalizeFS(XCASDeserializer.FSInfo fsInfo) private voidprivate voidprivate voidfinalizeRefValue(int extId, TOP fs, FeatureImpl fi) Common code run at finalize time, to set ref values and handle out-of-typesystem dataprivate StringgetCasTypeName(String aTagName) Gets the CAS type name corresponding to an XCAS tag name.private StringgetRealFeatName(String featName) private voidhandleFeature(Type type, TOP fs, String featName, String featValIn, boolean lenient) private voidhandleFeature(TOP fs, String featName, String featVal, boolean lenient) voidignorableWhitespace(char[] arg0, int arg1, int arg2) (package private) boolean(package private) TOPmaybeCreateWithV2Id(int id, Supplier<TOP> create) private String[]parseArray(String val) Parse a multi-valued attribute into a String array, by splitting on whitespace.private voidreadArray(TypeImpl type, Attributes attrs) private voidreadArrayElement(String eleName, Attributes attrs) private voidreadDocument(Attributes attrs) private voidreadFS(String qualifiedName, Attributes attrs) private voidreadFS(TypeImpl type, Attributes attrs, boolean toIndex) private final voidvoidvoidvoidstartElement(String nameSpaceURI, String localName, String qualifiedName, Attributes attrs) voidMethods inherited from class org.xml.sax.helpers.DefaultHandler
endPrefixMapping, notationDecl, processingInstruction, resolveEntity, skippedEntity, startPrefixMapping, unparsedEntityDecl
-
Field Details
-
DOC_STATE
private static final int DOC_STATE- See Also:
-
FS_STATE
private static final int FS_STATE- See Also:
-
FEAT_STATE
private static final int FEAT_STATE- See Also:
-
CONTENT_STATE
private static final int CONTENT_STATE- See Also:
-
FEAT_CONTENT_STATE
private static final int FEAT_CONTENT_STATE- See Also:
-
ARRAY_ELE_CONTENT_STATE
private static final int ARRAY_ELE_CONTENT_STATE- See Also:
-
ARRAY_ELE_STATE
private static final int ARRAY_ELE_STATE- See Also:
-
DOC_TEXT_STATE
private static final int DOC_TEXT_STATE- See Also:
-
OOTS_FEAT_STATE
private static final int OOTS_FEAT_STATE- See Also:
-
OOTS_CONTENT_STATE
private static final int OOTS_CONTENT_STATE- See Also:
-
DEFAULT_CONTENT_FEATURE
- See Also:
-
reservedAttrPrefix
- See Also:
-
unknownXMLSource
- See Also:
-
sofaTypeCode
private static final int sofaTypeCode- See Also:
-
locator
-
cas
-
fsTree
Map from extId to FSInfo (including fs) -
idLess
-
fixupToDos
-
uimaSerializableFixups
-
state
private int state -
buffer
-
currentFs
-
currentContentFeat
-
arrayPos
private int arrayPos -
outOfTypeSystemData
-
currentOotsFs
-
indexRepositories
map from index -> indexRepository, [0] = base view, [1] initial view, [2 +] other views -
views
map for index -> cas views, -
sofaRefMap
-
indexMap
Map external SofaNum -> internal sofaNum internal sofaNums also used to index indexRepositories -> ref to FsIndexRepositoryImpl -
nextIndex
private int nextIndex -
highestIdFs
-
fsId
private int fsIdthe fsId read from the _id attribute
-
-
Constructor Details
-
XCASDeserializerHandler
-
-
Method Details
-
resetBuffer
private final void resetBuffer() -
startDocument
- Specified by:
startDocumentin interfaceContentHandler- Overrides:
startDocumentin classDefaultHandler- Throws:
SAXException
-
startElement
public void startElement(String nameSpaceURI, String localName, String qualifiedName, Attributes attrs) throws SAXException - Specified by:
startElementin interfaceContentHandler- Overrides:
startElementin classDefaultHandler- Throws:
SAXException
-
readDocument
-
readArrayElement
- Throws:
SAXParseException
-
readFS
- Throws:
SAXParseException
-
readFS
- Parameters:
attrs-toIndex- Special hack to accommodate document annotation, which is already in the index.addr-- Throws:
SAXParseException- passthru
-
readArray
- Throws:
SAXParseException
-
emptyVal
-
handleFeature
private void handleFeature(TOP fs, String featName, String featVal, boolean lenient) throws SAXParseException - Throws:
SAXParseException
-
handleFeature
private void handleFeature(Type type, TOP fs, String featName, String featValIn, boolean lenient) throws SAXParseException - Throws:
SAXParseException
-
getRealFeatName
-
characters
- Specified by:
charactersin interfaceContentHandler- Overrides:
charactersin classDefaultHandler- Throws:
SAXException
-
isAllWhitespace
-
endElement
- Specified by:
endElementin interfaceContentHandler- Overrides:
endElementin classDefaultHandler- Throws:
SAXException
-
addArrayElement
- Throws:
SAXParseException
-
endDocument
- Specified by:
endDocumentin interfaceContentHandler- Overrides:
endDocumentin classDefaultHandler- Throws:
SAXException
-
finalizeFS
-
finalizeRefValue
Common code run at finalize time, to set ref values and handle out-of-typesystem data- Parameters:
extId- the external ID identifying either a deserialized FS or an out-of-typesystem instancefs- Feature Structure whose fi reference feature is to be set with a value derived from extId and FSinfofi- the featureImpl
-
finalizeArrayRefValue
Same as above, but specialized for array values, not feature slot values- Parameters:
extId-pos- the index in the arrayextId- the external ID identifying either a deserialized FS or an out-of-typesystem instance
-
finalizeAddToIndexes
-
finalizeOutOfTypeSystemFS
-
finalizeOutOfTypeSystemFeatures
private void finalizeOutOfTypeSystemFeatures() -
createException
-
createException
-
error
- Specified by:
errorin interfaceErrorHandler- Overrides:
errorin classDefaultHandler- Throws:
SAXException
-
fatalError
- Specified by:
fatalErrorin interfaceErrorHandler- Overrides:
fatalErrorin classDefaultHandler- Throws:
SAXException
-
ignorableWhitespace
- Specified by:
ignorableWhitespacein interfaceContentHandler- Overrides:
ignorableWhitespacein classDefaultHandler- Throws:
SAXException
-
setDocumentLocator
- Specified by:
setDocumentLocatorin interfaceContentHandler- Overrides:
setDocumentLocatorin classDefaultHandler
-
warning
- Specified by:
warningin interfaceErrorHandler- Overrides:
warningin classDefaultHandler- Throws:
SAXException
-
addToOutOfTypeSystemData
private void addToOutOfTypeSystemData(String typeName, Attributes attrs) throws XCASParsingException - Throws:
XCASParsingException
-
parseArray
Parse a multi-valued attribute into a String array, by splitting on whitespace.- Parameters:
val- attribute value- Returns:
- an array with each array value as an element
-
getCasTypeName
Gets the CAS type name corresponding to an XCAS tag name. The type name is usually equal to the tag name, but the characters : and - are translated into the sequences _colon_ and _dash_, respectively.- Parameters:
aTagName- XCAS tag name- Returns:
- CAS type name corresponding to this tag
-
maybeCreateWithV2Id
-