Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6055495
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:16:15+00:00 2026-05-23T08:16:15+00:00

I’m writing a applet that uses a DTD file to check the content of

  • 0

I’m writing a applet that uses a DTD file to check the content of the XML it receives.

I had the problem of the DTD not placed in the right folder with the applet viewer, but now that I’m testing this on the server I get the same error again.

java.security.AccessControlException: 
    access denied (java.io.FilePermission/leveldtd.dtd read)

How can I fix this when the applet is on the server?


public static void parseThis(InputSource is) throws Exception{
        SAXParserFactory spf = SAXParserFactory.newInstance();
        SAXParser sp = spf.newSAXParser();
        XMLHandlerLevel myExampleHandler = new XMLHandlerLevel();
        XMLReader xr = sp.getXMLReader();
        xr.setContentHandler(myExampleHandler);
        /* Begin parsing */ 
        xr.parse(is);
    }

XML parser creation.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T08:16:15+00:00Added an answer on May 23, 2026 at 8:16 am

    For an applet to get a resource from a server, it must use an URL. File objects will not work because:

    1. The File object will point to a place on the computer of the user.
    2. It requires a trusted applet to use File objects. Hence the AccessControlException in your output.

    URLs to resources can easily be formed using the URL(baseURL, pathString) constructor where the base URL is obtained from Applet.getDocumentBase() or Applet.getCodeBase().

    ..how do I give the URL to the parser ?

    Here is a code snippet taken from JaNeLA that uses an XSD located inside one of the Jars. The URL is stored in schemaSource.

    try {
        URL schemaSource = Thread.currentThread().getContextClassLoader().getResource("JNLP-6.0.xsd");
        System.out.println( "schemaSource: " + schemaSource );
    
        DocumentBuilderFactory factory =
            DocumentBuilderFactory.newInstance();
        factory.setFeature("http://xml.org/sax/features/validation", true);
        factory.setFeature("http://apache.org/xml/features/validation/schema", true) ;
        factory.setFeature("http://xml.org/sax/features/namespaces", true) ;
        factory.setFeature("http://apache.org/xml/features/validation/schema-full-checking", true);
        factory.setAttribute(
            "http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation",
            schemaSource.toString());
        factory.setNamespaceAware(true);
        factory.setValidating(true);
    
        InputStream schemaStream = schemaSource.openStream();
        try {
            StreamSource ss = new StreamSource( schemaStream );
            String language = XMLConstants.W3C_XML_SCHEMA_NS_URI;
            SchemaFactory schemaFactory = SchemaFactory.newInstance(language);
    
            Schema schema = schemaFactory.newSchema(ss);
            factory.setSchema( schema );
        }
        finally {
            schemaStream.close();
        }
    
        DocumentBuilder documentBuilder = factory.newDocumentBuilder();
        documentBuilder.setErrorHandler( errorHandler );
    
        InputStream is = page.openStream();
        try {
            document = documentBuilder.parse( is );
        }
        finally {
            is.close();
        }
    
        List<LaunchError> parseErrors = errorHandler.getParseErrors();
        xmlValid = parseErrors.isEmpty();
        errors.addAll(parseErrors);
    } catch(Exception e) {
        System.err.println( "Error: " + e.getMessage() );
        // TODO Show to user
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my XML file chapters tag has more chapter tag.i need to display chapters
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I need a function that will clean a strings' special characters. I do NOT
I'm parsing an XML file, the creators of it stuck in a bunch social
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.