Class DrillXSDSchemaVisitor
java.lang.Object
org.apache.drill.exec.store.xml.xsd.DrillXSDSchemaVisitor
- All Implemented Interfaces:
org.apache.ws.commons.schema.walker.XmlSchemaVisitor
public class DrillXSDSchemaVisitor
extends Object
implements org.apache.ws.commons.schema.walker.XmlSchemaVisitor
This class transforms an XSD schema into a Drill Schema.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns aTupleMetadata
representation of the schema contained in an XSD file.void
onEndAttributes
(org.apache.ws.commons.schema.XmlSchemaElement xmlSchemaElement, org.apache.ws.commons.schema.walker.XmlSchemaTypeInfo xmlSchemaTypeInfo) Called for each element decl once all its attributes have been previously processed by onVisitAttribute.void
onEnterAllGroup
(org.apache.ws.commons.schema.XmlSchemaAll xmlSchemaAll) void
onEnterChoiceGroup
(org.apache.ws.commons.schema.XmlSchemaChoice xmlSchemaChoice) void
onEnterElement
(org.apache.ws.commons.schema.XmlSchemaElement xmlSchemaElement, org.apache.ws.commons.schema.walker.XmlSchemaTypeInfo xmlSchemaTypeInfo, boolean b) Handles global elements establishing a map for the child elements and attributes (if any).void
onEnterSequenceGroup
(org.apache.ws.commons.schema.XmlSchemaSequence xmlSchemaSequence) void
onEnterSubstitutionGroup
(org.apache.ws.commons.schema.XmlSchemaElement xmlSchemaElement) void
onExitAllGroup
(org.apache.ws.commons.schema.XmlSchemaAll xmlSchemaAll) void
onExitChoiceGroup
(org.apache.ws.commons.schema.XmlSchemaChoice xmlSchemaChoice) void
onExitElement
(org.apache.ws.commons.schema.XmlSchemaElement xmlSchemaElement, org.apache.ws.commons.schema.walker.XmlSchemaTypeInfo xmlSchemaTypeInfo, boolean b) void
onExitSequenceGroup
(org.apache.ws.commons.schema.XmlSchemaSequence xmlSchemaSequence) void
onExitSubstitutionGroup
(org.apache.ws.commons.schema.XmlSchemaElement xmlSchemaElement) void
onVisitAny
(org.apache.ws.commons.schema.XmlSchemaAny xmlSchemaAny) void
onVisitAnyAttribute
(org.apache.ws.commons.schema.XmlSchemaElement xmlSchemaElement, org.apache.ws.commons.schema.XmlSchemaAnyAttribute xmlSchemaAnyAttribute) void
onVisitAttribute
(org.apache.ws.commons.schema.XmlSchemaElement xmlSchemaElement, org.apache.ws.commons.schema.walker.XmlSchemaAttrInfo xmlSchemaAttrInfo) This method just gathers the elements up into a table.
-
Constructor Details
-
DrillXSDSchemaVisitor
-
-
Method Details
-
getDrillSchema
Returns aTupleMetadata
representation of the schema contained in an XSD file. This method should only be called after the walk method of XmlSchemaWalker has been called.- Returns:
- A
TupleMetadata
representation of the XSD schema.
-
onEnterElement
public void onEnterElement(org.apache.ws.commons.schema.XmlSchemaElement xmlSchemaElement, org.apache.ws.commons.schema.walker.XmlSchemaTypeInfo xmlSchemaTypeInfo, boolean b) Handles global elements establishing a map for the child elements and attributes (if any). TBD: Does not handle case where multiple elements have the same name as in:
There is also the case where they are ambiguous unless namespaces are used:<element name="a" .../> <element name="b" .../> <element name="a" .../>
<element name="a" .../> <element ref="pre:a" .../> <!-- without namespace, ambiguous with prior "a" -->
- Specified by:
onEnterElement
in interfaceorg.apache.ws.commons.schema.walker.XmlSchemaVisitor
-
onExitElement
public void onExitElement(org.apache.ws.commons.schema.XmlSchemaElement xmlSchemaElement, org.apache.ws.commons.schema.walker.XmlSchemaTypeInfo xmlSchemaTypeInfo, boolean b) - Specified by:
onExitElement
in interfaceorg.apache.ws.commons.schema.walker.XmlSchemaVisitor
-
onVisitAttribute
public void onVisitAttribute(org.apache.ws.commons.schema.XmlSchemaElement xmlSchemaElement, org.apache.ws.commons.schema.walker.XmlSchemaAttrInfo xmlSchemaAttrInfo) This method just gathers the elements up into a table.- Specified by:
onVisitAttribute
in interfaceorg.apache.ws.commons.schema.walker.XmlSchemaVisitor
-
onEndAttributes
public void onEndAttributes(org.apache.ws.commons.schema.XmlSchemaElement xmlSchemaElement, org.apache.ws.commons.schema.walker.XmlSchemaTypeInfo xmlSchemaTypeInfo) Called for each element decl once all its attributes have been previously processed by onVisitAttribute. Constructs the map for the special attributes child element of each element. Note: does not construct an attribute child map if there are no attributes. Only supports attributes with no-namespace on their qnames. Or rather, ignores namespaces. Only deals with local names. TBD: needs to check for attributes with namespaced names and at minimum reject them.- Specified by:
onEndAttributes
in interfaceorg.apache.ws.commons.schema.walker.XmlSchemaVisitor
-
onEnterSubstitutionGroup
public void onEnterSubstitutionGroup(org.apache.ws.commons.schema.XmlSchemaElement xmlSchemaElement) - Specified by:
onEnterSubstitutionGroup
in interfaceorg.apache.ws.commons.schema.walker.XmlSchemaVisitor
-
onExitSubstitutionGroup
public void onExitSubstitutionGroup(org.apache.ws.commons.schema.XmlSchemaElement xmlSchemaElement) - Specified by:
onExitSubstitutionGroup
in interfaceorg.apache.ws.commons.schema.walker.XmlSchemaVisitor
-
onEnterAllGroup
public void onEnterAllGroup(org.apache.ws.commons.schema.XmlSchemaAll xmlSchemaAll) - Specified by:
onEnterAllGroup
in interfaceorg.apache.ws.commons.schema.walker.XmlSchemaVisitor
-
onExitAllGroup
public void onExitAllGroup(org.apache.ws.commons.schema.XmlSchemaAll xmlSchemaAll) - Specified by:
onExitAllGroup
in interfaceorg.apache.ws.commons.schema.walker.XmlSchemaVisitor
-
onEnterChoiceGroup
public void onEnterChoiceGroup(org.apache.ws.commons.schema.XmlSchemaChoice xmlSchemaChoice) - Specified by:
onEnterChoiceGroup
in interfaceorg.apache.ws.commons.schema.walker.XmlSchemaVisitor
-
onExitChoiceGroup
public void onExitChoiceGroup(org.apache.ws.commons.schema.XmlSchemaChoice xmlSchemaChoice) - Specified by:
onExitChoiceGroup
in interfaceorg.apache.ws.commons.schema.walker.XmlSchemaVisitor
-
onEnterSequenceGroup
public void onEnterSequenceGroup(org.apache.ws.commons.schema.XmlSchemaSequence xmlSchemaSequence) - Specified by:
onEnterSequenceGroup
in interfaceorg.apache.ws.commons.schema.walker.XmlSchemaVisitor
-
onExitSequenceGroup
public void onExitSequenceGroup(org.apache.ws.commons.schema.XmlSchemaSequence xmlSchemaSequence) - Specified by:
onExitSequenceGroup
in interfaceorg.apache.ws.commons.schema.walker.XmlSchemaVisitor
-
onVisitAny
public void onVisitAny(org.apache.ws.commons.schema.XmlSchemaAny xmlSchemaAny) - Specified by:
onVisitAny
in interfaceorg.apache.ws.commons.schema.walker.XmlSchemaVisitor
-
onVisitAnyAttribute
public void onVisitAnyAttribute(org.apache.ws.commons.schema.XmlSchemaElement xmlSchemaElement, org.apache.ws.commons.schema.XmlSchemaAnyAttribute xmlSchemaAnyAttribute) - Specified by:
onVisitAnyAttribute
in interfaceorg.apache.ws.commons.schema.walker.XmlSchemaVisitor
-