|
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; } |
<?xml version="1.0" encoding="UTF-8"?> <schema targetNamespace="http://www.my.com/eBP" xmlns="http://www.w3.org/2001/XMLSchema" elementFormDefault="unqualified" attributeFormDefault="unqualified">
<element name="C"> <complexType/> </element> </schema>
<?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:eBP="http://www.my.com/eBP" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs:import namespace="http://www.my.com/eBP" schemaLocation="b.xsd"/> <xs:element name="A"> <xs:complexType> <xs:sequence> <xs:element name="B" type="xs:string" default="Test"/> <xs:element ref ="eBP:C" minOccurs="0"/> </xs:sequence> <xs:attribute name="name" type="xs:string" use="optional" default="Peter"/> </xs:complexType> </xs:element> </xs:schema>
<A xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:eBP="http://www.my.com/eBP" xsi:noNamespaceSchemaLocation="a.xsd"> <B/> <eBP:C/> </A>
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
