The unfortunate side affect of doing this entity inclusion is that the
partX.xml files are xml fragments and not well-formed documents. XLink
provides a better alternative but is implementation bound. Not all xml
processors/parsers support the XLink syntax.

You could also use the transformation of the configuration file support in
mav to include multiple source documents into a single output document.
There is a lot of latitude here as to how you can do this.

One way would work something like this.

add to web.xml in <servlet-mapping>

<configFile>WEB-INF/master.xml</configFile>
<configTransform>WEB-INF/loadComponents.xsl</configTransform>

----- master.xml -----
<maverick version="2.0" default-view-type="document">

 <loadComponents>
    <file>component1.xml</file>
    <file>component2.xml</file>
 </loadComponents>
</maverick>

----- loadComponents.xsl ----
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>

 <!-- copy attributes and elements into the output doc -->
 <xsl:template match="@*|node()">
  <xsl:copy>
   <xsl:apply-templates select="@*|node()"/>
  </xsl:copy>
 </xsl:template>
 <xsl:template match="loadComponents">
    <xsl:variable name="component" select="document(file)/component"/>
    <commands>
      <xsl:apply-templates select="$component/commands/*"/>
    </commands>
    <views>
        <xsl:apply-templates select="$component/views/*"/>
    </views>
 </xsl:template>

</xsl:stylesheet>

----- component1.xml -----
<component>
 <commands>
    ...
 </commands>
 <views>
    ...
 </views>
</component>


This is method is a litte more complicated, but also gives much more
flexibility and control over what is included where.

----- Original Message -----
From: "Schnitzer, Jeff" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, November 11, 2002 1:00 PM
Subject: RE: [Mav-user] q: multiple config files


Yes, this is easy to do - since the XML config file is read with a
standard XML parser, use the XML entity mechanism to chop up the file.
This should probably be a FAQ, but the best explanation I have seen for
how to do this is in the Docbook documentation:

http://www.docbook.org/tdg/en/html/ch01.html#s-entities

Basically, you define entities for each chunk:

<!ENTITY part1 SYSTEM "part1.xml">
<!ENTITY part2 SYSTEM "part2.xml">
<!ENTITY part3 SYSTEM "part3.xml">

<maverick version="2.0">
  &part1;
  &part2;
  &part3;
</maverick>

That should work just fine.  The config format already allows multiple
<commands> and <views> elements.



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
[INVALID FOOTER]

Reply via email to