elena       2003/07/28 13:47:34

  Added:       java/tests/xinclude Test.java
               java/tests/xinclude/included elem.jpg elem.xml include.xml
                        include01.xml include02.xml include03.xml
                        include04.xml include05.xml include06.xml
                        include07.xml include08.xml include10.txt
                        not-well-formed.xml not.xml not2.xml text.txt
                        ue.xml ue2.xml unparsed.xml
               java/tests/xinclude/included/dir include09.xml
               java/tests/xinclude/tests test01.xml test02.xml test03.xml
                        test04.xml test05.xml test06.xml test07.xml
                        test08.xml test09.xml test10.xml test11.xml
                        test12.xml test13.xml test14.xml test15.xml
                        test16.xml test17.xml test18.xml test19.xml
                        test20.xml test21.xml test22.xml test23.xml
                        test24.xml test25.xml test26.xml test27.xml
                        test28.xml test29.xml test30.xml test31.xml
                        test32.xml test33.xml tests.dtd tests.xsd
  Log:
  Commit the tests for XInclude implementation.
  Submitter: Peter McCracken
  
  Revision  Changes    Path
  1.1                  xml-xerces/java/tests/xinclude/Test.java
  
  Index: Test.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Xerces" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation and was
   * originally based on software copyright (c) 2003, International
   * Business Machines, Inc., http://www.apache.org.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package xinclude;
  
  import java.io.FileOutputStream;
  import java.io.IOException;
  import java.io.OutputStream;
  import java.io.PrintWriter;
  
  import org.apache.xerces.parsers.XIncludeParserConfiguration;
  import org.apache.xerces.xni.XNIException;
  import org.apache.xerces.xni.parser.XMLErrorHandler;
  import org.apache.xerces.xni.parser.XMLInputSource;
  import org.apache.xerces.xni.parser.XMLParseException;
  import org.apache.xerces.xni.parser.XMLParserConfiguration;
  
  import xni.Writer;
  
  /**
   * Tests for XInclude implementation.
   * Use -f option to see the error message log
   * @author Peter McCracken, IBM
   */
  public class Test implements XMLErrorHandler {
      /** Namespaces feature id (http://xml.org/sax/features/namespaces). */
      protected static final String NAMESPACES_FEATURE_ID =
          "http://xml.org/sax/features/namespaces";;
  
      /** Validation feature id (http://xml.org/sax/features/validation). */
      protected static final String VALIDATION_FEATURE_ID =
          "http://xml.org/sax/features/validation";;
  
      /** Schema validation feature id 
(http://apache.org/xml/features/validation/schema). */
      protected static final String SCHEMA_VALIDATION_FEATURE_ID =
          "http://apache.org/xml/features/validation/schema";;
  
      /** Schema full checking feature id 
(http://apache.org/xml/features/validation/schema-full-checking). */
      protected static final String SCHEMA_FULL_CHECKING_FEATURE_ID =
          "http://apache.org/xml/features/validation/schema-full-checking";;
  
      /** Property identifier: error handler. */
      protected static final String ERROR_HANDLER =
          "http://apache.org/xml/properties/internal/error-handler";;
  
      protected static PrintWriter log = null;
      protected static boolean useLog = false;
      protected static String logFile = null;
  
      // this array contains whether the test number NN (contained in file testNN.xml)
      // is meant to be a pass or fail test
      // true means the test should pass
      private static boolean[] TEST_RESULTS = new boolean[] {
          // one value for each test
          true, true, true, true, true, true, false, true, false, true, // 10
          false, false, false, false, true, true, true, false, true, true, // 20
          true, false, true, false, false, false, true, true, false, true, // 30
          true, false, true, };
  
      public static void main(String[] args) {
          XMLParserConfiguration parserConfig = new XIncludeParserConfiguration();
          parserConfig.setFeature(NAMESPACES_FEATURE_ID, true);
          parserConfig.setFeature(SCHEMA_VALIDATION_FEATURE_ID, true);
          parserConfig.setFeature(SCHEMA_FULL_CHECKING_FEATURE_ID, true);
  
          Writer writer = null;
          int firstTest = 0;
  
          if (args.length > 0) {
              if (args[0].equals("-f")) {
                  useLog = true;
                  if (args.length > 1) {
                      try {
                          logFile = args[1];
                          log = new PrintWriter(new FileOutputStream(logFile));
                          firstTest = 2;
                      }
                      catch (IOException e) {
                          System.err.println(
                              "Error initializing XInclude tests.");
                          System.err.println(
                              "Couldn't initialize log file: " + logFile);
                          e.printStackTrace(System.err);
                          printUsage();
                          System.err.println();
                          System.err.println("XInclude testing aborted");
                          System.exit(1);
                      }
                  }
                  else {
                      printUsage();
                      System.exit(1);
                  }
              }
          }
  
          try {
              // We'll just ignore the output, for now.
              // Later, we when output relative URIs instead of absolute ones,
              // we can actually compare output to a set of expected outputs.
              OutputStream output = new OutputStream() {
                  public void write(int b) throws IOException {
                  }
              };
              writer = new Writer(parserConfig);
              writer.setOutput(output, "UTF8");
              parserConfig.setProperty(ERROR_HANDLER, new Test());
          }
          catch (Exception e) {
              System.err.println("Error initializing XInclude tests");
              if (useLog) {
                  e.printStackTrace(log);
              }
              printDetailsMessage();
              System.err.println("XInclude testing aborted");
              System.exit(1);
          }
  
          int totalFailures = 0;
          int totalTests = 0;
          if (firstTest >= args.length) {
              for (int i = firstTest; i < TEST_RESULTS.length; i++) {
                  totalTests++;
                  if (!runTest(i + 1, writer)) {
                      totalFailures++;
                  }
              }
          }
          else {
              for (int i = firstTest; i < args.length; i++) {
                  int testnum = Integer.parseInt(args[i]);
                  totalTests++;
                  if (!runTest(testnum, writer)) {
                      totalFailures++;
                  }
              }
          }
          
          if (log != null) {
              log.close();
          }
          
          if (totalFailures == 0) {
              System.out.println("All XInclude Tests Passed");
          }
          else {
              System.err.println(
                  "Total failures for XInclude: "
                      + totalFailures
                      + "/"
                      + totalTests);
              printDetailsMessage();
              System.exit(1);
          }
      }
  
      private static boolean runTest(int testnum, Writer writer) {
          String testname = "tests/xinclude/tests/test";
          if (testnum < 10) {
              testname += "0" + testnum;
          }
          else {
              testname += testnum;
          }
          testname += ".xml";
  
          try {
              writer.parse(new XMLInputSource(null, testname, null));
              if (TEST_RESULTS[testnum - 1]) {
                  if (useLog) {
                      log.println("PASS: " + testname);
                  }
                  return true;
              }
              else {
                  if (useLog) {
                      log.println("FAIL: " + testname);
                  }
                  return false;
              }
          }
          catch (XNIException e) {
              if (TEST_RESULTS[testnum - 1]) {
                  if (useLog) {
                      log.println("FAIL: " + testname);
                  }
                  return false;
              }
              else {
                  if (useLog) {
                      log.println("PASS: " + testname);
                  }
                  return true;
              }
          }
          catch (IOException e) {
              if (useLog) {
                  log.println("Unexpected IO problem: " + e);
                  log.println("FAIL: " + testname);
              }
              return false;
          }
      }
      /* (non-Javadoc)
       * @see org.apache.xerces.xni.parser.XMLErrorHandler#error(java.lang.String, 
java.lang.String, org.apache.xerces.xni.parser.XMLParseException)
       */
      public void error(String domain, String key, XMLParseException exception)
          throws XNIException {
          printError("Error", exception);
      }
  
      /* (non-Javadoc)
       * @see 
org.apache.xerces.xni.parser.XMLErrorHandler#fatalError(java.lang.String, 
java.lang.String, org.apache.xerces.xni.parser.XMLParseException)
       */
      public void fatalError(
          String domain,
          String key,
          XMLParseException exception)
          throws XNIException {
          printError("Fatal Error", exception);
      }
  
      /* (non-Javadoc)
       * @see org.apache.xerces.xni.parser.XMLErrorHandler#warning(java.lang.String, 
java.lang.String, org.apache.xerces.xni.parser.XMLParseException)
       */
      public void warning(String domain, String key, XMLParseException exception)
          throws XNIException {
          printError("Warning", exception);
      }
  
      private static void printUsage() {
          System.out.println("java xinclude.Test [-f file] [TESTS]");
          System.out.println(
              "  -f file : specifies a log file to print detailed error messages to.");
          System.out.println(
              "            If this option is absent, the messages will not be 
output.");
          System.out.println(
              "    TESTS : a space separated list of tests to run, specified by test 
number.");
          System.out.println(
              "          : If this is absent, all tests will be run.");
      }
  
      private static void printDetailsMessage() {
          if (useLog) {
              System.err.println("See file " + logFile + " for details");
          }
          else {
              System.err.println("Re-run with -f option to get details.");
          }
      }
  
      /** Prints the error message. */
      protected void printError(String type, XMLParseException ex) {
          if (!useLog)
              return;
          log.print("[");
          log.print(type);
          log.print("] ");
          String systemId = ex.getExpandedSystemId();
          if (systemId != null) {
              int index = systemId.lastIndexOf('/');
              if (index != -1)
                  systemId = systemId.substring(index + 1);
              log.print(systemId);
          }
          log.print(':');
          log.print(ex.getLineNumber());
          log.print(':');
          log.print(ex.getColumnNumber());
          log.print(": ");
          log.print(ex.getMessage());
          log.println();
          log.flush();
      } // printError(String,XMLParseException)
  }
  
  
  
  1.1                  xml-xerces/java/tests/xinclude/included/elem.jpg
  
        <<Binary file>>
  
  
  1.1                  xml-xerces/java/tests/xinclude/included/elem.xml
  
  Index: elem.xml
  ===================================================================
  <?xml version="1.0"?>
  <elem xmlns="http://www.schemaTest.org/xinclude-test"/>
  
  
  1.1                  xml-xerces/java/tests/xinclude/included/include.xml
  
  Index: include.xml
  ===================================================================
  <?xml version="1.0"?>
  <include xmlns="http://www.w3.org/2001/XInclude";
           href="elem.xml"/>
  
  
  1.1                  xml-xerces/java/tests/xinclude/included/include01.xml
  
  Index: include01.xml
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1"?>
  <xi1:include xmlns:xi1="http://www.w3.org/2001/XInclude";
                         xmlns:abc="asdfasdfasdf"
              href="include02.xml"/>
  
  
  1.1                  xml-xerces/java/tests/xinclude/included/include02.xml
  
  Index: include02.xml
  ===================================================================
  <?xml version='1.0'?>
  <xi2:include xmlns:xi2="http://www.w3.org/2001/XInclude";
                         xmlns:abc="asdfasdfasdf" href="include03.xml"/>
  
  
  1.1                  xml-xerces/java/tests/xinclude/included/include03.xml
  
  Index: include03.xml
  ===================================================================
  <?xml version='1.0'?>
  <xi3:include xmlns:xi3="http://www.w3.org/2001/XInclude";
                         xmlns:abc="asdfasdfasdf" href="include04.xml"/>
  
  
  1.1                  xml-xerces/java/tests/xinclude/included/include04.xml
  
  Index: include04.xml
  ===================================================================
  <?xml version='1.0'?>
  <xi4:include xmlns:xi4="http://www.w3.org/2001/XInclude";
                         xmlns:abc="asdfasdfasdf" href="include05.xml"/>
  
  
  1.1                  xml-xerces/java/tests/xinclude/included/include05.xml
  
  Index: include05.xml
  ===================================================================
  <?xml version='1.0'?>
  <xi5:include xmlns:xi5="http://www.w3.org/2001/XInclude";
                         xmlns:abc="asdfasdfasdf" href="include06.xml"/>
  
  
  1.1                  xml-xerces/java/tests/xinclude/included/include06.xml
  
  Index: include06.xml
  ===================================================================
  <?xml version='1.0'?>
  <xi6:include xmlns:xi6="http://www.w3.org/2001/XInclude"; href="include07.xml"/>
  
  
  1.1                  xml-xerces/java/tests/xinclude/included/include07.xml
  
  Index: include07.xml
  ===================================================================
  <?xml version='1.0'?>
  <xi7:include xmlns:xi7="http://www.w3.org/2001/XInclude"; href="include08.xml"/>
  
  
  1.1                  xml-xerces/java/tests/xinclude/included/include08.xml
  
  Index: include08.xml
  ===================================================================
  <?xml version='1.0'?>
  <xi8:include xmlns:xi8="http://www.w3.org/2001/XInclude"; href="dir/include09.xml"/>
  
  
  1.1                  xml-xerces/java/tests/xinclude/included/include10.txt
  
  Index: include10.txt
  ===================================================================
  Text3
  
  
  1.1                  xml-xerces/java/tests/xinclude/included/not-well-formed.xml
  
  Index: not-well-formed.xml
  ===================================================================
  <this is not XML>
  
  
  1.1                  xml-xerces/java/tests/xinclude/included/not.xml
  
  Index: not.xml
  ===================================================================
  <?xml version='1.0'?>
  <!DOCTYPE elem SYSTEM "../tests/tests.dtd">
  <elem bar="jpg"
        xmlns="http://www.schemaTest.org/xinclude-test"/>
  
  
  1.1                  xml-xerces/java/tests/xinclude/included/not2.xml
  
  Index: not2.xml
  ===================================================================
  <?xml version='1.0'?>
  <!DOCTYPE elem [
  <!ELEMENT elem EMPTY>
  <!ATTLIST elem
        xmlns    CDATA          #FIXED "http://www.schemaTest.org/xinclude-test";
        xml:base CDATA          #IMPLIED
        foo      ENTITY         #IMPLIED
        bar      NOTATION (jpg) #IMPLIED>
  <!NOTATION jpg SYSTEM "jpg">
  ]>
  <elem bar="jpg"
        xmlns="http://www.schemaTest.org/xinclude-test"/>
  
  
  1.1                  xml-xerces/java/tests/xinclude/included/text.txt
  
  Index: text.txt
  ===================================================================
  blah blah blah
  
  
  1.1                  xml-xerces/java/tests/xinclude/included/ue.xml
  
  Index: ue.xml
  ===================================================================
  <?xml version='1.0'?>
  <!DOCTYPE elem SYSTEM "../tests/tests.dtd">
  <elem foo="image"
        xmlns="http://www.schemaTest.org/xinclude-test"/>
  
  
  1.1                  xml-xerces/java/tests/xinclude/included/ue2.xml
  
  Index: ue2.xml
  ===================================================================
  <?xml version='1.0'?>
  <!DOCTYPE elem [
  <!ELEMENT elem EMPTY>
  <!ATTLIST elem
        xmlns     CDATA          #FIXED "http://www.schemaTest.org/xinclude-test";
        foo       ENTITY         #IMPLIED
        bar       NOTATION (jpg) #IMPLIED>
  <!NOTATION jpg SYSTEM "jpg">
  <!ENTITY image SYSTEM "foobar.jpg" NDATA jpg>
  ]>
  <elem foo="image"
        xmlns="http://www.schemaTest.org/xinclude-test"/>
  
  
  1.1                  xml-xerces/java/tests/xinclude/included/unparsed.xml
  
  Index: unparsed.xml
  ===================================================================
  <?xml version='1.0'?>
  <!DOCTYPE view [
   <!ELEMENT view EMPTY>
   <!NOTATION xjpg SYSTEM "jpg">
   <!ENTITY image SYSTEM "gris.jpg" NDATA xjpg>
   <!ATTLIST view sun ENTITY #IMPLIED>]>
  <view sun="image"/>
  
  
  1.1                  xml-xerces/java/tests/xinclude/included/dir/include09.xml
  
  Index: include09.xml
  ===================================================================
  <?xml version='1.0'?>
  <!-- tests that files included from other directories work -->
  <include xmlns="http://www.w3.org/2001/XInclude"; href="invalid.xml">
        <fallback><child3 xmlns="" name="kid3"><desc><include 
xmlns="http://www.w3.org/2001/XInclude"; href="../include10.txt" parse="text">
        <fallback>
                <!-- this fallback won't be used -->
                <child4 name="kid4">
                        <desc>Text4</desc>
                </child4>
        </fallback></include></desc></child3></fallback>
  </include>
  
  
  1.1                  xml-xerces/java/tests/xinclude/tests/test01.xml
  
  Index: test01.xml
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1"?>
  <!-- This test doesn't test anything in particular.  But it is an example of a
       somewhat complicated setup. -->
  <xit:myRoot   xmlns:xit="http://www.schemaTest.org/xinclude-test";
              xmlns:xi="http://www.w3.org/2001/XInclude";
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
              xsi:schemaLocation="http://www.schemaTest.org/xinclude-test tests.xsd">
        <xi:include xmlns:test01="http://www.test.org/test02"; 
href="../included/invalid.xml">
                <!-- comment -->
                <xi:fallback xmlns:test02="http://www.test.org/test02";>
                        <xi:include href="../included/invalid.xml">
                                <invalid1 xmlns:test03="http://www.test.org/test03";>
                                        <invalid2>                              
                                        </invalid2>
                                </invalid1>
                                <xi:fallback xmlns:test02="http://www.test.org/TEST02";>
                                        <child1 name="kid1"><desc>Text1</desc></child1>
                                </xi:fallback>
                        </xi:include>
                </xi:fallback>
        </xi:include>
        <xi:include href="../included/invalid.xml">
                <xi:fallback>
                        <child2 name="kid2"><desc>Text2</desc></child2>
                </xi:fallback>
        </xi:include>
        
        <!-- this tests a valid include -->
        <xi:include href="../included/include01.xml" parse="xml">
                <xi:fallback>
                        <!-- this should be ignored -->
                        <child2>Text2</child2>
                </xi:fallback>  
        </xi:include>
        
        <!-- this tests that idrefs still work when an ID from an included file is 
used -->
        <select name="kid3"/>
        
        <!-- this tests when an included file has a DTD, but the base file doesn't -->
        <xi:include href="../included/unparsed.xml"><xi:fallback/></xi:include>
  </xit:myRoot>
  
  
  1.1                  xml-xerces/java/tests/xinclude/tests/test02.xml
  
  Index: test02.xml
  ===================================================================
  <?xml version="1.0"?>
  <x xmlns="http://www.schemaTest.org/xinclude-test";
     xmlns:xi="http://www.w3.org/2001/XInclude";
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
     xsi:schemaLocation="http://www.schemaTest.org/xinclude-test tests.xsd">
     <!-- tests that attributes from other namespaces on xi:include elements are 
ignored -->
     <xi:include foo="bar"
                 parse="xml"
                 href="../included/elem.xml"/>
  </x>
  
  
  
  1.1                  xml-xerces/java/tests/xinclude/tests/test03.xml
  
  Index: test03.xml
  ===================================================================
  <?xml version="1.0"?>
  <x xmlns="http://www.schemaTest.org/xinclude-test";
     xmlns:xi="http://www.w3.org/2001/XInclude";
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
     xsi:schemaLocation="http://www.schemaTest.org/xinclude-test tests.xsd">
     <!-- tests that attributes from the XInclude namespace are ignored -->
     <xi:include parse="xml"
                 href="../included/elem.xml"
                 xi:foo="bar"/>
  </x>
  
  
  
  1.1                  xml-xerces/java/tests/xinclude/tests/test04.xml
  
  Index: test04.xml
  ===================================================================
  <?xml version="1.0"?>
  <x xmlns="http://www.schemaTest.org/xinclude-test";
     xmlns:xi="http://www.w3.org/2001/XInclude";
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
     xsi:schemaLocation="http://www.schemaTest.org/xinclude-test tests.xsd">
     <!-- thats that parse="xml" works -->
     <xi:include parse="xml"
                 href="../included/elem.xml"/>
  </x>
  
  
  
  1.1                  xml-xerces/java/tests/xinclude/tests/test05.xml
  
  Index: test05.xml
  ===================================================================
  <?xml version="1.0"?>
  <x xmlns="http://www.schemaTest.org/xinclude-test";
     xmlns:xi="http://www.w3.org/2001/XInclude";
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
     xsi:schemaLocation="http://www.schemaTest.org/xinclude-test tests.xsd">
     <!-- tests that parse="text" works -->
     <xi:include parse="text"
                 href="../included/text.txt"/>
  </x>
  
  
  
  1.1                  xml-xerces/java/tests/xinclude/tests/test06.xml
  
  Index: test06.xml
  ===================================================================
  <?xml version="1.0"?>
  <x xmlns="http://www.schemaTest.org/xinclude-test";
     xmlns:xi="http://www.w3.org/2001/XInclude";
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
     xsi:schemaLocation="http://www.schemaTest.org/xinclude-test tests.xsd">
     <!-- tests that parse="xml" is the default -->
     <xi:include href="../included/elem.xml"/>
  </x>
  
  
  
  1.1                  xml-xerces/java/tests/xinclude/tests/test07.xml
  
  Index: test07.xml
  ===================================================================
  <?xml version="1.0"?>
  <x xmlns="http://www.schemaTest.org/xinclude-test";
     xmlns:xi="http://www.w3.org/2001/XInclude";
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
     xsi:schemaLocation="http://www.schemaTest.org/xinclude-test tests.xsd">
     <!-- tests that values for parse other than "xml" or "text" are invalid -->
     <!-- EXPECT FAILURE -->
     <xi:include parse="xxx"
                 href="../included/elem.xml"/>
  </x>
  
  
  
  1.1                  xml-xerces/java/tests/xinclude/tests/test08.xml
  
  Index: test08.xml
  ===================================================================
  <?xml version="1.0"?>
  <x xmlns="http://www.schemaTest.org/xinclude-test";
     xmlns:xi="http://www.w3.org/2001/XInclude";
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
     xsi:schemaLocation="http://www.schemaTest.org/xinclude-test tests.xsd">
     <!-- tests that 0 fallbacks is not a failure when the include is successful -->
     <xi:include parse="xml"
                 href="../included/elem.xml"/>
  </x>
  
  
  
  1.1                  xml-xerces/java/tests/xinclude/tests/test09.xml
  
  Index: test09.xml
  ===================================================================
  <?xml version="1.0"?>
  <x xmlns="http://www.schemaTest.org/xinclude-test";
     xmlns:xi="http://www.w3.org/2001/XInclude";
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
     xsi:schemaLocation="http://www.schemaTest.org/xinclude-test tests.xsd">
     <!-- tests that 0 fallbacks is a failure when the include is unsuccessful -->
     <!-- EXPECT FAILURE -->
     <xi:include parse="xml"
                 href="../included/invalid.xml"/>
  </x>
  
  
  
  1.1                  xml-xerces/java/tests/xinclude/tests/test10.xml
  
  Index: test10.xml
  ===================================================================
  <?xml version="1.0"?>
  <x xmlns="http://www.schemaTest.org/xinclude-test";
     xmlns:xi="http://www.w3.org/2001/XInclude";
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
     xsi:schemaLocation="http://www.schemaTest.org/xinclude-test tests.xsd">
     <!-- tests that a fallback is used when the include is unsuccessful -->
     <xi:include parse="xml"
                 href="../included/elem.xml">
         <xi:fallback>
             <elem/>
         </xi:fallback>
     </xi:include>
  </x>
  
  
  
  1.1                  xml-xerces/java/tests/xinclude/tests/test11.xml
  
  Index: test11.xml
  ===================================================================
  <?xml version="1.0"?>
  <x xmlns="http://www.schemaTest.org/xinclude-test";
     xmlns:xi="http://www.w3.org/2001/XInclude";
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
     xsi:schemaLocation="http://www.schemaTest.org/xinclude-test tests.xsd">
     <!-- tests that 2 fallbacks cause a failure when the include is successful -->
     <!-- EXPECT FAILURE -->
     <xi:include parse="xml"
                 href="../included/elem.xml">
         <xi:fallback/>
         <xi:fallback/>
     </xi:include>
  </x>
  
  
  
  1.1                  xml-xerces/java/tests/xinclude/tests/test12.xml
  
  Index: test12.xml
  ===================================================================
  <?xml version="1.0"?>
  <x xmlns="http://www.schemaTest.org/xinclude-test";
     xmlns:xi="http://www.w3.org/2001/XInclude";
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
     xsi:schemaLocation="http://www.schemaTest.org/xinclude-test tests.xsd">
     <!-- tests that 2 fallbacks cause a failure when the include is unsuccessful -->
     <!-- EXPECT FAILURE -->
     <xi:include parse="xml"
                 href="../included/invalid.xml">
         <xi:fallback/>
         <xi:fallback/>
     </xi:include>
  </x>
  
  
  
  1.1                  xml-xerces/java/tests/xinclude/tests/test13.xml
  
  Index: test13.xml
  ===================================================================
  <?xml version="1.0"?>
  <x xmlns="http://www.schemaTest.org/xinclude-test";
     xmlns:xi="http://www.w3.org/2001/XInclude";
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
     xsi:schemaLocation="http://www.schemaTest.org/xinclude-test tests.xsd">
     <!-- tests that other elements from xi namespace are not allowed when include is 
successful -->
     <!-- EXPECT FAILURE -->
     <xi:include parse="xml"
                 href="../included/elem.xml">
         <xi:other/>
     </xi:include>
  </x>
  
  
  
  1.1                  xml-xerces/java/tests/xinclude/tests/test14.xml
  
  Index: test14.xml
  ===================================================================
  <?xml version="1.0"?>
  <x xmlns="http://www.schemaTest.org/xinclude-test";
     xmlns:xi="http://www.w3.org/2001/XInclude";
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
     xsi:schemaLocation="http://www.schemaTest.org/xinclude-test tests.xsd">
     <!-- tests that other elements from xi namespace are not allowed when include is 
successful -->
     <!-- EXPECT FAILURE -->
     <xi:include parse="xml"
                 href="../included/invalid.xml">
         <xi:other/>
     </xi:include>
  </x>
  
  
  
  1.1                  xml-xerces/java/tests/xinclude/tests/test15.xml
  
  Index: test15.xml
  ===================================================================
  <?xml version="1.0"?>
  <x xmlns="http://www.schemaTest.org/xinclude-test";
     xmlns:xi="http://www.w3.org/2001/XInclude";
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
     xsi:schemaLocation="http://www.schemaTest.org/xinclude-test tests.xsd">
     <!-- test that parser can be reused -->
     <xi:include href="../included/elem.xml"/>
     <xi:include href="../included/elem.xml"/>
     <xi:include href="../included/elem.xml"/>
  </x>
  
  
  
  1.1                  xml-xerces/java/tests/xinclude/tests/test16.xml
  
  Index: test16.xml
  ===================================================================
  <?xml version="1.0"?>
  <x xmlns="http://www.schemaTest.org/xinclude-test";
     xmlns:xi="http://www.w3.org/2001/XInclude";
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
     xsi:schemaLocation="http://www.schemaTest.org/xinclude-test tests.xsd">
     <!-- included file includes another file -->
     <xi:include parse="xml"
                 href="../included/include.xml"/>
  </x>
  
  
  
  1.1                  xml-xerces/java/tests/xinclude/tests/test17.xml
  
  Index: test17.xml
  ===================================================================
  <?xml version="1.0"?>
  <x xmlns="http://www.schemaTest.org/xinclude-test";
     xmlns:xi="http://www.w3.org/2001/XInclude";
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
     xsi:schemaLocation="http://www.schemaTest.org/xinclude-test tests.xsd">
     <!-- test that empty fallback is valid -->
     <xi:include parse="xml"
                 href="../included/elem.xml">
         <xi:fallback/>
     </xi:include>
  </x>
  
  
  
  1.1                  xml-xerces/java/tests/xinclude/tests/test18.xml
  
  Index: test18.xml
  ===================================================================
  <?xml version="1.0"?>
  <x xmlns="http://www.schemaTest.org/xinclude-test";
     xmlns:xi="http://www.w3.org/2001/XInclude";
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
     xsi:schemaLocation="http://www.schemaTest.org/xinclude-test tests.xsd">
     <!-- tests that fallback must be child of include -->
     <!-- EXPECT FAILURE -->
     <xi:fallback/>
     <xi:include parse="xml"
                 href="../included/elem.xml"/>
  </x>
  
  
  
  1.1                  xml-xerces/java/tests/xinclude/tests/test19.xml
  
  Index: test19.xml
  ===================================================================
  <?xml version="1.0"?>
  <x xmlns="http://www.schemaTest.org/xinclude-test";
     xmlns:xi="http://www.w3.org/2001/XInclude";
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
     xsi:schemaLocation="http://www.schemaTest.org/xinclude-test tests.xsd">
     <!-- test including XML as text -->
     <xi:include parse="text"
                 href="../included/elem.xml"/>
  </x>
  
  
  
  1.1                  xml-xerces/java/tests/xinclude/tests/test20.xml
  
  Index: test20.xml
  ===================================================================
  <?xml version="1.0"?>
  <x xmlns="http://www.schemaTest.org/xinclude-test";
     xmlns:xi="http://www.w3.org/2001/XInclude";
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
     xsi:schemaLocation="http://www.schemaTest.org/xinclude-test tests.xsd">
     <!-- test including file with different MIME-type as XML -->
     <xi:include parse="xml"
                 href="../included/elem.jpg"/>
  </x>
  
  
  
  1.1                  xml-xerces/java/tests/xinclude/tests/test21.xml
  
  Index: test21.xml
  ===================================================================
  <?xml version="1.0"?>
  <x xmlns="http://www.schemaTest.org/xinclude-test";
     xmlns:xi="http://www.w3.org/2001/XInclude";
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
     xsi:schemaLocation="http://www.schemaTest.org/xinclude-test tests.xsd">
     <!-- test including file with different MIME-type as text -->
     <xi:include parse="text"
                 href="../included/elem.jpg"/>
  </x>
  
  
  
  1.1                  xml-xerces/java/tests/xinclude/tests/test22.xml
  
  Index: test22.xml
  ===================================================================
  <?xml version="1.0"?>
  <x xmlns="http://www.schemaTest.org/xinclude-test";
     xmlns:xi="http://www.w3.org/2001/XInclude";
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
     xsi:schemaLocation="http://www.schemaTest.org/xinclude-test tests.xsd">
     <!-- include not well formed XML -->
     <!-- EXPECT FAILURE -->
     <xi:include parse="xml"
                 href="../included/not-well-formed.xml"/>
  </x>
  
  
  
  1.1                  xml-xerces/java/tests/xinclude/tests/test23.xml
  
  Index: test23.xml
  ===================================================================
  <?xml version="1.0"?>
  <x xmlns="http://www.schemaTest.org/xinclude-test";
     xmlns:xi="http://www.w3.org/2001/XInclude";
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
     xsi:schemaLocation="http://www.schemaTest.org/xinclude-test tests.xsd">
     <!-- including the same document, but as text -->
     <xi:include parse="text"
                 href="test24.xml"/>
  </x>
  
  
  
  1.1                  xml-xerces/java/tests/xinclude/tests/test24.xml
  
  Index: test24.xml
  ===================================================================
  <?xml version="1.0"?>
  <x xmlns="http://www.schemaTest.org/xinclude-test";
     xmlns:xi="http://www.w3.org/2001/XInclude";
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
     xsi:schemaLocation="http://www.schemaTest.org/xinclude-test tests.xsd">
     <!-- test that including the same document fails -->
     <!-- EXPECT FAILURE -->
     <xi:include parse="xml"
                 href="test24.xml"/>
  </x>
  
  
  
  1.1                  xml-xerces/java/tests/xinclude/tests/test25.xml
  
  Index: test25.xml
  ===================================================================
  <?xml version="1.0"?>
  <x xmlns="http://www.schemaTest.org/xinclude-test";
     xmlns:xi="http://www.w3.org/2001/XInclude";
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
     xsi:schemaLocation="http://www.schemaTest.org/xinclude-test tests.xsd">
     <!-- test including a resource that isn't there, when parse="xml" -->
     <!-- EXPECT FAILURE -->
     <xi:include parse="xml"
                 href="../included/invalid.xml"/>
  </x>
  
  
  
  1.1                  xml-xerces/java/tests/xinclude/tests/test26.xml
  
  Index: test26.xml
  ===================================================================
  <?xml version="1.0"?>
  <x xmlns="http://www.schemaTest.org/xinclude-test";
     xmlns:xi="http://www.w3.org/2001/XInclude";
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
     xsi:schemaLocation="http://www.schemaTest.org/xinclude-test tests.xsd">
     <!-- test including a resource that isn't there, when parse="text" -->
     <!-- EXPECT FAILURE -->
     <xi:include parse="text"
                 href="../included/invalid.xml"/>
  </x>
  
  
  
  1.1                  xml-xerces/java/tests/xinclude/tests/test27.xml
  
  Index: test27.xml
  ===================================================================
  <?xml version='1.0'?>
  <!DOCTYPE x SYSTEM "tests.dtd">
  <x xmlns="http://www.schemaTest.org/xinclude-test";
     xmlns:xi="http://www.w3.org/2001/XInclude";
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
     xsi:schemaLocation="http://www.schemaTest.org/xinclude-test tests.xsd">
     <elem bar="xjpg"/>
     <!-- test including a document with a non-conflicting notation -->
     <xi:include parse="xml"
                 href="../included/not.xml"/>
  </x>
  
  
  
  1.1                  xml-xerces/java/tests/xinclude/tests/test28.xml
  
  Index: test28.xml
  ===================================================================
  <?xml version='1.0'?>
  <!DOCTYPE x SYSTEM "tests.dtd">
  <x xmlns="http://www.schemaTest.org/xinclude-test";
     xmlns:xi="http://www.w3.org/2001/XInclude";
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
     xsi:schemaLocation="http://www.schemaTest.org/xinclude-test tests.xsd">
     <elem bar="jpg"/>
     <!-- test including a document with a duplicate notation -->
     <xi:include parse="xml"
                 href="../included/not.xml"/>
  </x>
  
  
  1.1                  xml-xerces/java/tests/xinclude/tests/test29.xml
  
  Index: test29.xml
  ===================================================================
  <?xml version='1.0'?>
  <!DOCTYPE x SYSTEM "tests.dtd">
  <x xmlns="http://www.schemaTest.org/xinclude-test";
     xmlns:xi="http://www.w3.org/2001/XInclude";
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
     xsi:schemaLocation="http://www.schemaTest.org/xinclude-test tests.xsd">
     <elem bar="jpg"/>
     <!-- test including a document with a conflicting notation -->
     <!-- EXPECT FAILURE -->
     <xi:include parse="xml"
                 href="../included/not2.xml"/>
  </x>
  
  
  1.1                  xml-xerces/java/tests/xinclude/tests/test30.xml
  
  Index: test30.xml
  ===================================================================
  <?xml version="1.0"?>
  <!DOCTYPE x SYSTEM "tests.dtd">
  <x xmlns="http://www.schemaTest.org/xinclude-test";
     xmlns:xi="http://www.w3.org/2001/XInclude";
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
     xsi:schemaLocation="http://www.schemaTest.org/xinclude-test tests.xsd">
     <!-- including document with non-conflicting unparsed entity -->
     <elem foo="ximage"/>
     <xi:include parse="xml"
                 href="../included/ue.xml"/>
  </x>
  
  
  
  1.1                  xml-xerces/java/tests/xinclude/tests/test31.xml
  
  Index: test31.xml
  ===================================================================
  <?xml version="1.0"?>
  <!DOCTYPE x SYSTEM "tests.dtd">
  <x xmlns="http://www.schemaTest.org/xinclude-test";
     xmlns:xi="http://www.w3.org/2001/XInclude";
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
     xsi:schemaLocation="http://www.schemaTest.org/xinclude-test tests.xsd">
     <!-- including document with duplicate unparsed entity -->
     <elem foo="image"/>
     <xi:include parse="xml"
                 href="../included/ue.xml"/>
  </x>
  
  
  
  1.1                  xml-xerces/java/tests/xinclude/tests/test32.xml
  
  Index: test32.xml
  ===================================================================
  <?xml version="1.0"?>
  <!DOCTYPE x SYSTEM "tests.dtd">
  <x xmlns="http://www.schemaTest.org/xinclude-test";
     xmlns:xi="http://www.w3.org/2001/XInclude";
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
     xsi:schemaLocation="http://www.schemaTest.org/xinclude-test tests.xsd">
     <!-- test including document with conflicting unparsed entity -->
     <!-- Note: this actually fails because of the conflicting notation; I'm not
          sure how to make a conflicting unparsed entity without having a conflicting
          notation -->
     <!-- EXPECT FAILURE -->
     <elem foo="image"/>
     <xi:include parse="xml"
                 href="../included/ue2.xml"/>
  </x>
  
  
  1.1                  xml-xerces/java/tests/xinclude/tests/test33.xml
  
  Index: test33.xml
  ===================================================================
  <?xml version="1.0"?>
  <x xmlns="http://www.schemaTest.org/xinclude-test";
     xmlns:xi="http://www.w3.org/2001/XInclude";
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
     xsi:schemaLocation="http://www.schemaTest.org/xinclude-test tests.xsd">
     <!-- including document with a DTD, and unparsed entities and notations,
          when the root document doesn't have one -->
     <xi:include parse="xml"
                 href="../included/ue.xml"/>
  </x>
  
  
  
  1.1                  xml-xerces/java/tests/xinclude/tests/tests.dtd
  
  Index: tests.dtd
  ===================================================================
  <?xml version='1.0' encoding="UTF-8"?>
  <!NOTATION jpg SYSTEM "jpg">
  <!NOTATION xjpg SYSTEM "jpg">
  <!ENTITY image SYSTEM "foobar.jpg" NDATA jpg>
  <!ENTITY ximage SYSTEM "foobar.jpg" NDATA xjpg>
  
  
  1.1                  xml-xerces/java/tests/xinclude/tests/tests.xsd
  
  Index: tests.xsd
  ===================================================================
  <?xml version="1.0"?>
  <schema xmlns="http://www.w3.org/2001/XMLSchema";
        xmlns:xml="http://www.w3.org/XML/1998/namespace";
        targetNamespace="http://www.schemaTest.org/xinclude-test";
        xmlns:xit="http://www.schemaTest.org/xinclude-test";>
  
  <import namespace="http://www.w3.org/XML/1998/namespace";
          schemaLocation="file:///C:/eclipse/workspace/xinclude/files/xml.xsd"/>
  
  <!-- used for test01.xml -->
  <complexType name="childType" mixed="true">
        <sequence>
                <element name="desc">
                        <simpleType>
                                <restriction base="string">
                                        <pattern value="Text\d"/>
                                </restriction>
                        </simpleType>
                </element>
        </sequence>
        <attribute name="name" type="ID"/>
        <attribute ref="xml:base"/>
  </complexType>
  
  <!-- used for test01.xml -->
  <complexType name="selectType">
        <attribute name="name" type="IDREF"/>
  </complexType>
  
  <!-- used for test01.xml -->
  <element name="myRoot">
        <complexType>
                <sequence>
                        <element name="child1" type="xit:childType"/>
                        <element name="child2" type="xit:childType"/>           
                        <element name="child3" type="xit:childType"/>
                        <element name="select" type="xit:selectType"/>
                        <element name="view">
                                <complexType>
                                        <attribute ref="xml:base"/>
                                        <attribute name="sun" type="string"/>
                                </complexType>
                        </element>
                </sequence>
        </complexType>
  </element>
  
  <attribute name="foo" type="string"/>
  
  <attribute name="bar" type="string"/>
  
  <element name="elem">
        <complexType>
                <attribute name="foo" type="string"/>
                <attribute name="bar" type="string"/>
                <attribute ref="xml:base"/>
        </complexType>
  </element>
  
  <element name="x">
        <complexType mixed="true">
                <sequence>
                        <element ref="xit:elem" minOccurs="0" maxOccurs="unbounded"/>
                </sequence>
        </complexType>
  </element>
  
  </schema>
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to