org.sourceprojects.xmlparser
Class AbstractTagParser<B>

java.lang.Object
  extended by org.sourceprojects.xmlparser.AbstractTagParser<B>
Type Parameters:
B - Type of ContextObject to use
All Implemented Interfaces:
TagDefinitionParser<B>

public abstract class AbstractTagParser<B>
extends java.lang.Object
implements TagDefinitionParser<B>

Abstract implementation of TagDefinitionParser with basic handling of some of the needed method structures. If someone want's to implement a tag parser / transformer, he must extends this class instead of implementing the interface directly.

Since:
0.0.1
Author:
noctarius

Constructor Summary
AbstractTagParser()
           
 
Method Summary
 void parseElement(org.w3c.dom.Element element, ParserContext<B> parserContext, DefinitionBuilder definitionBuilder)
          Parses an element.
 void parseElement(org.w3c.dom.Element element, java.lang.String localName, ParserContext<B> parserContext, DefinitionBuilder definitionBuilder)
          Parses an element.
 void parseElement(org.w3c.dom.Element element, java.lang.String localName, javax.xml.namespace.QName parent, ParserContext<B> parserContext, DefinitionBuilder definitionBuilder)
          Parses an element.
 org.w3c.dom.Node transformElement(org.w3c.dom.Element element, ParserContext<B> parserContext, DefinitionBuilder definitionBuilder)
          Transforms an element.
 org.w3c.dom.Node transformElement(org.w3c.dom.Element element, java.lang.String localName, ParserContext<B> parserContext, DefinitionBuilder definitionBuilder)
          Transforms an element.
 org.w3c.dom.Node transformElement(org.w3c.dom.Element element, java.lang.String localName, javax.xml.namespace.QName parent, ParserContext<B> parserContext, DefinitionBuilder definitionBuilder)
          Transforms an element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.sourceprojects.xmlparser.TagDefinitionParser
getNamespace, getTags
 

Constructor Detail

AbstractTagParser

public AbstractTagParser()
Method Detail

parseElement

public void parseElement(org.w3c.dom.Element element,
                         ParserContext<B> parserContext,
                         DefinitionBuilder definitionBuilder)
                  throws XmlParserParsingException
Description copied from interface: TagDefinitionParser
Parses an element. Method is called if a element combination namespace-tag (optional with parent hierarchy) is found

Specified by:
parseElement in interface TagDefinitionParser<B>
Parameters:
element - Element which was found
parserContext - ParserContext instance which was given to the XmlParser instance
definitionBuilder - DefinitionBuilder instance which was given to the XmlParser instance
Throws:
XmlParserParsingException - Is thrown when some error occurs. Implementation specific exceptions are wrapped into XmlParserParsingException

parseElement

public void parseElement(org.w3c.dom.Element element,
                         java.lang.String localName,
                         ParserContext<B> parserContext,
                         DefinitionBuilder definitionBuilder)
                  throws XmlParserParsingException
Description copied from interface: TagDefinitionParser
Parses an element. Method is called if a element combination namespace-tag (optional with parent hierarchy) is found

Specified by:
parseElement in interface TagDefinitionParser<B>
Parameters:
element - Element which was found
localName - Name, as String, of the actual element
parserContext - ParserContext instance which was given to the XmlParser instance
definitionBuilder - DefinitionBuilder instance which was given to the XmlParser instance
Throws:
XmlParserParsingException - Is thrown when some error occurs. Implementation specific exceptions are wrapped into XmlParserParsingException

parseElement

public void parseElement(org.w3c.dom.Element element,
                         java.lang.String localName,
                         javax.xml.namespace.QName parent,
                         ParserContext<B> parserContext,
                         DefinitionBuilder definitionBuilder)
                  throws XmlParserParsingException
Description copied from interface: TagDefinitionParser
Parses an element. Method is called if a element combination namespace-tag (optional with parent hierarchy) is found

Specified by:
parseElement in interface TagDefinitionParser<B>
Parameters:
element - Element which was found
localName - Name, as String, of the actual element
parent - QName instance of the parent element, null if no parent-hierarchy was defined
parserContext - ParserContext instance which was given to the XmlParser instance
definitionBuilder - DefinitionBuilder instance which was given to the XmlParser instance
Throws:
XmlParserParsingException - Is thrown when some error occurs. Implementation specific exceptions are wrapped into XmlParserParsingException

transformElement

public org.w3c.dom.Node transformElement(org.w3c.dom.Element element,
                                         ParserContext<B> parserContext,
                                         DefinitionBuilder definitionBuilder)
                                  throws XmlParserParsingException
Description copied from interface: TagDefinitionParser
Transforms an element. Method is called if a element combination namespace-tag (optional with parent hierarchy) is found

Specified by:
transformElement in interface TagDefinitionParser<B>
Parameters:
element - Element which was found
parserContext - ParserContext instance which was given to the XmlParser instance
definitionBuilder - DefinitionBuilder instance which was given to the XmlParser instance
Returns:
Node of the transformed element (defined against DefinitionBuilder.getDocument() Document), null if element should be removed from returning Document
Throws:
XmlParserParsingException - Is thrown when some error occurs. Implementation specific exceptions are wrapped into XmlParserParsingException

transformElement

public org.w3c.dom.Node transformElement(org.w3c.dom.Element element,
                                         java.lang.String localName,
                                         ParserContext<B> parserContext,
                                         DefinitionBuilder definitionBuilder)
                                  throws XmlParserParsingException
Description copied from interface: TagDefinitionParser
Transforms an element. Method is called if a element combination namespace-tag (optional with parent hierarchy) is found

Specified by:
transformElement in interface TagDefinitionParser<B>
Parameters:
element - Element which was found
localName - Name, as String, of the actual element
parserContext - ParserContext instance which was given to the XmlParser instance
definitionBuilder - DefinitionBuilder instance which was given to the XmlParser instance
Returns:
Node of the transformed element (defined against DefinitionBuilder.getDocument() Document), null if element should be removed from returning Document
Throws:
XmlParserParsingException - Is thrown when some error occurs. Implementation specific exceptions are wrapped into XmlParserParsingException

transformElement

public org.w3c.dom.Node transformElement(org.w3c.dom.Element element,
                                         java.lang.String localName,
                                         javax.xml.namespace.QName parent,
                                         ParserContext<B> parserContext,
                                         DefinitionBuilder definitionBuilder)
                                  throws XmlParserParsingException
Description copied from interface: TagDefinitionParser
Transforms an element. Method is called if a element combination namespace-tag (optional with parent hierarchy) is found

Specified by:
transformElement in interface TagDefinitionParser<B>
Parameters:
element - Element which was found
localName - Name, as String, of the actual element
parent - QName instance of the parent element, null if no parent-hierarchy was defined
parserContext - ParserContext instance which was given to the XmlParser instance
definitionBuilder - DefinitionBuilder instance which was given to the XmlParser instance
Returns:
Node of the transformed element (defined against DefinitionBuilder.getDocument() Document), null if element should be removed from returning Document
Throws:
XmlParserParsingException - Is thrown when some error occurs. Implementation specific exceptions are wrapped into XmlParserParsingException


Copyright © 2010. All Rights Reserved.