Click here to Skip to main content
15,886,805 members
Articles / Programming Languages / XML

Validating data with Flat File Checker

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
30 Oct 2009GPL32 min read 43.7K   881   17  
An article on data validation with a flat file schema generated in Flat File Checker.
��<?xml version="1.0" encoding="utf-16"?>

<xsd:schema attributeFormDefault="unqualified" elementFormDefault="qualified" version="1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">

  <xsd:element name="Files" type="FilesType" />

  <xsd:complexType name="FilesType">

    <xsd:sequence>

      <xsd:element name="Connection" type="ConnectionType" />

      <xsd:element name="Template" type="TemplateType" />

      <xsd:element name="File" type="FileType" />

    </xsd:sequence>

    <xsd:attribute name="ErrorLog" type="xsd:string" />

    <xsd:attribute name="ExecutionLog" type="xsd:string" />

  </xsd:complexType>

  <xsd:complexType name="FileType">

    <xsd:sequence>

      <xsd:element name="Columns" type="ColumnsType" />

    </xsd:sequence>

    <xsd:attribute name="Alias" type="xsd:string" />

    <xsd:attribute name="Name" type="xsd:string" />

    <xsd:attribute name="SaveTo" type="xsd:string" />

    <xsd:attribute name="HasHeader" type="xsd:boolean" />

    <xsd:attribute name="StringQualifier" type="xsd:string" />

    <xsd:attribute name="Delimiter" type="xsd:string" />

  </xsd:complexType>

  <xsd:complexType name="ColumnsType">

    <xsd:sequence>

      <xsd:element maxOccurs="unbounded" name="Column" type="ColumnType" />

    </xsd:sequence>

  </xsd:complexType>

  <xsd:complexType name="ColumnType">

    <xsd:sequence>

      <xsd:element name="Unique" type="UniqueType" />

      <xsd:element name="Value" type="ValueType" />

      <xsd:element maxOccurs="unbounded" name="Query" type="QueryType" />

      <xsd:element name="And" type="AndType" />

      <xsd:element name="Not" type="NotType" />

    </xsd:sequence>

    <xsd:attribute name="Name" type="xsd:string" />

  </xsd:complexType>

  <xsd:complexType name="NotType">

    <xsd:sequence>

      <xsd:element name="Query" type="QueryType" />

    </xsd:sequence>

  </xsd:complexType>

  <xsd:complexType name="QueryType">

    <xsd:sequence>

      <xsd:element name="Suppression" type="xsd:string" />

      <xsd:any />

    </xsd:sequence>

    <xsd:attribute name="Connection" type="xsd:string" />

    <xsd:attribute name="Exists" type="xsd:boolean" />

    <xsd:attribute name="Template" type="xsd:string" />

  </xsd:complexType>

  <xsd:complexType name="AndType">

    <xsd:sequence>

      <xsd:any maxOccurs="unbounded" />

    </xsd:sequence>

  </xsd:complexType>

  <xsd:complexType name="ParameterType">

    <xsd:attribute name="Name" type="xsd:string" />

    <xsd:attribute name="Value" type="xsd:string" />

    <xsd:attribute name="Condition" type="xsd:string" />

  </xsd:complexType>

  <xsd:complexType name="ValueType">

    <xsd:attribute name="Condition" type="xsd:string" />

    <xsd:attribute name="Value" type="xsd:string" />

  </xsd:complexType>

  <xsd:complexType name="UniqueType">

    <xsd:sequence>

      <xsd:element maxOccurs="unbounded" name="Column" type="ColumnType" />

      <xsd:element name="Action" type="ActionType" />

    </xsd:sequence>

  </xsd:complexType>

  <xsd:complexType name="ActionType">

    <xsd:sequence>

      <xsd:element name="Merge" type="MergeType" />

    </xsd:sequence>

  </xsd:complexType>

  <xsd:complexType name="MergeType">

    <xsd:sequence>

      <xsd:element name="Concatenate" type="ConcatenateType" />

      <xsd:element name="Sum" type="SumType" />

    </xsd:sequence>

  </xsd:complexType>

  <xsd:complexType name="SumType">

    <xsd:sequence>

      <xsd:element name="SourceColumn" type="SourceColumnType" />

    </xsd:sequence>

    <xsd:attribute name="Column" type="xsd:string" />

  </xsd:complexType>

  <xsd:complexType name="SourceColumnType">

    <xsd:attribute name="Name" type="xsd:string" />

  </xsd:complexType>

  <xsd:complexType name="ConcatenateType">

    <xsd:sequence>

      <xsd:element name="StartWith" type="xsd:string" />

      <xsd:element name="Column" type="ColumnType" />

      <xsd:element name="JoinWith" type="xsd:string" />

      <xsd:element name="EndWith" type="EndWithType" />

    </xsd:sequence>

    <xsd:attribute name="Column" type="xsd:string" />

  </xsd:complexType>

  <xsd:complexType name="EndWithType">

    <xsd:sequence>

      <xsd:element name="Column" type="ColumnType" />

    </xsd:sequence>

  </xsd:complexType>

  <xsd:complexType name="TemplateType">

    <xsd:attribute name="Name" type="xsd:string" />

    <xsd:attribute name="Path" type="xsd:string" />

  </xsd:complexType>

  <xsd:complexType name="ConnectionType">

    <xsd:attribute name="Name" type="xsd:string" />

    <xsd:attribute name="ConnectionString" type="xsd:string" />

  </xsd:complexType>

</xsd:schema>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The GNU General Public License (GPLv3)


Written By
Database Developer
United Kingdom United Kingdom
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions