Hi,

Probably the best way to do that is with XML entities:

<!ENTITY commonmappings SYSTEM "commonmappings.xml">
<persistence-units>
    <persistence-unit name="pu1">
        &commonmappings;
        <mapping-file>pu1-mappings.xml</mapping-file>
    </persistence-unit>
    <persistence-unit name="pu2">
        &commonmappings;
        <mapping-file>pu2-mappings.xml</mapping-file>
    </persistence-unit>
</persistence-units>

-Patrick

On Dec 19, 2007 12:32 AM, Adam Hardy <[EMAIL PROTECTED]> wrote:
> I omitted to mention that the pseudo-XML I gave doesn't work and I'm not clear
> how I can get it to include the other file.
>
>
> Adam Hardy on 18/12/07 21:55, wrote:
> > I have 2 persistence units, which share many of their mapping files, so
> > it is more like this:
> >
> > <persistence-unit name="mypu">
> >     <mapping-file>mypu.xml</mapping-file>
> >     <mapping-file>orm1.xml</mapping-file>
> >     <mapping-file>orm2.xml</mapping-file>
> > </persistence-unit>
> > <persistence-unit name="other">
> >     <mapping-file>other.xml</mapping-file>
> >     <mapping-file>orm1.xml</mapping-file>
> >     <mapping-file>orm2.xml</mapping-file>
> > </persistence-unit>
> >
> > and I want to cut out the duplication of the shared mapping files by
> > including just 1 seperate xml snippet like this:
> >
> > <persistence-unit name="mypu">
> >     <mapping-file>mypu.xml</mapping-file>
> >     <xi:include href="shared-mapping.xml"/>
> > </persistence-unit>
> > <persistence-unit name="other">
> >     <mapping-file>other.xml</mapping-file>
> >     <xi:include href="shared-mapping.xml"/>
> > </persistence-unit>
> >
> >
> > Michael Dick on 18/12/07 18:26, wrote:
> >> Hi Adam,
> >>
> >> Something like this should work  :
> >> <persistence-unit name="mypu">
> >>     <mapping-file>orm1.xml</mapping-file>
> >>     <mapping-file>orm2.xml</mapping-file>
> >>     . . .
> >> </persistence-unit>
> >>
> >> Is this what you're looking for?
> >>
> >> -Mike
> >>
> >> On Dec 18, 2007 5:59 AM, Adam Hardy <[EMAIL PROTECTED]> wrote:
> >>
> >>> I'm getting nowhere trying to massage my persistence.xml into something
> >>> that
> >>> validates and at this point I'm getting spurious errors from Eclipse
> >>> about
> >>> the
> >>> well-formedness of the XML, so I'll ask here to see if anyone's got an
> >>> example
> >>> to hand.
> >>>
> >>> I would like to include a list of mapping files in multiple places in my
> >>> persistence.xml (once in each persistence unit). I tried several
> >>> different
> >>> ideas
> >>> from the web, but I haven't got anything to validate in my XML editor
> >>> yet.
> >>>
> >>> i.e. I have a list like this:
> >>>
> >>>
> >>> <mapping-file>org/permacode/patternrepo/orm/Category.xml</mapping-file>
> >>>
> >>> <mapping-file>org/permacode/patternrepo/orm/Market.xml</mapping-file>
> >>>     <mapping-file>org/permacode/patternrepo/orm/Code.xml</mapping-file>
> >>>
> >>> <mapping-file>org/permacode/patternrepo/orm/TestResult.xml</mapping-file>
> >>>
> >>>
> >>> <mapping-file>org/permacode/patternrepo/orm/TradingParam.xml</mapping-file>
> >>>
> >>>
> >>> which I want to include - I'd be really grateful if someone could
> >>> tell me
> >>> the
> >>> xml syntax for the include?
> >
> >
>
>



-- 
Patrick Linskey
202 669 5907

Reply via email to