Solved

how to use JAXP in applet?

Posted on 2002-05-16
11
397 Views
Last Modified: 2013-11-23
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<check CLASSPATH>
at org.apache.xalan.templates.OutputProperties......

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.DOMSource;
import java.io.*;
import org.w3c.dom.*;


public class XmlString
{    
  public static void main(String[] args)
  {    
         
    try
    {
      DocumentBuilderFactory docFac = DocumentBuilderFactory.newInstance();    
       DocumentBuilder db = docFac.newDocumentBuilder();    
      Document m_dDoc = db.newDocument();
      Element   e1=m_dDoc.createElement("first");
      Text tx;
      tx=m_dDoc.createTextNode("hi");
      e1.appendChild(tx);/* */    
      m_dDoc.appendChild(e1);
       TransformerFactory tfac = TransformerFactory.newInstance();    
       StringWriter strWtr = new StringWriter();    
       StreamResult strResult = new StreamResult(strWtr);    
       Transformer trans = tfac.newTransformer();    
       trans.transform(new DOMSource(m_dDoc.getDocumentElement()), strResult);    
       System.out.println(strResult.getWriter().toString());
     }
     catch(Exception e)
     {
     }

   } // main
}
0
Comment
Question by:CFree
11 Comments
 
LVL 16

Expert Comment

by:heyhey_
ID: 7015611
  catch(Exception e)
    {
      e.printStackTrace();
    }

and copy and paste the exception stacktrace.
0
 

Author Comment

by:CFree
ID: 7017741
org.apache.xml.utils.WrappedRuntimeException: Output method is xml could not loa
d output_xml.properties (check CLASSPATH)
        at org.apache.xalan.templates.OutputProperties.getDefaultMethodPropertie
s(OutputProperties.java:364)
        at org.apache.xalan.templates.OutputProperties.<init>(OutputProperties.j
ava:130)
        at org.apache.xalan.transformer.TransformerIdentityImpl.<init>(Transform
erIdentityImpl.java:104)
        at org.apache.xalan.processor.TransformerFactoryImpl.newTransformer(Tran
sformerFactoryImpl.java:804)
        at XMLTest.init(XMLTest.java:36)
        at sun.applet.AppletPanel.run(AppletPanel.java:341)
        at java.lang.Thread.run(Thread.java:536)
0
 

Expert Comment

by:gvjay
ID: 7018071
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
0
 
LVL 16

Accepted Solution

by:
heyhey_ earned 100 total points
ID: 7020832
you probably have to use  XSLTProcessorApplet

http://xml.apache.org/xalan-j/usagepatterns.html#applet
0
 

Author Comment

by:CFree
ID: 7023071
gvjay:would you tell me some special way to let JAXP work in applet?

0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:CFree
ID: 7023151
gvjay:would you tell me some special way to let JAXP work in applet?

0
 

Author Comment

by:CFree
ID: 7023165
gvjay:would you tell me some special way to let JAXP work in applet?

0
 
LVL 35

Expert Comment

by:girionis
ID: 7029456
>org.apache.xml.utils.WrappedRuntimeException: Output method
> is xml could not load output_xml.properties (check CLASSPATH)

  The output_xml.properties file resides under the src/org/apache/xalan/templates under the subdirectory on where you install the JAXP classes. Adjust your CLASSPATH accordingly.

  Hope it helps.
0
 
LVL 5

Expert Comment

by:vemul
ID: 7888108
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
0
 
LVL 16

Expert Comment

by:heyhey_
ID: 7889046
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)
0
 
LVL 1

Expert Comment

by:Computer101
ID: 7959684
Comment from expert accepted as answer

Computer101
E-E Admin
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now