cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Torsten Curdt" <>
Subject RE: XObject
Date Fri, 01 Dec 2000 21:34:00 GMT
Ok, lets say there an XObject interface
*somewhere* ;) in the codebase.

This *was* the old one:

  import org.w3c.dom.Node;
  import org.xml.sax.DocumentHandler;

  public interface XObject {
    public void toSAX(DocumentHandler handler);
    public void toDOM(Node node);

And if got it right the new one could
look similiar to this:

  import org.w3c.dom.Node;
  import org.xml.sax.ContentHandler;

  public interface XObject {
    public void toSAX(ContentHandler handler);
    public void toDOM(Node node);

I was wondering how an implementation might
look like. Maybe something like this?

  public class test implements XObject{
    public void toDOM(Node node){
	Document doc = node.getOwnerDocument();
	Element e = doc.createElement("test");

    public void toSAX(ContentHandler handler){
      AttributesImpl attr = new AttributesImpl();
	String content = "content";


      handler.characters(content.toCharArray(), 0, content.length());


toSAX and toDOM should both give:


Correct!? (Haven't tested yet)

View raw message