-
1. Re: components.xml and include
lvdberg Jun 12, 2009 12:11 PM (in response to nico.ben)Hi,
This is something which can be done in Spring, but not (yet) in Seam. Besides that you're using the Facelets namespace (ui), which supports something like this for the inclusion of page (-parts).
You can have different components.xml in different jars, but I don't think its what you want to do.
Leo
-
2. Re: components.xml and include
christian.bauer Jun 12, 2009 12:31 PM (in response to nico.ben)Use XML includes/entities. If you don't know how that works, learn XML.
-
3. Re: components.xml and include
lvdberg Jun 12, 2009 3:17 PM (in response to nico.ben)IBM has a nice website about XML and includes, but I repeat its not the same as Spring offers.
http://www.ibm.com/developerworks/xml/library/x-tipgentity.html
Success,
Leo
P.S. Seam is already complex enough and we hoped we could forget XML a bit. A push in the right direction will keep people interested
-
4. Re: components.xml and include
acerberus Jul 5, 2009 12:32 PM (in response to nico.ben)It would however be really nice if it was supported in Seam directly since with a growing number of components the components.xml file gets quite messy.
The easiest way I can imagine to achieve this is to allow for XIncludes. This would probably just mean setting a flag for the XML Parser that is used to read in the components.xml file.
Cheers
Arno -
-
6. Re: components.xml and include
torakuma Jul 20, 2009 9:52 PM (in response to nico.ben)I would also like to do this so I tried out include/entity and was not able to get it to work.
My components.xml has:
<!DOCTYPE components [ <!ENTITY components2 SYSTEM "./components2.xml"> ]>
... and I reference the include as
&components2;
However I get the following error:
Caused by: java.lang.RuntimeException: Can't find schema/DTD reference: C:\jboss-4.2.3.GA\bin\components2.xml at org.jboss.seam.util.XML.getRootElement(XML.java:29) at org.jboss.seam.init.Initialization.initComponentsFromXmlDocument(Initialization.java:227) ... 138 more Caused by: org.dom4j.DocumentException: C:\jboss-4.2.3.GA\bin\components2.xml Nested exception: C:\jboss-4.2.3.GA\bin\components2.xml at org.dom4j.io.SAXReader.read(SAXReader.java:484) at org.dom4j.io.SAXReader.read(SAXReader.java:343) at org.jboss.seam.util.XML.getRootElement(XML.java:24) ... 139 more
It looks as though it is looking from the JBOSS bin directory! Shouldn't it find it at the same location as components.xml since I use
./
? -
7. Re: components.xml and include
torakuma Jul 30, 2009 4:35 PM (in response to nico.ben)Can anyone recommend the proper way to include?
-
8. Re: components.xml and include
asookazian Jul 30, 2009 7:57 PM (in response to nico.ben)I tried using <xi:include> and failed.
Spring does it (see below). We need an <import> tag in Seam as well.
An alternate approach is to use one or more occurrences of the <import/> element to load bean definitions from another file (or files). Let's look at a sample:<beans> <import resource="services.xml"/> <import resource="resources/messageSource.xml"/> <import resource="/resources/themeSource.xml"/> <bean id="bean1" class="..."/> <bean id="bean2" class="..."/> </beans>
In this example, external bean definitions are being loaded from 3 files, services.xml, messageSource.xml, and themeSource.xml. All location paths are considered relative to the definition file doing the importing, so services.xml in this case must be in the same directory or classpath location as the file doing the importing, while messageSource.xml and themeSource.xml must be in a resources location below the location of the importing file. As you can see, a leading slash is actually ignored, but given that these are considered relative paths, it is probably better form not to use the slash at all.
The contents of the files being imported must be fully valid XML bean definition files according to the Schema or DTD, including the top level <beans/> element.http://static.springsource.org/spring/docs/2.0.x/reference/beans.html
-
9. Re: components.xml and include
torakuma Aug 11, 2009 1:55 PM (in response to nico.ben)Can the Seam gods weigh in on this? Our project is getting quite large now and component configuration is becoming a headache since components.xml is so large.
-
10. Re: components.xml and include
christian.bauer Aug 11, 2009 2:35 PM (in response to nico.ben)Don't bump up your postings. Read the docs:
http://docs.jboss.org/seam/2.1.2/reference/en-US/html/xml.html#d0e4632