#!/bin/sh

## Location of the testsuite's files for Schemas
## You can download these from
##   http://www.w3.org/XML/2001/05/xmlschema-test-collection

## IMPORTANT: BUG FIXES TO THE TESTSUITE:
## msxsdtest/element/elemT074.xml
##   - needs to be modified to point to right schema (not elemT074.xml)
##   - suntest/SunTestsAll/xsd003b.xsd: replace use of xsd:number with
##     xsd:decimal, since the former doesn't exist in the standard

## All Sun tests are included in this testsuite
## All NIST tests are included in this testsuite
## Some Microsoft tests are missing in this testsuite

xmltests=./xmltests

## Name of the driver.
# testschema=${TESTSCHEMA:=./testdomschema -silent}
testschema=${TESTSCHEMA:-./testschema}

debug=""
verbose=0
show_expected_failure=0

run_all_tests=1
run_ms_element=0
run_ms_particle=0
run_sun=0
run_act=0
nist_tests=('anyURI' 'boolean' 'byte' 'dateTime' 'date'
            'decimal' 'double' 'duration' 'float' 'gDay'
            'gMonthDay' 'gMonth' 'gYear' 'gYearMonth' 'hexBinary' 'ID'
            'integer' 'int' 'language' 'long' 'Name' 'NCName'
            'negativeInteger' 'NMTOKEN' 'nonNegativeInteger'
            'nonPositiveInteger' 'normalizedString' 'positiveInteger'
            'QName' 'short' 'string' 'time' 'token' 'unsignedByte'
            'unsignedInt' 'unsignedLong' 'unsignedShort' 'base64Binary');

while getopts "vhdseuan:m:N" opt
do 
   case $opt in
      d) debug="-debug";;
      v) verbose=1;;
      s) show_expected_failure=1;;
      u) run_sun=1; run_all_tests=0;;
      n) nist_tests=( "$OPTARG" );  run_all_tests=0;;
      N) nist_tests=();;
      m) case $OPTARG in
           e) run_ms_element=1; run_all_tests=0;;
           p) run_ms_particle=1; run_all_tests=0;;
         esac;;
      a) run_act=1; run_all_tests=0; nist_tests=();;
      h) cat <<EOF
 -d   : debug mode ON
 -v   : verbose mode ON: list the tests are they are passed
 -s   : show output for expected failures
 -a   : run only ACT tests
 -u   : run only SUN tests
 -m e : run only Microsoft elements tests
 -m p : run only Microsoft particles tests
 -n ... : run only NIST tests (param is "boolean", "float", ...)
 -N     : do not run NIST tests
EOF
         exit 1;;
      *) echo "Invalid command line switch: $opt"
         exit 1
         ;;
   esac
done


XML="$testschema $debug"
ms=$xmltests/msxsdtest
sun=$xmltests/suntest/SunTestsAll
nist=$xmltests/nisttest/NISTTestsAll
act="act_testsuite"

msi=$ms/identityConstraint/idc_datatypes
mse=$ms/element
msp=$ms/Particles


total=0
failed=0
expected_fail=0
passed=0
not_run=0

#######################################
## summary ()
#######################################

summary() {
  echo "Total:$total  Passed:$passed  Failed:$failed  Expected_Fail:$expected_fail  Notrun:$not_run"
}

#######################################
## expect()
##   $1=schema file (can be empty)
##   $2=test file (can be empty)
##   $3=expected output
#######################################

expect() {
   xsd_file="$1"
   xml_file="$2"
   expected="$3"

   xsd=""
   if [ x"$xsd_file" != x ]; then
     xsd="-xsd $xsd_file"
   fi

   out=`eval $XML $xsd $xml_file 2>&1`
   total=`expr $total + 1`

   if [ x"$out" != x"$expected" ]; then
      quoted=`echo $out | sed -e 's/\"/\\\"/g' \
                              -e 's,'$mse',\$mse,' \
                              -e 's,'$msp',\$msp,' \
                              -e 's,'$sun',\$sun,'`
      echo "#------------ Test failed ------------"
      echo "  cmd: $XML $xsd $xml_file"
      echo "  quoted= $quoted"
      echo "  expected= $expected"
      failed=`expr $failed + 1`
   else
      passed=`expr $passed + 1`
      if [ x$verbose = x1 ]; then
         echo "#+++++ Test passed +++++"
         echo "  cmd: $XML $xsd $xml_file"
      fi
   fi
}

##################
## not_run()
##  $1=testname
##  $2=why
##################

notrun() {
  not_run=`expr $not_run + 1`
}

##################
## expected_failured()
##   $1=testname
##   $2=why
##################

expected_failure() {
  expected_fail=`expr $expected_fail + 1`
  total=`expr $total + 1`
  if [ x$show_expected_failure = x1 ]; then
     echo "$1: $2"
  fi
}

##################
## Error messages
##################

schema_ns="http://www.w3.org/2001/XMLSchema"
xsdtesting_ns="http://xsdtesting"
importedxsd_ns="http://importedXSD"

to_qname () {
 ns="$1"
 local="$2"
 if [ x"$ns" = x ]; then
   qname="$local"
 else
   qname="{$ns}$local"
 fi
}

type_not_declared () {
 file="$1"
 to_qname "$2" "$3"
 echo "$file: Type \"$qname\" was referenced but never declared"
}

elem_not_declared () {
 file="$1"
 to_qname "$2" "$3"
 echo "$file: Element \"$qname\" was referenced but never declared"
}

elem_unexpected () {
 file="$1"
 to_qname "$2" "$3"
 echo "$file: Unexpected element \"$qname\""
}

##################
## Microsoft elements tests -- A serie  (name attribute tests)
##################

if [ x$run_ms_element = x1     -o $run_all_tests = 1 ]; then
expect $mse/elemA001.xsd ""\
 "$mse/elemA001.xsd:3:16: Attribute \"name\" is required in this context"
expect $mse/elemA002.xsd "" ""
expect $mse/elemA003.xsd "" ""
expect $mse/elemA004.xsd "" ""
expect $mse/elemA005.xsd "" ""
expect $mse/elemA006.xsd "" \
 "$mse/elemA006.xsd:4:27: Element \"foo\" has already been declared"
expect $mse/elemA007.xsd "" ""
expect $mse/elemA009.xsd "" \
 "$mse/elemA009.xsd:3:31: Attribute \"name\": Invalid value: \"foo:bar\""
expect $mse/elemA010.xsd "" \
 "$mse/elemA010.xsd:3:28: Attribute \"name\": Invalid value: \":bar\""
expect $mse/elemA011.xsd "" \
 "$mse/elemA011.xsd:3:28: Attribute \"name\": Invalid value: \"foo:\""
expect $mse/elemA012.xsd "" \
 "$mse/elemA012.xsd:3:24: Attribute \"name\": Invalid value: \"\""
expect $mse/elemA013.xsd "" \
 "$mse/elemA013.xsd:3:25: Attribute \"name\": Invalid value: \"\""
expect $mse/elemA014.xsd "" \
 "$mse/elemA014.xsd:3:31: Attribute \"name\": Invalid value: \"-2.5foo\""
expect $mse/elemA015.xsd "" ""
expect $mse/elemA016.xsd "" ""
expect $mse/elemA017.xsd "" ""
fi

##################
## Microsoft elements tests -- B serie  (boolean tests)
##################

if [ x$run_ms_element = x1     -o $run_all_tests = 1 ]; then
expect $mse/elemB001.xsd "" ""
expect $mse/elemB002.xsd "" ""
expect $mse/elemB003.xsd "" \
 "$mse/elemB003.xsd:3:49: Attribute \"abstract\": Invalid value for boolean type: \"false true\""
expect $mse/elemB004.xsd "" \
 "$mse/elemB004.xsd:3:44: Attribute \"abstract\": Invalid value for boolean type: \"False\""
expect $mse/elemB005.xsd "" \
 "$mse/elemB005.xsd:3:39: Attribute \"abstract\": Invalid value for boolean type: \"\""
expect $mse/elemB006.xsd "" \
 "$mse/elemB006.xsd:3:46: Attribute \"abstract\": Invalid value for boolean type: \"boolean\""
expect $mse/elemB007.xsd "" ""
expect $mse/elemB008.xsd "" ""
expect $mse/elemB009.xsd "" \
 "$mse/elemB009.xsd:3:47: Attribute \"abstract\": Invalid value for boolean type: \"abstract\""
expect $mse/elemB010.xsd "" \
 "$mse/elemB010.xsd:3:49: Attribute \"abstract\": Invalid value for boolean type: \"true false\""
fi

##################
## Microsoft elements tests -- C serie  (block attribute + list type)
##################

if [ x$run_ms_element = x1     -o $run_all_tests = 1 ]; then
expect $mse/elemC001.xsd "" ""
expect $mse/elemC002.xsd "" ""
expect $mse/elemC003.xsd "" ""
expect $mse/elemC004.xsd "" ""
expect $mse/elemC005.xsd "" ""
expect $mse/elemC006.xsd "" ""
expect $mse/elemC007.xsd "" ""
expect $mse/elemC008.xsd "" ""
expect $mse/elemC009.xsd "" \
 "$mse/elemC009.xsd:3:39: Attribute \"block\": Invalid value \"foo\""
expect $mse/elemC010.xsd "" \
 "$mse/elemC010.xsd:3:40: Attribute \"block\": Invalid value \"#All\""
expect $mse/elemC011.xsd "" \
 "$mse/elemC011.xsd:3:45: Attribute \"block\": Invalid value \"Extension\""
expect $mse/elemC012.xsd "" \
 "$mse/elemC012.xsd:3:47: Attribute \"block\": Invalid value \"Restriction\""
expect $mse/elemC013.xsd "" \
 "$mse/elemC013.xsd:3:48: Attribute \"block\": Invalid value \"Substitution\""
expect $mse/elemC014.xsd "" \
 "$mse/elemC014.xsd:3:75: Attribute \"block\": Invalid value \"#all extension restriction substitution\""
expect $mse/elemC015.xsd "" \
 "$mse/elemC015.xsd:3:49: Attribute \"block\": Invalid value \"extension foo\""
expect $mse/elemC016.xsd "" \
 "$mse/elemC016.xsd:3:51: Attribute \"block\": Invalid value \"restriction foo\""
expect $mse/elemC017.xsd "" \
 "$mse/elemC017.xsd:3:52: Attribute \"block\": Invalid value \"substitution foo\""
expect $mse/elemC018.xsd "" ""
expect $mse/elemC020.xsd "" ""
fi

##################
## Microsoft elements tests -- D serie (default)
##################

if [ x$run_ms_element = x1     -o $run_all_tests = 1 ]; then
expect $mse/elemD001.xsd "" ""
expect $mse/elemD002.xsd "" ""
expect $mse/elemD003.xsd "" \
 "$mse/elemD003.xsd:3:72: Attributes \"fixed\" and \"default\" conflict with each other"
expect $mse/elemD004.xsd "" \
 "$mse/elemD004.xsd:9:56: No character data allowed by content model"
expect $mse/elemD005.xsd "" \
 "$mse/elemD005.xsd:3:58: Invalid year in \"foo\""
expect $mse/elemD006.xsd "" ""
fi

##################
## Microsoft elements tests -- E serie
##################

if [ x$run_ms_element = x1     -o $run_all_tests = 1 ]; then
expect $mse/elemE001.xsd "" ""
expect $mse/elemE002.xsd "" ""
expect $mse/elemE003.xsd "" ""
expect $mse/elemE004.xsd "" ""
expect $mse/elemE005.xsd "" ""
expect $mse/elemE006.xsd "" \
 "$mse/elemE006.xsd:3:62: Attribute \"name\": Invalid value: \"-foo\""
expect $mse/elemE007.xsd "" \
 "$mse/elemE007.xsd:4:50: Attribute \"substitutionGroup\": Invalid value: \"\""
expect $mse/elemE008.xsd "" \
   "`elem_not_declared "$mse/elemE008.xsd:11" "" foo`"
expect $mse/elemE009.xsd "" \
   "`elem_not_declared "$mse/elemE009.xsd:16" "" foo`"
fi

##################
## Microsoft elements tests -- F serie (final)
##################

if [ x$run_ms_element = x1     -o $run_all_tests = 1 ]; then
expect $mse/elemF001.xsd "" ""
expect $mse/elemF002.xsd "" ""
expect $mse/elemF003.xsd "" ""
expect $mse/elemF004.xsd "" \
 "$mse/elemF004.xsd:3:48: Attribute \"final\": Invalid value \"substitution\""
expect $mse/elemF005.xsd "" ""
expect $mse/elemF006.xsd "" \
 "$mse/elemF006.xsd:3:60: Attribute \"final\": Invalid value \"restriction substitution\""
expect $mse/elemF007.xsd "" \
 "$mse/elemF007.xsd:3:58: Attribute \"final\": Invalid value \"substitution extension\""
expect $mse/elemF008.xsd "" \
 "$mse/elemF008.xsd:3:70: Attribute \"final\": Invalid value \"extension restriction substitution\""
expect $mse/elemF009.xsd "" \
 "$mse/elemF009.xsd:3:39: Attribute \"final\": Invalid value \"foo\""
expect $mse/elemF010.xsd "" \
 "$mse/elemF010.xsd:3:40: Attribute \"final\": Invalid value \"#All\""
expect $mse/elemF011.xsd "" \
 "$mse/elemF011.xsd:3:45: Attribute \"final\": Invalid value \"Extension\""
expect $mse/elemF012.xsd "" \
 "$mse/elemF012.xsd:3:47: Attribute \"final\": Invalid value \"Restriction\""
expect $mse/elemF013.xsd "" \
 "$mse/elemF013.xsd:3:48: Attribute \"final\": Invalid value \"Substitution\""
expect $mse/elemF014.xsd "" \
 "$mse/elemF014.xsd:3:75: Attribute \"final\": Invalid value \"#all extension restriction substitution\""
expect $mse/elemF015.xsd "" \
 "$mse/elemF015.xsd:3:49: Attribute \"final\": Invalid value \"extension foo\""
expect $mse/elemF016.xsd "" \
 "$mse/elemF016.xsd:3:51: Attribute \"final\": Invalid value \"restriction foo\""
expect $mse/elemF017.xsd "" \
 "$mse/elemF017.xsd:3:52: Attribute \"final\": Invalid value \"substitution foo\""
expect $mse/elemF018.xsd "" ""
fi

##################
## Microsoft elements tests -- G serie
##################

if [ x$run_ms_element = x1     -o $run_all_tests = 1 ]; then
expect $mse/elemG001.xsd "" ""
expect $mse/elemG002.xsd "" ""
expect $mse/elemG003.xsd "" \
 "$mse/elemG003.xsd:8:21: No character data allowed by content model"
expect $mse/elemG004.xsd "" \
 "$mse/elemG004.xsd:8:21: No character data allowed by content model"
expect $mse/elemG005.xsd "" ""
fi

##################
## Microsoft elements tests -- H serie
##################

if [ x$run_ms_element = x1     -o $run_all_tests = 1 ]; then
expect $mse/elemH001.xsd "" ""
expect $mse/elemH002.xsd "" ""
expect $mse/elemH003.xsd "" \
 "$mse/elemH003.xsd:2:80: Attribute \"elementFormDefault\": Element's value not in the enumeration set"
expect $mse/elemH004.xsd "" \
 "$mse/elemH004.xsd:2:89: Attribute \"elementFormDefault\": Element's value not in the enumeration set"
expect $mse/elemH005.xsd "" \
 "$mse/elemH005.xsd:2:91: Attribute \"elementFormDefault\": Element's value not in the enumeration set"
expect $mse/elemH006.xsd "" \
 "$mse/elemH006.xsd:2:101: Attribute \"elementFormDefault\": Element's value not in the enumeration set"
fi

##################
## Microsoft elements tests -- I serie
##################

if [ x$run_ms_element = x1     -o $run_all_tests = 1 ]; then
expect $mse/elemI001.xsd "" ""
expect $mse/elemI002.xsd "" ""
expect $mse/elemI003.xsd "" \
 "$mse/elemI003.xsd:3:35: Attribute \"id\": Invalid value: \"25\""
expect $mse/elemI004.xsd "" \
 "$mse/elemI004.xsd:3:33: Attribute \"id\": Invalid value: \"\""
expect $mse/elemI005.xsd "" \
 "$mse/elemI005.xsd:4:39: ID \"foo25\" already defined"
fi

##################
## Microsoft elements tests -- J serie
##################

if [ x$run_ms_element = x1     -o $run_all_tests = 1 ]; then
notrun $mse/elemJ001.xsd "" "test incorrect, since minOccurs > maxOccurs. See description of changes J.8 in the standard"
expect $mse/elemJ002.xsd "" ""
expect $mse/elemJ003.xsd "" ""
expect $mse/elemJ004.xsd "" ""
expect $mse/elemJ005.xsd "" ""
expect $mse/elemJ006.xsd "" \
 "$mse/elemJ006.xsd:6:43: Attribute \"maxOccurs\": Invalid value \"\""
expect $mse/elemJ007.xsd "" \
 "$mse/elemJ007.xsd:6:45: Attribute \"maxOccurs\": Invalid value \"-1\""
expect $mse/elemJ008.xsd "" \
 "$mse/elemJ008.xsd:6:52: Attribute \"maxOccurs\": Invalid value \"Unbounded\""
expect $mse/elemJ009.xsd "" ""
expect $mse/elemJ010.xsd "" ""
expect $mse/elemJ011.xsd "" ""
expect $mse/elemJ012.xsd "" \
 "$mse/elemJ012.xsd:6:52: Attribute \"minOccurs\": Invalid integer: \"unbounded\""
expect $mse/elemJ013.xsd "" ""
expect $mse/elemJ014.xsd "" \
 "$mse/elemJ014.xsd:6:43: Attribute \"minOccurs\": Invalid: empty string used as a number"
expect $mse/elemJ015.xsd "" \
 "$mse/elemJ015.xsd:6:45: Attribute \"minOccurs\": -1 is smaller than minInclusive (0)"
expect $mse/elemJ016.xsd "" \
 "$mse/elemJ016.xsd:6:52: Attribute \"minOccurs\": Invalid integer: \"Unbounded\""
expect $mse/elemJ017.xsd "" ""
expect $mse/elemJ018.xsd "" ""
expect $mse/elemJ019.xsd "" \
 "$mse/elemJ019.xsd:6:58: minOccurs > maxOccurs when creating particle"
expect $mse/elemJ020.xsd "" \
 "$mse/elemJ020.xsd:6:74: Attribute \"minOccurs\": Invalid integer: \"unbounded\""
expect $mse/elemJ021.xsd "" ""
fi

##################
## Microsoft elements tests -- K serie
##################

if [ x$run_ms_element = x1     -o $run_all_tests = 1 ]; then
expect $mse/elemK001.xsd "" ""
expect $mse/elemK002.xsd "" ""
expect $mse/elemK003.xsd "" \
 "$mse/elemK003.xsd:3:39: Attribute \"nillable\": Invalid value for boolean type: \"\""
expect $mse/elemK004.xsd "" \
 "$mse/elemK004.xsd:3:43: Attribute \"nillable\": Invalid value for boolean type: \"True\""
expect $mse/elemK005.xsd "" \
 "$mse/elemK005.xsd:3:44: Attribute \"nillable\": Invalid value for boolean type: \"False\""
expect $mse/elemK006.xsd "" \
 "$mse/elemK006.xsd:3:49: Attribute \"nillable\": Invalid value for boolean type: \"true false\""
expect $mse/elemK007.xsd "" \
 "$mse/elemK007.xsd:3:43: Attribute \"nullable\": Attributes with no namespace invalid in this context"
fi

##################
## Microsoft elements tests -- L serie
##################

if [ x$run_ms_element = x1     -o $run_all_tests = 1 ]; then
expect $mse/elemL001.xsd "" ""
expect $mse/elemL002.xsd "" \
 "`elem_not_declared "$mse/elemL002.xsd:10" "" foo`"
expect $mse/elemL003.xsd "" \
 "$mse/elemL003.xsd:5:39: \"ref\" attribute cannot be self-referencing"
expect $mse/elemL004.xsd "" ""
notrun $mse/elemL005.xsd "Schema is empty"
fi

##################
## Microsoft elements tests -- M serie
##################

if [ x$run_ms_element = x1     -o $run_all_tests = 1 ]; then
expect $mse/elemM001.xsd "" ""
expect $mse/elemM002.xsd "" \
 "`type_not_declared "$mse/elemM002.xsd:6" "" foo`"
expect $mse/elemM003.xsd "" \
 "$mse/elemM003.xsd:5:31: Self-referencing restriction not allowed"
expect $mse/elemM004.xsd "" ""
expect $mse/elemM005.xsd "" \
 "$mse/elemM005.xsd:6:39: \"type\" attribute cannot be specified along with \"ref\""
fi

##################
## Microsoft elements tests -- N serie
##################

if [ x$run_ms_element = x1     -o $run_all_tests = 1 ]; then
expect $mse/elemN001.xsd "" ""
expect $mse/elemN002.xsd "" ""
expect $mse/elemN003.xsd "" ""
expect $mse/elemN004.xsd "" ""
expect $mse/elemN005.xsd "" ""
expect $mse/elemN006.xsd "" \
 "$mse/elemN006.xsd:3:58: Attribute \"foo\": Attributes with no namespace invalid in this context"
fi

##################
## Microsoft elements tests -- O serie
##################

if [ x$run_ms_element = x1     -o $run_all_tests = 1 ]; then
expect "" $mse/elemO001.xml \
 "$mse/elemO001.xml:4:11: \"parent\" is abstract"
expect "" $mse/elemO002.xml ""
expect "" $mse/elemO003.xml ""
expect "" $mse/elemO004.xml ""
expect "" $mse/elemO005.xml ""
expect "" $mse/elemO006.xml ""
expect "" $mse/elemO007.xml \
 "$mse/elemO007.xml:3:33: Element has character data, but is declared as nil"
expect "" $mse/elemO008.xml ""
expect "" $mse/elemO009.xml ""
expect "" $mse/elemO010.xml \
 "$mse/elemO010.xml:3:27: Attribute \"xsi:nil\" invalid for this element"
expect "" $mse/elemO011.xml \
 "$mse/elemO011.xml:3:27: Attribute \"xsi:nil\" invalid for this element"
expect "" $mse/elemO012.xml ""
fi

##################
## Microsoft elements tests -- P serie
##################

if [ x$run_ms_element = x1     -o $run_all_tests = 1 ]; then
expect $mse/elemP001.xsd "" \
 "$mse/elemP001.xsd:3:90: Attributes \"fixed\" and \"default\" conflict with each other"
expect $mse/elemP002.xsd "" \
 "$mse/elemP002.xsd:5:92: Attributes \"fixed\" and \"default\" conflict with each other"
expect $mse/elemP003.xsd "" ""
expect $mse/elemP004.xsd "" ""
expect $mse/elemP005.xsd "" \
 "$mse/elemP005.xsd:5:18: Either \"name\" or \"ref\" attribute must be present"
expect $mse/elemP006.xsd "" \
 "$mse/elemP006.xsd:6:45: \"ref\" attribute cannot be self-referencing"
expect $mse/elemP007.xsd "" \
 "$mse/elemP007.xsd:11:23: Cannot mix complexType definition and \"ref\" attribute"
expect $mse/elemP008.xsd "" \
 "$mse/elemP008.xsd:9:22: Cannot mix complexType definition and \"ref\" attribute"
expect $mse/elemP009.xsd "" \
 "$mse/elemP009.xsd:6:49: \"type\" attribute cannot be specified along with \"ref\""
fi

##################
## Microsoft elements tests -- Q serie
##################

if [ x$run_ms_element = x1     -o $run_all_tests = 1 ]; then
expect $mse/elemQ001.xsd "" ""
expect $mse/elemQ002.xsd "" ""
expect $mse/elemQ003.xsd "" ""
expect $mse/elemQ004.xsd "" \
 "`elem_unexpected $mse/elemQ004.xsd:7:19 $schema_ns annotation`"
expect $mse/elemQ005.xsd "" ""
expect $mse/elemQ006.xsd "" \
 "`elem_unexpected $mse/elemQ006.xsd:10:19 $schema_ns annotation`"
expect "" $mse/elemQ007.xml \
 "$mse/elemQ007.xml:3:8: Unexpected end of sequence, expecting \"fooTest\""
expect "" $mse/elemQ008.xml ""
expect "" $mse/elemQ009.xml \
 "`elem_unexpected $mse/elemQ009.xml:4:11 "" fooTest`"
expect "" $mse/elemQ010.xml \
 "$mse/elemQ010.xml:3:8: Unexpected end of sequence, expecting \"fooTest\""
expect "" $mse/elemQ011.xml ""
expect "" $mse/elemQ012.xml \
 "`elem_unexpected $mse/elemQ012.xml:4:11 "" fooTest`"
expect "" $mse/elemQ013.xml ""
expect "" $mse/elemQ014.xml \
 "`elem_unexpected $mse/elemQ014.xml:5:11 "" fooTest`"
expect "" $mse/elemQ015.xml ""
expect $mse/elemQ016.xsd "" ""
expect "" $mse/elemQ017.xml ""
expect "" $mse/elemQ018.xml \
 "$mse/elemQ018.xml:3:23: Element's value must be \"Hello\""
expect "" $mse/elemQ019.xml \
 "$mse/elemQ019.xml:3:21: Element's value must be \"Hello\""
expect "" $mse/elemQ020.xml ""
expect "" $mse/elemQ021.xml ""
expect "" $mse/elemQ022.xml ""
fi

##################
## Microsoft elements tests -- R serie
##################

if [ x$run_ms_element = x1     -o $run_all_tests = 1 ]; then
expect "" $mse/elemR001.xml ""
expect "" $mse/elemR002.xml ""
notrun $mse/elemR003.xsd "test seems wrong, all parsers fail"
expect "" $mse/elemR004.xml ""
expect "" $mse/elemR005.xml ""
notrun $mse/elemR006.xsd "test seems wrong, all parsers fail"
fi

##################
## Microsoft elements tests -- S serie (final)
##################

if [ x$run_ms_element = x1     -o $run_all_tests = 1 ]; then
expect $mse/elemS001.xsd "" \
 "$mse/elemS001.xsd:36:84: \"fr_invalid\" is final for restrictions, and cannot be substituted by\"fr1_invalid\""
expect "" $mse/elemS002.xml ""
expect "" $mse/elemS003.xml ""
expect $mse/elemS004.xsd "" \
 "$mse/elemS004.xsd:36:84: \"fe_invalid\" is final for extensions, and cannot be substituted by\"fe1_invalid\""
expect $mse/elemS005.xsd "" \
 "$mse/elemS005.xsd:36:80: \"fr_valid\" is final for restrictions, and cannot be substituted by\"fr1_valid\""
expect $mse/elemS006.xsd "" \
 "$mse/elemS006.xsd:36:84: \"fe_invalid\" is final for extensions, and cannot be substituted by\"fe1_invalid\""
expect "" $mse/elemS007.xml ""
expect "" $mse/elemS008.xml ""
fi

##################
## Microsoft elements tests -- T serie (block)
##################

if [ x$run_ms_element = x1     -o $run_all_tests = 1 ]; then
expect "" $mse/elemT001.xml \
 "$mse/elemT001.xml:3:29: Element \"fooTest\" blocks the use of restrictions of the type"
expect "" $mse/elemT002.xml ""
expect "" $mse/elemT003.xml ""
expect "" $mse/elemT004.xml \
 "$mse/elemT004.xml:3:29: Element \"fooTest\" blocks the use of extensions of the type"
expect "" $mse/elemT005.xml \
 "$mse/elemT005.xml:3:29: Element \"fooTest\" blocks the use of restrictions of the type"
expect "" $mse/elemT006.xml \
 "$mse/elemT006.xml:3:29: Element \"fooTest\" blocks the use of extensions of the type"
expect "" $mse/elemT007.xml ""
expect "" $mse/elemT008.xml ""
expect $mse/elemT009.xsd "" \
 "$mse/elemT009.xsd:10:59: Attribute \"block\": Invalid value \"list\""
expect $mse/elemT010.xsd "" \
 "$mse/elemT010.xsd:10:60: Attribute \"block\": Invalid value \"union\""
expect "" $mse/elemT011.xml \
 "$mse/elemT011.xml:2:29: Type is not a valid replacement for \"int\""
expect "" $mse/elemT012.xml \
 "$mse/elemT012.xml:2:30: Type is not a valid replacement for \"int\""
expect "" $mse/elemT013.xml \
 "$mse/elemT013.xml:2:30: Type is not a valid replacement for \"int\""
notrun $mse/elemT014.xml "Test seems invalid, all parsers fail"
notrun $mse/elemT015.xml "Test seems invalid, all parsers fail"
expect "" $mse/elemT016.xml ""
expect "" $mse/elemT017.xml \
 "$mse/elemT017.xml:3:21: Type is not a valid replacement for \"A\""
expect "" $mse/elemT018.xml \
 "$mse/elemT018.xml:2:23: Element \"test\" blocks the use of restrictions of the type"
expect "" $mse/elemT019.xml \
 "$mse/elemT019.xml:2:26: Type is not a valid replacement for \"A\""
notrun $mse/elemT022.xml "Test seems invalid, all parsers fail"
expect "" $mse/elemT024.xml \
 "$mse/elemT024.xml:2:24: Element \"test\" blocks the use of restrictions of the type"
expect "" $mse/elemT025.xml ""
expect "" $mse/elemT026.xml ""
expect "" $mse/elemT027.xml ""
expect "" $mse/elemT028.xml ""
expect "" $mse/elemT029.xml ""
expect "" $mse/elemT030.xml ""
expect "" $mse/elemT031.xml \
 "$mse/elemT031.xml:2:21: Type is not a valid replacement for \"A\""
expect "" $mse/elemT032.xml ""
expect "" $mse/elemT033.xml \
 "$mse/elemT033.xml:2:26: Type is not a valid replacement for \"A\""
expect "" $mse/elemT038.xml ""
expect "" $mse/elemT039.xml \
 "$mse/elemT039.xml:2:25: Element \"test3\" blocks the use of extensions of the type"
expect "" $mse/elemT040.xml ""
expect "" $mse/elemT041.xml ""
expect "" $mse/elemT042.xml ""
expect "" $mse/elemT043.xml ""
expect "" $mse/elemT044.xml ""
expect "" $mse/elemT045.xml \
 "$mse/elemT045.xml:2:21: Type is not a valid replacement for \"A\""
expect "" $mse/elemT046.xml \
 "$mse/elemT046.xml:2:21: Element \"test\" blocks the use of restrictions of the type"
expect "" $mse/elemT047.xml \
 "$mse/elemT047.xml:2:26: Type is not a valid replacement for \"A\""
expect "" $mse/elemT048.xml \
 "$mse/elemT048.xml:2:27: Type is not a valid replacement for \"A\""
expect "" $mse/elemT049.xml \
 "$mse/elemT049.xml:2:28: Type is not a valid replacement for \"A\""
expect "" $mse/elemT050.xml \
 "$mse/elemT050.xml:2:26: Type is not a valid replacement for \"A\""
expect "" $mse/elemT051.xml \
 "$mse/elemT051.xml:2:27: Type is not a valid replacement for \"A\""
expect "" $mse/elemT052.xml \
 "$mse/elemT052.xml:2:25: Element \"test2\" blocks the use of restrictions of the type"
expect "" $mse/elemT053.xml \
 "$mse/elemT053.xml:2:25: Element \"test2\" blocks the use of extensions of the type"
notrun $mse/elemT054.xml "Should fail, but all parsers let pass"
notrun $mse/elemT055.xml "Should fail, but all parsers let pass"
notrun $mse/elemT056.xml "Should fail, but all parsers let pass"
notrun $mse/elemT057.xml "Should fail, but all parsers let pass"
expect "" $mse/elemT058.xml ""
expect "" $mse/elemT074.xml \
 "$mse/elemT074.xml:2:23: Restrictions of type \"A\" are forbidden"
fi

##################
## Microsoft elements tests -- U serie (restrictions and facets)
##################

if [ x$run_ms_element = x1     -o $run_all_tests = 1 ]; then
expect "" $mse/elemU001.xml ""
expect "" $mse/elemU002.xml ""
expect "" $mse/elemU003.xml ""
expect "" $mse/elemU004.xml ""
expected_failure $mse/elemU005.xml "\p{LU} unsupported in pattern"
expected_failure $mse/elemU006.xml "\p{IsGreek} unsupported in pattern"
expected_failure $mse/elemU007.xml "\P{IsGreek} unsupported in pattern"
expect "" $mse/elemU008.xml ""
expect "" $mse/elemU009.xml ""
expect "" $mse/elemU010.xml ""
expect "" $mse/elemU011.xml ""
expect "" $mse/elemU012.xml ""
expect "" $mse/elemU013.xml ""
expect "" $mse/elemU014.xml ""
expect "" $mse/elemU015.xml ""
expect "" $mse/elemU017.xml ""
expect "" $mse/elemU018.xml ""
expect "" $mse/elemU019.xml ""
expect "" $mse/elemU020.xml ""
expect "" $mse/elemU021.xml ""
expect "" $mse/elemU022.xml ""
expect "" $mse/elemU023.xml ""
expect "" $mse/elemU024.xml ""
expect "" $mse/elemU025.xml \
 "$mse/elemU025.xml:2:14: string pattern not matched: Chapter \d"
fi

##################
## Microsoft elements tests -- Z serie
##################

if [ x$run_ms_element = x1     -o $run_all_tests = 1 ]; then
notrun $mse/elemZ001.xml "All parsers accept it"
expected_failure $mse/elemZ002.xml "Improper handling of derivation for simpleType for xsi:type attribute"
expect "" $mse/elemZ003.xml ""
expected_failure $mse/elemZ004.xsd "maxInt can't be bigger than Long_Integer'Last"
expect $mse/elemZ005.xsd ""
fi

##################
## Sun tests
##################

if [ x$run_sun = x1            -o $run_all_tests = 1 ]; then
expected_failure "$sun/idc001.nogen.n00.xml" "XPath not support => <unique> not supported"
expect "$sun/idc001.nogen.xsd" "$sun/idc001.nogen.v00.xml" ""
expect "$sun/idc001.nogen.xsd" "$sun/idc001.nogen.v01.xml" ""
expected_failure "$sun/idc002.e.xsd" "<key> not supported"
expected_failure "$sun/idc002b.e.xsd" "<key> not supported"
expected_failure "$sun/idc003.e.xsd" "<key> not supported"
expected_failure "$sun/idc004.nogen.xsd $sun/idc004.nogen.n01.xml" "<key> not supported"
expected_failure "$sun/idc004.nogen.xsd $sun/idc004.nogen.n02.xml" "<key> not supported"
expected_failure "$sun/idc004.nogen.xsd $sun/idc004.nogen.n03.xml" "<key> not supported"
expected_failure "$sun/idc004.nogen.xsd $sun/idc004.nogen.v00.xml" "<key> not supported"
expected_failure "$sun/idc004.e.xsd" "<key> not supported"
expected_failure "$sun/idc005.nogen.xsd $sun/idc005.nogen.n00.xml" "<key> not supported"
expected_failure "$sun/idc005.nogen.xsd $sun/idc005.nogen.n01.xml" "<key> not supported"
expected_failure "$sun/idc005.nogen.xsd $sun/idc005.nogen.v00.xml" "<key> not supported"
expected_failure "$sun/idc006.nogen.xsd $sun/idc006.nogen.n00.xml" "<key> not supported"
expected_failure "$sun/idc006.nogen.xsd $sun/idc006.nogen.n01.xml" "<key> not supported"
expected_failure "$sun/idc006.nogen.xsd $sun/idc006.nogen.v00.xml" "<key> not supported"

### SYN xsd001

expect "$sun/xsd001.xsd" "$sun/xsd001.n00.xml" \
 "$sun/xsd001.n00.xml:6:12: Unexpected end of sequence, expecting \"child\""
expect "$sun/xsd001.xsd" "$sun/xsd001.n01.xml" \
 "`elem_unexpected $sun/xsd001.n01.xml:10:9 "" child`"
expect "$sun/xsd001.xsd" "$sun/xsd001.n02.xml" \
 "$sun/xsd001.n02.xml:7:21: Attribute \"attr\": String is too short, minimum length is 5 characters"
expect "$sun/xsd001.xsd" "$sun/xsd001.n03.xml" \
 "$sun/xsd001.n03.xml:7:28: Attribute \"attr\": String too long, maximum length is 10 characters"
expect "$sun/xsd001.xsd" "$sun/xsd001.n04.xml" \
 "$sun/xsd001.n04.xml:4:11: String is too short, minimum length is 3 characters"
expect "$sun/xsd001.xsd" "$sun/xsd001.n05.xml" \
 "$sun/xsd001.n05.xml:3:20: String too long, maximum length is 10 characters"
expect "$sun/xsd001.xsd" "$sun/xsd001.n06.xml" \
 "$sun/xsd001.n06.xml:4:11: String is too short, minimum length is 3 characters"
expect "$sun/xsd001.xsd" "$sun/xsd001.n07.xml" \
 "$sun/xsd001.n07.xml:4:13: Namespace specification not authorized in this context"
expect "$sun/xsd001.xsd" "$sun/xsd001.v00.xml" ""
expect "$sun/xsd001.xsd" "$sun/xsd001.v01.xml" ""
expect "$sun/xsd001.xsd" "$sun/xsd001.v02.xml" ""
expect "$sun/xsd001.xsd" "$sun/xsd001.v03.xml" ""

### SUN xsd002

expect "$sun/xsd002.xsd" "$sun/xsd002.n00.xml" \
 "$sun/xsd002.n00.xml:3:11: Namespace specification not authorized in this context"
expect "$sun/xsd002.xsd" "$sun/xsd002.n01.xml" \
 "$sun/xsd002.n01.xml:3:9: Namespace specification is required in this context"
expect "$sun/xsd002.xsd" "$sun/xsd002.n02.xml" \
 "$sun/xsd002.n02.xml:3:11: Namespace specification not authorized in this context"
expect "$sun/xsd002.xsd" "$sun/xsd002.v00.xml" ""
expect "$sun/xsd002.xsd" "$sun/xsd002.v01.xml" ""

### SUN xsd003

expect "$sun/xsd003-1.e.xsd" "" \
 "`elem_unexpected $sun/xsd003-1.e.xsd:10:30 $schema_ns element`"
expect "$sun/xsd003-2.e.xsd" "" \
 "`elem_unexpected $sun/xsd003-2.e.xsd:10:50 $schema_ns attribute`"
expect "$sun/xsd003a.xsd" "$sun/xsd003a.v00.xml" ""
expect "$sun/xsd003b.xsd" "$sun/xsd003b.n00.xml" \
 "$sun/xsd003b.n00.xml:3:29: Attribute \"add\": Invalid integer: \"abc\""
expect "$sun/xsd003b.xsd" "$sun/xsd003b.n01.xml" \
 "$sun/xsd003b.n01.xml:3:50: Attribute \"foo:gAtt\": Element's value not in the enumeration set"
expect "$sun/xsd003b.xsd" "$sun/xsd003b.v00.xml" ""
expect "$sun/xsd003b.xsd" "$sun/xsd003b.v01.xml" ""

### SUN xsd004

expect "$sun/xsd004.xsd" "$sun/xsd004.n00.xml" \
 "$sun/xsd004.n00.xml:11:15: Must be a simple type, no <illegal> child allowed"
expect "$sun/xsd004.xsd" "$sun/xsd004.n01.xml" \
 "$sun/xsd004.n01.xml:8:20: No definition provided for \"undefined\""
expect "$sun/xsd004.xsd" "$sun/xsd004.n02.xml" \
 "$sun/xsd004.n02.xml:8:15: Namespace should be different from foo"
expect "$sun/xsd004.xsd" "$sun/xsd004.n03.xml" \
 "$sun/xsd004.n03.xml:8:21: Namespace should be different from foo"
expect "$sun/xsd004.xsd" "$sun/xsd004.n04.xml" \
 "$sun/xsd004.n04.xml:9:2: No character data allowed by content model"
expect "$sun/xsd004.xsd" "$sun/xsd004.n05.xml" \
 "$sun/xsd004.n05.xml:8:15: Invalid namespace for this element: \"foo\" not in \"##local\""
expect "$sun/xsd004.xsd" "$sun/xsd004.n06.xml" \
 "$sun/xsd004.n06.xml:8:12: Invalid namespace for this element: \"bar\" not in \"##local\""
expect "$sun/xsd004.xsd" "$sun/xsd004.n07.xml" \
 "$sun/xsd004.n07.xml:8:21: Invalid namespace for this element: \"zot\" not in \"##local\""
expect "$sun/xsd004.xsd" "$sun/xsd004.n08.xml" \
 "$sun/xsd004.n08.xml:8:21: No definition provided for \"undeclared\""
expect "$sun/xsd004.xsd" "$sun/xsd004.n09.xml" \
 "$sun/xsd004.n09.xml:8:12: Invalid namespace for this element: \"bar\" not in \"##targetNamespace\""
expect "$sun/xsd004.xsd" "$sun/xsd004.n10.xml" \
 "$sun/xsd004.n10.xml:8:18: Invalid namespace for this element: \"\" not in \"##targetNamespace\""
expect "$sun/xsd004.xsd" "$sun/xsd004.n11.xml" \
 "$sun/xsd004.n11.xml:8:15: Invalid namespace for this element: \"foo\" not in \"bar\""
expect "$sun/xsd004.xsd" "$sun/xsd004.n12.xml" \
 "$sun/xsd004.n12.xml:8:18: Invalid namespace for this element: \"\" not in \"bar\""
expect "$sun/xsd004.xsd" "$sun/xsd004.v00.xml" ""

### SUN xsd005

expect "$sun/xsd005.xsd" "$sun/xsd005.n00.xml" \
 "$sun/xsd005.n00.xml:5:10: Unexpected end of sequence, expecting \"a\""
expect "$sun/xsd005.xsd" "$sun/xsd005.n01.xml" \
 "$sun/xsd005.n01.xml:5:30: Unknown type \"undeclared\""
expect "$sun/xsd005.xsd" "$sun/xsd005.n02.xml" \
 "$sun/xsd005.n02.xml:6:15: Expecting at least 1 occurrences of \"c\" from namespace \"foo\""
expect "$sun/xsd005.xsd" "$sun/xsd005.n03.xml" \
 "$sun/xsd005.n03.xml:6:11: Expecting at least 1 occurrences of \"c\" from namespace \"foo\""
expect "$sun/xsd005.xsd" "$sun/xsd005.n04.xml" \
 "`elem_unexpected $sun/xsd005.n04.xml:6:15 foo d`"
expect "$sun/xsd005.xsd" "$sun/xsd005.n05.xml" \
 "$sun/xsd005.n05.xml:6:18: Unknown type \"ext\""
expect "$sun/xsd005.xsd" "$sun/xsd005.n06.xml" \
 "$sun/xsd005.n06.xml:7:9: Unexpected end of sequence, expecting \"d\""
expect "$sun/xsd005.xsd" "$sun/xsd005.v00.xml" ""

### SUN xsd006

expect "$sun/xsd006.xsd" "$sun/xsd006.n00.xml" \
 "`elem_unexpected $sun/xsd006.n00.xml:5:11 foo x`"
expect "$sun/xsd006.xsd" "$sun/xsd006.n01.xml" \
 "`elem_unexpected $sun/xsd006.n01.xml:5:15 foo x`"
expect "$sun/xsd006.xsd" "$sun/xsd006.n02.xml" \
 "$sun/xsd006.n02.xml:5:13: Unexpected end of sequence, expecting \"x\""
expect "$sun/xsd006.xsd" "$sun/xsd006.n03.xml" \
 "`elem_unexpected $sun/xsd006.n03.xml:5:15 foo x`"
expect "$sun/xsd006.xsd" "$sun/xsd006.n04.xml" \
 "$sun/xsd006.n04.xml:5:13: Unexpected end of sequence, expecting \"x\""
expect "$sun/xsd006.xsd" "$sun/xsd006.n05.xml" \
 "$sun/xsd006.n05.xml:6:13: Unexpected end of sequence, expecting \"x\""
expect "$sun/xsd006.xsd" "$sun/xsd006.n06.xml" \
 "`elem_unexpected $sun/xsd006.n06.xml:5:15 foo x`"
expect "$sun/xsd006.xsd" "$sun/xsd006.n07.xml" \
 "$sun/xsd006.n07.xml:6:13: Unexpected end of sequence, expecting \"x\""
expect "$sun/xsd006.xsd" "$sun/xsd006.n08.xml" \
 "$sun/xsd006.n08.xml:5:13: Unexpected end of sequence, expecting \"x\""
expect "$sun/xsd006.xsd" "$sun/xsd006.n09.xml" \
 "$sun/xsd006.n09.xml:6:13: Unexpected end of sequence, expecting \"x\""
expect "$sun/xsd006.xsd" "$sun/xsd006.n10.xml" \
 "$sun/xsd006.n10.xml:6:13: Unexpected end of sequence, expecting \"x\""
expect "$sun/xsd006.xsd" "$sun/xsd006.v00.xml" ""

### SUN xsd008

expect "$sun/xsd008.xsd" "$sun/xsd008.n00.xml" \
 "$sun/xsd008.n00.xml:4:27: \"facet\" is abstract"
expect "$sun/xsd008.xsd" "$sun/xsd008.n01.xml" \
 "$sun/xsd008.n01.xml:4:27: Expecting at least 1 occurrences of \"long\" from namespace \"foo\""
expect "$sun/xsd008.xsd" "$sun/xsd008.n02.xml" \
 "$sun/xsd008.n02.xml:4:25: Expecting at least 1 occurrences of \"long\" from namespace \"foo\""
expect "$sun/xsd008.xsd" "$sun/xsd008.v00.xml" ""

### SUN xsd011

expect "$sun/xsd011.xsd" "$sun/xsd011.n00.xml" \
 "$sun/xsd011.n00.xml:7:17: Unexpected end of sequence, expecting \"x\""
expect "$sun/xsd011.xsd" "$sun/xsd011.n01.xml" \
 "$sun/xsd011.n01.xml:7:14: Unexpected end of sequence, expecting \"x\""
expect "$sun/xsd011.xsd" "$sun/xsd011.n02.xml" \
 "$sun/xsd011.n02.xml:7:7: Element is set as nil, and doesn't accept any child element"
expect "$sun/xsd011.xsd" "$sun/xsd011.n03.xml" \
 "$sun/xsd011.n03.xml:7:2: Invalid number of elements in list, expecting at least 2"
expect "$sun/xsd011.xsd" "$sun/xsd011.v00.xml" ""

### SUN xsd012

expect "$sun/xsd012.xsd" "$sun/xsd012.n00.xml" \
 "$sun/xsd012.n00.xml:4:12: No character data allowed by content model"
expect "$sun/xsd012.xsd" "$sun/xsd012.v00.xml" ""

### SUN xsd013

expect "$sun/xsd013.e.xsd" "" \
 "`elem_not_declared "$sun/xsd013.e.xsd:20:9" $schema_ns root`"
expect "$sun/xsd014.e.xsd" "" \
 "`elem_not_declared "$sun/xsd014.e.xsd:19:9" $schema_ns undef`"
expect "$sun/xsd015.e.xsd" "" \
 "`type_not_declared "$sun/xsd015.e.xsd:22:9" $schema_ns abc`"
expect "$sun/xsd016.e.xsd" "" \
 "`type_not_declared "$sun/xsd016.e.xsd:15:9" $schema_ns abc`"
expect "$sun/xsd017.e.xsd" "" \
 "`type_not_declared "$sun/xsd017.e.xsd:29:9" foo def`"
expect "$sun/xsd018.e.xsd" "" \
 "`type_not_declared "$sun/xsd018.e.xsd:29:9" $schema_ns abc`"
expect "$sun/xsd019.e.xsd" "" \
 "`type_not_declared "$sun/xsd019.e.xsd:28:9" $schema_ns abc`"

### SUN xsd020

expect "$sun/xsd020.e.xsd" "" \
 "$sun/xsd020.e.xsd:22:33: Type specified in a simpleContent context must not have a complexContent"
expect "$sun/xsd020-2.e.xsd" "" \
 "$sun/xsd020-2.e.xsd:25:9: Attribute \"foo:abc\" is referenced, but not defined"
expect "$sun/xsd020-3.e.xsd" "" \
 "$sun/xsd020-3.e.xsd:28:9: Group \"abc\" is referenced, but not defined"
expect "$sun/xsd020-4.e.xsd" "" \
 "$sun/xsd020-4.e.xsd:32:9: attributeGroup \"foo:abc\" is referenced, but not defined"

### SUN xsd021

expect "$sun/xsd021.xsd" "$sun/xsd021.n00.xml" \
 "$sun/xsd021.n00.xml:8:28: Attribute \"f:a\": Invalid integer: \"invalid\""
expect "$sun/xsd021.xsd" "$sun/xsd021.n01.xml" \
 "$sun/xsd021.n01.xml:8:27: Attribute \"z:c\": Invalid integer: \"not ok\""
expect "$sun/xsd021.xsd" "$sun/xsd021.n02.xml" \
 "$sun/xsd021.n02.xml:8:38: Attribute \"u:undeclared\": No definition provided"
expect "$sun/xsd021.xsd" "$sun/xsd021.n03.xml" \
 "$sun/xsd021.n03.xml:8:31: Attribute \"f:b\": Invalid integer: \"invalid\""
expect "$sun/xsd021.xsd" "$sun/xsd021.n04.xml" \
 "$sun/xsd021.n04.xml:8:33: Attribute \"f:a\": Invalid namespace in this context, must be different from \"foo\""
expect "$sun/xsd021.xsd" "$sun/xsd021.n05.xml" \
 "$sun/xsd021.n05.xml:8:25: Attribute \"f:a\": Invalid namespace in this context, must be different from \"foo\""
expect "$sun/xsd021.xsd" "$sun/xsd021.n06.xml" \
 "$sun/xsd021.n06.xml:8:24: Attribute \"f:a\": No namespace allowed"
expect "$sun/xsd021.xsd" "$sun/xsd021.n07.xml" \
 "$sun/xsd021.n07.xml:8:24: Attribute \"b:b\": No namespace allowed"
expect "$sun/xsd021.xsd" "$sun/xsd021.n08.xml" \
 "$sun/xsd021.n08.xml:8:35: Attribute \"local\": Invalid namespace in this context, must be \"foo\""
expect "$sun/xsd021.xsd" "$sun/xsd021.n09.xml" \
 "$sun/xsd021.n09.xml:8:34: Attribute \"f:a\": Invalid integer: \"invalid\""
expect "$sun/xsd021.xsd" "$sun/xsd021.n10.xml" \
 "$sun/xsd021.n10.xml:8:30: Attribute \"local\": Invalid namespace in this context, must be \"bar\""
expect "$sun/xsd021.xsd" "$sun/xsd021.n11.xml" \
 "$sun/xsd021.n11.xml:8:28: Attribute \"f:a\": Invalid namespace in this context, must be \"bar\""
notrun "$sun/xsd021.xsd" "$sun/xsd021.v00.xml" "This test seems wrong, since it conflicts with elemK007 and elemN006, and isn't passed by Xerces"

### SUN xsd022

notrun "$sun/xsd022.xsd" "$sun/xsd022.n00.xml" "Schema is invalid, no base attribute specified for restriction"
notrun "$sun/xsd022.xsd" "$sun/xsd022.v00.xml" "Schema is invalid, no base attribute specified for restriction"

### SUN xsd023

notrun "$sun/xsd023.e.xsd" "" "Schema is in fact correct, confirmed by Xerces"

## SUN xsiType

expect "$sun/xsiType1.xsd" "$sun/xsiType1.v1.xml" ""
expect "$sun/xsiType1.xsd" "$sun/xsiType1.n1.xml" \
 "$sun/xsiType1.n1.xml:5:30: Type is not a valid replacement for \"B\""

## SUN xsiTypeBlock-1

expect "$sun/xsiType-block-1.xsd" "$sun/xsiType-block-1.v1.xml" ""
expect "$sun/xsiType-block-1.xsd" "$sun/xsiType-block-1.n1.xml" \
 "$sun/xsiType-block-1.n1.xml:5:26: Extensions of type \"B\" are forbidden"
expect "$sun/xsiType-block-1.xsd" "$sun/xsiType-block-1.n2.xml" \
 "$sun/xsiType-block-1.n2.xml:3:27: Extensions of type \"B\" are forbidden"
expect "$sun/xsiType-block-1.xsd" "$sun/xsiType-block-1.n3.xml" \
"$sun/xsiType-block-1.n3.xml:3:27: Extensions of type \"B\" are forbidden"
expect "$sun/xsiType-block-1.xsd" "$sun/xsiType-block-1.n4.xml" \
 "$sun/xsiType-block-1.n4.xml:3:27: Extensions of type \"B\" are forbidden"

## SUN xsiTypeBlock-2

expect "$sun/xsiType-block-2.xsd" "$sun/xsiType-block-2.v1.xml" ""
expect "$sun/xsiType-block-2.xsd" "$sun/xsiType-block-2.n1.xml" \
 "$sun/xsiType-block-2.n1.xml:5:26: Extensions of type \"B\" are forbidden"
expect "$sun/xsiType-block-2.xsd" "$sun/xsiType-block-2.n2.xml" \
 "$sun/xsiType-block-2.n2.xml:3:27: Extensions of type \"Dr\" are forbidden"
expect "$sun/xsiType-block-2.xsd" "$sun/xsiType-block-2.n3.xml" \
 "$sun/xsiType-block-2.n3.xml:3:27: Extensions of type \"B\" are forbidden"
expect "$sun/xsiType-block-2.xsd" "$sun/xsiType-block-2.n4.xml" \
 "$sun/xsiType-block-2.n4.xml:3:27: Extensions of type \"De\" are forbidden"

### SUN xsiTypeBlock-3

expect "$sun/xsiType-block-3.xsd" "$sun/xsiType-block-3.v1.xml" ""
expect "$sun/xsiType-block-3.xsd" "$sun/xsiType-block-3.n1.xml" \
 "$sun/xsiType-block-3.n1.xml:4:27: Element \"item2\" blocks the use of extensions of the type"
expect "$sun/xsiType-block-3.xsd" "$sun/xsiType-block-3.n2.xml" \
 "$sun/xsiType-block-3.n2.xml:3:27: Element \"item2\" blocks the use of extensions of the type"
expect "$sun/xsiType-block-3.xsd" "$sun/xsiType-block-3.n3.xml" \
 "$sun/xsiType-block-3.n3.xml:3:27: Element \"item2\" blocks the use of extensions of the type"
expect "$sun/xsiType-block-3.xsd" "$sun/xsiType-block-3.n4.xml" \
 "$sun/xsiType-block-3.n4.xml:3:27: Element \"item2\" blocks the use of extensions of the type"

### SUN xsiTypeBlock-4

expected_failure "$sun/xsiType-block-4.xsd" "$sun/xsiType-block-4.v1.xml" "Test itself says it is probably invalid"
expect "$sun/xsiType-block-4.xsd" "$sun/xsiType-block-4.n1.xml" \
 "$sun/xsiType-block-4.n1.xml:5:27: Restrictions of type \"Dr\" are forbidden"
expect "$sun/xsiType-block-4.xsd" "$sun/xsiType-block-4.n2.xml" \
 "$sun/xsiType-block-4.n2.xml:3:27: Element \"item2\" blocks the use of extensions of the type"
expect "$sun/xsiType-block-4.xsd" "$sun/xsiType-block-4.n3.xml" \
 "$sun/xsiType-block-4.n3.xml:4:27: Restrictions of type \"Dr\" are forbidden"
expect "$sun/xsiType-block-4.xsd" "$sun/xsiType-block-4.n4.xml" \
 "$sun/xsiType-block-4.n4.xml:4:27: Element \"item2\" blocks the use of extensions of the type"

### SUN type-and-subst

expect "$sun/type-and-subst-1.xsd" "$sun/type-and-subst-1.v1.xml" ""
expect "$sun/type-and-subst-1.xsd" "$sun/type-and-subst-1.v2.xml" ""
expect "$sun/type-and-subst-1.xsd" "$sun/type-and-subst-1.n1.xml" \
 "$sun/type-and-subst-1.n1.xml:4:26: Type is not a valid replacement for \"Dr\""
expect "$sun/type-and-subst-1.xsd" "$sun/type-and-subst-1.n2.xml" \
 "$sun/type-and-subst-1.n2.xml:2:26: Type is not a valid replacement for \"Dr\""
expect "$sun/type-and-subst-1.xsd" "$sun/type-and-subst-1.n3.xml" \
 "$sun/type-and-subst-1.n3.xml:2:26: Type is not a valid replacement for \"Dr\""
expect "$sun/type-and-subst-1.xsd" "$sun/type-and-subst-1.n4.xml" \
 "$sun/type-and-subst-1.n4.xml:2:26: Type is not a valid replacement for \"Dr\""
expect "$sun/type-and-subst-1.xsd" "$sun/type-and-subst-1.n5.xml" \
 "$sun/type-and-subst-1.n5.xml:3:27: Type is not a valid replacement for \"De\""
expect "$sun/type-and-subst-1.xsd" "$sun/type-and-subst-1.n6.xml" \
 "$sun/type-and-subst-1.n6.xml:2:27: Type is not a valid replacement for \"De\""
expect "$sun/type-and-subst-1.xsd" "$sun/type-and-subst-1.n7.xml" \
 "$sun/type-and-subst-1.n7.xml:2:27: Type is not a valid replacement for \"De\""
expect "$sun/type-and-subst-1.xsd" "$sun/type-and-subst-1.n8.xml" \
 "$sun/type-and-subst-1.n8.xml:2:27: Type is not a valid replacement for \"De\""
expect "$sun/type-and-subst-1.xsd" "$sun/type-and-subst-1.n9.xml" \
 "$sun/type-and-subst-1.n9.xml:2:27: Type is not a valid replacement for \"Drr\""
expect "$sun/type-and-subst-1.xsd" "$sun/type-and-subst-1.n10.xml" \
 "$sun/type-and-subst-1.n10.xml:2:27: Type is not a valid replacement for \"Drr\""
expect "$sun/type-and-subst-1.xsd" "$sun/type-and-subst-1.n11.xml" \
 "$sun/type-and-subst-1.n11.xml:2:27: Type is not a valid replacement for \"Drr\""
expect "$sun/type-and-subst-1.xsd" "$sun/type-and-subst-1.n12.xml" \
 "$sun/type-and-subst-1.n12.xml:2:27: Type is not a valid replacement for \"Drr\""
expect "$sun/type-and-subst-1.xsd" "$sun/type-and-subst-1.n13.xml" \
 "$sun/type-and-subst-1.n13.xml:2:27: Type is not a valid replacement for \"Drr\""
expect "$sun/type-and-subst-1.xsd" "$sun/type-and-subst-1.n14.xml" \
 "$sun/type-and-subst-1.n14.xml:2:27: Type is not a valid replacement for \"Drr\""
expect "$sun/type-and-subst-1.xsd" "$sun/type-and-subst-1.n15.xml" \
 "$sun/type-and-subst-1.n15.xml:2:27: Type is not a valid replacement for \"Dre\""
expect "$sun/type-and-subst-1.xsd" "$sun/type-and-subst-1.n16.xml" \
 "$sun/type-and-subst-1.n16.xml:2:27: Type is not a valid replacement for \"Dre\""
expect "$sun/type-and-subst-1.xsd" "$sun/type-and-subst-1.n17.xml" \
 "$sun/type-and-subst-1.n17.xml:2:27: Type is not a valid replacement for \"Dre\""
expect "$sun/type-and-subst-1.xsd" "$sun/type-and-subst-1.n18.xml" \
 "$sun/type-and-subst-1.n18.xml:2:27: Type is not a valid replacement for \"Dre\""
expect "$sun/type-and-subst-1.xsd" "$sun/type-and-subst-1.n19.xml" \
 "$sun/type-and-subst-1.n19.xml:2:27: Type is not a valid replacement for \"Dre\""
expect "$sun/type-and-subst-1.xsd" "$sun/type-and-subst-1.n20.xml" \
 "$sun/type-and-subst-1.n20.xml:2:27: Type is not a valid replacement for \"Dre\""
expect "$sun/type-and-subst-1.xsd" "$sun/type-and-subst-1.n21.xml" \
 "$sun/type-and-subst-1.n21.xml:2:27: Type is not a valid replacement for \"Der\""
expect "$sun/type-and-subst-1.xsd" "$sun/type-and-subst-1.n22.xml" \
 "$sun/type-and-subst-1.n22.xml:2:27: Type is not a valid replacement for \"Der\""
expect "$sun/type-and-subst-1.xsd" "$sun/type-and-subst-1.n23.xml" \
 "$sun/type-and-subst-1.n23.xml:2:27: Type is not a valid replacement for \"Der\""
expect "$sun/type-and-subst-1.xsd" "$sun/type-and-subst-1.n24.xml" \
 "$sun/type-and-subst-1.n24.xml:2:27: Type is not a valid replacement for \"Der\""
expect "$sun/type-and-subst-1.xsd" "$sun/type-and-subst-1.n25.xml" \
 "$sun/type-and-subst-1.n25.xml:2:27: Type is not a valid replacement for \"Der\""
expect "$sun/type-and-subst-1.xsd" "$sun/type-and-subst-1.n26.xml" \
 "$sun/type-and-subst-1.n26.xml:2:27: Type is not a valid replacement for \"Der\""
expect "$sun/type-and-subst-1.xsd" "$sun/type-and-subst-1.n27.xml" \
 "$sun/type-and-subst-1.n27.xml:2:27: Type is not a valid replacement for \"Dee\""
expect "$sun/type-and-subst-1.xsd" "$sun/type-and-subst-1.n28.xml" \
 "$sun/type-and-subst-1.n28.xml:2:27: Type is not a valid replacement for \"Dee\""
expect "$sun/type-and-subst-1.xsd" "$sun/type-and-subst-1.n29.xml" \
 "$sun/type-and-subst-1.n29.xml:2:27: Type is not a valid replacement for \"Dee\""
expect "$sun/type-and-subst-1.xsd" "$sun/type-and-subst-1.n30.xml" \
 "$sun/type-and-subst-1.n30.xml:2:27: Type is not a valid replacement for \"Dee\""
expect "$sun/type-and-subst-1.xsd" "$sun/type-and-subst-1.n31.xml" \
 "$sun/type-and-subst-1.n31.xml:2:27: Type is not a valid replacement for \"Dee\""
expect "$sun/type-and-subst-1.xsd" "$sun/type-and-subst-1.n32.xml" \
 "$sun/type-and-subst-1.n32.xml:2:27: Type is not a valid replacement for \"Dee\""
fi

###########################################
## Microsoft particles tests
###########################################

if [ x$run_ms_particle = x1    -o $run_all_tests = 1 ]; then
expect "" "$msp/particlesA001.xml" \
 "$msp/particlesA001.xml:3:7: Element \"elem\" must appear at least 1 times"
expect "" "$msp/particlesA002.xml" ""
expect "" "$msp/particlesA003.xml" \
 "`elem_unexpected $msp/particlesA003.xml:5:10 "" elem1`"
expect "" "$msp/particlesA004.xml" \
 "$msp/particlesA004.xml:4:9: Unexpected end of sequence, expecting \"(e1)\""
expect "" "$msp/particlesA005.xml" \
 "$msp/particlesA005.xml:6:9: Unexpected end of sequence, expecting \"(e1)\""
expect "" "$msp/particlesA006.xml" ""
expect "" "$msp/particlesA007.xml" ""
expect "" "$msp/particlesA008.xml" \
 "$msp/particlesA008.xml:4:9: Unexpected end of sequence, expecting \"(e1|e2)\""
expect "" "$msp/particlesA009.xml" \
 "$msp/particlesA009.xml:5:9: Unexpected end of sequence, expecting \"(e1|e2)\""
expect "" "$msp/particlesA010.xml" ""
expect "" "$msp/particlesA011.xml" ""
expect "" "$msp/particlesA012.xml" \
 "$msp/particlesA012.xml:4:9: Unexpected end of sequence, expecting \"<any>\""
expect "" "$msp/particlesA013.xml" \
 "$msp/particlesA013.xml:5:9: Unexpected end of sequence, expecting \"<any>\""
expect "" "$msp/particlesA014.xml" ""
expect "" "$msp/particlesA015.xml" ""

expect "" "$msp/particlesB001.xml" \
 "$msp/particlesB001.xml:4:9: Element \"e1\" must appear at least 1 times"
expect "" "$msp/particlesB002.xml" ""
expect "" "$msp/particlesB003.xml" \
 "`elem_unexpected $msp/particlesB003.xml:6:8 "" e1`"
expect "" "$msp/particlesB004.xml" \
 "$msp/particlesB004.xml:4:9: Unexpected end of sequence, expecting \"(e1)\""
expect "" "$msp/particlesB005.xml" ""
expect "" "$msp/particlesB006.xml" ""
expect "" "$msp/particlesB007.xml" \
 "`elem_unexpected $msp/particlesB007.xml:5:7 "" e1`"
expect "" "$msp/particlesB008.xml" \
 "$msp/particlesB008.xml:4:9: Unexpected end of sequence, expecting \"(e1|e2|e3|e4)\""
expect "" "$msp/particlesB009.xml" ""
expect "" "$msp/particlesB010.xml" ""
expect "" "$msp/particlesB011.xml" \
 "`elem_unexpected $msp/particlesB011.xml:4:18 "" e1`"
expect "" "$msp/particlesB012.xml" \
 "$msp/particlesB012.xml:4:9: Expecting one of \"<any>\""
expect "" "$msp/particlesB013.xml" ""
expect "" "$msp/particlesB014.xml" ""
expect "" "$msp/particlesB015.xml" \
 "`elem_unexpected $msp/particlesB015.xml:6:19 foo c`"

expect "" "$msp/particlesC001.xml" ""
expect "" "$msp/particlesC002.xml" ""
expect "" "$msp/particlesC003.xml" ""
expect "" "$msp/particlesC004.xml" ""
expect "" "$msp/particlesC005.xml" ""
expect "" "$msp/particlesC006.xml" ""
expect "" "$msp/particlesC007.xml" \
 "$msp/particlesC007.xml:4:11: Namespace should be different from http://xsdtesting"
expect "" "$msp/particlesC008.xml" ""
expect "" "$msp/particlesC009.xml" ""
expect "" "$msp/particlesC010.xml" ""
expect "" "$msp/particlesC011.xml" ""
expect "" "$msp/particlesC012.xml" \
 "$msp/particlesC012.xml:4:21: Invalid namespace for this element: \"foo\" not in \"http://xslt\""
expect "" "$msp/particlesC013.xml" \
 "$msp/particlesC013.xml:4:11: Invalid namespace for this element: \"http://xsdtesting\" not in \"http://xslt\""
expect "" "$msp/particlesC014.xml" \
 "$msp/particlesC014.xml:4:7: Invalid namespace for this element: \"\" not in \"http://xslt\""
expect "" "$msp/particlesC015.xml" ""
expect "" "$msp/particlesC016.xml" ""
expect "" "$msp/particlesC017.xml" \
 "$msp/particlesC017.xml:4:11: Invalid namespace for this element: \"http://xsdtesting\" not in \"foo bar\""
expect "" "$msp/particlesC018.xml" \
 "$msp/particlesC018.xml:4:9: Invalid namespace for this element: \"\" not in \"foo bar\""
expect "" "$msp/particlesC019.xml" \
 "$msp/particlesC019.xml:4:25: Invalid namespace for this element: \"xyz\" not in \"foo bar\""
expect "" "$msp/particlesC020.xml" \
 "$msp/particlesC020.xml:4:25: Invalid namespace for this element: \"foo\" not in \"##targetNamespace\""
expect "" "$msp/particlesC021.xml" ""
expect "" "$msp/particlesC022.xml" \
 "$msp/particlesC022.xml:4:40: Invalid namespace for this element: \"http://importedXSD\" not in \"##targetNamespace\""
expect "" "$msp/particlesC023.xml" \
 "$msp/particlesC023.xml:4:9: Invalid namespace for this element: \"\" not in \"##targetNamespace\""
expect "" "$msp/particlesC024.xml" \
 "$msp/particlesC024.xml:4:29: Invalid namespace for this element: \"foo\" not in \"##local\""
expect "" "$msp/particlesC025.xml" \
 "$msp/particlesC025.xml:4:11: Invalid namespace for this element: \"http://xsdtesting\" not in \"##local\""
expect "" "$msp/particlesC026.xml" \
 "$msp/particlesC026.xml:4:40: Invalid namespace for this element: \"http://importedXSD\" not in \"##local\""
expect "" "$msp/particlesC027.xml" ""
expect "" "$msp/particlesC028.xml" ""
expect "" "$msp/particlesC029.xml" ""
expect "" "$msp/particlesC030.xml" ""
expect "" "$msp/particlesC031.xml" \
 "$msp/particlesC031.xml:4:29: Invalid namespace for this element: \"xyz\" not in \"foo bar ##targetNamespace\""
expect "" "$msp/particlesC032.xml" \
 "$msp/particlesC032.xml:4:9: Invalid namespace for this element: \"\" not in \"foo bar ##targetNamespace\""
expect "" "$msp/particlesC033.xml" \
 "$msp/particlesC033.xml:4:44: Invalid namespace for this element: \"http://importedXSD\" not in \"foo bar ##targetNamespace\""
expect "" "$msp/particlesC034.xml" ""
expect "" "$msp/particlesC035.xml" \
 "$msp/particlesC035.xml:4:25: Invalid namespace for this element: \"bar\" not in \"foo ##local\""
expect "" "$msp/particlesC036.xml" \
 "$msp/particlesC036.xml:4:11: Invalid namespace for this element: \"http://xsdtesting\" not in \"foo ##local\""
expect "" "$msp/particlesC037.xml" ""
expect "" "$msp/particlesC038.xml" \
 "$msp/particlesC038.xml:4:40: Invalid namespace for this element: \"http://importedXSD\" not in \"foo ##local\""
expect "" "$msp/particlesC039.xml" \
 "$msp/particlesC039.xml:4:25: Invalid namespace for this element: \"foo\" not in \"##targetNamespace ##local\""
expect "" "$msp/particlesC040.xml" ""
expect "" "$msp/particlesC041.xml" ""
expect "" "$msp/particlesC042.xml" \
 "$msp/particlesC042.xml:4:40: Invalid namespace for this element: \"http://importedXSD\" not in \"##targetNamespace ##local\""
expect "" "$msp/particlesC043.xml" ""
expect "" "$msp/particlesC044.xml" ""
expect "" "$msp/particlesC045.xml" ""
expect "" "$msp/particlesC046.xml" ""
expect "" "$msp/particlesC047.xml" \
 "$msp/particlesC047.xml:4:40: Invalid namespace for this element: \"http://importedXSD\" not in \"foo ##targetNamespace bar ##local\""
expect "" "$msp/particlesC048.xml" \
 "$msp/particlesC048.xml:4:25: Invalid namespace for this element: \"xyz\" not in \"foo ##targetNamespace bar ##local\""

expect "" "$msp/particlesDa001.xml" \
 "`elem_unexpected $msp/particlesDa001.xml:5:39 $importedxsd_ns a1`"
expect "" "$msp/particlesDa002.xml" ""
expect "" "$msp/particlesDa003.xml" \
 "$msp/particlesDa003.xml:4:10: Namespace specification is required in this context"
expect "" "$msp/particlesDa004.xml" \
 "$msp/particlesDa004.xml:4:26: Expecting at least 1 occurrences of \"elem2\" from namespace \"http://xsdtesting\""
expect "" "$msp/particlesDa005.xml" \
 "$msp/particlesDa005.xml:4:10: Expecting at least 1 occurrences of \"elem2\" from namespace \"http://xsdtesting\""
expect "" "$msp/particlesDa006.xml" \
 "`elem_unexpected $msp/particlesDa006.xml:5:39 $importedxsd_ns a1`"
expect "" "$msp/particlesDa007.xml" ""
expect "" "$msp/particlesDa008.xml" \
 "$msp/particlesDa008.xml:4:10: Namespace specification is required in this context"
expect "" "$msp/particlesDa009.xml" \
 "$msp/particlesDa009.xml:4:26: Expecting at least 1 occurrences of \"elem2\" from namespace \"http://xsdtesting\""
expect "" "$msp/particlesDa010.xml" \
 "$msp/particlesDa010.xml:6:10: Expecting at least 1 occurrences of \"elem2\" from namespace \"http://xsdtesting\""
expect "" "$msp/particlesDa011.xml" \
 "$msp/particlesDa011.xml:4:12: \"elem2\" is abstract"

expect "" "$msp/particlesDb001.xml" \
 "$msp/particlesDb001.xml:3:41: Expecting at least 1 occurrences of \"elem1\" from namespace \"http://xsdtesting\""
expect "" "$msp/particlesDb002.xml" ""
expect "" "$msp/particlesDb003.xml" \
 "$msp/particlesDb003.xml:3:10: Namespace specification is required in this context"
expect "" "$msp/particlesDb004.xml" \
 "$msp/particlesDb004.xml:3:26: Expecting at least 1 occurrences of \"elem1\" from namespace \"http://xsdtesting\""
expect "" "$msp/particlesDb005.xml" \
 "$msp/particlesDb005.xml:3:10: Expecting at least 1 occurrences of \"elem1\" from namespace \"http://xsdtesting\""
expect "" "$msp/particlesDb006.xml" \
 "$msp/particlesDb006.xml:3:41: Expecting at least 1 occurrences of \"elem1\" from namespace \"http://xsdtesting\""
expect "" "$msp/particlesDb007.xml" ""
expect "" "$msp/particlesDb008.xml" \
 "$msp/particlesDb008.xml:3:10: Namespace specification is required in this context"
expect "" "$msp/particlesDb009.xml" \
 "$msp/particlesDb009.xml:3:26: Expecting at least 1 occurrences of \"elem1\" from namespace \"http://xsdtesting\""
expect "" "$msp/particlesDb010.xml" \
 "$msp/particlesDb010.xml:3:10: Expecting at least 1 occurrences of \"elem1\" from namespace \"http://xsdtesting\""
expect "" "$msp/particlesDb011.xml" \
 "$msp/particlesDb011.xml:3:12: \"elem1\" is abstract"

expect "" "$msp/particlesDc001.xml" ""
expect "" "$msp/particlesDc002.xml" ""
expect "" "$msp/particlesDc003.xml" ""
expect "" "$msp/particlesDc004.xml" ""
expect "" "$msp/particlesDc005.xml" ""
expect "" "$msp/particlesDc006.xml" ""
expect "" "$msp/particlesDc007.xml" ""
expect "" "$msp/particlesDc008.xml" ""
expect "" "$msp/particlesDc009.xml" ""



expect "" "$msp/particlesEa001.xml" ""
expect "" "$msp/particlesEa002.xml" \
 "$msp/particlesEa002.xml:4:9: Element \"a2\" must appear at least 1 times"
expect "" "$msp/particlesEa003.xml" ""
expect "" "$msp/particlesEa004.xml" ""
expect "" "$msp/particlesEa005.xml" \
 "`elem_unexpected $msp/particlesEa005.xml:5:9 $xsdtesting_ns a1`"
expect "" "$msp/particlesEa006.xml" \
 "`elem_unexpected $msp/particlesEa006.xml:5:9 $xsdtesting_ns a1`"
expect "" "$msp/particlesEa007.xml" \
 "$msp/particlesEa007.xml:3:10: Expecting (a1&a2)"
expect "" "$msp/particlesEa008.xml" ""
expect "" "$msp/particlesEa009.xml" \
 "$msp/particlesEa009.xml:4:9: Element \"a2\" must appear at least 1 times"
expect "" "$msp/particlesEa010.xml" ""
expect "" "$msp/particlesEa011.xml" ""
expect "" "$msp/particlesEa012.xml" \
 "`elem_unexpected $msp/particlesEa012.xml:5:9 $xsdtesting_ns a1`"
expect "" "$msp/particlesEa013.xml" \
 "`elem_unexpected $msp/particlesEa013.xml:5:9 $xsdtesting_ns a1`"
expect "" "$msp/particlesEa014.xml" \
 "`elem_unexpected $msp/particlesEa014.xml:5:10 $xsdtesting_ns foo`"
expect "" "$msp/particlesEa015.xml" ""
expect "" "$msp/particlesEa016.xml" \
 "$msp/particlesEa016.xml:4:9: Element \"a2\" must appear at least 1 times"
expect "" "$msp/particlesEa017.xml" ""
expect "" "$msp/particlesEa018.xml" ""
expect "" "$msp/particlesEa019.xml" \
 "`elem_unexpected $msp/particlesEa019.xml:5:9 $xsdtesting_ns a1`"
expect "" "$msp/particlesEa020.xml" \
 "`elem_unexpected $msp/particlesEa020.xml:5:9 $xsdtesting_ns a1`"
expect "" "$msp/particlesEa021.xml" \
 "$msp/particlesEa021.xml:3:10: Expecting (a1&a2)"
notrun "$msp/particlesEa022.xsd" "" "all parsers fail, test seems correct"
expect "$msp/particlesEa023.xsd" "" \
 "$msp/particlesEa023.xsd:11:39: minOccurs > maxOccurs when creating particle"
expect "$msp/particlesEa024.xsd" "" \
 "$msp/particlesEa024.xsd:11:53: minOccurs > maxOccurs when creating particle"
notrun "$msp/particlesEa025.xsd" "" "all parsers fail, test seems correct"



expect "" "$msp/particlesEb001.xml" ""
expect "" "$msp/particlesEb002.xml" \
 "$msp/particlesEb002.xml:4:9: Unexpected end of sequence, expecting \"a2\""
expect "" "$msp/particlesEb003.xml" ""
expect "" "$msp/particlesEb004.xml" \
 "`elem_unexpected $msp/particlesEb004.xml:3:9 $xsdtesting_ns a2`"
expect "" "$msp/particlesEb005.xml" \
 "`elem_unexpected $msp/particlesEb005.xml:5:9 $xsdtesting_ns a1`"
expect "" "$msp/particlesEb006.xml" \
 "`elem_unexpected $msp/particlesEb006.xml:5:9 $xsdtesting_ns a1`"
expect "" "$msp/particlesEb007.xml" \
 "`elem_unexpected $msp/particlesEb007.xml:3:24 foo foo`"
expect "" "$msp/particlesEb008.xml" \
 "$msp/particlesEb008.xml:3:9: Unexpected end of sequence, expecting \"(a1)\""
expect "" "$msp/particlesEb009.xml" \
 "$msp/particlesEb009.xml:4:9: Unexpected end of sequence, expecting \"a2\""
expect "" "$msp/particlesEb010.xml" ""
expect "" "$msp/particlesEb011.xml" \
 "$msp/particlesEb011.xml:3:9: Expecting (a1)"
expect "" "$msp/particlesEb012.xml" \
 "`elem_unexpected $msp/particlesEb012.xml:5:9 $xsdtesting_ns a1`"
expect "" "$msp/particlesEb013.xml" \
 "`elem_unexpected $msp/particlesEb013.xml:5:9 $xsdtesting_ns a1`"
expect "" "$msp/particlesEb014.xml" \
 "$msp/particlesEb014.xml:3:8: Expecting (a1)"
notrun "$msp/particlesEb015.xsd" "" "Test is invalid, Xerces confirmed this"
notrun "" "$msp/particlesEb016.xml" "Test should fail, minOccurs > maxOccurs"
expect "" "$msp/particlesEb017.xml" \
 "$msp/particlesEb017.xml:3:9: Unexpected end of sequence, expecting \"(a1)\""
expect "" "$msp/particlesEb018.xml" \
 "$msp/particlesEb018.xml:4:9: Unexpected end of sequence, expecting \"a2\""
expect "" "$msp/particlesEb019.xml" ""
expect "" "$msp/particlesEb020.xml" \
 "$msp/particlesEb020.xml:3:9: Expecting (a1)"
expect "" "$msp/particlesEb021.xml" \
 "`elem_unexpected $msp/particlesEb021.xml:5:9 $xsdtesting_ns a1`"
expect "" "$msp/particlesEb022.xml" \
 "`elem_unexpected $msp/particlesEb022.xml:5:9 $xsdtesting_ns a1`"
expect "" "$msp/particlesEb023.xml" \
 "$msp/particlesEb023.xml:3:6: Expecting (a1)"
expect "" "$msp/particlesEb024.xml" \
 "$msp/particlesEb024.xml:3:9: Unexpected end of sequence, expecting \"(a1)\""
expect "" "$msp/particlesEb025.xml" \
 "$msp/particlesEb025.xml:6:9: Unexpected end of sequence, expecting \"a2\""
expect "" "$msp/particlesEb026.xml" ""
expect "" "$msp/particlesEb027.xml" ""
expect "" "$msp/particlesEb028.xml" \
 "$msp/particlesEb028.xml:3:9: Expecting (a1)"
expect "" "$msp/particlesEb029.xml" \
 "$msp/particlesEb029.xml:6:9: Unexpected end of sequence, expecting \"a2\""
expect "" "$msp/particlesEb030.xml" \
 "`elem_unexpected $msp/particlesEb030.xml:7:9 $xsdtesting_ns a1`"
expect "" "$msp/particlesEb031.xml" \
 "$msp/particlesEb031.xml:3:15: Expecting (a1)"
expect "" "$msp/particlesEb032.xml" \
 "$msp/particlesEb032.xml:3:9: Unexpected end of sequence, expecting \"(a1)\""
expect "" "$msp/particlesEb033.xml" \
 "$msp/particlesEb033.xml:5:9: Unexpected end of sequence, expecting \"(a1)\""
expect "" "$msp/particlesEb034.xml" \
 "$msp/particlesEb034.xml:3:9: Expecting (a1)"
expect "" "$msp/particlesEb035.xml" \
 "$msp/particlesEb035.xml:6:9: Unexpected end of sequence, expecting \"a2\""
expect "" "$msp/particlesEb036.xml" ""
expect "" "$msp/particlesEb037.xml" \
 "$msp/particlesEb037.xml:8:9: Unexpected end of sequence, expecting \"a2\""
expect "" "$msp/particlesEb038.xml" ""
expect "" "$msp/particlesEb039.xml" \
 "$msp/particlesEb039.xml:3:6: Expecting (a1)"

expect "" "$msp/particlesEc001.xml" ""
expect "" "$msp/particlesEc002.xml" ""
expect "" "$msp/particlesEc003.xml" \
 "`elem_unexpected $msp/particlesEc003.xml:4:8 $xsdtesting_ns b`"
expect "" "$msp/particlesEc004.xml" \
 "`elem_unexpected $msp/particlesEc004.xml:3:6 "" x`"
expect "" "$msp/particlesEc005.xml" \
 "$msp/particlesEc005.xml:3:9: Unexpected end of sequence, expecting \"(a1|a2)\""
expect "" "$msp/particlesEc006.xml" ""
expect "" "$msp/particlesEc007.xml" \
 "`elem_unexpected $msp/particlesEc007.xml:4:9 $xsdtesting_ns a2`"
expect "" "$msp/particlesEc008.xml" \
 "$msp/particlesEc008.xml:3:10: Expecting (a1|a2)"
expect "$msp/particlesEc009.xsd" "" \
 "$msp/particlesEc009.xsd:4:29: minOccurs > maxOccurs when creating particle"
expected_failure "" "$msp/particlesEc010.xml" "Test applies to old handling of minOccurs and maxOccurs"
expect "" "$msp/particlesEc011.xml" \
 "$msp/particlesEc011.xml:3:9: Unexpected end of sequence, expecting \"(a1|a2)\""
expect "" "$msp/particlesEc012.xml" ""
expect "" "$msp/particlesEc013.xml" \
 "`elem_unexpected $msp/particlesEc013.xml:4:9 $xsdtesting_ns a2`"
expect "" "$msp/particlesEc014.xml" \
 "$msp/particlesEc014.xml:3:6: Expecting (a1|a2)"
expect "" "$msp/particlesEc015.xml" \
 "$msp/particlesEc015.xml:3:9: Unexpected end of sequence, expecting \"(a1|a2)\""
expect "" "$msp/particlesEc016.xml" ""
expect "" "$msp/particlesEc017.xml" ""
expect "" "$msp/particlesEc018.xml" ""
expect "" "$msp/particlesEc019.xml" ""
expect "" "$msp/particlesEc020.xml" ""
expect "" "$msp/particlesEc021.xml" ""
expect "" "$msp/particlesEc022.xml" \
 "`elem_unexpected $msp/particlesEc022.xml:5:8 $xsdtesting_ns a`"
expect "" "$msp/particlesEc023.xml" \
 "`elem_unexpected $msp/particlesEc023.xml:5:8 $xsdtesting_ns b`"
expect "" "$msp/particlesEc024.xml" \
 "`elem_unexpected $msp/particlesEc024.xml:5:8 $xsdtesting_ns x`"
expect "" "$msp/particlesEc025.xml" \
 "$msp/particlesEc025.xml:3:8: Expecting (a|b)"
expect "" "$msp/particlesEc026.xml" \
 "$msp/particlesEc026.xml:3:9: Unexpected end of sequence, expecting \"(a|b)\""
expect "" "$msp/particlesEc027.xml" \
 "$msp/particlesEc027.xml:4:9: Unexpected end of sequence, expecting \"(a|b)\""
expect "" "$msp/particlesEc028.xml" \
 "$msp/particlesEc028.xml:4:9: Unexpected end of sequence, expecting \"(a|b)\""
expect "" "$msp/particlesEc029.xml" ""
expect "" "$msp/particlesEc030.xml" ""
expect "" "$msp/particlesEc031.xml" ""
expect "" "$msp/particlesEc032.xml" ""
expect "" "$msp/particlesEc033.xml" ""
expect "" "$msp/particlesEc034.xml" ""
expect "" "$msp/particlesEc035.xml" ""
expect "" "$msp/particlesEc036.xml" ""
expect "" "$msp/particlesEc037.xml" ""
expect "" "$msp/particlesEc038.xml" \
 "`elem_unexpected $msp/particlesEc038.xml:7:8 $xsdtesting_ns a`"
expect "" "$msp/particlesEc039.xml" \
 "`elem_unexpected $msp/particlesEc039.xml:7:8 $xsdtesting_ns a`"
expect "" "$msp/particlesEc040.xml" \
 "`elem_unexpected $msp/particlesEc040.xml:7:6 "" x`"
expect "" "$msp/particlesEc041.xml" \
 "$msp/particlesEc041.xml:3:6: Expecting (a|b)"


expect "$msp/particlesEd001.xsd" "" \
 "`elem_unexpected $msp/particlesEd001.xsd:8:12 $schema_ns all`"

expect "" "$msp/particlesFa001.xml" ""
expect "" "$msp/particlesFa002.xml" ""
expect "" "$msp/particlesFa003.xml" ""
expect "" "$msp/particlesFa004.xml" ""
expect "" "$msp/particlesFa005.xml" ""

expect "" "$msp/particlesFb001.xml" ""
expected_failure "$msp/particlesFb002.xsd" "" "test seems valid"
expect "$msp/particlesFb003.xsd" "" "f"
expect "" "$msp/particlesFb004.xml" ""
expect "$msp/particlesFb005.xsd" "" \
 "`elem_unexpected $msp/particlesFb005.xsd:15:20 $schema_ns sequence`"
expect "$msp/particlesFb006.xsd" "" \
 "`elem_unexpected $msp/particlesFb006.xsd:16:18 $schema_ns choice`"

# expect "" "$msp/particlesHa001.xml" ""
# expect "" "$msp/particlesHa002.xml" ""
# expect "" "$msp/particlesHa003.xml" ""
# expect "" "$msp/particlesHa004.xml" ""
# expect "" "$msp/particlesHa005.xml" ""
# expect "" "$msp/particlesHa006.xml" ""
# expect "" "$msp/particlesHa007.xml" ""
# expect "$msp/particlesHa008.xsd" "" "f"
# expect "" "$msp/particlesHa009.xml" ""
# expect "" "$msp/particlesHa010.xml" ""
# expect "" "$msp/particlesHa011.xml" ""
# expect "" "$msp/particlesHa012.xml" ""
# expect "" "$msp/particlesHa013.xml" ""
# expect "" "$msp/particlesHa014.xml" ""
# expect "" "$msp/particlesHa015.xml" ""
# expect "" "$msp/particlesHa016.xml" ""
# expect "" "$msp/particlesHa017.xml" ""
# expect "" "$msp/particlesHa018.xml" ""


# expect "$msp/particlesHb001.xsd" "" "f"
# expect "$msp/particlesHb002.xsd" "" "f"
# expect "$msp/particlesHb003.xsd" "" "f"
# expect "$msp/particlesHb004.xsd" "" "f"
# expect "$msp/particlesHb005.xsd" "" "f"
# expect "$msp/particlesHb006.xsd" "" "f"
# expect "$msp/particlesHb007.xsd" "" "f"
# expect "$msp/particlesHb008.xsd" "" "f"
# expect "$msp/particlesHb009.xsd" "" "f"
# expect "$msp/particlesHb010.xsd" "" "f"
# expect "$msp/particlesHb011.xsd" "" "f"


# expect "" "$msp/particlesIa001.xml" ""
# expect "" "$msp/particlesIa002.xml" ""
# expect "" "$msp/particlesIa003.xml" ""
# expect "" "$msp/particlesIa004.xml" ""
# expect "" "$msp/particlesIa005.xml" ""
# expect "$msp/particlesIa006.xsd" "" "f"
# expect "$msp/particlesIa008.xsd" "" "f"


# expect "" "$msp/particlesIb001.xml" ""
# expect "$msp/particlesIb002.xsd" "" "f"
# expect "" "$msp/particlesIb003.xml" ""
# expect "$msp/particlesIb004.xsd" "" "f"
# expect "" "$msp/particlesIb005.xml" ""
# expect "$msp/particlesIb006.xsd" "" "f"
# expect "$msp/particlesIb007.xsd" "" "f"


# expect "" "$msp/particlesIc001.xml" ""
# expect "$msp/particlesIc002.xsd" "" "f"
# expect "$msp/particlesIc003.xsd" "" "f"
# expect "$msp/particlesIc004.xsd" "" "f"
# expect "" "$msp/particlesIc005.xml" ""
# expect "" "$msp/particlesIc006.xml" ""
# expect "" "$msp/particlesIc007.xml" ""


# expect "" "$msp/particlesId001.xml" ""
# expect "" "$msp/particlesId002.xml" ""
# expect "$msp/particlesId003.xsd" "" "f"
# expect "" "$msp/particlesId004.xml" ""
# expect "" "$msp/particlesId005.xml" ""
# expect "$msp/particlesId006.xsd" "" "f"
# expect "" "$msp/particlesId007.xml" ""
# expect "" "$msp/particlesId008.xml" ""
# expect "" "$msp/particlesId009.xml" ""
# expect "" "$msp/particlesId010.xml" ""
# expect "" "$msp/particlesId011.xml" ""
# expected_failure "$msp/particlesId012.xsd" "" "Test is valid"

#### Not finished ####
fi


################
## NIST tests ##
################

num=0
while [ $num -lt ${#nist_tests[*]} ]; do
#   echo "Running NIST test: ${nist_tests[$num]}"
   eval `./extract.pl ${nist_tests[$num]}`
   num=`expr $num + 1`
done

###############
## ACT tests ##
###############

if [ x$run_act = x1            -o $run_all_tests = 1 ]; then
   expect "" "$act/basic_types-1.xml" \
     "act_testsuite/basic_types-1.xml:11:28: 03:01:03 is greater than maxExclusive (03:01:02.5)"
   expect "" "$act/basic_types-2.xml" \
     "act_testsuite/basic_types-2.xml:10:28: 04:01:02 is greater than maxInclusive (03:01:02)"
   expect "" "$act/basic_types-3.xml" \
     "act_testsuite/basic_types-3.xml:14:26: 12521 is greater than maxInclusive ( 1.25200000000000000E+04)"
   expect "" "$act/E802-003.xml" ""
   expect "" "$act/uri.xml" ""
   expect "" "$act/wf.xml" "$act/wf.xml:7:86: Name differ for closing tag (expecting test, opened line 6)"
   expect "$act/ns1.xsd" "" "$act/ns1.xsd:5:30: Unexpected element \"element\""
   expect "" "$act/empty.xml" "$act/empty.xml:3:71: Mixed content is not allowed for this element"
   expect "$act/recursive_import/import.xsd" "" ""
   expect "" "$act/elementFormDefault/doc.xml" ""
   expect "" "$act/elementFormDefault/doc2.xml" ""
   expect "$act/F427-004/xmldsig-core-schema.xsd" "$act/F427-004/dsig-example.xml" ""
fi

summary
