Hello, I am using Xerces 1.7, C++. I have found many cases where namespace prefixes are missing, and other cases where namespace uri strings are empty. In particular I find that if I take the purchaseOrder example out of the Schema spec, use an import for the IPO schema, all the namespace uris for the imported types are empty. I am attaching sample use cases from the Schema spec examples.
What I am doing:
I am using the SAX2 parser. Parser is configured to do _full_ schema
validation, and core namespace prefixes are set to be on.
Core validation set to true, dynamic set to false (this is
SAX2XMLReader::Val_Always according to some examples).
Consider for example an attribute whose type is specified in the imported
schema. I do something like:
unsigned int uriId = attr->getURIId();
printf("attrURIId: %d\n", uriId);
const XMLCh* uriStr = sax2Parser->getScanner()->getURIText(uriId);
StrX attrURIStr(uriStr);
printf("attrURI: %s\n", attrURIStr.localForm() );
The uri-id is unity (1). I find that in any case where the prefix or
namespace is incorrectly reported, the uri-id is always unity.
When I dump the first 10 URI strings I get:
URI 0:
URI 1:
URI 2: http://apache.org/xml/UknownNS
URI 3: http://www.w3.org/XML/1998/namespace
URI 4: http://www.w3.org/2000/xmlns/
URI 5: http://www.w3.org/2001/XMLSchema-instance
URI 6: http://www.example.com/Report
URI 7: http://www.w3.org/2001/XMLSchema
URI 8: http://www.example.com/IPO
URI 9:
But many of the elements and attributes are incorrectly mapped to URI 1
when they ought to have been mapped to URI 8. See "output.txt" in the
attached zip file. Has anyone else run into similar problems?
As an aside: The above example shows me using a slightly modified sax2
parser implementation; I modified the Xerces source to expose the scanner
so I could get the uri-text (as I see no other way to get the textual
representation apart from doing this). A friend had suggested that I modify
both the parser (to expose the scanner) and the scanner (to expose the
grammar resolver) so that I could get at the necessary information about
the schema, so that I can dynamically create an object system in C++ to
represent the data. That is why I am having to modify the parsers,
scanners, and grammar resolvers. But something curious is happening with
namespace uris.
Bob
w3-sample-report-import.zip
Description: Zip compressed data
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
