How to use DOMParser from an Applet / Or, how to parse XML from an Applet?

Hey,
As stating in the subject line, I wonder how to do it without getting an �Access Denied� error.
I would like to parse a XML file that has external DTD pointing to a SYSTEM location. Yes, I can change it to a public location. However, in either way, I have problems to use DOMBuilder to parse the xml file. The application always throws the security exception.
I tried to use the DOMParser from org.apache.xerces.parsers to parse the xml file. I set the DOMParser to ignore parsing the external DTD, and use the DOMParser.parse(InputSource) to parse the xml file from a giving URL. However, I get null of the result document.
Does anyone know how to parse the XML from an Applet? Or, does anyone know how to use the DOMParser from an Applet?
Thank you very much,

If the document resides on the local filesystem, you will need to sign a CAB or JAR for the applet to circumvent the sandbox's security restrictions. There are dozens of posts on how to do this. Basically, that will turn the applet into an application, from a Java security perspective.
- Saish
"My karma ran over your dogma." - Anon

Similar Messages

  • Can anyone help me figure out how to use my new LaCie external hard drive to import movies from my camcorder into imovie '09? I ran into so many problems last night!! Was up way past my bedtime!

    Can anyone help me figure out how to use my new LaCie external hard drive to import movies from my camcorder into imovie '09? I ran into so many problems last night!! Was up way past my bedtime!

    I'll stay in this chat ... I answered in the other one ... I have a Sony digital Handycam ... from years ago.  I just got the LaCie and I think I formatted it for only to be used on my Mac ... how should I go about reformatting it to be HFS Extended like you said?

  • Can't parse xml from applet using dom on linux on Netscape 7 using jre 1.4.

    Hi,
    I can't seem to parse xml from an applet on linux on Netscape 7 using the JRE 1.4.
    My code looks like the following:
    StringBufferInputStream is = new StringBufferInputStream("<foo></foo>");
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    DocumentBuilder builder = null;
    try
      builder = factory.newDocumentBuilder();
      domDocument = builder.parse(is); // this line creates an exception
    catch (Exception e)
      System.out.println(e);
    This code works fine from an applet on windows. On linux, the error message is:
    java.security.AccessControlException: access denied (java.util.PropertyPermission entityExpansionLimit read)
    I've tried both JRE 1.4.0_04 and 1.4.1_03
    Thanks!
    Q

    There's another posting about this same problem (platform unspecified), but the same error message. I was also having this problem (Windows 1.4.03) and swithced back to 1.4.01 and the problem went away. In the future, I may sign my applets to get a more generous security policy. But, I'm sure it'll be a lot of work (vs. a line of code somewhere).

  • How to use u sb in i pad, how to use u sb in i pad

    how to use u sb in i pad, how to use u sb in i pad

    You get Apple iPad Camera Connection kit for iPad (1st, 2nd and 3rd Gen) and Lightning to Usb Camera Adapter for (iPad 4th Gen, iPad Mini, iPad Mini with Retina Display and iPad Air) which allows you to connect many Digital Cameras on your iPad and then Import the images directly on your iPad from your Digital Camera.
    http://store.apple.com/us/product/MC531ZM/A/apple-ipad-camera-connection-kit
    http://store.apple.com/us/product/MD821ZM/A/lightning-to-usb-camera-adapter
    Note : You cannot use the connector to connect any other Usb device to your iPad other the Digital Camera as iPad doesn't have supported drivers.

  • How to use video conference with life messenger, how to use video conference with life messenger

    how to use video conference with life messenger, how to use video conference with msn life messenger

    Hi,
    Do you mean Window Live Messenger or it's Mac equivalent MSN for Mac ?
    Actually the app comes with Office
    In the Microsoft Office X (2001 version) it was still called MSN  Messenger
    In Office 2008 it was called Microsoft Messenger.
    The current one that can also be  downloaded as a standalone app  also comes with Office 2011 is also called Microsoft Messenger.
    This is version 8 and this version is the only one that can Video Chat as a standalone app.
    Version 7 required you  were in a mixed environment (with PCs) connected to the correct sort of Windows Server.
    This page may help you further.
    8:20 PM      Saturday; June 11, 2011
    Please, if posting Logs, do not post any Log info after the line "Binary Images for iChat"
     G4/1GhzDual MDD (Leopard 10.5.8)
     MacBookPro 2Gb( 10.6.7)
     Mac OS X (10.6.7),
    "Limit the Logs to the Bits above Binary Images."  No, Seriously.

  • Parsing XML from Socket input stream

    I create a sax parser to which I send the InputStream from the socket
    But my HandlerBase never gets the events. I get startDocument
    but that is it, I never get any other event.
    The code I have works just like expected when I make the InputStream
    come from a file. The only differeence I see is that when I file is used the
    InputStream is fully consumed while with the socket the InputStream
    is kept open (I MUST KEEP THE SOCKET OPEN ALL THE TIME). If the parser
    does not generate the events unless the InputStream is fully consumed,
    isn't that against the whole idea of SAX (sax event driven) .
    Has anyone been succesfull parsing XML from the InputStream of a socket?
    if yes how?
    I am using JAXP 1.0.1 but I can upgrade to JAXP 1.1.0
    which uses SAX 2.0
    Does anybody know if my needs can be met by JAXP 1.1.0?
    Thanks

    I did the same with client/server model.
    I have client program with SAX parser. Please try if you can make the server side. I was be able to write the program with help from this forum. Please search to see if you can get the forum from which I got help for this program.
    // JAXP packages
    import javax.xml.parsers.*;
    import org.xml.sax.*;
    import org.xml.sax.helpers.*;
    // JAVA packages
    import java.util.*;
    import java.io.*;
    import java.net.*;
    public class XMLSocketClient {
    final private static int buffSize = 1024*10;
    final private static int PORTNUM = 8888;
         final private static int threadSleepValue = 1000;
    private static void usage() {
    System.err.println("Usage: XMLSocketClient [-v] serverAddr");
    System.err.println(" -v = validation");
    System.exit(1);
    public static void main(String[] args) {
    String address = null;
    boolean validation = false;
    Socket socket = null;
    InputStreamReader isr_socket = null;
    BufferedReader br_socket = null;
    CharArrayReader car = null;
    BufferedReader br_car = null;
    char[] charBuff = new char[buffSize];
    int in_buff = 0;
    * Parse arguments of command options
    for (int i = 0; i < args.length; i++) {
    if (args.equals("-v")) {
    validation = true;
    } else {
    address = args[i];
    // Must be last arg
    if (i != args.length - 1) {
    usage();
    // Initialize the socket and streams
    try {
    socket = new Socket(address, PORTNUM);
    isr_socket = new InputStreamReader(socket.getInputStream());
    br_socket = new BufferedReader(isr_socket, buffSize);
    catch (IOException e) {
    System.err.println("Exception: couldn't create stream socket "
    + e.getMessage());
    System.exit(1);
    * Check whether the buffer has input.
    try {
    while (br_socket.ready() != true) {
                   try {
                        Thread.currentThread().sleep(threadSleepValue);     
                   catch (InterruptedException ie) {
              System.err.println("Interrupted error for sleep: "+ ie.getMessage());
                   System.exit(1);
    catch (IOException e) {
    System.err.println("I/O error for in.read(): "+ e.getMessage());
    System.exit(1);
    try {
    in_buff = br_socket.read(charBuff, 0, buffSize);
    System.out.println("in_buff = " + in_buff);
    System.out.println("charBuff length: " + charBuff.length);
    if (in_buff != -1) {
    System.out.println("End of file");
    } catch (IOException e) {
    System.out.println("Exception: " + e.getMessage());
    System.exit(1);
    System.out.println("reading XML file:");
    StringBuffer display = new StringBuffer();
    display.append(charBuff, 0, in_buff);
    System.out.println(display.toString());
    * Create BufferedReader from the charBuff
    * in order to put into XML parser.
    car = new CharArrayReader(charBuff, 0, in_buff); // these two lines have to be here.
    br_car = new BufferedReader(car);
    * Create a JAXP SAXParserFactory and configure it
    * This section is standard handling of XML document by SAX XML parser.
    SAXParserFactory spf = SAXParserFactory.newInstance();
    spf.setValidating(validation);
    XMLReader xmlReader = null;
    try {
    // Create a JAXP SAXParser
    SAXParser saxParser = spf.newSAXParser();
    // Get the encapsulated SAX XMLReader
    xmlReader = saxParser.getXMLReader();
    } catch (Exception ex) {
    System.err.println(ex);
    System.exit(1);
    // Set the ContentHandler of the XMLReader
    xmlReader.setContentHandler(new MyXMLHandler());
    // Set an ErrorHandler before parsing
    xmlReader.setErrorHandler(new MyErrorHandler(System.err));
    try {
    * Tell the XMLReader to parse the XML document
    xmlReader.parse(new InputSource(br_car));
    } catch (SAXException se) {
    System.err.println(se.getMessage());
    System.exit(1);
    } catch (IOException ioe) {
    System.err.println(ioe);
    System.exit(1);
    * Clearance of i/o functions after parsing.
    try {
    br_socket.close();
    } catch (IOException e) {
    System.out.println("Exception: " + e.getMessage());
    try {
    socket.close();
    } catch (IOException e) {
    System.out.println("Exception: " + e.getMessage());
    try {
    br_car.close();
    } catch (IOException e) {
    System.out.println("Exception: " + e.getMessage());
    * The XML handler used by this program
    class MyXMLHandler extends DefaultHandler {
    // A Hashtable with tag names as keys and Integers as values
    private Hashtable tags;
    // Parser calls this once at the beginning of a document
    public void startDocument() throws SAXException {
    System.out.println("startDocument()");
    tags = new Hashtable();
    // Parser calls this for each element in a document
    public void startElement(String namespaceURI, String localName,
    String rawName, Attributes atts)
    throws SAXException
    String key = localName;
    Object value = tags.get(key);
    System.out.println("startElement()");
    System.out.println("namespaceURI: " + namespaceURI);
    System.out.println("localName: " + localName);
    System.out.println("rawName: " + rawName);
    if (value == null) {
    // Add a new entry
    tags.put(key, new Integer(1));
    } else {
    // Get the current count and increment it
    int count = ((Integer)value).intValue();
    count++;
    tags.put(key, new Integer(count));
    // Parser calls this once after parsing a document
    public void endDocument() throws SAXException {
    Enumeration e = tags.keys();
    System.out.println("endDocument()");
    while (e.hasMoreElements()) {
    String tag = (String)e.nextElement();
    int count = ((Integer)tags.get(tag)).intValue();
    System.out.println("Tag <" + tag + "> occurs " + count
    + " times");
    * Error handler of XML parser to report errors and warnings
    * This is standard handling.
    class MyErrorHandler implements ErrorHandler {
    /** Error handler output goes here */
    private PrintStream out;
    MyErrorHandler(PrintStream out) {
    this.out = out;
    * Returns a string describing parse exception details
    private String getParseExceptionInfo(SAXParseException spe) {
    String systemId = spe.getSystemId();
    if (systemId == null) {
    systemId = "null";
    String info = "URI=" + systemId +
    " Line=" + spe.getLineNumber() +
    ": " + spe.getMessage();
    return info;
    * The following methods are standard SAX ErrorHandler methods.
    * See SAX documentation for more info.
    public void warning(SAXParseException spe) throws SAXException {
    out.println("Warning: " + getParseExceptionInfo(spe));
    public void error(SAXParseException spe) throws SAXException {
    String message = "Error: " + getParseExceptionInfo(spe);
    throw new SAXException(message);
    public void fatalError(SAXParseException spe) throws SAXException {
    String message = "Fatal Error: " + getParseExceptionInfo(spe);
    throw new SAXException(message);

  • Parse XML from CLOB field

    How can I parse XML from CLOB field? I need to replace or delete the node from XML document and update the database with new XML. I am using Oracle 9i release 2.
    Here is the XML. In this XML if section1 and section2 exists then I need to delete the section1 node. If section2 doesn't exist, replace section1 with section2 node.
    <Document ID='2' TypeID='2'>
    <Body>
    <Page Name='Page1'>
    <Sec ID='section1' Title='Section 1' GroupID='' />
    <Sec ID='section2' Title='Section 2' GroupID='' />
    </Page>
    </Body>
    </Document>
    Please help.. Thank you..

    In 9.2, you are limited into your options. Have a look into, among others, updateXML. Updating tp 10gR2 will give you more options to succeed.

  • How to use CrossReference and DVM in ODI &how to populate data into Xref

    Can any one tell how to use Domain Value Maps and Cross Referencing in ODI?
    DVM or Domain Value Map are created and used in ESB console of SOA suite.
    My actual requirement is as follows:
    The below steps describe loading data from ERP Application 1 to ERP Application 2.
    1. The Source Application ERP APP1, populates the interface table using their native technology.
    2. A job scheduler invokes the Source side ODI Package.
    3. ODI then extracts the data from Source Interface table and populates the Target Interface table.
    4. After populating the Target interface table the ODI populates the X-ref table with App 1 ID and generated common ID.
    5. The ODI either deletes or updates the rows that were processed from the Source interface table.
    6. On the Target Application ERP APP2, the native application extracts data from target interface table and populates target database there by generating ERP Application 2 ID.
    7. A job scheduler on the Target application invokes the ODI package to populate the Application 2 ID onto the Xref table matching on the Common ID.
    I just want to know :
    1. How to populate data into the Xref table from Source datastore
    2. And if data is successfully laoded from target datastore to actual base table of target then how to populate the target id into the cross reference table.

    can anyone suggest me some answer, then it would be of great help?

  • How to parse XML in an applet

    Hi all,
    I am using a webrowset that gets an xml file form the server. The webrowset object has to parse this file. I have serveral questions about this and how the web browser will use an xml parser in general.
    1) I need to set a whole bunch of permission just to use the parser (read/write permissions) Why do I need to do this as I am not trying to access the local resources in any way.
    2) I get the following error in ie6.
    ReadXml : com.sun.parser.Resolver error
    In the debugger, using appletviewer, I get "no value set for parser property"
    I assume that the browser is having problems locating and using the parser but cannot figure out how to solve this. I am using the java plugin so I have access to the latest version on the jvm.
    Any help appreciated!
    Tia
    Mark

    Specify the jar file containing the parser in the archive attribute
    of the applet tag.
    <applet
    archive = "xerces.jar"
    >
    </applet>

  • How to use functions(to_char,to_date,trim..etc) in oracle xml table

    Hi I am new to oracle xml.
          In the below scenario how can use the functions like (to_char,To_date,trim..etc) In oracle xmltable."username","password" are inputs to my procedure.
    SELECT *
        INTO l_username,
                  l_password
        FROM xmltable('/InputParameters/ParamSet'
                        passing l_xmldoc
                        COLUMNS
                                l_username  VARCHAR2(28)    path 'username',
                                l_password VARCHAR2(28)     path 'password'
    and please Help how to write above with xmlquery.
    Thanks,

    In the same place you would for any regular SELECT statement
    SELECT TO_CHAR(...),
           TO_NUMBER(...)
      FROM random_table
    WHERE TO_CHAR(...) = col1
       AND TO_NUMBER(...) = col2
    username and password are the results of the SQL statement.  I'm guessing l_xmldoc is the input? There is not need to write something so simple as XQuery so what is your larger goal?  If you provide a clearer example and question, we can help you better.

  • Cannot parse xml from applet

    I really hope that somebody can help me with this.....
    I'm trying to simply parse an xml document into an applet so that the info can be used later on. I just need the tag, attribute and value.
    So far, all that I can do is get the "access denied" java.util.propertypermission user.dir read error that I see tons of people complaining about. here's my code:
    public StageInfo getNextStage() throws Exception
            handler = new GameXMLHandler(m_imageGiver, m_codeBase);
            spf = SAXParserFactory.newInstance();
            parser = spf.newSAXParser();
            parser.parse("Loader.xml", handler);
            return handler.getStageInfo();
        }is there a way to parse an xml file in an applet? everywhere I look, somebody is saying that it can be done, but never have they done it. I'm starting to think that there is something beyond my control that is stopping this from working. Please help!!!!

    If I read your post correctly, your applet is trying to read xml file from the user's local drive? This must be done with a signed (trusted) applet. Otherwise normal run-of-the-mill applets can't access drives. Java security feature. You can use Frame, it can access local drives.

  • How to use macbook air on 12v supply, how to use macbook air on 12v supply

    I want to use my macbook air when in my rv which has 12v supply. I tried an inverter; this did not work. Has anyone any suggestions?
    I am in UK

    My error they changed the interface you just uncheck mirroring:
    Make sure each display is properly connected and powered on.
    From the Apple () menu, choose System Preferences.
    From the View menu, choose Displays.
    Click the Arrangement tab.
    Disable (uncheck) "Mirror Displays".
    Message was edited by: themachead

  • How can I export a stylesheet (either CSS or XSLT) with XML from indesign?

    Hi,
    I am using indesign CS4. I want to export style sheet whether it is CSS or XSLT file with xml.
    I try to get it but can't.
    Also the XML i am exporting does not styles that has been applied by me while creating the file in Indesign.
    Please help me out by telling me the way how can i get a stylesheet and also how can I embed that style sheet with XML so that my XML file looks similiar to the indesign file.
    Thanks,
    Choudhary Nafees Ahmed

    I am using indesign CS4. I want to export style sheet whether it is CSS or XSLT file with xml.
    CSS is not an XML style sheet, it's an HTML style sheet. "Export to HTML" will export an empty stylesheet for the paragraph and character styles. ID cannot convert its (very advanced) typographic capabilities to the (very limited) CSS notation, and thus it defaults to exporting the names only.
    XSLT is not an XML style sheet either; it's a transformation format (http://www.w3.org/TR/xslt).
    I try to get it but can't.
    Also the XML i am exporting does not styles that has been applied by me while creating the file in Indesign.
    XML Export does not export anything except the items you tagged with the Auto-tag feature, or you tagged yourself. If you need your styles tagged, use Map Styles to Tags (http://www.adobe.com/accessibility/products/indesign/mapping.html).
    XML has almost nothing to do with styling -- ideally, XML describes document structure while styles describe formatting.

  • How to use session variable in JSP function  & How to use both JSP  Servlet

    Hi,
    I am new to JSP and servlets
    Still I am devloping a website in JSP. I am not mixing JSP with servlets, but I do create Java files for bean, logic and database works.
    I try to keep the hard coding part out of JSP.
    I dont how to use both JSP and Servlets in combination.
    Hence If needed I write some functions in JSP.
    but it gives me error
    +<%! public void abc()+
    +{+
    int intUserId = Integer.valueOf((Integer) session.getAttribute("MySession_UserID"));
    +}+
    +%>+
    Saying cannot find symbol session
    1) So can u please tell how can I access session variables within JSP function
    2) And also give me some links/tutorials about useing both JSP and Servlets in combination.
    Thanks
    Venkat

    The application architecture when you use Servlets and JSP in a standard MVC pattern is explained here (under the heading "Integrating Servlets and JSP Pages") and here ...

  • How to use the Camera kit with ipad, How to use the Camera kit with ipad

    I bought the iPad CAmera Connection kit the other day and attempt to connect with iPad to upload/download photos from SD card.  How?  Clueless?

    You can only copy from SD Card/Camera to iPad. It won't work from iPad to SD Card.
    http://i1224.photobucket.com/albums/ee374/Diavonex/1d0cb10d.jpg
    http://i1224.photobucket.com/albums/ee374/Diavonex/e8058ab4.jpg

Maybe you are looking for

  • I have lost my facetime option when moved to another country. pls suggest how can i get it back

    Hi , Recenlty i have bouhgt  new iphone5s from middle east . When i was using the phone over there the facetime was working perfect for me . Now when i moved to another country i can not see the facetime option in the iphone . Could you pls suggest h

  • How to set proxy in MID

    I have an MIDlet Program which is connecting to some URL. But my System is running in Proxy. so when i tried to connect, IO Exception is throwing. What i have to do. Either we have to use setProperty here. Santhosh

  • EJB + CORBA problems

    Hi there, I've got some code (EJB) which connect me to OLAPService on my 9i Oracle server. I deployed it to Oracle AS which is istalled on another machine. Then I wrote client application which has to connect to OAS and invoke EJB method to connect t

  • New Oracle By examples available on OTN (Install, upgrade,agent patching ..

    Hi, The following OBEs are now available on 10.2.0.2 Enterprise Manager OBE page (http://www.oracle.com/technology/obe/obe10gemgc_10202/index.html) on OTN: Installing Oracle Enterprise Manager 10g Grid Control Release 2 (10.2.0.1.0) Patching Grid Con

  • Computer on the fritz

    I don't even know if this is the right category for this topic, but I guess it's close enough. Here's the problem. At seemingly random times of the day, for unknown reasons, my computer stop communicating properly with my keyboard. Or maybe the other