CFree
asked on
how to use JAXP in applet?
how to use JAXP in applet?
hi,
The codes as following really do work, but when I add them to a Applet,error occured:
Output method is xml could not load output_xml.properties<chec k CLASSPATH>
at org.apache.xalan.templates .OutputPro perties... ...
I never set classpath after all. I just copied the .jar files from JAXP 1.4 to java\j2re1.4.0\lib\ext\
thanks in advance!
import javax.xml.parsers.*;
import javax.xml.transform.*;
import javax.xml.transform.stream .*;
import javax.xml.transform.dom.DO MSource;
import java.io.*;
import org.w3c.dom.*;
public class XmlString
{
public static void main(String[] args)
{
try
{
DocumentBuilderFactory docFac = DocumentBuilderFactory.new Instance() ;
DocumentBuilder db = docFac.newDocumentBuilder( );
Document m_dDoc = db.newDocument();
Element e1=m_dDoc.createElement("f irst");
Text tx;
tx=m_dDoc.createTextNode(" hi");
e1.appendChild(tx);/* */
m_dDoc.appendChild(e1);
TransformerFactory tfac = TransformerFactory.newInst ance();
StringWriter strWtr = new StringWriter();
StreamResult strResult = new StreamResult(strWtr);
Transformer trans = tfac.newTransformer();
trans.transform(new DOMSource(m_dDoc.getDocume ntElement( )), strResult);
System.out.println(strResu lt.getWrit er().toStr ing());
}
catch(Exception e)
{
}
} // main
}
hi,
The codes as following really do work, but when I add them to a Applet,error occured:
Output method is xml could not load output_xml.properties<chec
at org.apache.xalan.templates
I never set classpath after all. I just copied the .jar files from JAXP 1.4 to java\j2re1.4.0\lib\ext\
thanks in advance!
import javax.xml.parsers.*;
import javax.xml.transform.*;
import javax.xml.transform.stream
import javax.xml.transform.dom.DO
import java.io.*;
import org.w3c.dom.*;
public class XmlString
{
public static void main(String[] args)
{
try
{
DocumentBuilderFactory docFac = DocumentBuilderFactory.new
DocumentBuilder db = docFac.newDocumentBuilder(
Document m_dDoc = db.newDocument();
Element e1=m_dDoc.createElement("f
Text tx;
tx=m_dDoc.createTextNode("
e1.appendChild(tx);/* */
m_dDoc.appendChild(e1);
TransformerFactory tfac = TransformerFactory.newInst
StringWriter strWtr = new StringWriter();
StreamResult strResult = new StreamResult(strWtr);
Transformer trans = tfac.newTransformer();
trans.transform(new DOMSource(m_dDoc.getDocume
System.out.println(strResu
}
catch(Exception e)
{
}
} // main
}
ASKER
org.apache.xml.utils.Wrapp edRuntimeE xception: Output method is xml could not loa
d output_xml.properties (check CLASSPATH)
at org.apache.xalan.templates .OutputPro perties.ge tDefaultMe thodProper tie
s(OutputProperties.java:36 4)
at org.apache.xalan.templates .OutputPro perties.<i nit>(Outpu tPropertie s.j
ava:130)
at org.apache.xalan.transform er.Transfo rmerIdenti tyImpl.<in it>(Transf orm
erIdentityImpl.java:104)
at org.apache.xalan.processor .Transform erFactoryI mpl.newTra nsformer(T ran
sformerFactoryImpl.java:80 4)
at XMLTest.init(XMLTest.java: 36)
at sun.applet.AppletPanel.run (AppletPan el.java:34 1)
at java.lang.Thread.run(Threa d.java:536 )
d output_xml.properties (check CLASSPATH)
at org.apache.xalan.templates
s(OutputProperties.java:36
at org.apache.xalan.templates
ava:130)
at org.apache.xalan.transform
erIdentityImpl.java:104)
at org.apache.xalan.processor
sformerFactoryImpl.java:80
at XMLTest.init(XMLTest.java:
at sun.applet.AppletPanel.run
at java.lang.Thread.run(Threa
JAXP implementaion may not work in an Applet as it checks for default properties on the system. Under normal circumstances, Applet cannot access system resources, so it cannot load default properties
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
gvjay:would you tell me some special way to let JAXP work in applet?
ASKER
gvjay:would you tell me some special way to let JAXP work in applet?
ASKER
gvjay:would you tell me some special way to let JAXP work in applet?
>org.apache.xml.utils.Wrap pedRuntime Exception: Output method
> is xml could not load output_xml.properties (check CLASSPATH)
The output_xml.properties file resides under the src/org/apache/xalan/templ ates under the subdirectory on where you install the JAXP classes. Adjust your CLASSPATH accordingly.
Hope it helps.
> is xml could not load output_xml.properties (check CLASSPATH)
The output_xml.properties file resides under the src/org/apache/xalan/templ
Hope it helps.
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
- PAQ'ed and points NOT refunded
Please leave any comments here within the
next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !
vemul
Cleanup Volunteer
I will leave a recommendation in the Cleanup topic area that this question is:
- PAQ'ed and points NOT refunded
Please leave any comments here within the
next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !
vemul
Cleanup Volunteer
I don't agree
on the URL that I posted above
http://xml.apache.org/xalan-j/usagepatterns.html#applet
it's cleare explained how to use Xalan in applet (which was the original question)
on the URL that I posted above
http://xml.apache.org/xalan-j/usagepatterns.html#applet
it's cleare explained how to use Xalan in applet (which was the original question)
Comment from expert accepted as answer
Computer101
E-E Admin
Computer101
E-E Admin
{
e.printStackTrace();
}
and copy and paste the exception stacktrace.