nu.validator.source
Class SourceCode

java.lang.Object
  extended by nu.validator.source.SourceCode
All Implemented Interfaces:
CharacterHandler

public final class SourceCode
extends Object
implements CharacterHandler


Field Summary
private  Line currentLine
           
private  String encoding
           
private  SortedSet<Location> exactErrors
           
private  int expectedLength
           
private  List<Line> lines
           
private  LocationRecorder locationRecorder
           
private static org.apache.log4j.Logger log4j
           
private  SortedSet<Integer> oneBasedLineErrors
           
private  boolean prevWasCr
           
private  SortedSet<Location> rangeLasts
           
private  SortedSet<Location> reverseSortedLocations
           
private static Location[] SOURCE_LOCATION_ARRAY_TYPE
           
private  String type
           
private  String uri
           
 
Constructor Summary
SourceCode()
           
 
Method Summary
(package private)  void addLocatorLocation(int oneBasedLine, int oneBasedColumn)
           
 void characters(char[] ch, int start, int length)
           
(package private)  void emitCharacter(Location location, SourceHandler handler)
           
(package private)  void emitContent(Location from, Location until, SourceHandler handler)
          Emits content between from a location (inclusive) until a location (exclusive).
 void emitSource(SourceHandler handler)
           
 void end()
           
 void exactError(Location location, SourceHandler extractHandler)
           
(package private)  Line getLine(int line)
           
 ContentHandler getLocationRecorder()
          Returns the locationRecorder.
(package private)  int getNumberOfLines()
           
 String getUri()
          Returns the uri.
 void initialize(InputSource inputSource)
           
 boolean isWithinKnownSource(int oneBasedLine)
           
 boolean isWithinKnownSource(Location location)
           
 void lineError(int oneBasedLine, SourceHandler extractHandler)
           
private  void newLine()
           
 Location newLocatorLocation(int oneBasedLine, int oneBasedColumn)
           
 void rangeEndError(Location rangeStart, Location rangeLast, SourceHandler extractHandler)
           
 Location rangeStartForRangeLast(Location rangeLast)
           
 void rememberExactError(Location location)
           
 void start()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log4j

private static final org.apache.log4j.Logger log4j

SOURCE_LOCATION_ARRAY_TYPE

private static Location[] SOURCE_LOCATION_ARRAY_TYPE

uri

private String uri

type

private String type

encoding

private String encoding

expectedLength

private int expectedLength

reverseSortedLocations

private final SortedSet<Location> reverseSortedLocations

exactErrors

private final SortedSet<Location> exactErrors

rangeLasts

private final SortedSet<Location> rangeLasts

oneBasedLineErrors

private final SortedSet<Integer> oneBasedLineErrors

lines

private final List<Line> lines

currentLine

private Line currentLine

prevWasCr

private boolean prevWasCr

locationRecorder

private final LocationRecorder locationRecorder
Constructor Detail

SourceCode

public SourceCode()
Method Detail

initialize

public void initialize(InputSource inputSource)

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws SAXException
Specified by:
characters in interface CharacterHandler
Throws:
SAXException

newLine

private void newLine()

end

public void end()
         throws SAXException
Specified by:
end in interface CharacterHandler
Throws:
SAXException

start

public void start()
           throws SAXException
Specified by:
start in interface CharacterHandler
Throws:
SAXException

addLocatorLocation

void addLocatorLocation(int oneBasedLine,
                        int oneBasedColumn)

exactError

public void exactError(Location location,
                       SourceHandler extractHandler)
                throws SAXException
Throws:
SAXException

rememberExactError

public void rememberExactError(Location location)

rangeEndError

public void rangeEndError(Location rangeStart,
                          Location rangeLast,
                          SourceHandler extractHandler)
                   throws SAXException
Throws:
SAXException

rangeStartForRangeLast

public Location rangeStartForRangeLast(Location rangeLast)
Parameters:
rangeLast -
Returns:

lineError

public void lineError(int oneBasedLine,
                      SourceHandler extractHandler)
               throws SAXException
Throws:
SAXException

isWithinKnownSource

public boolean isWithinKnownSource(Location location)

isWithinKnownSource

public boolean isWithinKnownSource(int oneBasedLine)

getLine

Line getLine(int line)

getNumberOfLines

int getNumberOfLines()

emitCharacter

void emitCharacter(Location location,
                   SourceHandler handler)
             throws SAXException
Throws:
SAXException

emitContent

void emitContent(Location from,
                 Location until,
                 SourceHandler handler)
           throws SAXException
Emits content between from a location (inclusive) until a location (exclusive).

Parameters:
from -
until -
handler -
Throws:
SAXException

emitSource

public void emitSource(SourceHandler handler)
                throws SAXException
Throws:
SAXException

getUri

public String getUri()
Returns the uri.

Returns:
the uri

getLocationRecorder

public ContentHandler getLocationRecorder()
Returns the locationRecorder. The returned object is guaranteed to also implement LexicalHandler.

Returns:
the locationRecorder

newLocatorLocation

public Location newLocatorLocation(int oneBasedLine,
                                   int oneBasedColumn)