Top Description Inners Fields Constructors Methods
org.jdom2.output.support

public final Class SAXTarget

extends Object
Class Inheritance
Imports
org.xml.sax.ContentHandler, .DTDHandler, .EntityResolver, .ErrorHandler, org.xml.sax.ext.DeclHandler, .LexicalHandler, org.jdom2.output.JDOMLocator

The target for all SAX notifications in this OuputProcessor
Author
Rolf Lear

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
SAXTarget.SAXLocator

A locator specific to the SAXOutputter process.

Field Summary

Modifier and TypeField and Description
private final ContentHandler
contentHandler

registered ContentHandler

private final boolean
declareNamespaces

Whether to report attribute namespace declarations as xmlns attributes.

private final DeclHandler
declHandler

registered DeclHandler

private final DTDHandler
dtdHandler

registered DTDHandler

private final EntityResolver
entityResolver

registered EntityResolver

private final ErrorHandler
errorHandler

registered ErrorHandler

private final LexicalHandler
lexicalHandler

registered LexicalHandler

private final SAXTarget.SAXLocator
private final boolean
reportDtdEvents

Whether to report DTD events to DeclHandlers and LexicalHandlers.

Constructor Summary

AccessConstructor and Description
public
SAXTarget(ContentHandler
The ContentHandler
contentHandler
,
ErrorHandler
The ErrorHandler
errorHandler
,
DTDHandler
The DTDHandler
dtdHandler
,
EntityResolver
The EntityResolver
entityResolver
,
LexicalHandler
The LexicalHandler
lexicalHandler
,
DeclHandler
The DeclHandler
declHandler
,
boolean
Whether to declare Namespaces
declareNamespaces
,
boolean
Whether to report DTD Events
reportDtdEvents
,
String
The public ID (null if none)
publicID
,
String
The System ID (null if none)
systemID
)

Create the collection of handlers for a SAXOutputProcessor

Method Summary

Modifier and TypeMethod and Description
public ContentHandler

Returns:

The target ContentHandler
getContentHandler
()

public DeclHandler

Returns:

The target DeclHandler
getDeclHandler
()

public DTDHandler

Returns:

The target DTDHandler
getDTDHandler
()

public EntityResolver

Returns:

The target EntityResolver
getEntityResolver
()

public ErrorHandler

Returns:

The target ErrorHandler
getErrorHandler
()

public LexicalHandler

Returns:

The target LexicalHandler
getLexicalHandler
()

public SAXTarget.SAXLocator

Returns:

the Locator used for this Output
getLocator
()

public boolean

Returns:

Whether to declare Namespaces
isDeclareNamespaces
()

public boolean

Returns:

Whether to report DTD Events
isReportDTDEvents
()

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

contentHandlerback to summary
private final ContentHandler contentHandler

registered ContentHandler

declareNamespacesback to summary
private final boolean declareNamespaces

Whether to report attribute namespace declarations as xmlns attributes. Defaults to false as per SAX specifications.

See Also
SAX namespace specifications
declHandlerback to summary
private final DeclHandler declHandler

registered DeclHandler

dtdHandlerback to summary
private final DTDHandler dtdHandler

registered DTDHandler

entityResolverback to summary
private final EntityResolver entityResolver

registered EntityResolver

errorHandlerback to summary
private final ErrorHandler errorHandler

registered ErrorHandler

lexicalHandlerback to summary
private final LexicalHandler lexicalHandler

registered LexicalHandler

locatorback to summary
private final SAXTarget.SAXLocator locator
reportDtdEventsback to summary
private final boolean reportDtdEvents

Whether to report DTD events to DeclHandlers and LexicalHandlers. Defaults to true.

Constructor Detail

SAXTargetback to summary
public SAXTarget(ContentHandler contentHandler, ErrorHandler errorHandler, DTDHandler dtdHandler, EntityResolver entityResolver, LexicalHandler lexicalHandler, DeclHandler declHandler, boolean declareNamespaces, boolean reportDtdEvents, String publicID, String systemID)

Create the collection of handlers for a SAXOutputProcessor

Parameters
contentHandler:ContentHandler

The ContentHandler

errorHandler:ErrorHandler

The ErrorHandler

dtdHandler:DTDHandler

The DTDHandler

entityResolver:EntityResolver

The EntityResolver

lexicalHandler:LexicalHandler

The LexicalHandler

declHandler:DeclHandler

The DeclHandler

declareNamespaces:boolean

Whether to declare Namespaces

reportDtdEvents:boolean

Whether to report DTD Events

publicID:String

The public ID (null if none)

systemID:String

The System ID (null if none)

Method Detail

getContentHandlerback to summary
public ContentHandler getContentHandler()
Returns:ContentHandler

The target ContentHandler

getDeclHandlerback to summary
public DeclHandler getDeclHandler()
Returns:DeclHandler

The target DeclHandler

getDTDHandlerback to summary
public DTDHandler getDTDHandler()
Returns:DTDHandler

The target DTDHandler

getEntityResolverback to summary
public EntityResolver getEntityResolver()
Returns:EntityResolver

The target EntityResolver

getErrorHandlerback to summary
public ErrorHandler getErrorHandler()
Returns:ErrorHandler

The target ErrorHandler

getLexicalHandlerback to summary
public LexicalHandler getLexicalHandler()
Returns:LexicalHandler

The target LexicalHandler

getLocatorback to summary
public SAXTarget.SAXLocator getLocator()
Returns:SAXTarget.SAXLocator

the Locator used for this Output

isDeclareNamespacesback to summary
public boolean isDeclareNamespaces()
Returns:boolean

Whether to declare Namespaces

isReportDTDEventsback to summary
public boolean isReportDTDEvents()
Returns:boolean

Whether to report DTD Events

org.jdom2.output.support back to summary

public final Class SAXTarget.SAXLocator

extends Object
implements JDOMLocator
Class Inheritance
All Implemented Interfaces
org.jdom2.output.JDOMLocator, org.xml.sax.Locator

A locator specific to the SAXOutputter process.
Author
Rolf Lear

Field Summary

Modifier and TypeField and Description
private Object
private final String
private final String

Constructor Summary

AccessConstructor and Description
public
SAXLocator(String
This Locator's SystemID
publicid
,
String
This Locator's PublicID
systemid
)

Creates a SAXLocator which implements JDOMLocator

Method Summary

Modifier and TypeMethod and Description
public int
getColumnNumber()

Implements org.xml.sax.Locator.getColumnNumber.

Return the column number where the current document event ends.
public int
getLineNumber()

Implements org.xml.sax.Locator.getLineNumber.

Return the line number where the current document event ends.
public Object
getNode()

Implements org.jdom2.output.JDOMLocator.getNode.

Returns the JDOM node being processed by SAXOutputter.
public String
getPublicId()

Implements org.xml.sax.Locator.getPublicId.

Return the public identifier for the current document event.
public String
getSystemId()

Implements org.xml.sax.Locator.getSystemId.

Return the system identifier for the current document event.
public void
setNode(Object
The location to set.
node
)

Set the location on this SAXLocator

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

nodeback to summary
private Object node
publicidback to summary
private final String publicid
systemidback to summary
private final String systemid

Constructor Detail

SAXLocatorback to summary
public SAXLocator(String publicid, String systemid)

Creates a SAXLocator which implements JDOMLocator

Parameters
publicid:String

This Locator's SystemID

systemid:String

This Locator's PublicID

Method Detail

getColumnNumberback to summary
public int getColumnNumber()

Implements org.xml.sax.Locator.getColumnNumber.

Doc from org.xml.sax.Locator.getColumnNumber.

Return the column number where the current document event ends. This is one-based number of Java char values since the last line end.

Warning

The return value from the method is intended only as an approximation for the sake of diagnostics; it is not intended to provide sufficient information to edit the character content of the original XML document. For example, when lines contain combining character sequences, wide characters, surrogate pairs, or bi-directional text, the value may not correspond to the column in a text editor's display.

The return value is an approximation of the column number in the document entity or external parsed entity where the markup triggering the event appears.

If possible, the SAX driver should provide the line position of the first character after the text associated with the document event. The first column in each line is column 1.

Returns:int

The column number, or -1 if none is available.

Annotations
@Override
getLineNumberback to summary
public int getLineNumber()

Implements org.xml.sax.Locator.getLineNumber.

Doc from org.xml.sax.Locator.getLineNumber.

Return the line number where the current document event ends. Lines are delimited by line ends, which are defined in the XML specification.

Warning

The return value from the method is intended only as an approximation for the sake of diagnostics; it is not intended to provide sufficient information to edit the character content of the original XML document. In some cases, these "line" numbers match what would be displayed as columns, and in others they may not match the source text due to internal entity expansion.

The return value is an approximation of the line number in the document entity or external parsed entity where the markup triggering the event appears.

If possible, the SAX driver should provide the line position of the first character after the text associated with the document event. The first line is line 1.

Returns:int

The line number, or -1 if none is available.

Annotations
@Override
getNodeback to summary
public Object getNode()

Implements org.jdom2.output.JDOMLocator.getNode.

Doc from org.jdom2.output.JDOMLocator.getNode.

Returns the JDOM node being processed by SAXOutputter.

Returns:Object

the JDOM node being processed by SAXOutputter.

Annotations
@Override
getPublicIdback to summary
public String getPublicId()

Implements org.xml.sax.Locator.getPublicId.

Doc from org.xml.sax.Locator.getPublicId.

Return the public identifier for the current document event.

The return value is the public identifier of the document entity or of the external parsed entity in which the markup triggering the event appears.

Returns:String

A string containing the public identifier, or null if none is available.

Annotations
@Override
getSystemIdback to summary
public String getSystemId()

Implements org.xml.sax.Locator.getSystemId.

Doc from org.xml.sax.Locator.getSystemId.

Return the system identifier for the current document event.

The return value is the system identifier of the document entity or of the external parsed entity in which the markup triggering the event appears.

If the system identifier is a URL, the parser must resolve it fully before passing it to the application. For example, a file name must always be provided as a file:... URL, and other kinds of relative URI are also resolved against their bases.

Returns:String

A string containing the system identifier, or null if none is available.

Annotations
@Override
setNodeback to summary
public void setNode(Object node)

Set the location on this SAXLocator

Parameters
node:Object

The location to set.