xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ahmad Morad <mo...@db.informatik.uni-kassel.de>
Subject TransformerFactory
Date Thu, 04 Jan 2001 15:19:09 GMT
Thanks Don Leslie,

now I use the Xalan-Java 2.0.D05. But I still have some problems!.
The problem is that the methods in TansfomFactory, TranformFactoryImpl
try to read some system properties to decide which parser to use!. Some of
these properties however are not allowed to read from an applet. I found it 
ver complecated to use these classes. I believe ther must be a simple way
to set chosse the parser implicitly, and to avoid such complicated decisions
about the parser.

Here is the new code which works will as an application:
##
  TransformerFactory tFactory = TransformerFactory.newInstance(); 
  StringReader strR = new StringReader(sheet);
  StreamSource src = new StreamSource(strR);// Erzeugen aus dem String
  tableTransformer = tFactory.newTransformer(src);
##

And her a short cut from the stack trace:
##
 javax.xml.transform.TransformerConfigurationException: access denied 
(java.util.PropertyPermission method read)
	at 
org.apache.xalan.processor.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:743)
	at 
org.apache.xalan.processor.TransformerFactoryImpl.newTransformer(TransformerFactoryImpl.java:603)
	at tcldbc.TclDBMessageHandler.<init>(TclDBMessageHandler.java:69)
	at tcldbc.TclDBSocket.<init>(TclDBSocket.java:108)
	at escherC05.makeContentPane(escherC05.java:44)
	at escherC05.init(escherC05.java:33)
	at sun.applet.AppletPanel.run(AppletPanel.java:344)
...
##

I tried to look into the code and I think the code produces the error is 
within the TranformFactoryImpl.newTemplates() metgod while calling
  String currentDir = System.getProperty("user.dir");
..

I wolud like also to put a remark about the Serializer classes; To serialize 
a DOM-Node as HTML, you need some serialze-object. The use of the serialize 
classes is very complex, and There is no enough possibilities to control the 
exact way of serialization. From same samples I found that the best way to do 
it is something like: 
##
   Transformer serializer = tfactory.newTransformer();
   serializer.setOutputProperty(OutputKeys.INDENT, "yes");
   serializer.setOutputProperty(OutputKeys.METHOD,"xml");
   serializer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
   serializer.setOutputProperty(OutputKeys.ENCODING,"");
   serializer.transform(new DOMSource(node), new StreamResult(htmlWriter));
   res = htmlWriter.toString();
##

However if I use :
	serializer.setOutputProperty(OutputKeys.METHOD,"xml");
Then the output contains some extra lines, which I don't want to produce. 
(The JEditorPane can't then visualize the HTML text). If I want to use
a java.util.Property object to control the output, I can't know which 
properties I have exactly to set. I mean for example for the 
SerializerFactory.getSerializer(Property) method.?

Is there some new books or documentation that handle the new versions of 
xalan, xerces ... ? I found it very difficault to work with API-DOCS.


Thank you

Morad
-- 
Dipl. Math. Morad Ahmad ///\\ morad@db.informatik.uni-kassel.de 
Universitaet Gh. Kassel['`|'`]www.db.informatik.uni-kassel.de/~morad
Heinrich-Plett-Str. 40 { ^ }Tel.: ++49(561)804-4101 
D-34109 Kassel, Germany \\// Fax: ++49(561)804-4199

Mime
View raw message