You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Dahnke, Eric (Company IT)" <Er...@morganstanley.com> on 2005/05/25 22:03:06 UTC

Parsing struts-config. Parser chokes on

Hello,

I've written a little script to parse struts-config.xml in order to get
a list of the actions and types, etc. It works great if I comment out
the <!DOCTYPE... > line at the top of the file. 

Without commenting the <!DOCTYPE... > line I get an IOException related
to a parse error when executing the following code:

DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
	dbf.setValidating(false);
      dbf.setIgnoringComments(true);

	try {
		Document doc = dbf.newDocumentBuilder().parse(new
File(contextPath +
                    "/web/WEB-INF/struts-config.xml"));

	} catch ...

This is with JAXP using JDK 1.4.2. Can I comment out the <!DOCTYPE... >
line or otherwise get rid of it? Neither Struts nor Tomcat seem to mind.
The application starts and works fine. Thoughts? Workarounds? Thx. 
--------------------------------------------------------
 
NOTICE: If received in error, please destroy and notify sender.  Sender does not waive confidentiality or privilege, and use is prohibited. 
 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Parsing struts-config. Parser chokes on

Posted by Michael Jouravlev <jm...@gmail.com>.
Have you tried org.apache.struts.config.impl.ModuleConfigImpl.findActionConfigs
?

On 5/25/05, Dahnke, Eric (Company IT) <Er...@morganstanley.com> wrote:
> 
> Hello,
> 
> I've written a little script to parse struts-config.xml in order to get
> a list of the actions and types, etc. It works great if I comment out
> the <!DOCTYPE... > line at the top of the file.
> 
> Without commenting the <!DOCTYPE... > line I get an IOException related
> to a parse error when executing the following code:
> 
> DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
>         dbf.setValidating(false);
>       dbf.setIgnoringComments(true);
> 
>         try {
>                 Document doc = dbf.newDocumentBuilder().parse(new
> File(contextPath +
>                     "/web/WEB-INF/struts-config.xml"));
> 
>         } catch ...
> 
> This is with JAXP using JDK 1.4.2. Can I comment out the <!DOCTYPE... >
> line or otherwise get rid of it? Neither Struts nor Tomcat seem to mind.
> The application starts and works fine. Thoughts? Workarounds? Thx.
> --------------------------------------------------------

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org