I would expect it to work with any (validating) XML parser. XSDs are internal to the XML language; entities are external insofar as they're SGML markup that the XML parser obeys.
That said, I could be totally wrong; maybe XSD-validating parsers ignore DTD and entity content. Ignoring your editor, what happens if you put an <!ENTITY declaration after the <?xml bit but before the <persistence bit? -Patrick On Jan 2, 2008 9:10 AM, Adam Hardy <[EMAIL PROTECTED]> wrote: > Is that for use with DTDs only? It's not recognised by my XML editor where my > persistence.xml starts: > > <?xml version="1.0" encoding="UTF-8"?> > <persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xsi:schemaLocation="http://java.sun.com/xml/ns/persistence > http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"> > > > > Patrick Linskey on 30/12/07 19:16, wrote: > > 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
