Thanks for the reply Kelly. An entity resolver works when there is an entry for an xsd. I had that part working as stated. The problem I was running into was sometimes it was stated and sometimes it just wasn't there (various clients). Using the method Boris and Vitaly outlined, I was able to solve the problem. I had tried to use it before but I was unsure of the syntax and could not get it to work.
Wade On Mon, Jan 18, 2010 at 10:59 AM, Kelly Beard <[email protected]> wrote: > > On Mon, Jan 18, 2010 at 9:54 AM, Boris Kolpackov > <[email protected]> wrote: > > The thing with setExternalSchemaLocation is that the schema path will be > > resolved relative to the XML file being parsed unless it is an absolute > > URI (in the file:/// form in case of a filesystem path). This page has > > some more information: > > > > http://www.codesynthesis.com/projects/xsd/documentation/cxx/tree/guide/#5.1 > > > > Boris > > Yes, that was the problem I recently had. I've successfully been able > to load my own XSD by overriding an EntityResolver. Seems to work for > me. > > class RFIDResolver : public EntityResolver { > public : > InputSource* resolveEntity(const XMLCh* const publicId, const > XMLCh* const systemId) > { > CStr2XStr path("/home/dfcuser/rfid.xsd"); > > if (XMLString::compareString(systemId, path.unicodeForm())) { > return new LocalFileInputSource(path.unicodeForm()); > } else { > return 0; > } > } > }; > > ... > > RFIDResolver *rfidResolver = new RFIDResolver(); > parser->setEntityResolver(rfidResolver); > > -- > Kelly Beard
