Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with XSD file

Status
Not open for further replies.

MokMike

Programmer
Apr 16, 2009
5
Hello

I am trying to do the following:

I have an app that currently reads in files in either delimited text files or excel files. I want to include xml documents as allowable file types. Currently, each file is accomponied by a format file, that has three data descriptors for each column in the data set, as follows:

A validation type -
This is partially tied to the data type EG int, string, boolean, but also has values such as integerwithrelatedbooleanfield or integerwithrelatedintegerfield

those two types indicates to the validation object that not only must the data pass a standard cint test, but that there must be valid data in another field of that record for this field to be valid as well. An example is a pair of fields:

dataid which is an intwithrelatedboolean
isdatacertaintype which would be a booleanwithrelatedinteger

how can i code that as a complex type in my xsd AND include the column number that is related?

The other two descriptors I believe are fairly simple, the second being the column number of the related field, and whether this field can bypass validation.

 
I have just made a basic XSD, and read through some of the tutorial at w3schools, plus some of the posts here. I tried attaching my xds, xml, and xslt but I could not, I will paste them here instead.

<?xml version="1.0" encoding="utf-8"?>
<steps>
<step>
<stepid>732</stepid>
<screentypeid>2</screentypeid>
<stepforyesid>14</stepforyesid>
<stepfornoid>27</stepfornoid>
<stepformaybeid>0</stepformaybeid>
<question>"Who made who"</question>
<explanation>"Who made you?"</explanation>
<subheadingid>1</subheadingid>
<evalglobal>"nVG_11 = doody"</evalglobal>
<decisionstep>"false"</decisionstep>
<decisionid></decisionid>
<displayglobal>"nStatus = Active"</displayglobal>
<transfergroupId>6</transfergroupId>
<TransferGroupExplanation>"Where are you going"</TransferGroupExplanation>
<OperatorInstruction></OperatorInstruction>
</step>

</steps>

<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="step" targetNamespace=" elementFormDefault="qualified" xmlns=" xmlns:mstns=" xmlns:xs=" <xs:element name="steps">
<xs:complexType>
<xs:sequence>
<xs:element name="step" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="stepid" type="xs:int" />
<xs:element name="screentypeid" type="xs:int" />
<xs:element name="stepforyesid" type="xs:int" />
<xs:element name="stepfornoid" type="xs:int" />
<xs:element name="stepformaybeid" type="xs:int" />
<xs:element name="question" type="xs:string" />
<xs:element name="explanation" type="xs:string" />
<xs:element name="subheadingid" type="xs:int" />
<xs:element name="evalglobal" type="xs:string" />
<xs:element name="decisionstep" type="xs:Boolean" />
<xs:element name="decisionid" type="xs:int" />
<xs:element name="displayglobal" type="xs:int" />
<xs:element name="transfergroupId" type="xs:int" />
<xs:element name="TransferGroupExplanation" type="xs:string" />
<xs:element name="OperatorInstruction" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>


<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl=" <xsl:template match="/">
<html>
<body>
<table width="50%" cellspacing="0" cellpadding="0" style="font-family:verdana;font-size:X-Small" border="1">
<tr bgcolor="#336699">
<th align="right">
<font color="White">stepid</font>
</th>
<th align="right">
<font color="White">screentypeid</font>
</th>
<th align="right">
<font color="White">stepforyesid</font>
</th>
<th align="right">
<font color="White">stepfornoid</font>
</th>
<th align="right">
<font color="White">stepformaybeid</font>
</th>
<th align="left">
<font color="White">question</font>
</th>
<th align="left">
<font color="White">explanation</font>
</th>
<th align="right">
<font color="White">subheadingid</font>
</th>
<th align="left">
<font color="White">evalglobal</font>
</th>
<th align="left">
<font color="White">decisionstep</font>
</th>
<th align="right">
<font color="White">decisionid</font>
</th>
<th align="right">
<font color="White">displayglobal</font>
</th>
<th align="right">
<font color="White">transfergroupid</font>
</th>
<th align="left">
<font color="White">TransferGroupExplanation</font>
</th>
<th align="left">
<font color="White">OperatorInstruction</font>
</th>
</tr>
<tr>
<td align="right">
<xsl:value-of select="steps/step/stepid" />
</td>
<td align="right">
<xsl:value-of select="steps/step/screentypeid" />
</td>
<td align="right">
<xsl:value-of select="steps/step/stepforyesid" />
</td>
<td align="right">
<xsl:value-of select="steps/step/stepfornoid" />
</td>
<td align="right">
<xsl:value-of select="steps/step/stepformaybeid" />
</td>
<td align="left">
<xsl:value-of select="steps/step/question" />
</td>
<td align="left">
<xsl:value-of select="steps/step/explanation" />
</td>
<td align="right">
<xsl:value-of select="steps/step/subheadingid" />
</td>
<td align="left">
<xsl:value-of select="steps/step/evalglobal" />
</td>
<td align="left">
<xsl:value-of select="steps/step/decisionstep" />
</td>
<td align="right">
<xsl:value-of select="steps/step/decisionid" />
</td>
<td align="right">
<xsl:value-of select="steps/step/displayglobal" />
</td>
<td align="right">
<xsl:value-of select="steps/step/transfergroupid" />
</td>
<td align="left">
<xsl:value-of select="steps/step/TransferGroupExplanation" />
</td>
<td align="left">
<xsl:value-of select="steps/step/OperatorInstruction" />
</td>
</tr>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
 
Ok, I am hoping to here some guidance back, I think this will allow me to communicate to my validator on a field level whether all values in this column can bypass validation or not.

<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="step" targetNamespace=" elementFormDefault="qualified" xmlns=" xmlns:mstns=" xmlns:xs=" <xs:element name="steps">
<xs:complexType>
<xs:sequence>
<xs:element name="step" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="stepid" type="xs:int" />
<xs:documentation>This step id will serve as the unique key</xs:documentation>
<xs:complexType>
<xs:sequence>
<xs:element name="bypassvalidation" type="xs:Boolean" value="False" />
</xs:sequence>
</xs:complexType>
<xs:element name="screentypeid" type="xs:int" />
<xs:complexType>
<xs:sequence>
<xs:element name="bypassvalidation" type="xs:Boolean" value="False" />
</xs:sequence>
</xs:complexType>
<xs:element name="stepforyesid" type="xs:int" />
<xs:complexType>
<xs:sequence>
<xs:element name="bypassvalidation" type="xs:Boolean" value="False" />
</xs:sequence>
</xs:complexType>
<xs:element name="stepfornoid" type="xs:int" />
<xs:complexType>
<xs:sequence>
<xs:element name="bypassvalidation" type="xs:Boolean" value="False" />
</xs:sequence>
</xs:complexType>
<xs:element name="stepformaybeid" type="xs:int" />
<xs:complexType>
<xs:sequence>
<xs:element name="bypassvalidation" type="xs:Boolean" value="False" />
</xs:sequence>
</xs:complexType>
<xs:element name="question" type="xs:string" />
<xs:complexType>
<xs:sequence>
<xs:element name="bypassvalidation" type="xs:Boolean" value="False" />
</xs:sequence>
</xs:complexType>
<xs:element name="explanation" type="xs:string" />
<xs:complexType>
<xs:sequence>
<xs:element name="bypassvalidation" type="xs:Boolean" value="True" />
</xs:sequence>
</xs:complexType>
<xs:element name="subheadingid" type="xs:int" />
<xs:complexType>
<xs:sequence>
<xs:element name="bypassvalidation" type="xs:Boolean" value="True" />
</xs:sequence>
</xs:complexType>
<xs:element name="evalglobal" type="xs:string" />
<xs:complexType>
<xs:sequence>
<xs:element name="bypassvalidation" type="xs:Boolean" value="True" />
</xs:sequence>
</xs:complexType>
<xs:element name="decisionstep" type="xs:Boolean" />
<xs:complexType>
<xs:sequence>
<xs:element name="bypassvalidation" type="xs:Boolean" value="False" />
</xs:sequence>
</xs:complexType>
<xs:element name="decisionid" type="xs:int" />
<xs:complexType>
<xs:sequence>
<xs:element name="bypassvalidation" type="xs:Boolean" value="False" />
</xs:sequence>
</xs:complexType>
<xs:element name="displayglobal" type="xs:int" />
<xs:complexType>
<xs:sequence>
<xs:element name="bypassvalidation" type="xs:Boolean" value="False" />
</xs:sequence>
</xs:complexType>
<xs:element name="transfergroupId" type="xs:int" />
<xs:complexType>
<xs:sequence>
<xs:element name="bypassvalidation" type="xs:Boolean" value="True" />
</xs:sequence>
</xs:complexType>
<xs:element name="TransferGroupExplanation" type="xs:string" />
<xs:complexType>
<xs:sequence>
<xs:element name="bypassvalidation" type="xs:Boolean" value="True" />
</xs:sequence>
</xs:complexType>
<xs:element name="OperatorInstruction" type="xs:string" />
<xs:complexType>
<xs:sequence>
<xs:element name="bypassvalidation" type="xs:Boolean" value="True"/>
</xs:sequence>
</xs:complexType>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
 
Ok, having read more I think I need something more like this:

<xs:element name="question" />
<xs:complexType>
<xs:sequence>
<xs:element name="question" type="xs:string" />
<xs:element name="relatedcolumn" type="xs:integer" value="0" />
<xs:element name="bypassvalidation" type="xs:Boolean" value="False" />
</xs:sequence>
</xs:complexType>
<xs:element name="explanation" />
<xs:complexType>
<xs:sequence>
<xs:element name="explanation" type="xs:string" />
<xs:element name="relatedcolumn" type="xs:integer" value="0" />
<xs:element name="bypassvalidation" type="xs:Boolean" value="True" />
</xs:sequence>
</xs:complexType>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top