Applet AccessControlExceptions using Netscape and Java plugin

I get the following AccessControlException when running a simple applet that tries to connect to an RMI object when using Netscape Communicator 4.5 with the Java plugin supplied with JDK1.3
java.security.AccessControlException: access denied (java.net.SocketPermission 10.195.57.34:1489 connect,resolve)The HTML page contains the following code:
<embed type=application/x-java-applet;version=1.3
code=test.AppletTest archive=AppletTest.jar width=800 height=600>
</embed>I have modified the default policy file C:\jdk1.3\jre\lib\security\java.policy with the following:
grant {permission java.security.AllPermission;};
With the above change the applet works when using appletviewer but if I remove this change I get the same AccessControlException as I do with Netscape.
This suggests that the Java plugin is not using the default policy file. What am I doing wrong / how can I fix it?
Thanks,
Neil

Alon,
Thanks for the information. The fact that appletviewer and Netscape may be using different security files because of having different java.homes certainly explains the differences I'm experiencing between the two.
I've now modified C:\Program Files\JavaSoft\JRE\1.3\lib\security\java.policy which now reads as follows:
grant codeBase "file:${java.home}/lib/ext/*" {
  permission java.security.AllPermission;
grant {
  permission java.security.AllPermission;
};but I've not changed C:\Program Files\JavaSoft\JRE\1.3\lib\security\java.security. Unfortunately this still doen't work with Netscape. In your reply you mention changing java.security files - am I making the wrong changes?
Neil
Neil

Similar Messages

  • Forms10g JAR and Java Plugin Caching problems

    Hello,
    Does anybody know following problem:
    We are deploying the forms java classes in a jar-file
    signed with our own certificate.
    We have a our own second (JavaBeans for forms) and a third jar file signed and deploying it in the right order
    archive = 'f90...jar,f2.jar,f3.jar'
    We are using the Sun Java Plugin 1.4.2 on the Client.
    Everything starts and works correct when it loads
    from the Application server the first time.
    Then the jar-files are in the cache.
    If you restart your Browser the Java Console hangs...
    No error messages in the console
    If we only load the forms jar file starting works
    except the error message in the console:
    Deactivating Caching also helps.
    Any ideas why there are problems with the
    Caching?
    sun.plugin.cache.DownloadException
         at sun.plugin.cache.CachedFileLoader.load(Unknown Source)
         at sun.plugin.cache.FileCache.get(Unknown Source)
         at sun.net.www.protocol.https.PluginDelegateHttpsURLConnection.connectWithCache(Unknown Source)
         at sun.net.www.protocol.https.PluginDelegateHttpsURLConnection.connect(Unknown Source)
         at sun.net.www.protocol.https.PluginDelegateHttpsURLConnection.getInputStream(Unknown Source)
         at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(Unknown Source)
         at sun.awt.image.URLImageSource.getDecoder(Unknown Source)
         at sun.awt.image.InputStreamImageSource.doFetch(Unknown Source)
         at sun.awt.image.ImageFetcher.fetchloop(Unknown Source)
         at sun.awt.image.ImageFetcher.run(Unknown Source)
    proxyHost=null
    proxyPort=0
    connectMode=HTTPS, native.
    sun.plugin.cache.DownloadException
         at sun.plugin.cache.CachedFileLoader.load(Unknown Source)
         at sun.plugin.cache.FileCache.get(Unknown Source)
         at sun.net.www.protocol.https.PluginDelegateHttpsURLConnection.connectWithCache(Unknown Source)
         at sun.net.www.protocol.https.PluginDelegateHttpsURLConnection.connect(Unknown Source)
         at sun.net.www.protocol.https.PluginDelegateHttpsURLConnection.getInputStream(Unknown Source)
         at java.net.HttpURLConnection.getResponseCode(Unknown Source)
         at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(Unknown Source)
         at sun.applet.AppletClassLoader.getBytes(Unknown Source)
         at sun.applet.AppletClassLoader.access$100(Unknown Source)
         at sun.applet.AppletClassLoader$1.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         at sun.applet.AppletClassLoader.findClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at sun.applet.AppletClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at java.util.ResourceBundle.loadBundle(Unknown Source)
         at java.util.ResourceBundle.findBundle(Unknown Source)
         at java.util.ResourceBundle.getBundleImpl(Unknown Source)
         at java.util.ResourceBundle.getBundle(Unknown Source)
         at oracle.forms.registry.MessageManager.getMessage(Unknown Source)
         at oracle.forms.registry.MessageManager.getMessage(Unknown Source)
         at oracle.forms.engine.Runform.createInitialMessage(Unknown Source)
         at oracle.forms.engine.Runform.sendInitialMessage(Unknown Source)
         at oracle.forms.engine.Runform.startRunform(Unknown Source)
         at oracle.forms.engine.Main.createRunform(Unknown Source)
         at oracle.forms.engine.Main.start(Unknown Source)
         at sun.applet.AppletPanel.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    Version von Forms-Applet: 9.0.4.0
    sun.plugin.cache.DownloadException
         at sun.plugin.cache.CachedFileLoader.load(Unknown Source)
         at sun.plugin.cache.FileCache.get(Unknown Source)
         at sun.net.www.protocol.https.PluginDelegateHttpsURLConnection.connectWithCache(Unknown Source)
         at sun.net.www.protocol.https.PluginDelegateHttpsURLConnection.connect(Unknown Source)
         at sun.net.www.protocol.https.PluginDelegateHttpsURLConnection.getInputStream(Unknown Source)
         at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(Unknown Source)
         at sun.awt.image.URLImageSource.getDecoder(Unknown Source)
         at sun.awt.image.InputStreamImageSource.doFetch(Unknown Source)
         at sun.awt.image.ImageFetcher.fetchloop(Unknown Source)
         at sun.awt.image.ImageFetcher.run(Unknown Source)

    Thanks. But It is not solely about LAF. It is just that my form applet is not getting dowloaded as soon as user opens application on browser. It is the whole applet nothing about LAf. But still I would send the email.
    Thanks,
    RK

  • 32-bit flash and java plugins freeze firefox and gnome on 64-bit linux

    I have installed FC13 64-bit and am running 32-bit firefox 3.6.8 so that I can run flash plugin.
    When I start 32-bit firefox 3.6.8 and go to site with flash or java applet, firefox locks up my gnome desktop necessitating a reboot of my computer.
    Firefox 3.6.8 32-bit
    Flash 10.1r82
    Java jdk 1.6.0_15 32-bit
    I have used a similar configuration on 32-bit FC13 with 32-bit Firefox 3.6.8 and everything works fine. No lockups.

    Hi!
    I finally solved this problem. The 32-bit libflashplugin required a 32-bit libcurl library that is not installed by default on 64-bit linux systems (at least not on Fedora). Once I installed 32-bit libcurl libs, flash and java plugins starting magically working.
    In my opinion, 64-bit Fedora has done a poor job with 32-bit compatibility viz a viz 32-bit libs. I will submit an improvement ticket to Fedora folks about installing more 32-bit libs on 64-bit distros.
    Bobby

  • Simple XML to Text onversion using XSLT and Java?

    Hi all!
    I'm completly new to using XSLT and Java and are trying to convert a XML file into a ordinary Textfile that I am gonna import into another application.
    I started up writing a ordinary XML parser in Java which interpreted the XML file, but realized later on that it was possible to do with a ordinary XSLT.
    So far it is a 2-step process right now, I've tied my XSLT to the XML file and then just open the XML file up in a ordinary browser and then get the result.
    I found an example (http://www.onjava.com/pub/a/onjava/excerpt/java_xslt_ch5/index.html?page=3) where u hook up a XML file and a XSL file separately and the process it, and dump it to Stdout. But do I need to hook up a XSL file like this when the XML file is tied to a XSL file internally?

    Just to give you an example to show you how easy it is: http://www.daniweb.com/forums/thread137587.html

  • Information Retrieval with Genetic Programming using J2ME and Java WTK

    i have a big project to make a software using java programming especially n using J2ME and Java Wireless Toolkit, and i'm a begginer for java programming. I have no idea for the interface and how to setting connection between my phone mobile and GPRS. what should i do? thank you

    I believe MIT has lots of sourcecode. Try searching their site.

  • Not able to recognize any video/audio devices using jmf and java soun

    Hi ,
    I need one help from your side.
    Here I am expecting some clarifications from you. Before that let you my environement.
    My working environment :
    Eclipse tool and added jmf jar to my project I did not do any thing more.
    If any thing I need to do just let me know. My target platform is MAC & UBUNTU.
    Please bare with my questions.
    1) I am not able to recognize any video/audio devices using jmf and java sound APIs on My system.
    ( I checked with the app mentioned in the http://www.java-forums.org/new-java/11201-jmf-cannot-connect-device.html )
    Do we need any administrives rights for our working PC.
    What is the procedure/ setup I need to follow from a java application to enable particular audio/video device since I dont about end-user system setup right.
    If possible send some sample code to recognize /r detect audio device ( voice input ). It should run on both MAC and UBUNTU.
    2) I run the one sample audio recording application of this link (http://www.jsresources.org/examples/SimpleAudioRecorder.java.html) which is provided by YOU.
    I got output audio file and able to hear voice on UBUNTU system but not able to hear voice on MAC system.
    I heared that default line in ( audio setup of the sys) is wont take any voice data on MAC.Why I made this stmt means we are getting false when using isSupported methods of JAVA SOUND API.
    ( like for TragetdataLine ...i,e, all ports are getting false)
    I have one sample audio recording app implemented by QUICKTIME API. In this case also he taking audio ftom device only using quicetime API.
    With that we are able to record and hear audio ( voice input --> not line in , external device we added some thing like SSB...)
    3) In case of Video capturing DataSource, Streams are implemented by PullBufferDataSource , PullBufferStream intefaces used.
    In case of Audio capturing DataSource, Streams are implemented by PushBufferDataSource, PushBufferStream intefaces used.
    Can you explain the reasons ? I gone through API but i am not clear.
    HOPE I WILL BE CLARIFIED EVERY THING FROM YOU.
    Thanks
    RamaRao.G

    Hi ,
    I need one help from your side.
    Here I am expecting some clarifications from you. Before that let you my environement.
    My working environment :
    Eclipse tool and added jmf jar to my project I did not do any thing more.
    If any thing I need to do just let me know. My target platform is MAC & UBUNTU.
    Please bare with my questions.
    1) I am not able to recognize any video/audio devices using jmf and java sound APIs on My system.
    ( I checked with the app mentioned in the http://www.java-forums.org/new-java/11201-jmf-cannot-connect-device.html )
    Do we need any administrives rights for our working PC.
    What is the procedure/ setup I need to follow from a java application to enable particular audio/video device since I dont about end-user system setup right.
    If possible send some sample code to recognize /r detect audio device ( voice input ). It should run on both MAC and UBUNTU.
    2) I run the one sample audio recording application of this link (http://www.jsresources.org/examples/SimpleAudioRecorder.java.html) which is provided by YOU.
    I got output audio file and able to hear voice on UBUNTU system but not able to hear voice on MAC system.
    I heared that default line in ( audio setup of the sys) is wont take any voice data on MAC.Why I made this stmt means we are getting false when using isSupported methods of JAVA SOUND API.
    ( like for TragetdataLine ...i,e, all ports are getting false)
    I have one sample audio recording app implemented by QUICKTIME API. In this case also he taking audio ftom device only using quicetime API.
    With that we are able to record and hear audio ( voice input --> not line in , external device we added some thing like SSB...)
    3) In case of Video capturing DataSource, Streams are implemented by PullBufferDataSource , PullBufferStream intefaces used.
    In case of Audio capturing DataSource, Streams are implemented by PushBufferDataSource, PushBufferStream intefaces used.
    Can you explain the reasons ? I gone through API but i am not clear.
    HOPE I WILL BE CLARIFIED EVERY THING FROM YOU.
    Thanks
    RamaRao.G

  • Netscape 6 & Java Plugin

    Hi,
    I am trying to write an Applet which will run in both Netscape and IE, using the Java Plugin. I have problems scripting the applet using Javascript when in Netscape - due to problems with Live Connect, I understand.
    I realise that Sun say Netscape 4.X cannot script applets running in Java Plugin but I thought Netscape 6 should be able to. I have tried on Netscape 6.1 running Java Plugin 1.3.1_01 with no luck - I keep getting an error: "document.FT.getString is not a function". Has anyone had any luck at getting Netscape 6 to script applets running through Java Plugin? I have looked through newsgroups but haven't found any information on scripting plugin applets on Netscape.
    I would be very grateful for any information!
    Kevin.

    OK, here's my code. The class the applet is in is called Applet and it is contained within a JAR archive called signedApplet.jar. This should work OK although I have changed the name of the Applet and the archive for the purposes of simplicity.
    <SCRIPT LANGUAGE="JavaScript"><!--
    var _info = navigator.userAgent;
    var _ns = false;
    var ie = (info.indexOf("MSIE") > 0 && info.indexOf("Win") > 0 && info.indexOf("Windows 3.1") < 0);
    //--></SCRIPT>
    <COMMENT><SCRIPT LANGUAGE="JavaScript1.1"><!--
    var ns = (navigator.appName.indexOf("Netscape") >= 0 && ((info.indexOf("Win") > 0 && info.indexOf("Win16") < 0 && java.lang.System.getProperty("os.version").indexOf("3.5") < 0) || (info.indexOf("Sun") > 0) || (_info.indexOf("Linux") > 0)));
    //--></SCRIPT></COMMENT>
    <SCRIPT LANGUAGE="JavaScript"><!--
    if (_ie == true)
         document.writeln('<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" ID="FT" WIDTH = 0 HEIGHT = 0 NAME = "Applet" codebase="http://java.sun.com/products/plugin/1.3/jinstall-13-win32.cab#Version=1,3,0,0">');
         document.writeln('<PARAM NAME = CODE VALUE = "Applet" >');
         document.writeln('<PARAM NAME = ARCHIVE VALUE = "signedApplet.jar" >');
         document.writeln('<PARAM NAME = NAME VALUE = "Applet" >');
         document.writeln('<PARAM NAME="type" VALUE="application/x-java-applet;version=1.3">');
         document.writeln('<PARAM NAME="scriptable" VALUE="true">');
         document.writeln('<PARAM NAME="mayscript" VALUE="true">');
         document.writeln('</OBJECT>');
    else if (_ns == true)
         //if netscape 6 then just use standard Applet tag
         if (navigator.userAgent.indexOf("Netscape6")>0)
              document.writeln('<APPLET ID="FT" ARCHIVE="signedApplet.jar" CODE = "Applet" WIDTH = 0 HEIGHT = 0 NAME = "Applet"></APPLET>');
         else
              document.writeln('Sorry, Netscape versions higher than 6.0 or Microsoft Internet Explorer 5.0 must be used to view this page.');
    //--></SCRIPT>

  • LAF and Java Plugin not opening in some machines

    Hi all,
    I have strange problem in my forms 10g application. We have implemented LAF in our Forms 10g application that requires to use Sun Java Plugin.
    In formsweb.cfg, the sun java plugin version that would be downloaded is - 1.4.2. For most of my users they have version 1.5.0_13 installed already. All users are able to run the application without any problems.
    Only in one machine, it does not open up the form applet and instead opens a blank form on IE version 7.
    I have other machines with same config Windows XP and IE 7 and they work fine. They too have the Javaplugin version 1.5.0_13 installed and it does not prompt the user to download 1.4.2 version.
    Can anyone help me to fix this problem?
    Thanks,
    RK

    Thanks. But It is not solely about LAF. It is just that my form applet is not getting dowloaded as soon as user opens application on browser. It is the whole applet nothing about LAf. But still I would send the email.
    Thanks,
    RK

  • How can i change font used by the java plugin?

    im running j2se 1.4.0 on win2k, and the java plugin is using a font that is not readable because sized way too small (also, the font is not a 'standard' font).
    the font is also applied do class loading or exception messages in java applets (in IE5.5, but i don't think that this is browser-related).
    is there a possibility to change to font (or the font size)?

    thanks for the tip, but this problem seems not to be tightened to the font.properties file:
    the wrong font is only used with the j2sdk1.4.0 plugin, not with that from j2re1.4.0 (actually, i had installed jre first, and afterwards j2sdk without removing j2re before). changing the plugin used back to j2re made the java console display the correct font (though the font.properties files were identically in both cases).

  • Admin applet issue (unable to enable java plugins)

    i installed orlc UCM on linux 64 and the (unable to enable java plugins) so i cant access admin applet..
    i did this
    http://www.java.com/en/download/help/linux_x64_install.xml
    http://www.oracle.com/technetwork/java/javase/manual-plugin-install-linux-136395.html
    but still nothing,,
    Edited by: mahmoud abukhaled on Sep 17, 2012 2:06 AM
    Edited by: mahmoud abukhaled on Sep 17, 2012 2:08 AM
    Edited by: mahmoud abukhaled on Sep 17, 2012 2:16 AM
    Edited by: mahmoud abukhaled on Sep 17, 2012 2:16 AM

    You need to add security policy file
    Check this out
    http://stackoverflow.com/questions/2612895/where-to-place-java-applet-policy-file
    http://geosim.cs.vt.edu/Java/MigModel/help/Policies.html
    Regards,
    Vikrant Korde

  • Syntax errors using sql and java

    Could somebody inform of the correct syntax for using UPDATE and INSERT SQL commands in a java program? Any information I can find demonstrates this with:
    INSERT INTO table_name(column_name, ..., column_name)
    VALUES(value, ..., value)
    However - this isn't working? any suggestions - and I know its very basic, but I'm just learning.
    String query = " INSERT INTO SESSIONS (" +                                   
                        "id,module_name, module_number, level, session " +
                        "term, class_list, location, lecturer" + ")
    VALUES('"+
                        fields.id.getText() + "', '"+
                        fields.module_name.getText() + "', '" + fields.module_number.getText() + "', '" +
                   fields.level.getText() + "', '" fields.session.getText() "', '" +
                   fields.term.getText() + "', '" fields.class_list.getText() "', '" +
                   fields.location.getText() + "', '" fields.lecturer.getText() "')";
              output.append( " \nSending query: " + connection.nativeSQL(query)+ "\n");                                                                                                         
              output.append( "query sent");     
    thanks
              int result = statement.executeUpdate(query);                    

    With all those quotes and apostrophes and string concatenations, I'd be surprised if you got it right by the fourth try. (By the way, you appear to have missed a comma between "session" and "term".) Are you planning to insert more than one record in your program? If so, you should consider using a PreparedStatement. This will likely run faster, and your program will definitely be easier to read. Also, you won't have to come back here later to ask how you deal with data that includes apostrophes (the notorious "O'Brien" problem). Here's how you do that... you define the PreparedStatement only once:
    String query =
      "INSERT INTO SESSIONS (id,module_name, module_number, level, session, term, class_list, location, lecturer) " +
      "VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?)";
    PreparedStatement insert = connection.prepareStatement(query);and then every time you want to insert a record you do this:
    insert.setString(1, fields.id.getText());
    insert.setString(2, fields.module_name.getText());
    // and so on...
    insert.executeQuery();

  • Building a best practice web application using ColdFusion and Jave EE

    I've been tasked with rewriting a software using ColdFusion.  I cannot seem to find a lot of information on best practice development in ColdFusion.  I am an experience Java developer who has never used ColdFusion before.  I want to build this application using a synergy of ColdFusion and Java EE technologies.  Can someone recommend me a book that outlines how to developer in ColdFusion?  Ideally this book assumes the reader is an experienced developer with no exposure to ColdFusion.  Ideally the methods outlined in the book are still "best practice" methods.

    jaisheela wrote:
    Hello Friends,
    I am also in the same situation.
    I am a building a new web application using JSF and AJAX.
    Requirement is I need to use IBM version of DOJO and JSF but I need to develop the whole application using Eclipse 3.3,2 and Tomcat 5.5.
    With IBM version of DOJO and JSF, will Eclipse and Tomcat help to speed up the development or do you suggest me to go for Rational Application Developer and WebSphere Application Server.
    If I need to go with RAD and WAS, then I am new to RAD and WAS, is it easy to use RAD and WAS for this kind of application and implement web applicaiton fast.
    Any feedback will be great help.Those don't sound like requirements of the system to me. They sound more like someone wants to improve their CV/resume
    From what I've read recently, if it's just fast you want, look at Ruby on Rails

  • Fault Policies using retry and java hadler

    Hi,
    I am using fault policies to handle a remote and binding faults.Whenever i get a fault i want to retry for 5 times and then call a java handler, which will insert the error into queue.
    I have written the fault policies and java handler.But the problem is for each retry it is going to Java handler and pushing the message to queue.
    Here is my Fault policies file.
    <?xml version="1.0" encoding="UTF-8"?>
    <faultPolicies xmlns="http://schemas.oracle.com/bpel/faultpolicy"
    xmlns:bpelx="http://schemas.oracle.com/bpel/extension"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <faultPolicy version="2.0.1" id="FaultHandling-faultpolicy">
    <Conditions>
    <faultName xmlns:bpelx="http://schemas.oracle.com/bpel/extension"
    name="bpelx:remoteFault">
    <condition>
    <action ref="ora-retry"/>
    </condition>
    </faultName>
    <faultName xmlns:bpelx="http://schemas.oracle.com/bpel/extension"
    name="bpelx:bindingFault">
    <condition>
    <action ref="ora-retry"/>
    </condition>
    </faultName>
    <faultName xmlns:bpelx="http://schemas.xmlsoap.org/ws/2003/03/business-process/"
    name="bpws:selectionFailure">
    <condition>
    <action ref="ora-retry"/>
    </condition>
    </faultName>
    </Conditions>
    <Actions>
    <Action id="ora-terminate">
    <abort/>
    </Action>
    <Action id="ora-replay-scope">
    <replayScope/>
    </Action>
    <Action id="ora-retry">
    <retry>
    <retryCount>7</retryCount>
    <retryInterval>2</retryInterval>
    <retryFailureAction ref="ora-java"/>
    </retry>
    </Action>
    <Action id="ora-java">
    <javaAction className="faultpolicies.MyFaultHandler"
    defaultAction="ora-human-intervention"
    propertySet="customLogProps">
    </javaAction>
    </Action>
    <Action id="ora-rethrow-fault">
    <rethrowFault/>
    </Action>
    <Action id="ora-human-intervention">
    <humanIntervention/>
    </Action>
    </Actions>
    </faultPolicy>
    </faultPolicies>
    Pls guide me what should be done..
    Thanks.

    There is no point in retry on binding fault, rather you can raise it as exception and catch it in sepcific catch block or catch all will handle it.
    Ideally this particular instance will be faulted and if required you can customize to send a mail with fault string to developer or support person or dba
    This type of fault need human intervension to fix this code or it could be data issue.
    - It is considered good etiquette to reward answerers with points (as "helpful" - 5 pts - or "correct" - 10pts).
    Thanks,
    Vijay

  • Pocket IE and Java Plugin

    Is there and if so where can I get the java plugin for the Pocket PC 2002 Pocket IE for a strongARM processor? Please help!!!
    Kyle Goodwin
    [email protected]

    I fooled around with this a year ago... At the time there were a few 1.1.X JVM variants around (just search for them). Only found one viable Java 2 (1.3.X w/Swing) JVM & it was basically a replacement OS for certain IPAQs called Savaje (worked pretty well but dev. has since been abandoned by the co. in favor of cell phone JVMs..)
    Good luck,
    Chris

  • How use XSD and Java? What classes/methods?

    I want to use an XSD instead of a DTD with my XML and Java. Does anyone know the classes/methods I should use to do this? Is it even possible? Can you send sample code?

    here is the helper function... hope it helps...
    import java.io.IOException;
    import java.math.*;
    import java.text.*;
    import org.xml.sax.Attributes;
    import org.xml.sax.ContentHandler;
    import org.xml.sax.ErrorHandler;
    import org.xml.sax.Locator;
    import org.xml.sax.SAXException;
    import org.xml.sax.SAXParseException;
    import org.xml.sax.XMLReader;
    import org.xml.sax.helpers.XMLReaderFactory;
    public class SAXParserDemo
         public SAXParserDemo()
         public void performDemo(String uri)
              System.out.println("Parsing XML file: " + uri + "\n\n");
              ContentHandler contentHandler = new MyContentHandler();
              ErrorHandler errorHandler = new MyErrorHandler();
              try
                   XMLReader parser = XMLReaderFactory.createXMLReader("org.apache.xerces.parsers.SAXParser");
                   parser.setContentHandler(contentHandler);
                   parser.setErrorHandler(errorHandler);
                   parser.setFeature("http://xml.org/sax/features/validation", true);
                   parser.parse(uri);
              catch(IOException e)
                   System.out.println("Error reading URI: " + e);
              catch(SAXException e)
                   System.out.println("Error in parsing: " + e);
         public static void main(String[] args)
              if(args.length != 1)
                   System.out.println("Usage: java SAXParserDemo [XML URI]");
                   System.exit(0);
              String uri = args[0];
              SAXParserDemo parserDemo = new SAXParserDemo();
              parserDemo.performDemo(uri);
    class MyErrorHandler implements ErrorHandler
         public void warning(SAXParseException exception) throws SAXException
              throw new SAXException("Warning encountered."+exception);
         public void error(SAXParseException exception) throws SAXException
              throw new SAXException("Error encountered: "+exception);
         public void fatalError(SAXParseException exception) throws SAXException
              throw new SAXException("Fatal error encountered."+exception);
    class MyContentHandler implements ContentHandler
         private Locator locator;
         public void setDocumentLocator(Locator locator)
              //System.out.println("     * setDocumentLocator() called");
              this.locator = locator;
         public void startDocument() throws SAXException
              //System.out.println("System Message: Parsing begins...");
         public void endDocument() throws SAXException
              //System.out.println("System Message: ...Parsing ends.");
         public void processingInstruction(String target, String data) throws SAXException
              //System.out.println("System Message: PI: Target: "+target+" and Data: "+data);
         public void startPrefixMapping(String prefix, String uri)
              //System.out.println("System Message: Mapping starts on prefix "+prefix+" mapped to URI "+uri);
         public void endPrefixMapping(String prefix)
              //System.out.println("System Message: Mapping ends on prefix "+prefix);
         public void startElement(String namespaceURI, String localName, String rawName, Attributes atts) throws SAXException
              //System.out.println("System Message: startElement: "+localName);
              if(!namespaceURI.equals(""))
                   //System.out.println("System Message: in namespace "+namespaceURI+" ("+rawName+")");
              else
                   //System.out.println("System Message: has no associated namespace");
              int i;
              for(i=0;i<atts.getLength();i++)
                   //System.out.println("System Message: Attribute: "+atts.getLocalName(i)+"="+atts.getValue(i));
         public void endElement(String namespaceURI, String localName, String rawName) throws SAXException
              //System.out.println("System Message: endElement: "+localName+"\n");
         public void characters(char[] ch, int start, int length) throws SAXException
              String s = new String(ch, start, length);
              //System.out.println("System Message: characters: "+s);
         public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException
              String s = new String(ch, start, length);
              //System.out.println("System Message: ignorableWhitespace: ["+s+"]");
         public void skippedEntity(String name) throws SAXException
              //System.out.println("System Message: Skipping entity: "+name);
    }

Maybe you are looking for

  • Logic 8 quits unexpectedly upon opening every time

    either opening from a project file or the dock. Just doesn't open at all and I get a message that it has quit unexpectedly. couple notes: - I recently did a software update that included something for Logic - I recently installed new RAM... has been

  • Regarding Subtotal Text Printing in ALV

    Dear all, I want to print some text in subtotaling.But i am not getting it..I am doing like below. My FORM SUBTOTAL_TEXT  does not get hit al all. Plz let me know where I am going wrong *&      Form  GET_EVENTS       text -->  p1        text <--  p2 

  • Finding text in a PDF using preview has stopped working (correctly)

    Finding text in a PDF using preview has stopped working (correctly). When I search for certain words in a PDF using preview, it correctly finds all the pages in the document with that word.  However, it no longer highlights the word being searched fo

  • No mail in my Exchange account after update

    After updating, I've got my two mail accounts, but the Exchange one only has the last email received in it; none of the rest (which are still on the server).  I can't see a setting to change to get the mail displayed.  I've currently got it set using

  • Help missing add button to add Processed Entities to a process in the proce

    I am misssing the add button to ad entities and attributes. How do you add entities to a process?