1. /*
  2. * Copyright (c) 2004 World Wide Web Consortium,
  3. *
  4. * (Massachusetts Institute of Technology, European Research Consortium for
  5. * Informatics and Mathematics, Keio University). All Rights Reserved. This
  6. * work is distributed under the W3C(r) Software License [1] in the hope that
  7. * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
  8. * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  9. *
  10. * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
  11. */
  12. package org.w3c.dom.ls;
  13. import org.w3c.dom.DOMException;
  14. /**
  15. * <code>DOMImplementationLS</code> contains the factory methods for creating
  16. * Load and Save objects.
  17. * <p> The expectation is that an instance of the
  18. * <code>DOMImplementationLS</code> interface can be obtained by using
  19. * binding-specific casting methods on an instance of the
  20. * <code>DOMImplementation</code> interface or, if the <code>Document</code>
  21. * supports the feature <code>"Core"</code> version <code>"3.0"</code>
  22. * defined in [<a href='http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407'>DOM Level 3 Core</a>]
  23. * , by using the method <code>DOMImplementation.getFeature</code> with
  24. * parameter values <code>"LS"</code> (or <code>"LS-Async"</code>) and
  25. * <code>"3.0"</code> (respectively).
  26. * <p>See also the <a href='http://www.w3.org/TR/2004/REC-DOM-Level-3-LS-20040407'>Document Object Model (DOM) Level 3 Load
  27. and Save Specification</a>.
  28. */
  29. public interface DOMImplementationLS {
  30. // DOMImplementationLSMode
  31. /**
  32. * Create a synchronous <code>LSParser</code>.
  33. */
  34. public static final short MODE_SYNCHRONOUS = 1;
  35. /**
  36. * Create an asynchronous <code>LSParser</code>.
  37. */
  38. public static final short MODE_ASYNCHRONOUS = 2;
  39. /**
  40. * Create a new <code>LSParser</code>. The newly constructed parser may
  41. * then be configured by means of its <code>DOMConfiguration</code>
  42. * object, and used to parse documents by means of its <code>parse</code>
  43. * method.
  44. * @param mode The <code>mode</code> argument is either
  45. * <code>MODE_SYNCHRONOUS</code> or <code>MODE_ASYNCHRONOUS</code>, if
  46. * <code>mode</code> is <code>MODE_SYNCHRONOUS</code> then the
  47. * <code>LSParser</code> that is created will operate in synchronous
  48. * mode, if it's <code>MODE_ASYNCHRONOUS</code> then the
  49. * <code>LSParser</code> that is created will operate in asynchronous
  50. * mode.
  51. * @param schemaType An absolute URI representing the type of the schema
  52. * language used during the load of a <code>Document</code> using the
  53. * newly created <code>LSParser</code>. Note that no lexical checking
  54. * is done on the absolute URI. In order to create a
  55. * <code>LSParser</code> for any kind of schema types (i.e. the
  56. * LSParser will be free to use any schema found), use the value
  57. * <code>null</code>.
  58. * <p ><b>Note:</b> For W3C XML Schema [<a href='http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/'>XML Schema Part 1</a>]
  59. * , applications must use the value
  60. * <code>"http://www.w3.org/2001/XMLSchema"</code>. For XML DTD [<a href='http://www.w3.org/TR/2004/REC-xml-20040204'>XML 1.0</a>],
  61. * applications must use the value
  62. * <code>"http://www.w3.org/TR/REC-xml"</code>. Other Schema languages
  63. * are outside the scope of the W3C and therefore should recommend an
  64. * absolute URI in order to use this method.
  65. * @return The newly created <code>LSParser</code> object. This
  66. * <code>LSParser</code> is either synchronous or asynchronous
  67. * depending on the value of the <code>mode</code> argument.
  68. * <p ><b>Note:</b> By default, the newly created <code>LSParser</code>
  69. * does not contain a <code>DOMErrorHandler</code>, i.e. the value of
  70. * the "<a href='http://www.w3.org/TR/DOM-Level-3-Core/core.html#parameter-error-handler'>
  71. * error-handler</a>" configuration parameter is <code>null</code>. However, implementations
  72. * may provide a default error handler at creation time. In that case,
  73. * the initial value of the <code>"error-handler"</code> configuration
  74. * parameter on the new <code>LSParser</code> object contains a
  75. * reference to the default error handler.
  76. * @exception DOMException
  77. * NOT_SUPPORTED_ERR: Raised if the requested mode or schema type is
  78. * not supported.
  79. */
  80. public LSParser createLSParser(short mode,
  81. String schemaType)
  82. throws DOMException;
  83. /**
  84. * Create a new <code>LSSerializer</code> object.
  85. * @return The newly created <code>LSSerializer</code> object.
  86. * <p ><b>Note:</b> By default, the newly created
  87. * <code>LSSerializer</code> has no <code>DOMErrorHandler</code>, i.e.
  88. * the value of the <code>"error-handler"</code> configuration
  89. * parameter is <code>null</code>. However, implementations may
  90. * provide a default error handler at creation time. In that case, the
  91. * initial value of the <code>"error-handler"</code> configuration
  92. * parameter on the new <code>LSSerializer</code> object contains a
  93. * reference to the default error handler.
  94. */
  95. public LSSerializer createLSSerializer();
  96. /**
  97. * Create a new empty input source object where
  98. * <code>LSInput.characterStream</code>, <code>LSInput.byteStream</code>
  99. * , <code>LSInput.stringData</code> <code>LSInput.systemId</code>,
  100. * <code>LSInput.publicId</code>, <code>LSInput.baseURI</code>, and
  101. * <code>LSInput.encoding</code> are null, and
  102. * <code>LSInput.certifiedText</code> is false.
  103. * @return The newly created input object.
  104. */
  105. public LSInput createLSInput();
  106. /**
  107. * Create a new empty output destination object where
  108. * <code>LSOutput.characterStream</code>,
  109. * <code>LSOutput.byteStream</code>, <code>LSOutput.systemId</code>,
  110. * <code>LSOutput.encoding</code> are null.
  111. * @return The newly created output object.
  112. */
  113. public LSOutput createLSOutput();
  114. }