[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Undeclared prefix error with Xerces Java on Mac only

  • From: Michael Glavassevich <mrglavas@c...>
  • To: George Cristian Bina <george@o...>
  • Date: Tue, 10 Mar 2009 22:38:19 -0400

Re:  Undeclared prefix error with Xerces Java on Mac only

George Cristian Bina <george@o...> wrote on 03/10/2009 08:55:12 PM:

> Hi Michael,
>
> There is one problem I could spot on your file, the schemaLocation
> should contain one or more pairs of the form
> namespace location
> and you specify only a location. You should correct that as below:
>
> xsi:schemaLocation="http://openscoreformat.sourceforge.net/osf/metadata
> http://www.recordare.com/xsd/metadata.xsd"
>
> The next thing you should do after you update the schemaLocation as
> above (if you still get the error) is to check if you load Xerces or
> another schema parser, print the validator class name and see if that is
> what you expect or not.


And I think that is the most likely problem. I recall that the factory loading code for SchemaFactory (and XPathFactory too) in Java 5 was at one time and possibly still is busted [1]. You end up getting the JDK SchemaFactory instead of the one from Xerces. The code donated to Apache had this bug and we fixed it before it (i.e. the JAXP 1.3 version of xml-apis.jar) was released with Xerces-J 2.7.0 (the first Xerces release to support SchemaFactory). I'd suggest you include the Apache xml-apis.jar in the JDK endorsed directory so that the correct SchemaFactory implementation gets loaded.

> Further you can see if you load that class from
> the library you expect it to be loaded from or from some other
> (eventually older) library. For that you can load the .class file as
> resource and see where that comes from. A quick search shows also some
> code that does that:
> http://www.techtalkz.com/414239-post6.html
>
> Hope that helps,
> George
> --
> George Cristian Bina
> <oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
> http://www.oxygenxml.com
>
>
> Michael Good wrote:
> > I am running into a platform-specific XSD validation issue that has me
> > stumped. Hopefully this group has some advice on things to check.
> >
> > I'm working on a program that validates Open Score Format files
> > (http://openscoreformat.sourceforge.net/). Open Score Format is an
> > extension of MusicXML 2.0 that, among other things, adds a standard
> > metadata file format. It is the validation of this metadata file that
> > causes the problem.
> >
> > The program uses the Xerces Java 2.9.1 parser. On a Windows system
> > running Java 6, all validates fine. On Mac systems running Java 5,
> > metadata files generate the validation error:
> >
> >   UndeclaredPrefix: Cannot resolve 'dcterms:W3CDTF' as a QName: the
> > prefix 'dcterms' is not declared.
> >
> > Here is a sample file that causes the problem:
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <osfmeta:osf-package-metadata-baseline
> > xmlns:osfmeta="http://openscoreformat.sourceforge.net/osf/metadata"
> > xmlns:dc="http://purl.org/dc/elements/1.1/"
> > xmlns:dcterms="http://purl.org/dc/terms/"
> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > xsi:schemaLocation="http://www.recordare.com/xsd/metadata.xsd">
> >    <dc:title>1. Im wunderschönen Monat Mai</dc:title>
> >    <dc:creator>Robert Schumann</dc:creator>
> >    <dc:description>DICHTERLIEBE, Op. 48</dc:description>
> >    <dc:publisher/>
> >    <dcterms:created xsi:type="dcterms:W3CDTF">2009-03-10</dcterms:created>
> >    <dcterms:issued xsi:type="dcterms:W3CDTF">2009-03-10</dcterms:issued>
> >    <dcterms:modified xsi:type="dcterms:W3CDTF">2009-03-10</dcterms:modified>
> >    <dcterms:dateCopyrighted
> > xsi:type="dcterms:W3CDTF">2009</dcterms:dateCopyrighted>
> >    <dc:type xsi:type="dcterms:DCMIType">InteractiveResource</dc:type>
> >    <dcterms:medium
> > xsi:type="dcterms:IMT">application/vnd.yamaha.openscoreformat.
> osfpvg+xml</dcterms:medium>
> >    <dc:identifier xsi:type="dcterms:URI">http://www.recordare.
> com/</dc:identifier>
> >    <dc:source xsi:type="dcterms:URI">http://www.recordare.com/</dc:source>
> >    <dc:language xsi:type="dcterms:RFC4646">und</dc:language>
> >    <dc:rights>Copyright © 2002 Recordare LLC</dc:rights>
> >    <osfmeta:meter>
> >       <osfmeta:beats>2</osfmeta:beats>
> >       <osfmeta:beat-type>4</osfmeta:beat-type>
> >    </osfmeta:meter>
> >    <osfmeta:key>
> >       <osfmeta:root>A</osfmeta:root>
> >       <osfmeta:mode>major</osfmeta:mode>
> >    </osfmeta:key>
> > </osfmeta:osf-package-metadata-baseline>
> >
> > It sure looks to me like dcterms is declared! And again, it validates
> > fine on Windows, but not on the Mac system.
> >
> > So what might be happening differently between the two systems? The
> > Windows system is running Java 6 while the Mac is running Java 5. But
> > both systems are using Xerces Java 2.9.1. Validation is being done
> > with the javax.xml.validation.Validator Maybe one of the systems is
> > actually pulling in a different SchemaFactory oe Validator? Maybe
> > there are different configuration defaults between systems for the
> > SchemaFactory, Schema, and/or Validator classes?
> >
> > All the schemas, both top-level and imported, are supplied in local
> > versions. I double-checked and the LSResourceResolver is resolving
> > correctly both on Windows and Mac. The metadata.xsd file is available
> > in the Open Score Format SVN repository; I've temporarily put a copy
> > at http://www.recordare.com/xsd/metadata.xsd.
> >
> > I'm still pretty new to the area of namespace-aware XSD schema
> > validation in Java. I get the feeling that I am missing some
> > boilerplate / configuration code, but after checking online
> > documentation and doing web searches, I still do not know where that
> > might be.
> >
> > Thanks for any advice on how to fix this up, or how to approach
> fixing this up!
> >
> > Best regards,
> >
> > Michael Good
> > Recordare LLC
> > www.recordare.com
> >
> > _______________________________________________________________________
> >
> > XML-DEV is a publicly archived, unmoderated list hosted by OASIS
> > to support XML implementation and development. To minimize
> > spam in the archives, you must subscribe before posting.
> >
> > [Un]Subscribe/change address: http://www.oasis-open.org/mlmanage/
> > Or unsubscribe: xml-dev-unsubscribe@l...
> > subscribe: xml-dev-subscribe@l...
> > List archive: http://lists.xml.org/archives/xml-dev/
> > List Guidelines: http://www.oasis-open.org/maillists/guidelines.php
> >
>
> _______________________________________________________________________
>
> XML-DEV is a publicly archived, unmoderated list hosted by OASIS
> to support XML implementation and development. To minimize
> spam in the archives, you must subscribe before posting.
>
> [Un]Subscribe/change address: http://www.oasis-open.org/mlmanage/
> Or unsubscribe: xml-dev-unsubscribe@l...
> subscribe: xml-dev-subscribe@l...
> List archive: http://lists.xml.org/archives/xml-dev/
> List Guidelines: http://www.oasis-open.org/maillists/guidelines.php


[1] http://markmail.org/message/bntj64gxademl5ex

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@c...

E-mail: mrglavas@a...



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.