Parsing XML documents behind a firewall; java makes a connect to theactual DTD?

Discussion in 'Java' started by Berlin Brown, Apr 18, 2008.

  1. Berlin  Brown

    Berlin Brown Guest

    Xerces or some seems to make a request to the DTD to use while
    validating a XML document.

    This is a major bug that even the w3c is complaining about.

    Does anyone know how to turn this. Off. I want to do it through some
    java setting as opposed to visiting each individual file.?

    This is essentially the code:

    public static Object [] validateXML(final String url, final String
    http_data) {
    try {
    if ((http_data == null) || (http_data.length() == 0)) {
    throw new RuntimeException("Invalid HTTP data argument");
    }

    final DOMParser parser = new DOMParser();
    parser.setFeature("http://xml.org/sax/features/validation", true);
    parser.setProperty("http://apache.org/xml/properties/schema/
    external-noNamespaceSchemaLocation",
    "memory.xsd");
    LoadTestXMLDefaultHandler errors = new LoadTestXMLDefaultHandler();
    parser.setErrorHandler(errors);
    parser.parse(new InputSource(new StringReader(http_data)));
    Object tuple [] = { new Boolean(true), "" };
    return tuple;
    } catch (Exception e) {
    final StringBuffer err_msg = new StringBuffer();
    err_msg.append("ERR: validateXML() - Error validating HTTP
    content.");
    err_msg.append("ERR: url=" + url + " error=" + e.getMessage());
    Object tuple [] = { new Boolean(false), err_msg.toString() };
    return tuple;
    }
    }
    Berlin Brown, Apr 18, 2008
    #1
    1. Advertising

  2. Berlin  Brown

    CK Guest

    Re: Parsing XML documents behind a firewall; java makes a connect to the actual DTD?

    Words to the wise, Berlin Brown <> wrote:

    >Xerces or some seems to make a request to the DTD to use while
    >validating a XML document.
    >
    >This is a major bug that even the w3c is complaining about.
    >
    >Does anyone know how to turn this. Off. I want to do it through some
    >java setting as opposed to visiting each individual file.?


    Does this help?

    http://xerces.apache.org/xerces-j/a...work/XMLParser.html#setLoadDTDGrammar(boolean)
    --
    Claus Dragon <>
    =(UDIC)=
    d++ e++ T--
    K1!2!3!456!7!S a29
    "Coffee is a mocker. So, I am going to mock."

    - Me, lately.
    CK, Apr 18, 2008
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Amit Sharma

    Parsing DTD from XML in Java

    Amit Sharma, Jan 12, 2004, in forum: Java
    Replies:
    1
    Views:
    512
    Manish Hatwalne
    Jan 12, 2004
  2. Robert Dodier
    Replies:
    6
    Views:
    2,341
    Matthias Kraft
    Sep 14, 2004
  3. test
    Replies:
    2
    Views:
    1,995
    Oliver Wong
    Jul 28, 2006
  4. Kumarforg

    Web Service invocation from behind proxy behind firewall

    Kumarforg, Aug 3, 2004, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    180
    Kumarforg
    Aug 3, 2004
  5. Replies:
    2
    Views:
    121
Loading...

Share This Page