}
}
protected final void processEII(QualifiedName name, boolean hasAttributes) throws FastInfosetException, IOException {
if (_prefixTable._currentInScope[name.prefixIndex] != name.namespaceNameIndex) {
throw new FastInfosetException(CommonResourceBundle.getInstance().getString("message.qnameOfEIINotInScope"));
}
final Node parentCurrentNode = _currentNode;
_currentNode = _currentElement = createElement(name.namespaceName, name.qName, name.localName);
if (_namespaceAttributesIndex > 0) {
for (int i = 0; i < _namespaceAttributesIndex; i++) {
_currentElement.setAttributeNode(_namespaceAttributes[i]);
_namespaceAttributes[i] = null;
}
_namespaceAttributesIndex = 0;
}
if (hasAttributes) {
processAIIs();
}
parentCurrentNode.appendChild(_currentElement);
while(!_terminate) {
_b = read();
switch(DecoderStateTables.EII(_b)) {
case DecoderStateTables.EII_NO_AIIS_INDEX_SMALL:
processEII(_elementNameTable._array[_b], false);
break;
case DecoderStateTables.EII_AIIS_INDEX_SMALL:
processEII(_elementNameTable._array[_b & EncodingConstants.INTEGER_3RD_BIT_SMALL_MASK], true);
break;
case DecoderStateTables.EII_INDEX_MEDIUM:
processEII(decodeEIIIndexMedium(), (_b & EncodingConstants.ELEMENT_ATTRIBUTE_FLAG) > 0);
break;
case DecoderStateTables.EII_INDEX_LARGE:
processEII(decodeEIIIndexLarge(), (_b & EncodingConstants.ELEMENT_ATTRIBUTE_FLAG) > 0);
break;
case DecoderStateTables.EII_LITERAL:
{
final QualifiedName qn = processLiteralQualifiedName(
_b & EncodingConstants.LITERAL_QNAME_PREFIX_NAMESPACE_NAME_MASK,
_elementNameTable.getNext());
_elementNameTable.add(qn);
processEII(qn, (_b & EncodingConstants.ELEMENT_ATTRIBUTE_FLAG) > 0);
break;
}
case DecoderStateTables.EII_NAMESPACES:
processEIIWithNamespaces();
break;
case DecoderStateTables.CII_UTF8_SMALL_LENGTH:
{
_octetBufferLength = (_b & EncodingConstants.OCTET_STRING_LENGTH_7TH_BIT_SMALL_MASK)
+ 1;
appendOrCreateTextData(processUtf8CharacterString());
break;
}
case DecoderStateTables.CII_UTF8_MEDIUM_LENGTH:
{
_octetBufferLength = read() + EncodingConstants.OCTET_STRING_LENGTH_7TH_BIT_SMALL_LIMIT;
appendOrCreateTextData(processUtf8CharacterString());
break;
}
case DecoderStateTables.CII_UTF8_LARGE_LENGTH:
{
_octetBufferLength = (read() << 24) |
(read() << 16) |
(read() << 8) |
read();
_octetBufferLength += EncodingConstants.OCTET_STRING_LENGTH_7TH_BIT_MEDIUM_LIMIT;
appendOrCreateTextData(processUtf8CharacterString());
break;
}
case DecoderStateTables.CII_UTF16_SMALL_LENGTH:
{
_octetBufferLength = (_b & EncodingConstants.OCTET_STRING_LENGTH_7TH_BIT_SMALL_MASK)
+ 1;
String v = decodeUtf16StringAsString();
if ((_b & EncodingConstants.CHARACTER_CHUNK_ADD_TO_TABLE_FLAG) > 0) {
_characterContentChunkTable.add(_charBuffer, _charBufferLength);
}
appendOrCreateTextData(v);
break;
}
case DecoderStateTables.CII_UTF16_MEDIUM_LENGTH:
{
_octetBufferLength = read() + EncodingConstants.OCTET_STRING_LENGTH_7TH_BIT_SMALL_LIMIT;
String v = decodeUtf16StringAsString();
if ((_b & EncodingConstants.CHARACTER_CHUNK_ADD_TO_TABLE_FLAG) > 0) {
_characterContentChunkTable.add(_charBuffer, _charBufferLength);
}
appendOrCreateTextData(v);
break;
}
case DecoderStateTables.CII_UTF16_LARGE_LENGTH:
{
_octetBufferLength = (read() << 24) |
(read() << 16) |
(read() << 8) |
read();
_octetBufferLength += EncodingConstants.OCTET_STRING_LENGTH_7TH_BIT_MEDIUM_LIMIT;
String v = decodeUtf16StringAsString();
if ((_b & EncodingConstants.CHARACTER_CHUNK_ADD_TO_TABLE_FLAG) > 0) {
_characterContentChunkTable.add(_charBuffer, _charBufferLength);
}
appendOrCreateTextData(v);
break;
}
case DecoderStateTables.CII_RA:
{
final boolean addToTable = (_b & EncodingConstants.CHARACTER_CHUNK_ADD_TO_TABLE_FLAG) > 0;
// Decode resitricted alphabet integer
_identifier = (_b & 0x02) << 6;
_b = read();
_identifier |= (_b & 0xFC) >> 2;
decodeOctetsOnSeventhBitOfNonIdentifyingStringOnThirdBit(_b);
String v = decodeRestrictedAlphabetAsString();
if (addToTable) {
_characterContentChunkTable.add(_charBuffer, _charBufferLength);
}
appendOrCreateTextData(v);
break;
}
case DecoderStateTables.CII_EA:
{
final boolean addToTable = (_b & EncodingConstants.CHARACTER_CHUNK_ADD_TO_TABLE_FLAG) > 0;
// Decode encoding algorithm integer
_identifier = (_b & 0x02) << 6;
_b = read();
_identifier |= (_b & 0xFC) >> 2;
decodeOctetsOnSeventhBitOfNonIdentifyingStringOnThirdBit(_b);
final String s = convertEncodingAlgorithmDataToCharacters(false);
if (addToTable) {
_characterContentChunkTable.add(s.toCharArray(), s.length());
}
appendOrCreateTextData(s);
break;
}
case DecoderStateTables.CII_INDEX_SMALL:
{
final String s = _characterContentChunkTable.getString(_b & EncodingConstants.INTEGER_4TH_BIT_SMALL_MASK);
appendOrCreateTextData(s);
break;
}
case DecoderStateTables.CII_INDEX_MEDIUM:
{
final int index = (((_b & EncodingConstants.INTEGER_4TH_BIT_MEDIUM_MASK) << 8) | read())
+ EncodingConstants.INTEGER_4TH_BIT_SMALL_LIMIT;
final String s = _characterContentChunkTable.getString(index);
appendOrCreateTextData(s);
break;
}
case DecoderStateTables.CII_INDEX_LARGE:
{
int index = ((_b & EncodingConstants.INTEGER_4TH_BIT_LARGE_MASK) << 16) |
(read() << 8) |
read();
index += EncodingConstants.INTEGER_4TH_BIT_MEDIUM_LIMIT;
final String s = _characterContentChunkTable.getString(index);
appendOrCreateTextData(s);
break;
}
case DecoderStateTables.CII_INDEX_LARGE_LARGE:
{
int index = (read() << 16) |
(read() << 8) |
read();
index += EncodingConstants.INTEGER_4TH_BIT_LARGE_LIMIT;
final String s = _characterContentChunkTable.getString(index);
appendOrCreateTextData(s);
break;
}
case DecoderStateTables.COMMENT_II:
processCommentII();
break;
case DecoderStateTables.PROCESSING_INSTRUCTION_II:
processProcessingII();
break;
case DecoderStateTables.UNEXPANDED_ENTITY_REFERENCE_II:
{
String entity_reference_name = decodeIdentifyingNonEmptyStringOnFirstBit(_v.otherNCName);
String system_identifier = ((_b & EncodingConstants.UNEXPANDED_ENTITY_SYSTEM_IDENTIFIER_FLAG) > 0)
? decodeIdentifyingNonEmptyStringOnFirstBit(_v.otherURI) : null;
String public_identifier = ((_b & EncodingConstants.UNEXPANDED_ENTITY_PUBLIC_IDENTIFIER_FLAG) > 0)
? decodeIdentifyingNonEmptyStringOnFirstBit(_v.otherURI) : null;
// TODO create Node
break;
}
case DecoderStateTables.TERMINATOR_DOUBLE:
_doubleTerminate = true;
case DecoderStateTables.TERMINATOR_SINGLE:
_terminate = true;
break;
default:
throw new FastInfosetException(CommonResourceBundle.getInstance().getString("message.IllegalStateDecodingEII"));
}
}
_terminate = _doubleTerminate;
_doubleTerminate = false;