Hi Randy,
"WATTS, RANDY (ATTSI)" <[EMAIL PROTECTED]> writes:
> Is there a way to specify an absolute path to the schema file?
>
> It seems as though the only option is the current directory xerces is
> running in.
The paths in the *schemaLocation attributes and in the external schema
location properties are treated as relative to the XML instance being
parsed unless they are full URIs.
> file:///opt/local/data/schema.xsd
This format works fine for me.
> all variations throw the same exception
> Warning at file , line 0, char 0
> Message: An exception occurred! Type:RuntimeException,
> Message:Warning: The primary document entity could not be opened.
> Id=3Dschema.xsd
I think there is still something wrong with the way you set the
external schema location. Note also that if the schema you specified
with the external property does not exist then the parser will try
to use the paths specified in the *schemaLocation attributes in the
XML document. Here is my code:
std::auto_ptr<SAX2XMLReader> sax (
XMLReaderFactory::createXMLReader ());
sax->setFeature (XMLUni::fgSAX2CoreNameSpaces, true);
sax->setFeature (XMLUni::fgSAX2CoreNameSpacePrefixes, true);
sax->setFeature (XMLUni::fgXercesValidationErrorAsFatal, true);
sax->setFeature (XMLUni::fgSAX2CoreValidation, true);
sax->setFeature (XMLUni::fgXercesSchema, true);
sax->setFeature (XMLUni::fgXercesSchemaFullChecking, false);
xml::string sl (p.schema_location ());
const void* v (sl.c_str ());
sax->setProperty (XMLUni::fgXercesSchemaExternalSchemaLocation,
const_cast<void*> (v));
Here xml::string is a simple string class for XMLCh.
hth,
-boris
--
Boris Kolpackov
Code Synthesis Tools CC
http://www.codesynthesis.com
Open-Source, Cross-Platform C++ XML Data Binding