Solved

how to use JAXP in applet?

Posted on 2002-05-16
11
394 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

746 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

13 Experts available now in Live!

Get 1:1 Help Now