Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

how to use JAXP in applet?

Posted on 2002-05-16
11
Medium Priority
?
417 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
The top UI technologies you need to be aware of

An important part of the job as a front-end developer is to stay up to date and in contact with new tools, trends and workflows. That’s why you cannot miss this upcoming webinar to explore the latest trends in UI technologies!

 
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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
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

715 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