Added MarshallerSource

This commit is contained in:
Arjen Poutsma
2007-06-14 00:04:16 +00:00
parent 5ab5d742aa
commit 1be5b4a086
4 changed files with 141 additions and 13 deletions

View File

@@ -22,6 +22,7 @@ import org.xml.sax.EntityResolver;
import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXNotRecognizedException;
import org.xml.sax.XMLReader;
import org.xml.sax.ext.LexicalHandler;
/**
* Abstract base class for SAX <code>XMLReader</code> implementations. Contains properties as defined in {@link
@@ -43,6 +44,8 @@ public abstract class AbstractXmlReader implements XMLReader {
private ErrorHandler errorHandler;
private LexicalHandler lexicalHandler;
public ContentHandler getContentHandler() {
return contentHandler;
}
@@ -75,6 +78,14 @@ public abstract class AbstractXmlReader implements XMLReader {
this.errorHandler = errorHandler;
}
public LexicalHandler getLexicalHandler() {
return lexicalHandler;
}
public void setLexicalHandler(LexicalHandler lexicalHandler) {
this.lexicalHandler = lexicalHandler;
}
/**
* Throws a <code>SAXNotRecognizedException</code> exception.
*
@@ -88,30 +99,35 @@ public abstract class AbstractXmlReader implements XMLReader {
/**
* Throws a <code>SAXNotRecognizedException</code> exception.
*
* @throws org.xml.sax.SAXNotRecognizedException
* always
* @throws SAXNotRecognizedException always
*/
public void setFeature(String name, boolean value) throws SAXNotRecognizedException {
throw new SAXNotRecognizedException(name);
}
/**
* Throws a <code>SAXNotRecognizedException</code> exception.
*
* @throws org.xml.sax.SAXNotRecognizedException
* always
* Throws a <code>SAXNotRecognizedException</code> exception when the given property does not signify a lexical
* handler. The property name for a lexical handler is <code>http://xml.org/sax/properties/lexical-handler</code>.
*/
public Object getProperty(String name) throws SAXNotRecognizedException {
throw new SAXNotRecognizedException(name);
if ("http://xml.org/sax/properties/lexical-handler".equals(name)) {
return lexicalHandler;
}
else {
throw new SAXNotRecognizedException(name);
}
}
/**
* Throws a <code>SAXNotRecognizedException</code> exception.
*
* @throws org.xml.sax.SAXNotRecognizedException
* always
* Throws a <code>SAXNotRecognizedException</code> exception when the given property does not signify a lexical
* handler. The property name for a lexical handler is <code>http://xml.org/sax/properties/lexical-handler</code>.
*/
public void setProperty(String name, Object value) throws SAXNotRecognizedException {
throw new SAXNotRecognizedException(name);
if ("http://xml.org/sax/properties/lexical-handler".equals(name)) {
lexicalHandler = (LexicalHandler) value;
}
else {
throw new SAXNotRecognizedException(name);
}
}
}