Arch4J 1.1

org.arch4j.propertytree
Class XMLPropertyBuilder

java.lang.Object
  |
  +--org.arch4j.propertytree.XMLPropertyBuilder
All Implemented Interfaces:
PropertyBuilder, XMLHandler

public class XMLPropertyBuilder
extends Object
implements XMLHandler, PropertyBuilder


Field Summary
protected static String VALUE_ATTRIBUTE
           
static String XML_EXTENSION
           
 
Constructor Summary
XMLPropertyBuilder()
           
XMLPropertyBuilder(boolean getValueFromAttribute)
           
 
Method Summary
 ReadOnlyProperty buildProperties(String aFilepath)
          this method accepts a full filepath and then parses that file to return a Property hierarchy.
 boolean canParse(String aPathname)
          this method accepts a filename and then determines if this property builder can build properties from that file, based on its extension.
 void characters(char[] buffer, int start, int length)
          this method is called when the parser encounters plain text outside of a bracketed tag.
 void endDocument()
          called when parser reaches the end of the document
 void endElement(String name)
          this method is called whenever the parser encounters the end of an element
 void error(String message, String source, int line, int column)
          this method is called by the parser if it encounters a recoverable error.
 void fatalError(String message, String source, int line, int column)
          this method is called by the parser if it encounters a non-recoverable error.
 void startDocument()
          this method is called by the parser at the start of a document
 void startElement(String name, Map attributes)
          this method is called when the parser encounters a starting element tag.
 void warning(String message, String source, int line, int column)
          this method is called by the parser if it encounters a warning situation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

XML_EXTENSION

public static String XML_EXTENSION

VALUE_ATTRIBUTE

protected static String VALUE_ATTRIBUTE
Constructor Detail

XMLPropertyBuilder

public XMLPropertyBuilder()

XMLPropertyBuilder

public XMLPropertyBuilder(boolean getValueFromAttribute)
Method Detail

canParse

public boolean canParse(String aPathname)
this method accepts a filename and then determines if this property builder can build properties from that file, based on its extension.

Specified by:
canParse in interface PropertyBuilder
Returns:
true if this class can create properties from the file

buildProperties

public ReadOnlyProperty buildProperties(String aFilepath)
this method accepts a full filepath and then parses that file to return a Property hierarchy.

Specified by:
buildProperties in interface PropertyBuilder
Parameters:
aFilepath - full filepath of a file to parse.

startDocument

public void startDocument()
this method is called by the parser at the start of a document

Specified by:
startDocument in interface XMLHandler

characters

public void characters(char[] buffer,
                       int start,
                       int length)
this method is called when the parser encounters plain text outside of a bracketed tag. It provides the text in the buffer in the index range start -> end.

Specified by:
characters in interface XMLHandler
Parameters:
buffer - buffer containing plain text characters
start - start index of plain text characters in buffer
length - number of characters in plain text

startElement

public void startElement(String name,
                         Map attributes)
this method is called when the parser encounters a starting element tag.

Specified by:
startElement in interface XMLHandler
Parameters:
attributes - a map of attribute names and values found in this element

endElement

public void endElement(String name)
this method is called whenever the parser encounters the end of an element

Specified by:
endElement in interface XMLHandler
Parameters:
name - the tag of the element that is ending

endDocument

public void endDocument()
called when parser reaches the end of the document

Specified by:
endDocument in interface XMLHandler

error

public void error(String message,
                  String source,
                  int line,
                  int column)
this method is called by the parser if it encounters a recoverable error.

Specified by:
error in interface XMLHandler
Parameters:
message - error message generated by parser
source - source of XML document - generally a file name
line - line number of document on which error occurred.
column - column number at which error occurred.

fatalError

public void fatalError(String message,
                       String source,
                       int line,
                       int column)
this method is called by the parser if it encounters a non-recoverable error. The parser aborts after this callback.

Specified by:
fatalError in interface XMLHandler
Parameters:
message - error message generated by parser
source - source of XML document - generally a file name
line - line number of document on which error occurred.
column - column number at which error occurred.

warning

public void warning(String message,
                    String source,
                    int line,
                    int column)
this method is called by the parser if it encounters a warning situation.

Specified by:
warning in interface XMLHandler
Parameters:
message - error message generated by parser
source - source of XML document - generally a file name
line - line number of document on which error occurred.
column - column number at which error occurred.

Arch4J 1.1

Copyright © 2000-2004 SpiderLogic, a service of Wipfli Ullrich Bertelson LLP.