protected void handleStartTag( XmlPullParser parser, Sink sink )
throws XmlPullParserException, MacroExecutionException
{
isEmptyElement = parser.isEmptyElementTag();
SinkEventAttributeSet attribs = getAttributesFromParser( parser );
if ( parser.getName().equals( HTML.toString() ) )
{
//Do nothing
return;
}
else if ( parser.getName().equals( HEAD.toString() ) )
{
sink.head( attribs );
}
else if ( parser.getName().equals( TITLE.toString() ) )
{
sink.title( attribs );
}
else if ( parser.getName().equals( META.toString() ) )
{
String name = parser.getAttributeValue( null, Attribute.NAME.toString() );
String content = parser.getAttributeValue( null, Attribute.CONTENT.toString() );
if ( "author".equals( name ) )
{
sink.author( null );
sink.text( content );
sink.author_();
}
else if ( "date".equals( name ) )
{
sink.date( null );
sink.text( content );
sink.date_();
}
else
{
sink.unknown( "meta", new Object[] { Integer.valueOf( TAG_TYPE_SIMPLE ) }, attribs );
}
}
/*
* The ADDRESS element may be used by authors to supply contact information
* for a model or a major part of a model such as a form. This element
* often appears at the beginning or end of a model.
*/
else if ( parser.getName().equals( ADDRESS.toString() ) )
{
sink.author( attribs );
}
else if ( parser.getName().equals( BODY.toString() ) )
{
sink.body( attribs );
}
else if ( parser.getName().equals( DIV.toString() ) )
{
String divclass = parser.getAttributeValue( null, Attribute.CLASS.toString() );
if ( "source".equals( divclass ) )
{
this.boxed = true;
}
super.baseStartTag( parser, sink ); // pick up other divs
}
/*
* The PRE element tells visual user agents that the enclosed text is
* "preformatted". When handling preformatted text, visual user agents:
* - May leave white space intact.
* - May render text with a fixed-pitch font.
* - May disable automatic word wrap.
* - Must not disable bidirectional processing.
* Non-visual user agents are not required to respect extra white space
* in the content of a PRE element.
*/
else if ( parser.getName().equals( PRE.toString() ) )
{
if ( boxed )
{
attribs.addAttributes( SinkEventAttributeSet.BOXED );
}
verbatim();
sink.verbatim( attribs );