Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

how to use JAXP in applet?

Posted on 2002-05-16
11
Medium Priority
?
421 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 16

Accepted Solution

by:
heyhey_ earned 400 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
 

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

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

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

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
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…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Suggested Courses

877 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