DatabaseRecordReader.xml

From DISMARC Help

Jump to: navigation, search

XMLs that follow the schema below, are used for DatabaseRecordReaders. These config files will create a hierarchical XML.


Sample

Here is a little sample configuration

  <?xml version="1.0" encoding="UTF-8"?>
  <MdmDatabaseRecordReaderConfig>
     <dsn>mysql:host=localhost;dbname=jazz;</dsn>
     <username></username>
     <password></password>
     <limitfrom>0</limitfrom>
     <limitsize>0</limitsize>
     <Table name="Skivor">
        <TableConstrain field="deleted" op="=" value="0"/>
        <Table name="Titlar">
           <TableJoin from="SkivId" to="SkivId" />
           <Ignore>SkivId</Ignore>
           <Ignore>NamnId</Ignore>
           <Table name="latar">
              <TableJoin from="NamnId" to="NamnId" />
           </Table>
        </Table>
     </Table>
  </MdmDatabaseRecordReaderConfig>

This is the connection information.

dsn
This is the DataSourceName for the connection. Format: mysql:host=<hostname>[:<port>];dbname=<database>
username
Username to use when connecting to the dsn
password
Password to use when connecting to the dsn
limitfrom - limitsize
Limits the result



Schema

This is the XSD for the config files

  <?xml version="1.0" encoding="UTF-8"?>
  <xsd:schema targetNamespace="http://www.ait.co.at/mdm/recordreader/databaserecordreader" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:mdm="http://www.ait.co.at/mdm/recordreader/databaserecordreader">
      <xsd:element name="MdmDatabaseRecordReaderConfig" type="mdm:MdmDatabaseRecordReaderConfigComplexType">
      </xsd:element>
      <xsd:complexType name="MdmDatabaseRecordReaderConfigComplexType">
      	<xsd:sequence>
      		<xsd:element ref="mdm:dsn" minOccurs="1" maxOccurs="1"></xsd:element>
      		<xsd:element ref="mdm:username" minOccurs="1"
      			maxOccurs="1">
      		</xsd:element>
      		<xsd:element ref="mdm:password" minOccurs="1"
      			maxOccurs="1">
      		</xsd:element>
      		<xsd:element ref="mdm:limitfrom" minOccurs="1"
      			maxOccurs="1">
      		</xsd:element>
      		<xsd:element ref="mdm:limitsize" minOccurs="1"
      			maxOccurs="1">
      		</xsd:element>
      		<xsd:element ref="mdm:CharacterSetClient" maxOccurs="1" minOccurs="0"></xsd:element>
      		<xsd:element ref="mdm:CharacterSetResult" maxOccurs="1" minOccurs="0"></xsd:element>
      		<xsd:element ref="mdm:CharacterSetConnection" maxOccurs="1" minOccurs="0"></xsd:element>
              <xsd:element ref="mdm:Table" maxOccurs="1" minOccurs="0"></xsd:element>
          </xsd:sequence>
      </xsd:complexType>
      <xsd:element name="dsn" type="xsd:string"></xsd:element>
      <xsd:element name="username" type="xsd:string"></xsd:element>
      <xsd:element name="password" type="xsd:string"></xsd:element>
      <xsd:element name="limitfrom" type="xsd:string"></xsd:element>
      <xsd:element name="limitsize" type="xsd:string"></xsd:element>
  
  
      <xsd:element name="Table" type="mdm:TableType"></xsd:element>
      
  
      <xsd:complexType name="TableType">
      	<xsd:sequence>
      		<xsd:element name="TableJoin" maxOccurs="unbounded"
      			minOccurs="0">
      			<xsd:complexType>
      				<xsd:attribute name="from" type="xsd:string"
      					use="required">
      				</xsd:attribute>
      				<xsd:attribute name="to" type="xsd:string"
      					use="required">
      				</xsd:attribute>
      			</xsd:complexType>
      		</xsd:element>
      		<xsd:element name="TableConstrain">
      			<xsd:complexType>
      				<xsd:attribute name="field" type="xsd:string" use="required">
      				</xsd:attribute>
      				<xsd:attribute name="value" type="xsd:string" use="required">
      				</xsd:attribute>
      				<xsd:attribute name="op" use="required">
      					<xsd:simpleType>
      						<xsd:restriction base="xsd:string">
      							<xsd:enumeration value="<"></xsd:enumeration>
      							<xsd:enumeration value=">"></xsd:enumeration>
      							<xsd:enumeration value="="></xsd:enumeration>
      							<xsd:enumeration value="!="></xsd:enumeration>
      						</xsd:restriction>
      					</xsd:simpleType>
      				</xsd:attribute>
      			</xsd:complexType>
      		</xsd:element>
      		<xsd:element name="Ignore" type="xsd:string"
      			maxOccurs="unbounded" minOccurs="0">
      		</xsd:element>
      		<xsd:element ref="mdm:Table" maxOccurs="unbounded"
      			minOccurs="0">
      		</xsd:element>
      	</xsd:sequence>
      	<xsd:attribute name="name" type="xsd:string" use="required"></xsd:attribute>
      	<xsd:attribute name="identifier" type="xsd:string" use="optional"></xsd:attribute>
      </xsd:complexType>
  
      <xsd:element name="CharacterSetClient" type="xsd:string"></xsd:element>
  
      <xsd:element name="CharacterSetResult" type="xsd:string"></xsd:element>
  
      <xsd:element name="CharacterSetConnection" type="xsd:string"></xsd:element>
  </xsd:schema>
Personal tools