Exactly, Mike. But, as we talked yesterday, when does this version of
Xerxes get incorporated into the Sun JDK? Having the Sun JDK use a
non-validating parser and the IBM JDK use a validating parser will continue
to introduce inconsistencies (as documented in OPENJPA-513).
Kevin
On Wed, Jul 30, 2008 at 9:25 AM, Michael Dick <[EMAIL PROTECTED]>wrote:
> FWIW this may be related to the way we disable validation based on the
> version of xerces that is in use :
>
> There's a specific check in XMLDataParser which disables validation based
> on
> the version of xerces found on the classpath.
>
> static {
> try {
> // check for Xerces version 2.0.2 to see if we need to disable
> // schema validation, which works around the bug reported at:
> // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4708859
> _schemaBug = "Xerces-J 2.0.2".equals(Class.forName
> ("org.apache.xerces.impl.Version").getField("fVersion").
> get(null));
> } catch (Throwable t) {
> // Xerces might not be available
> _schemaBug = false;
> }
> }
> :
> :
> if (schemaSource != null && _schemaBug) {
> if (_log != null && _log.isTraceEnabled())
> _log.trace(_loc.get("parser-schema-bug"));
> schemaSource = null;
> }
> boolean validating = _validating && (getDocType() != null
> || schemaSource != null);
> :
> :
> _sourceName = sourceName;
> SAXParser parser = XMLFactory.getSAXParser(validating, true);
> Object schema = null;
> if (validating) {
> schema = schemaSource;
> if (schema == null && getDocType() != null)
> xml = new DocTypeReader(xml, getDocType());
> }
>
> I haven't done all my homework to verify that this is the case, but explain
> the difference between JDKs.
>
> -mike
>
> On Wed, Jul 30, 2008 at 8:12 AM, Kevin Sutter <[EMAIL PROTECTED]> wrote:
>
> > Craig,
> > If you would have asked me before seeing the error, I would have thought
> > the
> > same thing. But, with the original xml, I received the following error
> > from
> > the validating parser in the IBM JDK:
> >
> > Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 1.516 sec
> > <<< FAILURE!
> >
> >
> testMapping(org.apache.openjpa.persistence.jdbc.unique.TestUniqueConstraintWithXMLDescriptor)
> > Time elapsed: 1.437 sec <<< ERROR!
> > <openjpa-1.2.0-SNAPSHOT-r422266:680481M nonfatal general error>
> > org.apache.openjpa.persistence.PersistenceException:
> > org.xml.sax.SAXException:
> >
> >
> file:/C:/eclipse.workspaces/3.2.2/openjpa-trunk-committed/openjpa-persistence-jdbc/target/test-classes/org/apache/openjpa/persistence/jdbc/unique/orm.xml
> > [Location: Line: 27, C: 35]: org.xml.sax.SAXParseException:
> > cvc-complex-type.2.1: Element 'xml-mapping-metadata-complete' must have
> no
> > character or element information item [children], because the type's
> > content
> > type is empty.
> > at
> > org.apache.openjpa.persistence.PersistenceMetaDataFactory.parseXML(Pe
> > rsistenceMetaDataFactory.java:249)
> > :
> > :
> >
> > I surmised from this error that the problem was due to the split xml tag.
> > The XSD has this element defined as follows:
> >
> > <xsd:element name="xml-mapping-metadata-complete" type="orm:emptyType"
> > minOccurs="0"/>
> >
> > So, I changed it to the single line version and the problem went away.
> >
> > Kevin
> >
> > On Mon, Jul 28, 2008 at 4:31 PM, Craig L Russell <[EMAIL PROTECTED]
> > >wrote:
> >
> > > Hi Kevin,
> > >
> > > Just for my information, what's wrong with the original xml:
> > >
> > > <persistence-unit-metadata>
> > >> - <xml-mapping-metadata-complete>
> > >> - </xml-mapping-metadata-complete>
> > >> + <xml-mapping-metadata-complete/>
> > >> </persistence-unit-metadata>
> > >>
> > >
> > >
> > > I understand these statements (before versus after) are legal and
> > > equivalent. But I'm always looking to improve my understanding.
> > >
> > > Thanks,
> > >
> > > Craig
> > >
> > > On Jul 28, 2008, at 1:26 PM, [EMAIL PROTECTED] wrote:
> > >
> > > Author: kwsutter
> > >> Date: Mon Jul 28 13:26:21 2008
> > >> New Revision: 680481
> > >>
> > >> URL: http://svn.apache.org/viewvc?rev=680481&view=rev
> > >> Log:
> > >> OPENJPA-668. Fixed up the orm.xml file that was used for testing so
> > that
> > >> it could pass the validation of the IBM JDK parser.
> > >>
> > >> Modified:
> > >>
> > >>
> >
> openjpa/trunk/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/jdbc/unique/orm.xml
> > >>
> > >> Modified:
> > >>
> >
> openjpa/trunk/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/jdbc/unique/orm.xml
> > >> URL:
> > >>
> >
> http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/jdbc/unique/orm.xml?rev=680481&r1=680480&r2=680481&view=diff
> > >>
> > >>
> >
> ==============================================================================
> > >> ---
> > >>
> >
> openjpa/trunk/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/jdbc/unique/orm.xml
> > >> (original)
> > >> +++
> > >>
> >
> openjpa/trunk/openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/jdbc/unique/orm.xml
> > >> Mon Jul 28 13:26:21 2008
> > >> @@ -23,8 +23,7 @@
> > >> version="1.0">
> > >>
> > >> <persistence-unit-metadata>
> > >> - <xml-mapping-metadata-complete>
> > >> - </xml-mapping-metadata-complete>
> > >> + <xml-mapping-metadata-complete/>
> > >> </persistence-unit-metadata>
> > >>
> > >>
> > >> @@ -76,10 +75,8 @@
> > >>
> > >> <many-to-many name="bs">
> > >> <join-table
> name="UNIQUE_JOINTABLE_XML">
> > >> - <join-column name="FK_A_XML"
> > >> referenced-column-name="aid" nullable="false">
> > >> - </join-column>
> > >> - <inverse-join-column
> > >> name="FK_B_XML" referenced-column-name="bid" nullable="false">
> > >> - </inverse-join-column>
> > >> + <join-column name="FK_A_XML"
> > >> referenced-column-name="aid" nullable="false"/>
> > >> + <inverse-join-column
> > >> name="FK_B_XML" referenced-column-name="bid" nullable="false"/>
> > >> <unique-constraint>
> > >>
> > >> <column-name>FK_A_XML</column-name>
> > >>
> > >> <column-name>FK_B_XML</column-name>
> > >>
> > >>
> > >>
> > > Craig L Russell
> > > Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
> > > 408 276-5638 mailto:[EMAIL PROTECTED]
> > > P.S. A good JDO? O, Gasp!
> > >
> > >
> >
>