- Register custom InputTranscoder schema
- Instanciate (Singleton ) InputTranscoder obj
</xsd:schema>For eg : a relation algebra to xml schema notation
- Provide mapping rules : Input Schema -> XML Schema (Internal format)
Lets assume a table EMP = Employee(name, age, Address )
will be translated to
<xsd:schema xmlns:xsd="http://www.w3.org/2000/08/XMLSchema">
<xsd:annotation>
<xsd:documentation>
Relation Algebra to XML schema Translation example.
Copyright 2000 Ajitesh Das.
</xsd:documentation>
</xsd:annotation><xsd:element name="Employee" type="EmployeeType"/>
<xsd:complexType name="EmployeeType">
<xsd:sequence>
<xsd:element name="name" type="xsd:string"/>
<xsd:element name="age" type="xsd:integer"/>
<xsd:element ref="address" default="null" type= "xsd:string"/>
</xsd:sequence>
</xsd:complextype>
For eg the script :
class XMLTranscoderRule:
::::::::::::::::::::::::::::::::::
def setInputElement(self,'name'):
self.element = eleName
def setOutputElement(self,
seqName )
#.......
self.seqName [0] = seqName [0] # "FirstName"
self.seqName [1] = seqName [1] # "LastName"
def apply(self):
# split first name and last name
self.seqData[0] = first part of name
self.seqData[0] = last part of name
This will change the XML
schema from above to :
<xsd:schema xmlns:xsd="http://www.w3.org/2000/08/XMLSchema"></xsd:schema>
<xsd:annotation>
<xsd:documentation>
Relation Algebra to XML schema Translation example.
Copyright 2000 Ajitesh Das.
</xsd:documentation>
</xsd:annotation><xsd:element name="Employee" type="EmployeeType"/>
<xsd:complexType name="EmployeeType">
<xsd:sequence>
<xsd:element name="FirstName" type="xsd:string"/>
<xsd:element name="LastName" type="xsd:string"/>
<xsd:element name="age" type="xsd:integer"/>
<xsd:element ref="address" default="null" type= "xsd:string"/>
</xsd:sequence>
</xsd:complextype>
- Register custom OutputTranscoder schema
- Instanciate (Singleton ) OutputTranscoder obj
For eg : xml schema notation to a relation algebra
- Provide mapping rules : XML Schema (Internal format) -> Input Schema
The above schema : translate :
EMP = Employee(FirstName, LastName, age, address ) relational table
- Provide persistant registration of custom schema
- Provides utility configuration
- Read Data
- Lookup for InputTranscoder
- Translate Schema -> XML
- Apply Rule set
- Translate XML -> Schema (output)