public abstract class DOMConvertor extends Convertor
Modifier | Constructor and Description |
---|---|
protected |
DOMConvertor(String publicID,
String systemID,
String rootElement)
Creat a DOMConvertor
|
Modifier and Type | Method and Description |
---|---|
protected static Object |
delegateRead(Element element)
delegate the read operation to a convertor referenced by
dtd_public_id |
protected static Element |
delegateWrite(Document doc,
Object obj)
delegate the write operation to a convertor able to write
obj |
protected static Lookup |
findContext(Document doc)
get a context associated with the document
doc . |
Object |
read(Reader r)
Read content from
r and delegate to readElement(org.w3c.dom.Element)
passing parsed content as a root element of DOM document |
protected abstract Object |
readElement(Element element)
Provide an object constructed from the element.
|
void |
write(Writer w,
Object inst)
Write object described by DOM document filled by
writeElement(org.w3c.dom.Document, org.w3c.dom.Element, java.lang.Object) |
protected abstract void |
writeElement(Document doc,
Element element,
Object obj)
Fill a DOM element describing
obj with attributes or subelements. |
findContext, findContext, registerSaver, unregisterSaver
public final Object read(Reader r) throws IOException, ClassNotFoundException
r
and delegate to readElement(org.w3c.dom.Element)
passing parsed content as a root element of DOM documentread
in class Convertor
r
- stream containing stored objectIOException
- if the object cannot be readClassNotFoundException
- if the object class cannot be resolvedpublic final void write(Writer w, Object inst) throws IOException
writeElement(org.w3c.dom.Document, org.w3c.dom.Element, java.lang.Object)
write
in class Convertor
w
- stream into which inst is writteninst
- the setting object to be writtenIOException
- if the object cannot be writtenprotected abstract Object readElement(Element element) throws IOException, ClassNotFoundException
element
- represents a read object in a DOM documentIOException
- if the object cannot be readClassNotFoundException
- if the object class cannot be resolvedprotected abstract void writeElement(Document doc, Element element, Object obj) throws IOException, DOMException
obj
with attributes or subelements.doc
- a DOM document allowing to create elements describing passed objectelement
- represents a written object in a DOM documentobj
- an object to convertIOException
- if the object cannot be writtenDOMException
- if an element construction failedprotected static final Object delegateRead(Element element) throws IOException, ClassNotFoundException
dtd_public_id
element
- DOM element that should be readIOException
- if the object cannot be readClassNotFoundException
- if the object class cannot be resolvedreadElement(org.w3c.dom.Element)
protected static final Element delegateWrite(Document doc, Object obj) throws IOException, DOMException
obj.
doc
- a DOM document allowing to create elements describing passed objectobj
- an object to convertIOException
- if the object cannot be writtenDOMException
- if an element construction failedwriteElement(org.w3c.dom.Document, org.w3c.dom.Element, java.lang.Object)
protected static Lookup findContext(Document doc)
doc
. It can
contain various info like a file location of the read document etc.doc
- a DOM document containing stored object