2 Replies Latest reply on Oct 21, 2010 10:09 AM by sat90210

    Set JBossEntityResolver to XML Parser by (XML) configuration

    sat90210 Newbie

      Hi, Is there a way to set entityResolver ( in my case, JbossEntityResolver) to the XML Parser before the documentBuilder class parses the input XML file. I could do it by using the following code

       

       

      DocumentBuilder db = fact.newDocumentBuilder();

      db.setEntityResolver(new JBossEntityResolver());      

      db.parse(....);

       

      But this makes the my application code server specific. Is there a way by using configuration file in JBOSS.

        • 1. Re: Set JBossEntityResolver to XML Parser by (XML) configuration
          jaikiran pai Master

          Can you please provide more details on what you are trying to solve?

          • 2. Re: Set JBossEntityResolver to XML Parser by (XML) configuration
            sat90210 Newbie

            My application takes  XML as input and  validates the XML. I have a custom dtd to validate the input XML. The input XML has a reference to the dtd and that reference is a URL. When validating the XML , I want the parser to look locally for the dtd. I did the entity mapping (URL=local dtd) using jbossentityresolvermgr mBean. When the parser validates the input XML, I want the parser to look for the dtd locally. To do this, I had to set the entityresolver of the parser so that it refers the Jbossentityresolver Class to locate the dtd locally. I did this by modifying the code where I parse the input XML by using setEntityResolver(new JBossEntityResolver()). This makes the code Jboss AS specific. Is there a way to do this by a configuration setup where I can get the parser to look locally for the dtd.  Basically, I am trying to setup XML registry in  jboss, similar to what we had in Weblogic.