That's because the schema information is located in a different schema
grammar object. You need to enumerate the grammars in use. To do this you
will either need to modify the Xerces parser (SAX2XMLReaderImpl), and
scanner (XMLScanner) classes -- as the scanner is private to the parser
(add a public accessor) and the schema resolver is private to the scanner
(add another accessor). But this, as you would guess is most ugly as you
would now have to put the entire Xerces code base under source control and
keep it up to date with changes back at Apache.
An alternative way would be to recreate all necessary classes outside of
Xerces. Create your own scanner, and parser. Unfortunately once you try
this you will run into other problems, such as other critical API's not
being exported on Windows. So you are left with replicating half of Xerces
classes to correct these problems (on Windows especially), or altering its
code base significantly.
If it sounds like I have been down this road, its true. I have submitted
bugs to Apache to export additional API's so that people can create custom
parsers. They probably ought to add accessors so that you can get at the
scanner and schema resolver (to make things easier out of the box). Until
they change some of these API's, you won't get around having to maintain
your own source trees of Xerces (argh!!!).
If you need anymore information, let me know.
Bob
At 09:09 PM 5/22/2002 +0300, you wrote:
>Team,
>
>I'm trying the XML Parser to gather the grammar information about XML
>schema I use.
>I'm concerned to get the complete info about all elements declared in the
>schema and all schemas that are imported with the <import> directive.
>I'm using a SEnumVal tool to see if all information is gathered.
>
>Unfortunately it seems that the schemas' elements, included by import
>directive, are not get to the SchemaElementDecl pool.
>I have attached sample files:
>a.xml - instance document
>a.xsd - schema
>b.xsd - imported schema
>
>Run SEnumVal a.xml
>As you can see from the output, the element eBP:C exists in the A content
>model, but no more information about it.
>
>
>Name: A
>Model Type: Children
>Create Reason: Declared
>ContentType: Sequence
>Content Model: (B,eBP:C?)
>ComplexType:
> TypeName: ,C0
> ContentType: Sequence
>Attributes:
> Name: name
> Type: CDATA
> Default Type: #DEFAULT
> Value: Peter
> Base Datatype: string
>
>--------------------------------------------
>Name: B
>Model Type: Simple
>Create Reason: Declared
>Base Datatype: string
>Default value: Test
>--------------------------------------------
>
>
>P.S. (offtopic)
>You may modify the SEnumVal sample to include the default value for the
>element, like below:
>
> XMLCh* defValue = curElem.getDefaultValue();
> if( defValue )
> {
> cout << "Default value:\t" << StrX(defValue) << endl;
> }
>
>
>
>
>---------------------------------------------------------------------
>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]