Hey Vladimir, I'm sorry, I don't have example Entity Resolver code in C++. I work on the Xerces-Perl project and use Xerces-C quite extensively, but all my example code is in perl.
The issues are: * create a class that subclasses from EntityResolver, e.g. MyER. * in your xml files specify the schema that you want to use, but it should be unresolvable (i.e. a disk file that doesn't exist) * in your applications create an instance of you MyER class and tell the parser to use it. MyER er; SAXParser parser; parser.setEntityResolver(er); The entity resolver's resolveEnity() method should be invoked whenever an external entity (like the schema) does not resolve. Inside you MyER class's resolveEntity() method, you would create the schema string from the database (using the information in the PUBLIC and SYSTEM id's passed as parameters) and then create a MemBufInputSource using the string, and return it. jas. "Vladimir Sinichkin" <[EMAIL PROTECTED]> writes: > Hello, Jason > Thank you for your advise. > But I have no idea how to do that. > Do you have any sample code? > How to create entity resolver from my string containing a schema? > How the DOMParser should know to invoke the resolver if xml string has no > reference to schema? > > Thank you in advance > Vladimir > > > "Vladimir Sinichkin" <[EMAIL PROTECTED]> writes: > > > > > I am working on a project where xml and schema,specifing the grammar > > > of the xml, are created dinamicly from the database. There are some > > > reasons that I do not want to write the xml and the schema to files, > > > but keep them in strings. I am using Xerces C++ 1.5.0 (DOMParser). > > > I am using MemBufInputSource to pass my xml to the DOMParser, but I > > > have no idea how to pass the schema to the parser without writing it > > > to a file. Does anybody know how to solve my problem? > > > > Just as a guess, I would create and entity resolver, and when the > > parser attempts to find the schema it will invoke your resolver, and > > your resolver can return a MemBufInputSource with the schema. > > > > jas. > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
