Greetings group, How can I use the Schema parsing API(XS API) to retrieve the components of a Schema given a element so that: 1) To get Global element constructs in a given schema file. 2) To get either a element declaration to get its further child constructs. 3) To know whether an element construct is of type SimpleType or ComplexType. 4) To know an elements construct's informatin like (name, datatype, its value if textnode, enumeration values if any, default if any, content model like required or not?, min and max occrances, attributes info). 5) To know an attribute construct's informatin like (name, datatype, its value, enumeration values if any, default if any, content model like required or not?, derived from restriction/union/list).
I was using XPath API in Xerces previously but considering the complications in the incude/import constructs I have started exploring Xerces API (API of ASModel , XS and PSVI). I could not find any examples that tell how to process(Not parse plz!!!) a schema using XSSchemaGrammar retrieved from a XSSchemaLoader.loadGrammar(...). I could not explore beyond XSSchemaGrammar as at every place in XSElementDeclaration/XSTypeDefinition/XSSimpleTypeDefinition/XSComplexTypeDe finition, etc classes there are references to PSVI Interfaces/classes. It would be very nice if you can throw some light on the dependencies of these packages. ******************************** *The Use Case is detailed below* ******************************** The user supplies an XML Schema file as listed below: <?xml version="1.0" encoding="UTF-8"?> <xsd:schema targetNamespace="http://my-company.com/namespace" xmlns="http://my-company.com/namespace" xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xsd:element name="Person"> <xsd:complexType> <xsd:sequence> <xsd:element name="First" type="xsd:string"/> <xsd:element name="Last" type="xsd:string"/> <xsd:element name="Title" type="xsd:string" minOccurs="0"/> <xsd:element name="PhoneExt"> <xsd:simpleType> <xsd:restriction base="xsd:int"> <xsd:maxInclusive value="999"/> </xsd:restriction> </xsd:simpleType> </xsd:element> <xsd:element name="EMail" type="xsd:string"/> </xsd:sequence> <xsd:attribute name="Manager" type="xsd:boolean" use="required"/> <xsd:attribute name="Programmer" type="xsd:boolean" use="optional"/> <xsd:attribute name="Degree"> <xsd:simpleType> <xsd:restriction base="xsd:string"> <xsd:enumeration value="BA"/> <xsd:enumeration value="MA"/> <xsd:enumeration value="Ph.D"/> </xsd:restriction> </xsd:simpleType> </xsd:attribute> </xsd:complexType> </xsd:element> </xsd:schema> ************ *End Result* ************ The schema is shown visually in a java tree(JTree object). Then I would like to show it something like -- Person -- <at>Manager -- <at>Programmer -- <at>Degree -- <,> <-- represents a sequence -- <el>First -- <el>Last -- <el>Title -- <el>PhoneExt -- <el>EMail When the User selects a schema node in JTree. The properties of the node would be shown to user Eg : When the user selects the Programmer node in the tree. The Properties :- Data Type : boolean Use : Mandatory Thanks in Advance, --Ramesh --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
