[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ozone + xerces.DOMWriter



Hi,
I'm new to both XML and ozone and am having trouble following this thread.
What is DOMWriter? I'm using 0.3.2 and xerces 1_0_3 and found it in neither.
I have attached some code I've written which works but is a little slow, to
print the document I'm using Xerces serialize package and it works. I would
like to take your advice and do something like this on the server.
How do I go about doing this? Is the XML support a pre made regular Ozone
object? Is there an object interface/implementation I can extend?
What I would ultimately like to do is this:
Manage a XML document in the server, offer methods to manipulate it and
return subsets of it from the server thus avoiding having to iterate the
entire document at the client.
One last question: Why do I need to pass dI.getDocumentElement() to the
serialize method and not just dI?

Regards,
Micky.


----- Original Message -----
From: "Falko Braeutigam" <falko@softwarebuero.de>
To: <ozone-users@ozone-db.org>
Sent: Wednesday, March 15, 2000 7:02 PM
Subject: Re: ozone + xerces.DOMWriter


> On Wed, 15 Mar 2000, you wrote:
> > Thank you for your interest.
> > I took the test.xml file which was in the ozone-distribution.
> > Currently I have problems to run ozone on solaris.
> > (The performance was quite bad, so we decided to switch the platform)
>
> Again, to run the XML printer in the client application will always result
in
> poor performance, no matter what hardware you use. Out tests show that an
XML
> printer in the client can process 10 DOM nodes per second. The same code
> running on the server can process several thousands of nodes per second.
>
>
> Falko
> --
> ______________________________________________________________________
> Falko Braeutigam                         mailto:falko@softwarebuero.de
> softwarebuero m&b (SMB)                    http://www.softwarebuero.de
>
>
import org.apache.xerces.dom.*;
import org.apache.xml.serialize.XMLSerializer;
import org.apache.xml.serialize.OutputFormat;
import org.w3c.dom.*;
import org.ozoneDB.xml.*;
import org.ozoneDB.xml.util.DOMConverterUtil;
import org.ozoneDB.RemoteDatabase;
public class XMLTest_Read {

  public static void main (String micky[]){    
    RemoteDatabase      database = new RemoteDatabase();
    try {
      database.open ("localhost", 3333);
      database.reloadClasses();
      Document dI = (Document) database.objectForName ("domTest");      
      try{
        XMLSerializer writer = new org.apache.xml.serialize.XMLSerializer(System.out, new OutputFormat());
        System.out.println("Serializing:");
        //System.out.println(dI.getDocumentElement().getTagName());
        writer.serialize(dI.getDocumentElement());
        }
        catch (Exception E){
          System.out.println("Error Serializing:");  
          System.out.println(E.getMessage());   
          }     
      database.close();    
      }
    catch (Exception E){
      System.out.println("Get Object Error:");  
      System.out.println(E.getMessage());   
      }     
    }
}
import org.apache.xerces.dom.*;
import org.apache.xml.serialize.*;
import org.w3c.dom.*;
import java.io.IOException;
import org.ozoneDB.RemoteDatabase;
import org.ozoneDB.xml.util.DOMConverterUtil;
public class XMLTest {

  public static void main (String micky[]){
    //Creating document:  
    DocumentImpl dI = new DocumentImpl();    
    Element topEl = dI.createElement("aDocument");
    topEl.setAttribute ("id", "test");  
    ElementImpl subEl = new ElementImpl(dI, "aLeaf");
    TextImpl ti = new TextImpl(dI, "This is text");
    subEl.appendChild(ti);
    topEl.appendChild (subEl);  
    dI.appendChild (topEl);
    
    //Serialing to System.out:
    XMLSerializer writer = new XMLSerializer(System.out, new OutputFormat());
    try {
      System.out.println("Serializing:");
      writer.serialize(dI);
      }
    catch (IOException E){
      System.out.println("Error:");  
      System.out.println(E.getMessage());  
      }  

    //Converting and storing:
    DOMConverterUtil DC = new org.ozoneDB.xml.util.DOMConverterUtil();  
    try {
      RemoteDatabase  database = new RemoteDatabase();
      database.open ("localhost", 3333);
      DC.openConverter(database);
      Document OD = DC.convertDOM(dI, "domTest");
      }
    catch (Exception E){
      System.out.println("Error:");  
      System.out.println(E.getMessage());  
      } 
  }
}