Reputation: 183
If I start with xmlSchemaNewParserCtxt() the parser is fine and finds all referenced schemas, but I wonder if I can somehow tell it where the schemas are if I use xmlSchemaNewMemParserCtxt().
The thing is, If I already have downloaded XSD in memory can I pass the document URL to the parser so it finds related stuff?
a)
char *urlPath = "http://docs.oasis-open.org/ubl/os-UBL-2.1/xsd/maindoc/UBL-Invoice-2.1.xsd";
xmlSchemaNewParserCtxt (urlPath);
b)
xmlSchemaNewMemParserCtxt (schemaBuffer, buffSize);
Variant a) works fine, variant b) produces error I/O warning : failed to load external entity "../common/UBL-CommonAggregateComponents-2.1.xsd"
Schemas are located here: http://docs.oasis-open.org/ubl/os-UBL-2.1/xsd
Upvotes: 0
Views: 317
Reputation: 33618
The best solution is probably to use XML catalogs, but you can also control loading of sub-resources with xmlRegisterInputCallbacks
or xmlSetExternalEntityLoader
.
Upvotes: 1