public void parse ( ) { ChunkHeader firstChunkHeader = readChunkHeader ( ) ; if ( firstChunkHeader == null ) { return ; } switch ( firstChunkHeader . getChunkType ( ) ) { case ChunkType . XML : case ChunkType . NULL : break ; case ChunkType . STRING_POOL : default : // strange chunk header type, just skip this chunk header? } // read string pool chunk ChunkHeader stringPoolChunkHeader = readChunkHeader ( ) ; if ( stringPoolChunkHeader == null ) { return ; } ParseUtils . checkChunkType ( ChunkType . STRING_POOL , stringPoolChunkHeader . getChunkType ( ) ) ; stringPool = ParseUtils . readStringPool ( buffer , ( StringPoolHeader ) stringPoolChunkHeader ) ; // read on chunk, check if it was an optional XMLResourceMap chunk ChunkHeader chunkHeader = readChunkHeader ( ) ; if ( chunkHeader == null ) { return ; } if ( chunkHeader . getChunkType ( ) == ChunkType . XML_RESOURCE_MAP ) { long [ ] resourceIds = readXmlResourceMap ( ( XmlResourceMapHeader ) chunkHeader ) ; resourceMap = new String [ resourceIds . length ] ; for ( int i = 0 ; i < resourceIds . length ; i ++ ) { resourceMap [ i ] = Attribute . AttrIds . getString ( resourceIds [ i ] ) ; } chunkHeader = readChunkHeader ( ) ; } while ( chunkHeader != null ) { /*if (chunkHeader.chunkType == ChunkType.XML_END_NAMESPACE) { break; }*/ long beginPos = buffer . position ( ) ; switch ( chunkHeader . getChunkType ( ) ) { case ChunkType . XML_END_NAMESPACE : XmlNamespaceEndTag xmlNamespaceEndTag = readXmlNamespaceEndTag ( ) ; xmlStreamer . onNamespaceEnd ( xmlNamespaceEndTag ) ; break ; case ChunkType . XML_START_NAMESPACE : XmlNamespaceStartTag namespaceStartTag = readXmlNamespaceStartTag ( ) ; xmlStreamer . onNamespaceStart ( namespaceStartTag ) ; break ; case ChunkType . XML_START_ELEMENT : XmlNodeStartTag xmlNodeStartTag = readXmlNodeStartTag ( ) ; break ; case ChunkType . XML_END_ELEMENT : XmlNodeEndTag xmlNodeEndTag = readXmlNodeEndTag ( ) ; break ; case ChunkType . XML_CDATA : XmlCData xmlCData = readXmlCData ( ) ; break ; default : if ( chunkHeader . getChunkType ( ) >= ChunkType . XML_FIRST_CHUNK && chunkHeader . getChunkType ( ) <= ChunkType . XML_LAST_CHUNK ) { Buffers . skip ( buffer , chunkHeader . getBodySize ( ) ) ; } else { throw new ParserException ( "Unexpected chunk type:" + chunkHeader . getChunkType ( ) ) ; } } Buffers . position ( buffer , beginPos + chunkHeader . getBodySize ( ) ) ; chunkHeader = readChunkHeader ( ) ; } }
Parse binary xml .