OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Re: [xml-dev] Undeclared prefix error with Xerces Java on Mac only

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:


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. 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:

Hope that helps,
George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger

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@lists.xml.org
> subscribe: xml-dev-subscribe@lists.xml.org
> List archive: http://lists.xml.org/archives/xml-dev/
> List Guidelines: http://www.oasis-open.org/maillists/guidelines.php

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

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS