facebook

XML validation for custom DTDs

  1. MyEclipse Archived
  2.  > 
  3. Bugs
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #220025 Reply

    mikewse
    Member

    I can’t get this to work with my “problem” DTDs, but maybe I have a different scenario as my DTDs are not available at any http locations. Description:

    log4j.dtd
    ———-
    This is bundled inside log4j.jar and used by our log4j.xml settings files with a standard heading of:
    <?xml version=”1.0″ encoding=”UTF-8″ ?>
    <!DOCTYPE log4j:configuration SYSTEM “log4j.dtd”>
    <log4j:configuration xmlns:log4j=”http://jakarta.apache.org/log4j/”&gt;

    configuration-1.0.dtd
    ————————
    This is our own dtd used by our application settings files with a heading like:
    <!DOCTYPE app-configuration PUBLIC “-//App/Configuration DTD 1.0//EN”
    “configuration-1.0.dtd”>

    Both of these dtds annoy me with red crosses inside Eclipse for the files using them and I would very much like to get rid of these errors, plus of course get auto-completion working.
    I have tried putting copies of the dtds inside
    eclipse\plugins\com.genuitec.eclipse.xmen_3.8.1\dtd
    and have tried different combinations of prefixes but to no avail. Maybe you can try with the log4j dtd and tell me how you get it done?

    Cheers Mike

    #220027 Reply

    Scott Anderson
    Participant

    Mike,

    You didn’t provide any context information, as we request in the Posting Guidelines thread at the top of this forum, so I’ll answer your question assuming you’re using MyEclipse 3.8.2.

    What you need to do is add your custom DTDs to the XML Catalog located at Window > Preferences > MyEclipse > Editors > XML > XML Catalog. Once they’re added properly there, the validator and code assist modules will be able to use them effectively.

    #220065 Reply

    mikewse
    Member

    Hi Scott,

    > assuming you’re using MyEclipse 3.8.2.

    Yes, that’s right. Sorry for forgetting that. Actually, I was posting this as a followup on the thread “No proxy support [Closed]” (http://www.myeclipseide.com/PNphpBB2+file-viewtopic-t-1263.html) where the last posts were discussing 3.8.2, but for some reason the BB put my post as a new thread…

    > add your custom DTDs to the XML Catalog

    Thanks! Great, this was a function a thought was missing. I had browsed through the XML Editor settings but for some reason the “XML Catalog” heading didn’t ring a bell for me (was looking for DTD, schema, etc).

    Adding the DTDs in these settings corrected the problem for our own application DTD, but not for log4j. I think the difference may lie in the format of the DTD key as our own application DTD has a key on the format -//blabla/blabla//EN but log4j uses a different syntax. Or it is the PUBLIC/SYSTEM difference. This is the standard log4j header:

    <?xml version=”1.0″ encoding=”UTF-8″ ?>
    <!DOCTYPE log4j:configuration SYSTEM “log4j.dtd”>
    <log4j:configuration xmlns:log4j=”http://jakarta.apache.org/log4j/”&gt;

    And I have thus added an XML Catalog entry like this:
    URI: defslog4j/lib/log4j.dtd
    Key Type: System ID
    Key: log4j.dtd

    But I still get a red cross with “file not found” on the DOCTYPE line, where the path it’s looking for is ending with WEB-INF/classes.

    BTW: I have found a bug in the Edit XML Catalog Entry dialog box; when editing an entry with Key Type = SYSTEM ID it pops up showing PUBLIC ID as preselected.

    Cheers / Mike

    #220242 Reply

    mikewse
    Member

    Hi, haven’t heard from you about this…
    Best regards
    Mike

    #228608 Reply

    dgtale
    Member

    Hi mikewse
    I had the same problem solved in this way:

    1. Apply this code in your log4jconfig.xml

    <!DOCTYPE log4j:configuration PUBLIC "-//LOGGER" "log4j.dtd">

    2. Then add your custom PUBBLIC DTDs to the XML Catalog located at Window > Preferences > MyEclipse > Editors > XML > XML Catalog (using the key “-//LOGGER”).

    Here (http://www.xml.com/lpt/a/2002/09/04/xslt.html) you can find some info about how the parser works:

    If it can't find PUBLIC, the parser uses the SYSTEM identifier following the PUBLIC identifier. The SYSTEM identifier doesn't need the word "SYSTEM" -- because it's a required parameter, the XML parser knows what it is.

    This means that MyEclipse uses the PUBLIC identifier, while in runtime the parser uses the SYSTEM

    #230759 Reply

    jakegage
    Member

    Hey there,

    I’d like to try this solution, but I don’t see references to “log4jconfig.xml” anywhere. Is this just another name for “log4j.xml”?

    Jake

    #230776 Reply

    Riyad Kalla
    Member

    Most likely, yes.

Viewing 7 posts - 1 through 7 (of 7 total)
Reply To: XML validation for custom DTDs

You must be logged in to post in the forum log in