You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by el...@apache.org on 2002/06/11 19:16:08 UTC
cvs commit: xml-xerces/java/src/org/w3c/dom/ls DocumentLS.java DOMBuilder.java DOMBuilderFilter.java DOMEntityResolver.java DOMImplementationLS.java DOMInputSource.java DOMWriter.java DOMWriterFilter.java LSLoadEvent.java LSProgressEvent.java ParseErrorEvent.java
elena 2002/06/11 10:16:08
Added: java/src/org/w3c/dom/ls DocumentLS.java DOMBuilder.java
DOMBuilderFilter.java DOMEntityResolver.java
DOMImplementationLS.java DOMInputSource.java
DOMWriter.java DOMWriterFilter.java
LSLoadEvent.java LSProgressEvent.java
ParseErrorEvent.java
Log:
Add DOM Level 3 Load and Save interfaces (WD Experimental)
Revision Changes Path
1.1 xml-xerces/java/src/org/w3c/dom/ls/DocumentLS.java
Index: DocumentLS.java
===================================================================
/*
* Copyright (c) 2002 World Wide Web Consortium,
* (Massachusetts Institute of Technology, Institut National de
* Recherche en Informatique et en Automatique, Keio University). All
* Rights Reserved. This program is distributed under the W3C's Software
* Intellectual Property License. This program is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY; without even
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE.
* See W3C License http://www.w3.org/Consortium/Legal/ for more details.
*/
package org.w3c.dom.ls;
import org.w3c.dom.Node;
import org.w3c.dom.DOMException;
/**
* DOM Level 3 WD - Experimental.
* The DocumentLS interface provides a mechanism by which the content of a
* document can be replaced with the DOM tree produced when loading a URI,
* or parsing a string. The expectation is that an instance of the
* DocumentLS interface can be obtained by using binding-specific casting
* methods on an instance of the Document interface.
* <p>uses the default features.
* <p>See also the <a href='http://www.w3.org/TR/2002/WD-DOM-Level-3-ASLS-20020409'>Document Object Model (DOM) Level 3 Abstract Schemas and Load
and Save Specification</a>.
*/
public interface DocumentLS {
/**
* Indicates whether the method load should be synchronous or
* asynchronous. When the async attribute is set to <code>true</code>
* the load method returns control to the caller before the document has
* completed loading. The default value of this attribute is
* <code>false</code>. Should the DOM spec define the default value of
* this attribute? What if implementing both async and sync IO is
* impractical in some systems? 2001-09-14. default is
* <code>false</code> but we need to check with Mozilla and IE.
* @exception DOMException
* NOT_SUPPORTED_ERR: Raised if the implementation doesn't support the
* mode the attribute is being set to.
*/
public boolean getAsync();
/**
* Indicates whether the method load should be synchronous or
* asynchronous. When the async attribute is set to <code>true</code>
* the load method returns control to the caller before the document has
* completed loading. The default value of this attribute is
* <code>false</code>. Should the DOM spec define the default value of
* this attribute? What if implementing both async and sync IO is
* impractical in some systems? 2001-09-14. default is
* <code>false</code> but we need to check with Mozilla and IE.
* @exception DOMException
* NOT_SUPPORTED_ERR: Raised if the implementation doesn't support the
* mode the attribute is being set to.
*/
public void setAsync(boolean async)
throws DOMException;
/**
* If the document is currently being loaded as a result of the method
* <code>load</code> being invoked the loading and parsing is
* immediately aborted. The possibly partial result of parsing the
* document is discarded and the document is cleared.
*/
public void abort();
/**
* Replaces the content of the document with the result of parsing the
* given URI. Invoking this method will either block the caller or
* return to the caller immediately depending on the value of the async
* attribute. Once the document is fully loaded the document will fire a
* "load" event that the caller can register as a listener for. If an
* error occurs the document will fire an "error" event so that the
* caller knows that the load failed (see <code>ParseErrorEvent</code>).
* If this method is called on a document that is currently loading, the
* current load is interrupted and the new URI load is initiated.
* @param uri The URI reference for the XML file to be loaded. If this is
* a relative URI, the base URI used by the implementation is
* implementation dependent.
* @return If async is set to <code>true</code> <code>load</code> returns
* <code>true</code> if the document load was successfully initiated.
* If an error occurred when initiating the document load
* <code>load</code> returns <code>false</code>.If async is set to
* <code>false</code> <code>load</code> returns <code>true</code> if
* the document was successfully loaded and parsed. If an error
* occurred when either loading or parsing the URI <code>load</code>
* returns <code>false</code>.
*/
public boolean load(String uri);
/**
* Replace the content of the document with the result of parsing the
* input string, this method is always synchronous. This method always
* parses from a DOMString, which means the data is always UTF16. All
* other encoding information is ignored.
* @param source A string containing an XML document.
* @return <code>true</code> if parsing the input string succeeded
* without errors, otherwise <code>false</code>.
*/
public boolean loadXML(String source);
/**
* Save the document or the given node to a string (i.e. serialize the
* document or node).
* @param snode Specifies what to serialize, if this parameter is
* <code>null</code> the whole document is serialized, if it's
* non-null the given node is serialized.
* @return The serialized document or <code>null</code>.
* @exception DOMException
* WRONG_DOCUMENT_ERR: Raised if the node passed in as the node
* parameter is from an other document.
*/
public String saveXML(Node snode)
throws DOMException;
}
1.1 xml-xerces/java/src/org/w3c/dom/ls/DOMBuilder.java
Index: DOMBuilder.java
===================================================================
/*
* Copyright (c) 2002 World Wide Web Consortium,
* (Massachusetts Institute of Technology, Institut National de
* Recherche en Informatique et en Automatique, Keio University). All
* Rights Reserved. This program is distributed under the W3C's Software
* Intellectual Property License. This program is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY; without even
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE.
* See W3C License http://www.w3.org/Consortium/Legal/ for more details.
*/
package org.w3c.dom.ls;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.DOMException;
import org.w3c.dom.DOMErrorHandler;
/**
* DOM Level 3 WD - Experimental.
* A interface to an object that is able to build a DOM tree from various
* input sources.
* <p><code>DOMBuilder</code> provides an API for parsing XML documents and
* building the corresponding DOM document tree. A <code>DOMBuilder</code>
* instance is obtained from the <code>DOMImplementationLS</code> interface
* by invoking its <code>createDOMBuilder</code>method.
* <p> As specified in , when a document is first made available via the
* DOMBuilder: there is only one <code>Text</code> node for each block of
* text. The <code>Text</code> nodes are into "normal" form: only structure
* (e.g., elements, comments, processing instructions, CDATA sections, and
* entity references) separates <code>Text</code> nodes, i.e., there are
* neither adjacent <code>Text</code> nodes nor empty <code>Text</code>
* nodes. it is expected that the <code>value</code> and
* <code>nodeValue</code> attributes of an <code>Attr</code> node initially
* return the XML 1.0 normalized value. However, if the features
* <code>validate-if-schema</code> and <code>datatype-normalization</code>
* are set to <code>true</code>, depending on the attribute normalization
* used, the attribute values may differ from the ones obtained by the XML
* 1.0 attribute normalization. If the feature
* <code>datatype-normalization</code> is not set to <code>true</code>, the
* XML 1.0 attribute normalization is guaranteed to occur, and if attributes
* list does not contain namespace declarations, the <code>attributes</code>
* attribute on <code>Element</code> node represents the property
* [attributes] defined in . XML Schemas does not modify the XML attribute
* normalization but represents their normalized value in an other
* information item property: [schema normalized value]XML Schema
* normalization only occurs if <code>datatype-normalization</code> is set
* to <code>true</code>.
* <p> Asynchronous <code>DOMBuilder</code> objects are expected to also
* implement the <code>events::EventTarget</code> interface so that event
* listeners can be registerd on asynchronous <code>DOMBuilder</code>
* objects.
* <p> Events supported by asynchronous <code>DOMBuilder</code> are: load: The
* document that's being loaded is completely parsed, see the definition of
* <code>LSLoadEvent</code>progress: Progress notification, see the
* definition of <code>LSProgressEvent</code> All events defined in this
* specification use the namespace URI
* <code>"http://www.w3.org/2002/DOMLS"</code>.
* <p> <code>DOMBuilder</code>s have a number of named features that can be
* queried or set. The name of <code>DOMBuilder</code> features must be
* valid XML names. Implementation specific features (extensions) should
* choose a implementation specific prefix to avoid name collisions.
* <p> Even if all features must be recognized by all implementations, being
* able to set a state (<code>true</code> or <code>false</code>) is not
* always required. The following list of recognized features indicates the
* definitions of each feature state, if setting the state to
* <code>true</code> or <code>false</code> must be supported or is optional
* and, which state is the default one:
* <dl>
* <dt><code>"cdata-sections"</code></dt>
* <dd> This
* feature is equivalent to the one provided on
* <code>Document.setNormalizationFeature</code> in . </dd>
* <dt><code>"comments"</code></dt>
* <dd>
* This feature is equivalent to the one provided on
* <code>Document.setNormalizationFeature</code> in . </dd>
* <dt>
* <code>"charset-overrides-xml-encoding"</code></dt>
* <dd>
* <dl>
* <dt><code>true</code></dt>
* <dd>[required] (
* default) If a higher level protocol such as HTTP provides an indication
* of the character encoding of the input stream being processed, that will
* override any encoding specified in the XML declaration or the Text
* declaration (see also 4.3.3 "Character Encoding in Entities").
* Explicitly setting an encoding in the <code>DOMInputSource</code>
* overrides encodings from the protocol. </dd>
* <dt><code>false</code></dt>
* <dd>[required] Any
* character set encoding information from higher level protocols is ignored
* by the parser. </dd>
* </dl></dd>
* <dt><code>"datatype-normalization"</code></dt>
* <dd> This feature is
* equivalent to the one provided on
* <code>Document.setNormalizationFeature</code> in . </dd>
* <dt><code>"entities"</code></dt>
* <dd>
* This feature is equivalent to the one provided on
* <code>Document.setNormalizationFeature</code> in . </dd>
* <dt>
* <code>"canonical-form"</code></dt>
* <dd> This feature is equivalent to the one
* provided on <code>Document.setNormalizationFeature</code> in . </dd>
* <dt>
* <code>"infoset"</code></dt>
* <dd> This feature is equivalent to the one provided on
* <code>Document.setNormalizationFeature</code> in . </dd>
* <dt>
* <code>"namespaces"</code></dt>
* <dd> This feature is equivalent to the one provided
* on <code>Document.setNormalizationFeature</code> in . </dd>
* <dt>
* <code>"namespace-declarations"</code></dt>
* <dd> This feature is equivalent to the
* one provided on <code>Document.setNormalizationFeature</code> in . </dd>
* <dt>
* <code>"supported-mediatypes-only"</code></dt>
* <dd>
* <dl>
* <dt><code>true</code></dt>
* <dd>[optional] Check
* that the media type of the parsed resource is a supported media type and
* call the error handler if an unsupported media type is encountered. The
* media types defined in must be accepted. </dd>
* <dt><code>false</code></dt>
* <dd>[required] (
* default) Don't check the media type, accept any type of data. </dd>
* </dl></dd>
* <dt>
* <code>"validate-if-schema"</code></dt>
* <dd> This feature is equivalent to the one
* provided on <code>Document.setNormalizationFeature</code> in . </dd>
* <dt>
* <code>"validation"</code></dt>
* <dd> This feature is equivalent to the one provided
* on <code>Document.setNormalizationFeature</code> in . </dd>
* <dt>
* <code>"whitespace-in-element-content"</code></dt>
* <dd> This feature is equivalent
* to the one provided on <code>Document.setNormalizationFeature</code> in . </dd>
* </dl>
* <p>See also the <a href='http://www.w3.org/TR/2002/WD-DOM-Level-3-ASLS-20020409'>Document Object Model (DOM) Level 3 Abstract Schemas and Load
and Save Specification</a>.
*/
public interface DOMBuilder {
/**
* If a <code>DOMEntityResolver</code> has been specified, each time a
* reference to an external entity is encountered the
* <code>DOMBuilder</code> will pass the public and system IDs to the
* entity resolver, which can then specify the actual source of the
* entity.
*/
public DOMEntityResolver getEntityResolver();
/**
* If a <code>DOMEntityResolver</code> has been specified, each time a
* reference to an external entity is encountered the
* <code>DOMBuilder</code> will pass the public and system IDs to the
* entity resolver, which can then specify the actual source of the
* entity.
*/
public void setEntityResolver(DOMEntityResolver entityResolver);
/**
* In the event that an error is encountered in the XML document being
* parsed, the <code>DOMDocumentBuilder</code> will call back to the
* <code>errorHandler</code> with the error information. When the
* document loading process calls the error handler the node closest to
* where the error occured is passed to the error handler, if the
* implementation is unable to pass the node where the error occures the
* document Node is passed to the error handler. In addition to passing
* the Node closest to to where the error occured, the implementation
* should also pass any other valuable information to the error handler,
* such as file name, line number, and so on. Mutations to the document
* from within an error handler will result in implementation dependent
* behavour.
*/
public DOMErrorHandler getErrorHandler();
/**
* In the event that an error is encountered in the XML document being
* parsed, the <code>DOMDocumentBuilder</code> will call back to the
* <code>errorHandler</code> with the error information. When the
* document loading process calls the error handler the node closest to
* where the error occured is passed to the error handler, if the
* implementation is unable to pass the node where the error occures the
* document Node is passed to the error handler. In addition to passing
* the Node closest to to where the error occured, the implementation
* should also pass any other valuable information to the error handler,
* such as file name, line number, and so on. Mutations to the document
* from within an error handler will result in implementation dependent
* behavour.
*/
public void setErrorHandler(DOMErrorHandler errorHandler);
/**
* When the application provides a filter, the parser will call out to
* the filter at the completion of the construction of each
* <code>Element</code> node. The filter implementation can choose to
* remove the element from the document being constructed (unless the
* element is the document element) or to terminate the parse early. If
* the document is being validated when it's loaded the validation
* happens before the filter is called.
*/
public DOMBuilderFilter getFilter();
/**
* When the application provides a filter, the parser will call out to
* the filter at the completion of the construction of each
* <code>Element</code> node. The filter implementation can choose to
* remove the element from the document being constructed (unless the
* element is the document element) or to terminate the parse early. If
* the document is being validated when it's loaded the validation
* happens before the filter is called.
*/
public void setFilter(DOMBuilderFilter filter);
/**
* Set the state of a feature.
* <br>The feature name has the same form as a DOM hasFeature string.
* <br>It is possible for a <code>DOMBuilder</code> to recognize a feature
* name but to be unable to set its value.
* @param name The feature name.
* @param state The requested state of the feature (<code>true</code> or
* <code>false</code>).
* @exception DOMException
* NOT_SUPPORTED_ERR: Raised when the <code>DOMBuilder</code> recognizes
* the feature name but cannot set the requested value.
* <br>NOT_FOUND_ERR: Raised when the <code>DOMBuilder</code> does not
* recognize the feature name.
*/
public void setFeature(String name,
boolean state)
throws DOMException;
/**
* Query whether setting a feature to a specific value is supported.
* <br>The feature name has the same form as a DOM hasFeature string.
* @param name The feature name, which is a DOM has-feature style string.
* @param state The requested state of the feature (<code>true</code> or
* <code>false</code>).
* @return <code>true</code> if the feature could be successfully set to
* the specified value, or <code>false</code> if the feature is not
* recognized or the requested value is not supported. The value of
* the feature itself is not changed.
*/
public boolean canSetFeature(String name,
boolean state);
/**
* Look up the value of a feature.
* <br>The feature name has the same form as a DOM hasFeature string
* @param name The feature name, which is a string with DOM has-feature
* syntax.
* @return The current state of the feature (<code>true</code> or
* <code>false</code>).
* @exception DOMException
* NOT_FOUND_ERR: Raised when the <code>DOMBuilder</code> does not
* recognize the feature name.
*/
public boolean getFeature(String name)
throws DOMException;
/**
* Parse an XML document from a location identified by a URI reference .
* If the URI contains a fragment identifier (see section 4.1 in ), the
* behavior is not defined by this specification, but future versions of
* this specification might define the behavior.
* @param uri The location of the XML document to be read.
* @return If the <code>DOMBuilder</code> is a synchronous
* <code>DOMBuilder</code> the newly created and populated
* <code>Document</code> is returned. If the <code>DOMBuilder</code>
* is asynchronous then <code>null</code> is returned since the
* document object is not yet parsed when this method returns.
*/
public Document parseURI(String uri);
/**
* Parse an XML document from a resource identified by a
* <code>DOMInputSource</code>.
* @param is The <code>DOMInputSource</code> from which the source
* document is to be read.
* @return If the <code>DOMBuilder</code> is a synchronous
* <code>DOMBuilder</code> the newly created and populated
* <code>Document</code> is returned. If the <code>DOMBuilder</code>
* is asynchronous then <code>null</code> is returned since the
* document object is not yet parsed when this method returns.
* @exception DOMSystemException
* Exceptions raised by <code>parse</code> originate with the installed
* ErrorHandler, and thus depend on the implementation of the
* <code>DOMErrorHandler</code> interfaces. The default ErrorHandlers
* will raise a <code>DOMSystemException</code> if any form I/O or
* other system error occurs during the parse, but application defined
* ErrorHandlers are not required to do so.
*/
public Document parse(DOMInputSource is)
throws Exception;
// ACTION_TYPES
/**
* Replace the context node with the result of parsing the input source.
* For this action to work the context node must have a parent and the
* context node must be an <code>Element</code>, <code>Text</code>,
* <code>CDATASection</code>, <code>Comment</code>,
* <code>ProcessingInstruction</code>, or <code>EntityReference</code>
* node.
*/
public static final short ACTION_REPLACE = 1;
/**
* Append the result of the input source as children of the context node.
* For this action to work, the context node must be an
* <code>Element</code> or a <code>DocumentFragment</code>.
*/
public static final short ACTION_APPEND_AS_CHILDREN = 2;
/**
* Insert the result of parsing the input source after the context node.
* For this action to work the context nodes parent must be an
* <code>Element</code>.
*/
public static final short ACTION_INSERT_AFTER = 3;
/**
* Insert the result of parsing the input source before the context node.
* For this action to work the context nodes parent must be an
* <code>Element</code>.
*/
public static final short ACTION_INSERT_BEFORE = 4;
/**
* Parse an XML document or fragment from a resource identified by a
* <code>DOMInputSource</code> and insert the content into an existing
* document at the position specified with the <code>contextNode</code>
* and <code>action</code> arguments. When parsing the input stream the
* context node is used for resolving unbound namespace prefixes.
* <br> As the new data is inserted into the document at least one
* mutation event is fired per immidate child (or sibling) of context
* node.
* <br> If an error occurs while parsing, the caller is notified through
* the error handler.
* @param is The <code>DOMInputSource</code> from which the source
* document is to be read.
* @param cnode The node that is used as the context for the data that
* is being parsed. This node must be a <code>Document</code> node, a
* <code>DocumentFragment</code> node, or a node of a type that is
* allowed as a child of an element, e.g. it can not be an attribute
* node.
* @param action This parameter describes which action should be taken
* between the new set of node being inserted and the existing
* children of the context node. The set of possible actions is
* defined above.
* @exception DOMException
* NOT_SUPPORTED_ERR: Raised when the <code>DOMBuilder</code> doesn't
* support this method.
* <br>NO_MODIFICATION_ALLOWED_ERR: Raised if the context node is
* readonly.
*/
public void parseWithContext(DOMInputSource is,
Node cnode,
short action)
throws DOMException;
}
1.1 xml-xerces/java/src/org/w3c/dom/ls/DOMBuilderFilter.java
Index: DOMBuilderFilter.java
===================================================================
/*
* Copyright (c) 2002 World Wide Web Consortium,
* (Massachusetts Institute of Technology, Institut National de
* Recherche en Informatique et en Automatique, Keio University). All
* Rights Reserved. This program is distributed under the W3C's Software
* Intellectual Property License. This program is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY; without even
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE.
* See W3C License http://www.w3.org/Consortium/Legal/ for more details.
*/
package org.w3c.dom.ls;
import org.w3c.dom.Node;
/**
* DOM Level 3 WD - Experimental.
* <code>DOMBuilderFilter</code>s provide applications the ability to examine
* nodes as they are being constructed during a parse. As each node is
* examined, it may be modified or removed, or the entire parse may be
* terminated early.
* <p>At the time any of the filter methods are called by the parser, the
* owner Document and DOMImplementation objects exist and are accessible.
* The document element is never passed to the <code>DOMBuilderFilter</code>
* methods, i.e. it is not possible to filter out the document element.
* <p>All validity checking while reading a document occurs on the source
* document as it appears on the input stream, not on the DOM document as it
* is built in memory. With filters, the document in memory may be a subset
* of the document on the stream, and its validity may have been affected by
* the filtering.
* <p> All default content, including default attributes, must be passed to
* the filter methods.
* <p> Any exception raised in the filter are ignored by the
* <code>DOMBuilder</code>.
* <p> The constants <code>FILTER_ACCEPT</code>, <code>FILTER_REJECT</code>
* and <code>FILTER_SKIP</code> are defined in DOM Level 2 Traversal . The
* description of these methods is not complete
* <p>See also the <a href='http://www.w3.org/TR/2002/WD-DOM-Level-3-ASLS-20020409'>Document Object Model (DOM) Level 3 Abstract Schemas and Load
and Save Specification</a>.
*/
public interface DOMBuilderFilter {
/**
* Interrupt the normal processing of the document.
*/
public static final short FILTER_INTERRUPT = 4;
/**
* This method will be called by the parser after each <code>Element</code>
* start tag has been scanned, but before the remainder of the
* <code>Element</code> is processed. The intent is to allow the
* element, including any children, to be efficiently skipped. Note that
* only element nodes are passed to the <code>startContainer</code>
* function.
* <br>The element node passed to <code>startContainer</code> for
* filtering will include all of the Element's attributes, but none of
* the children nodes. The Element may not yet be in place in the
* document being constructed (it may not have a parent node.)
* <br>A <code>startContainer</code> filter function may access or change
* the attributers for the Element. Changing Namespace declarations will
* have no effect on namespace resolution by the parser.
* <br>For efficiency, the Element node passed to the filter may not be
* the same one as is actually placed in the tree if the node is
* accepted. And the actual node (node object identity) may be reused
* during the process of reading in and filtering a document.
* @param snode The newly encountered element. At the time this method is
* called, the element is incomplete - it will have its attributes,
* but no children. Should the parameter be an Element since we only
* passed elements to startContainer?
* @return <code>FILTER_ACCEPT</code> if this <code>Element</code>
* should be included in the DOM document being built.
* <code>FILTER_REJECT</code> if the <code>Element</code> and all of
* its children should be rejected. <code>FILTER_SKIP</code> if the
* <code>Element</code> should be rejected. All of its children are
* inserted in place of the rejected <code>Element</code> node.
* <code>FILTER_INTERRUPT</code> if the filter wants to stop the
* processing of the document. Interrupting the processing of the
* document does no longer garantee that the entire is XML
* well-formed. Returning any other values will result in unspecified
* behavior.
*/
public short startContainer(Node snode);
/**
* This method will be called by the parser at the completion of the
* parsing of each node. The node and all of its decendants will exist
* and be complete. The parent node will also exist, although it may be
* incomplete, i.e. it may have additional children that have not yet
* been parsed. Attribute nodes are never passed to this function.
* <br>From within this method, the new node may be freely modified -
* children may be added or removed, text nodes modified, etc. The state
* of the rest of the document outside this node is not defined, and the
* affect of any attempt to navigate to, or to modify any other part of
* the document is undefined.
* <br>For validating parsers, the checks are made on the original
* document, before any modification by the filter. No validity checks
* are made on any document modifications made by the filter.
* <br>If this new node is rejected, the parser might reuse the new node
* or any of its decendants.
* @param enode The newly constructed element. At the time this method is
* called, the element is complete - it has all of its children (and
* their children, recursively) and attributes, and is attached as a
* child to its parent.
* @return <code>FILTER_ACCEPT</code> if this <code>Node</code> should
* be included in the DOM document being built.
* <code>FILTER_REJECT</code> if the <code>Node</code> and all of its
* children should be rejected. <code>FILTER_SKIP</code> if the
* <code>Node</code> should be skipped and the <code>Node</code>
* should be replaced by all the children of the <code>Node</code>.
*/
public short acceptNode(Node enode);
/**
* Tells the <code>DOMBuilder</code> what types of nodes to show to the
* filter. See <code>NodeFilter</code> for definition of the constants.
* The constant <code>SHOW_ATTRIBUTE</code> is meaningless here,
* attribute nodes will never be passed to a
* <code>DOMBuilderFilter</code>.
*/
public int getWhatToShow();
}
1.1 xml-xerces/java/src/org/w3c/dom/ls/DOMEntityResolver.java
Index: DOMEntityResolver.java
===================================================================
/*
* Copyright (c) 2002 World Wide Web Consortium,
* (Massachusetts Institute of Technology, Institut National de
* Recherche en Informatique et en Automatique, Keio University). All
* Rights Reserved. This program is distributed under the W3C's Software
* Intellectual Property License. This program is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY; without even
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE.
* See W3C License http://www.w3.org/Consortium/Legal/ for more details.
*/
package org.w3c.dom.ls;
/**
* DOM Level 3 WD - Experimental.
* <code>DOMEntityResolver</code> Provides a way for applications to redirect
* references to external entities.
* <p>Applications needing to implement customized handling for external
* entities must implement this interface and register their implementation
* by setting the <code>entityResolver</code> attribute of the
* <code>DOMBuilder</code>.
* <p>The <code>DOMBuilder</code> will then allow the application to intercept
* any external entities (including the external DTD subset and external
* parameter entities) before including them.
* <p>Many DOM applications will not need to implement this interface, but it
* will be especially useful for applications that build XML documents from
* databases or other specialized input sources, or for applications that
* use URNs. <code>DOMEtityResolver</code> is based on the SAX2
* <code>EntityResolver</code> interface.
* <p>See also the <a href='http://www.w3.org/TR/2002/WD-DOM-Level-3-ASLS-20020409'>Document Object Model (DOM) Level 3 Abstract Schemas and Load
and Save Specification</a>.
*/
public interface DOMEntityResolver {
/**
* Allow the application to resolve external entities.
* <br>The <code>DOMBuilder</code> will call this method before opening
* any external entity except the top-level document entity (including
* the external DTD subset, external entities referenced within the DTD,
* and external entities referenced within the document element); the
* application may request that the <code>DOMBuilder</code> resolve the
* entity itself, that it use an alternative URI, or that it use an
* entirely different input source.
* <br>Application writers can use this method to redirect external system
* identifiers to secure and/or local URIs, to look up public
* identifiers in a catalogue, or to read an entity from a database or
* other input source (including, for example, a dialog box).
* <br>If the system identifier is a URI, the <code>DOMBuilder</code> must
* resolve it fully before reporting it to the application through this
* interface. See issue #4. An alternative would be to pass the URI out
* without resolving it, and to provide a base as an additional
* parameter. SAX resolves URIs first, and does not provide a base.
* @param publicId The public identifier of the external entity being
* referenced, or <code>null</code> if none was supplied.
* @param systemId The system identifier, a URI reference , of the
* external entity being referenced exactly as written in the source.
* @param baseURI The absolute base URI of the resource being parsed, or
* <code>null</code> if there is no base URI.
* @return A <code>DOMInputSource</code> object describing the new input
* source, or <code>null</code> to request that the parser open a
* regular URI connection to the system identifier.
* @exception DOMSystemException
* Any <code>DOMSystemException</code>, possibly wrapping another
* exception.
*/
public DOMInputSource resolveEntity(String publicId,
String systemId,
String baseURI)
throws Exception;
}
1.1 xml-xerces/java/src/org/w3c/dom/ls/DOMImplementationLS.java
Index: DOMImplementationLS.java
===================================================================
/*
* Copyright (c) 2002 World Wide Web Consortium,
* (Massachusetts Institute of Technology, Institut National de
* Recherche en Informatique et en Automatique, Keio University). All
* Rights Reserved. This program is distributed under the W3C's Software
* Intellectual Property License. This program is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY; without even
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE.
* See W3C License http://www.w3.org/Consortium/Legal/ for more details.
*/
package org.w3c.dom.ls;
import org.w3c.dom.DOMException;
/**
* DOM Level 3 WD - Experimental.
* <code>DOMImplementationLS</code> contains the factory methods for creating
* objects that implement the <code>DOMBuilder</code> (parser) and
* <code>DOMWriter</code> (serializer) interfaces.
* <p> An object that implements DOMImplementationLS is obtained by doing a
* binding specific cast from DOMImplementation to DOMImplementationLS.
* Implementations supporting the Load and Save feature must implement the
* DOMImplementationLS interface on whatever object implements the
* DOMImplementation interface.
* <p>See also the <a href='http://www.w3.org/TR/2002/WD-DOM-Level-3-ASLS-20020409'>Document Object Model (DOM) Level 3 Abstract Schemas and Load
and Save Specification</a>.
*/
public interface DOMImplementationLS {
// DOMIMplementationLSMode
/**
* Create a synchronous <code>DOMBuilder</code>.
*/
public static final short MODE_SYNCHRONOUS = 1;
/**
* Create an asynchronous <code>DOMBuilder</code>.
*/
public static final short MODE_ASYNCHRONOUS = 2;
/**
* Create a new <code>DOMBuilder</code>. The newly constructed parser may
* then be configured by means of its <code>setFeature</code> method,
* and used to parse documents by means of its <code>parse</code>
* method.
* @param mode The <code>mode</code> argument is either
* <code>MODE_SYNCHRONOUS</code> or <code>MODE_ASYNCHRONOUS</code>, if
* <code>mode</code> is <code>MODE_SYNCHRONOUS</code> then the
* <code>DOMBuilder</code> that is created will operate in synchronous
* mode, if it's <code>MODE_ASYNCHRONOUS</code> then the
* <code>DOMBuilder</code> that is created will operate in
* asynchronous mode.
* @param schemaType An absolute URI representing the type of the schema
* language used during the load of a <code>Document</code> using the
* newly created <code>DOMBuilder</code>. Note that no lexical
* checking is done on the absolute URI. In order to create a
* <code>DOMBuilder</code> for any kind of schema types (i.e. the
* DOMBuilder will be free to use any schema found), use the value
* <code>null</code>. For W3C XML Schema , applications must use the
* value <code>"http://www.w3.org/2001/XMLSchema"</code>. For XML DTD
* , applications must use the value
* <code>"http://www.w3.org/TR/REC-xml"</code>. Other Schema languages
* are outside the scope of the W3C and therefore should recommend an
* absolute URI in order to use this method.
* @return The newly created <code>DOMBuilder</code> object. This
* <code>DOMBuilder</code> is either synchronous or asynchronous
* depending on the value of the <code>mode</code> argument.
* @exception DOMException
* NOT_SUPPORTED_ERR: Raised if the requested mode or schema type is
* not supported.
*/
public DOMBuilder createDOMBuilder(short mode,
String schemaType)
throws DOMException;
/**
* Create a new <code>DOMWriter</code> object. <code>DOMWriter</code>s are
* used to serialize a DOM tree back into an XML document.
* @return The newly created <code>DOMWriter</code> object.
*/
public DOMWriter createDOMWriter();
/**
* Create a new "empty" <code>DOMInputSource</code>.
* @return The newly created <code>DOMInputSource</code> object.
*/
public DOMInputSource createDOMInputSource();
}
1.1 xml-xerces/java/src/org/w3c/dom/ls/DOMInputSource.java
Index: DOMInputSource.java
===================================================================
/*
* Copyright (c) 2002 World Wide Web Consortium,
* (Massachusetts Institute of Technology, Institut National de
* Recherche en Informatique et en Automatique, Keio University). All
* Rights Reserved. This program is distributed under the W3C's Software
* Intellectual Property License. This program is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY; without even
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE.
* See W3C License http://www.w3.org/Consortium/Legal/ for more details.
*/
package org.w3c.dom.ls;
/**
* DOM Level 3 WD - Experimental.
* This interface represents a single input source for an XML entity.
* <p> This interface allows an application to encapsulate information about
* an input source in a single object, which may include a public
* identifier, a system identifier, a byte stream (possibly with a specified
* encoding), and/or a character stream.
* <p> The exact definitions of a byte stream and a character stream are
* binding dependent.
* <p> There are two places that the application will deliver this input
* source to the parser: as the argument to the <code>parse</code> method,
* or as the return value of the <code>DOMEntityResolver.resolveEntity</code>
* method. There are at least three places where DOMInputSource is passed
* to the parser (parseWithContext).
* <p> The <code>DOMBuilder</code> will use the <code>DOMInputSource</code>
* object to determine how to read XML input. If there is a character stream
* available, the parser will read that stream directly; if not, the parser
* will use a byte stream, if available; if neither a character stream nor a
* byte stream is available, the parser will attempt to open a URI
* connection to the resource identified by the system identifier.
* <p> A <code>DOMInputSource</code> object belongs to the application: the
* parser shall never modify it in any way (it may modify a copy if
* necessary). Eventhough all attributes in this interface are writable the
* DOM implementation is expected to never mutate a DOMInputSource.
* <p>See also the <a href='http://www.w3.org/TR/2002/WD-DOM-Level-3-ASLS-20020409'>Document Object Model (DOM) Level 3 Abstract Schemas and Load
and Save Specification</a>.
*/
public interface DOMInputSource {
/**
* An attribute of a language-binding dependent type that represents a
* stream of bytes.
* <br>The parser will ignore this if there is also a character stream
* specified, but it will use a byte stream in preference to opening a
* URI connection itself.
* <br>If the application knows the character encoding of the byte stream,
* it should set the encoding attribute. Setting the encoding in this
* way will override any encoding specified in the XML declaration
* itself.
*/
public java.io.InputStream getByteStream();
/**
* An attribute of a language-binding dependent type that represents a
* stream of bytes.
* <br>The parser will ignore this if there is also a character stream
* specified, but it will use a byte stream in preference to opening a
* URI connection itself.
* <br>If the application knows the character encoding of the byte stream,
* it should set the encoding attribute. Setting the encoding in this
* way will override any encoding specified in the XML declaration
* itself.
*/
public void setByteStream(java.io.InputStream byteStream);
/**
* An attribute of a language-binding dependent type that represents a
* stream of 16-bit units. Application must encode the stream using
* UTF-16 (defined in and Amendment 1 of ).
* <br>If a character stream is specified, the parser will ignore any byte
* stream and will not attempt to open a URI connection to the system
* identifier.
*/
public java.io.Reader getCharacterStream();
/**
* An attribute of a language-binding dependent type that represents a
* stream of 16-bit units. Application must encode the stream using
* UTF-16 (defined in and Amendment 1 of ).
* <br>If a character stream is specified, the parser will ignore any byte
* stream and will not attempt to open a URI connection to the system
* identifier.
*/
public void setCharacterStream(java.io.Reader characterStream);
/**
* A string attribute that represents a sequence of 16 bit units (utf-16
* encoded characters).
* <br>If string data is available in the input source, the parser will
* ignore the character stream and the byte stream and will not attempt
* to open a URI connection to the system identifier.
*/
public String getStringData();
/**
* A string attribute that represents a sequence of 16 bit units (utf-16
* encoded characters).
* <br>If string data is available in the input source, the parser will
* ignore the character stream and the byte stream and will not attempt
* to open a URI connection to the system identifier.
*/
public void setStringData(String stringData);
/**
* The character encoding, if known. The encoding must be a string
* acceptable for an XML encoding declaration ( section 4.3.3 "Character
* Encoding in Entities").
* <br>This attribute has no effect when the application provides a
* character stream. For other sources of input, an encoding specified
* by means of this attribute will override any encoding specified in
* the XML claration or the Text Declaration, or an encoding obtained
* from a higher level protocol, such as HTTP .
*/
public String getEncoding();
/**
* The character encoding, if known. The encoding must be a string
* acceptable for an XML encoding declaration ( section 4.3.3 "Character
* Encoding in Entities").
* <br>This attribute has no effect when the application provides a
* character stream. For other sources of input, an encoding specified
* by means of this attribute will override any encoding specified in
* the XML claration or the Text Declaration, or an encoding obtained
* from a higher level protocol, such as HTTP .
*/
public void setEncoding(String encoding);
/**
* The public identifier for this input source. The public identifier is
* always optional: if the application writer includes one, it will be
* provided as part of the location information.
*/
public String getPublicId();
/**
* The public identifier for this input source. The public identifier is
* always optional: if the application writer includes one, it will be
* provided as part of the location information.
*/
public void setPublicId(String publicId);
/**
* The system identifier, a URI reference , for this input source. The
* system identifier is optional if there is a byte stream or a
* character stream, but it is still useful to provide one, since the
* application can use it to resolve relative URIs and can include it in
* error messages and warnings (the parser will attempt to fetch the
* ressource identifier by the URI reference only if there is no byte
* stream or character stream specified).
* <br>If the application knows the character encoding of the object
* pointed to by the system identifier, it can register the encoding by
* setting the encoding attribute.
* <br>If the system ID is a relative URI reference (see section 5 in ),
* the behavior is implementation dependent.
*/
public String getSystemId();
/**
* The system identifier, a URI reference , for this input source. The
* system identifier is optional if there is a byte stream or a
* character stream, but it is still useful to provide one, since the
* application can use it to resolve relative URIs and can include it in
* error messages and warnings (the parser will attempt to fetch the
* ressource identifier by the URI reference only if there is no byte
* stream or character stream specified).
* <br>If the application knows the character encoding of the object
* pointed to by the system identifier, it can register the encoding by
* setting the encoding attribute.
* <br>If the system ID is a relative URI reference (see section 5 in ),
* the behavior is implementation dependent.
*/
public void setSystemId(String systemId);
/**
* The base URI to be used (see section 5.1.4 in ) for resolving relative
* URIs to absolute URIs. If the baseURI is itself a relative URI, the
* behavior is implementation dependent.
*/
public String getBaseURI();
/**
* The base URI to be used (see section 5.1.4 in ) for resolving relative
* URIs to absolute URIs. If the baseURI is itself a relative URI, the
* behavior is implementation dependent.
*/
public void setBaseURI(String baseURI);
}
1.1 xml-xerces/java/src/org/w3c/dom/ls/DOMWriter.java
Index: DOMWriter.java
===================================================================
/*
* Copyright (c) 2002 World Wide Web Consortium,
* (Massachusetts Institute of Technology, Institut National de
* Recherche en Informatique et en Automatique, Keio University). All
* Rights Reserved. This program is distributed under the W3C's Software
* Intellectual Property License. This program is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY; without even
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE.
* See W3C License http://www.w3.org/Consortium/Legal/ for more details.
*/
package org.w3c.dom.ls;
import org.w3c.dom.Node;
import org.w3c.dom.DOMException;
import org.w3c.dom.DOMErrorHandler;
/**
* DOM Level 3 WD - Experimental.
* <code>DOMWriter</code> provides an API for serializing (writing) a DOM
* document out in an XML document. The XML data is written to an output
* stream, the type of which depends on the specific language bindings in
* use.
* <p> During serialization of XML data, namespace fixup is done when
* possible. allows empty strings as a real namespace URI. If the
* <code>namespaceURI</code> of a <code>Node</code> is empty string, the
* serialization will treat them as <code>null</code>, ignoring the prefix
* if any.
* <p> <code>DOMWriter</code> accepts any node type for serialization. For
* nodes of type <code>Document</code> or <code>Entity</code>, well formed
* XML will be created if possible. The serialized output for these node
* types is either as a Document or an External Entity, respectively, and is
* acceptable input for an XML parser. For all other types of nodes the
* serialized form is not specified, but should be something useful to a
* human for debugging or diagnostic purposes. Note: rigorously designing an
* external (source) form for stand-alone node types that don't already have
* one defined in seems a bit much to take on here.
* <p>Within a Document, DocumentFragment, or Entity being serialized, Nodes
* are processed as follows Documents are written including an XML
* declaration and a DTD subset, if one exists in the DOM. Writing a
* document node serializes the entire document. Entity nodes, when written
* directly by <code>writeNode</code> defined in the <code>DOMWriter</code>
* interface, output the entity expansion but no namespace fixup is done.
* The resulting output will be valid as an external entity. Entity
* reference nodes are serialized as an entity reference of the form "
* <code>&entityName;</code>" in the output. Child nodes (the expansion)
* of the entity reference are ignored. CDATA sections containing content
* characters that can not be represented in the specified output encoding
* are handled according to the "split-cdata-sections" feature.If the
* feature is <code>true</code>, CDATA sections are split, and the
* unrepresentable characters are serialized as numeric character references
* in ordinary content. The exact position and number of splits is not
* specified. If the feature is <code>false</code>, unrepresentable
* characters in a CDATA section are reported as errors. The error is not
* recoverable - there is no mechanism for supplying alternative characters
* and continuing with the serialization. DocumentFragment nodes are
* serialized by serializing the children of the document fragment in the
* order they appear in the document fragment. All other node types
* (Element, Text, etc.) are serialized to their corresponding XML source
* form. The serialization of a DOM Node does not always generate a
* well-formed XML document, i.e. a <code>DOMBuilder</code> might through
* fatal errors when parsing the resulting serialization.
* <p> Within the character data of a document (outside of markup), any
* characters that cannot be represented directly are replaced with
* character references. Occurrences of '<' and '&' are replaced by
* the predefined entities &lt; and &amp. The other predefined
* entities (&gt, &apos, etc.) are not used; these characters can be
* included directly. Any character that can not be represented directly in
* the output character encoding is serialized as a numeric character
* reference.
* <p> Attributes not containing quotes are serialized in quotes. Attributes
* containing quotes but no apostrophes are serialized in apostrophes
* (single quotes). Attributes containing both forms of quotes are
* serialized in quotes, with quotes within the value represented by the
* predefined entity &quot;. Any character that can not be represented
* directly in the output character encoding is serialized as a numeric
* character reference.
* <p> Within markup, but outside of attributes, any occurrence of a character
* that cannot be represented in the output character encoding is reported
* as an error. An example would be serializing the element
* <LaCa�ada/> with the encoding="us-ascii".
* <p> When requested by setting the <code>normalize-characters</code> feature
* on <code>DOMWriter</code>, all data to be serialized, both markup and
* character data, is W3C Text normalized according to the rules defined in
* . The W3C Text normalization process affects only the data as it is being
* written; it does not alter the DOM's view of the document after
* serialization has completed.
* <p>Namespaces are fixed up during serialization, the serialization process
* will verify that namespace declarations, namespace prefixes and the
* namespace URIs associated with Elements and Attributes are consistent. If
* inconsistencies are found, the serialized form of the document will be
* altered to remove them. The algorithm used for doing the namespace fixup
* while serializing a document is a combination of the algorithms used for
* lookupNamespaceURI and lookupNamespacePrefix . previous paragraph to be
* defined closer here.
* <p>Any changes made affect only the namespace prefixes and declarations
* appearing in the serialized data. The DOM's view of the document is not
* altered by the serialization operation, and does not reflect any changes
* made to namespace declarations or prefixes in the serialized output.
* <p> While serializing a document the serializer will write out
* non-specified values (such as attributes whose <code>specified</code> is
* <code>false</code>) if the <code>discard-default-content</code> feature
* is set to <code>true</code>. If the <code>discard-default-content</code>
* flag is set to <code>false</code> and a schema is used for validation,
* the schema will be also used to determine if a value is specified or not.
* If no schema is used, the <code>specified</code> flag on attribute nodes
* is used to determine if attribute values should be written out.
* <p> Ref to Core spec (1.1.9, XML namespaces, 5th paragraph) entity ref
* description about warning about unbound entity refs. Entity refs are
* always serialized as <code>&foo;</code>, also mention this in the
* load part of this spec.
* <p> <code>DOMWriter</code>s have a number of named features that can be
* queried or set. The name of <code>DOMWriter</code> features must be valid
* XML names. Implementation specific features (extensions) should choose an
* implementation dependent prefix to avoid name collisions.
* <p>Here is a list of features that must be recognized by all
* implementations. Using these features does affect the <code>Node</code>
* being serialized, only its serialized form is affected.
* <dl>
* <dt>
* <code>"discard-default-content"</code></dt>
* <dd> This feature is equivalent to the
* one provided on <code>Document.setNormalizationFeature</code> in . </dd>
* <dt>
* <code>"entities"</code></dt>
* <dd> This feature is equivalent to the one provided on
* <code>Document.setNormalizationFeature</code> in . </dd>
* <dt>
* <code>"canonical-form"</code></dt>
* <dd>
* <dl>
* <dt><code>true</code></dt>
* <dd>[optional] This formatting
* writes the document according to the rules specified in . Setting this
* feature to true will set the feature <code>"format-pretty-print"</code>
* to false. </dd>
* <dt><code>false</code></dt>
* <dd>[required] (default) Do not canonicalize the
* output. </dd>
* </dl></dd>
* <dt><code>"format-pretty-print"</code></dt>
* <dd>
* <dl>
* <dt><code>true</code></dt>
* <dd>[optional]
* Formatting the output by adding whitespace to produce a pretty-printed,
* indented, human-readable form. The exact form of the transformations is
* not specified by this specification. Setting this feature to true will
* set the feature "canonical-form" to false. </dd>
* <dt><code>false</code></dt>
* <dd>[required] (
* default) Don't pretty-print the result. </dd>
* </dl></dd>
* <dt>
* <code>"normalize-characters"</code></dt>
* <dd> This feature is equivalent to the one
* provided on <code>Document.setNormalizationFeature</code> in . Unlike in
* the Core, the default value for this feature is <code>true</code>. </dd>
* <dt>
* <code>"split-cdata-sections"</code></dt>
* <dd> This feature is equivalent to the one
* provided on <code>Document.setNormalizationFeature</code> in . </dd>
* <dt>
* <code>"validation"</code></dt>
* <dd> This feature is equivalent to the one provided
* on <code>Document.setNormalizationFeature</code> in . </dd>
* <dt>
* <code>"whitespace-in-element-content"</code></dt>
* <dd> This feature is equivalent
* to the one provided on <code>Document.setNormalizationFeature</code> in . </dd>
* </dl>
* <p>See also the <a href='http://www.w3.org/TR/2002/WD-DOM-Level-3-ASLS-20020409'>Document Object Model (DOM) Level 3 Abstract Schemas and Load
and Save Specification</a>.
*/
public interface DOMWriter {
/**
* Set the state of a feature.
* <br>The feature name has the same form as a DOM hasFeature string.
* <br>It is possible for a <code>DOMWriter</code> to recognize a feature
* name but to be unable to set its value.
* @param name The feature name.
* @param state The requested state of the feature (<code>true</code> or
* <code>false</code>).
* @exception DOMException
* NOT_SUPPORTED_ERR: Raised when the <code>DOMWriter</code> recognizes
* the feature name but cannot set the requested value.
* <br>Raise a NOT_FOUND_ERR When the <code>DOMWriter</code> does not
* recognize the feature name.
*/
public void setFeature(String name,
boolean state)
throws DOMException;
/**
* Query whether setting a feature to a specific value is supported.
* <br>The feature name has the same form as a DOM hasFeature string.
* @param name The feature name, which is a DOM has-feature style string.
* @param state The requested state of the feature (<code>true</code> or
* <code>false</code>).
* @return <code>true</code> if the feature could be successfully set to
* the specified value, or <code>false</code> if the feature is not
* recognized or the requested value is not supported. The value of
* the feature itself is not changed.
*/
public boolean canSetFeature(String name,
boolean state);
/**
* Look up the value of a feature.
* <br>The feature name has the same form as a DOM hasFeature string
* @param name The feature name, which is a string with DOM has-feature
* syntax.
* @return The current state of the feature (<code>true</code> or
* <code>false</code>).
* @exception DOMException
* NOT_FOUND_ERR: Raised when the <code>DOMWriter</code> does not
* recognize the feature name.
*/
public boolean getFeature(String name)
throws DOMException;
/**
* The character encoding in which the output will be written.
* <br> The encoding to use when writing is determined as follows: If the
* encoding attribute has been set, that value will be used.If the
* encoding attribute is <code>null</code> or empty, but the item to be
* written, or the owner document of the item, specifies an encoding
* (i.e. the "actualEncoding" from the document) specified encoding,
* that value will be used.If neither of the above provides an encoding
* name, a default encoding of "UTF-8" will be used.
* <br>The default value is <code>null</code>.
*/
public String getEncoding();
/**
* The character encoding in which the output will be written.
* <br> The encoding to use when writing is determined as follows: If the
* encoding attribute has been set, that value will be used.If the
* encoding attribute is <code>null</code> or empty, but the item to be
* written, or the owner document of the item, specifies an encoding
* (i.e. the "actualEncoding" from the document) specified encoding,
* that value will be used.If neither of the above provides an encoding
* name, a default encoding of "UTF-8" will be used.
* <br>The default value is <code>null</code>.
*/
public void setEncoding(String encoding);
/**
* The end-of-line sequence of characters to be used in the XML being
* written out. Any string is supported, but these are the recommended
* end-of-line sequences (using other character sequences than these
* recommended ones can result in a document that is either not
* serializable or not well-formed):
* <dl>
* <dt><code>null</code></dt>
* <dd> Use a default
* end-of-line sequence. DOM implementations should choose the default
* to match the usual convention for text files in the environment being
* used. Implementations must choose a default sequence that matches one
* of those allowed by 2.11 "End-of-Line Handling". </dd>
* <dt>CR</dt>
* <dd>The
* carriage-return character (#xD).</dd>
* <dt>CR-LF</dt>
* <dd> The carriage-return and
* line-feed characters (#xD #xA). </dd>
* <dt>LF</dt>
* <dd> The line-feed character (#xA). </dd>
* </dl>
* <br>The default value for this attribute is <code>null</code>.
*/
public String getNewLine();
/**
* The end-of-line sequence of characters to be used in the XML being
* written out. Any string is supported, but these are the recommended
* end-of-line sequences (using other character sequences than these
* recommended ones can result in a document that is either not
* serializable or not well-formed):
* <dl>
* <dt><code>null</code></dt>
* <dd> Use a default
* end-of-line sequence. DOM implementations should choose the default
* to match the usual convention for text files in the environment being
* used. Implementations must choose a default sequence that matches one
* of those allowed by 2.11 "End-of-Line Handling". </dd>
* <dt>CR</dt>
* <dd>The
* carriage-return character (#xD).</dd>
* <dt>CR-LF</dt>
* <dd> The carriage-return and
* line-feed characters (#xD #xA). </dd>
* <dt>LF</dt>
* <dd> The line-feed character (#xA). </dd>
* </dl>
* <br>The default value for this attribute is <code>null</code>.
*/
public void setNewLine(String newLine);
/**
* When the application provides a filter, the serializer will call out
* to the filter before serializing each Node. Attribute nodes are never
* passed to the filter. The filter implementation can choose to remove
* the node from the stream or to terminate the serialization early.
*/
public DOMWriterFilter getFilter();
/**
* When the application provides a filter, the serializer will call out
* to the filter before serializing each Node. Attribute nodes are never
* passed to the filter. The filter implementation can choose to remove
* the node from the stream or to terminate the serialization early.
*/
public void setFilter(DOMWriterFilter filter);
/**
* The error handler that will receive error notifications during
* serialization. The node where the error occured is passed to this
* error handler, any modification to nodes from within an error
* callback should be avoided since this will result in undefined,
* implementation dependent behavior.
*/
public DOMErrorHandler getErrorHandler();
/**
* The error handler that will receive error notifications during
* serialization. The node where the error occured is passed to this
* error handler, any modification to nodes from within an error
* callback should be avoided since this will result in undefined,
* implementation dependent behavior.
*/
public void setErrorHandler(DOMErrorHandler errorHandler);
/**
* Write out the specified node as described above in the description of
* <code>DOMWriter</code>. Writing a Document or Entity node produces a
* serialized form that is well formed XML, when possible (Entity nodes
* might not always be well formed XML in themselves). Writing other
* node types produces a fragment of text in a form that is not fully
* defined by this document, but that should be useful to a human for
* debugging or diagnostic purposes.
* <br> If the specified encoding is not supported the error handler is
* called and the serialization is interrupted.
* @param destination The destination for the data to be written.
* @param wnode The <code>Document</code> or <code>Entity</code> node to
* be written. For other node types, something sensible should be
* written, but the exact serialized form is not specified.
* @return Returns <code>true</code> if <code>node</code> was
* successfully serialized and <code>false</code> in case a failure
* occured and the failure wasn't canceled by the error handler.
* @exception DOMSystemException
* This exception will be raised in response to any sort of IO or system
* error that occurs while writing to the destination. It may wrap an
* underlying system exception.
*/
public boolean writeNode(java.io.OutputStream destination,
Node wnode)
throws Exception;
/**
* Serialize the specified node as described above in the description of
* <code>DOMWriter</code>. The result of serializing the node is
* returned as a DOMString (this method completely ignores all the
* encoding information avaliable). Writing a Document or Entity node
* produces a serialized form that is well formed XML. Writing other
* node types produces a fragment of text in a form that is not fully
* defined by this document, but that should be useful to a human for
* debugging or diagnostic purposes.
* <br> Error handler is called if encoding not supported...
* @param wnode The node to be written.
* @return Returns the serialized data, or <code>null</code> in case a
* failure occured and the failure wasn't canceled by the error
* handler.
* @exception DOMException
* DOMSTRING_SIZE_ERR: Raised if the resulting string is too long to
* fit in a <code>DOMString</code>.
*/
public String writeToString(Node wnode)
throws DOMException;
}
1.1 xml-xerces/java/src/org/w3c/dom/ls/DOMWriterFilter.java
Index: DOMWriterFilter.java
===================================================================
/*
* Copyright (c) 2002 World Wide Web Consortium,
* (Massachusetts Institute of Technology, Institut National de
* Recherche en Informatique et en Automatique, Keio University). All
* Rights Reserved. This program is distributed under the W3C's Software
* Intellectual Property License. This program is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY; without even
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE.
* See W3C License http://www.w3.org/Consortium/Legal/ for more details.
*/
package org.w3c.dom.ls;
import org.w3c.dom.traversal.NodeFilter;
/**
* DOM Level 3 WD - Experimental.
* <code>DOMWriterFilter</code>s provide applications the ability to examine
* nodes as they are being serialized. <code>DOMWriterFilter</code> lets the
* application decide what nodes should be serialized or not.
* <p>See also the <a href='http://www.w3.org/TR/2002/WD-DOM-Level-3-ASLS-20020409'>Document Object Model (DOM) Level 3 Abstract Schemas and Load
and Save Specification</a>.
*/
public interface DOMWriterFilter extends NodeFilter {
/**
* Tells the <code>DOMWriter</code> what types of nodes to show to the
* filter. See <code>NodeFilter</code> for definition of the constants.
* The constant <code>SHOW_ATTRIBUTE</code> is meaningless here,
* attribute nodes will never be passed to a <code>DOMWriterFilter</code>
* .
*/
public int getWhatToShow();
}
1.1 xml-xerces/java/src/org/w3c/dom/ls/LSLoadEvent.java
Index: LSLoadEvent.java
===================================================================
/*
* Copyright (c) 2002 World Wide Web Consortium,
* (Massachusetts Institute of Technology, Institut National de
* Recherche en Informatique et en Automatique, Keio University). All
* Rights Reserved. This program is distributed under the W3C's Software
* Intellectual Property License. This program is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY; without even
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE.
* See W3C License http://www.w3.org/Consortium/Legal/ for more details.
*/
package org.w3c.dom.ls;
import org.w3c.dom.Document;
import org.w3c.dom.events.Event;
/**
* DOM Level 3 WD - Experimental.
* This interface represents a load event object that signals the completion
* of a document load.
* <p>See also the <a href='http://www.w3.org/TR/2002/WD-DOM-Level-3-ASLS-20020409'>Document Object Model (DOM) Level 3 Abstract Schemas and Load
and Save Specification</a>.
*/
public interface LSLoadEvent extends Event {
/**
* The document that finished loading.
*/
public Document getNewDocument();
/**
* The input source that was parsed.
*/
public DOMInputSource getInputSource();
}
1.1 xml-xerces/java/src/org/w3c/dom/ls/LSProgressEvent.java
Index: LSProgressEvent.java
===================================================================
/*
* Copyright (c) 2002 World Wide Web Consortium,
* (Massachusetts Institute of Technology, Institut National de
* Recherche en Informatique et en Automatique, Keio University). All
* Rights Reserved. This program is distributed under the W3C's Software
* Intellectual Property License. This program is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY; without even
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE.
* See W3C License http://www.w3.org/Consortium/Legal/ for more details.
*/
package org.w3c.dom.ls;
import org.w3c.dom.events.Event;
/**
* DOM Level 3 WD - Experimental.
* This interface represents a progress event object that notifies the
* application about progress as a document is parsed. It extends the
* <code>Event</code> interface defined in .
* <p>See also the <a href='http://www.w3.org/TR/2002/WD-DOM-Level-3-ASLS-20020409'>Document Object Model (DOM) Level 3 Abstract Schemas and Load
and Save Specification</a>.
*/
public interface LSProgressEvent extends Event {
/**
* The input source that is being parsed.
*/
public DOMInputSource getInputSource();
/**
* The current position in the input source, including all external
* entities and other resources that have been read.
*/
public int getPosition();
/**
* The total size of the document including all external resources, this
* number might change as a document is being parsed if references to
* more external resources are seen.
*/
public int getTotalSize();
}
1.1 xml-xerces/java/src/org/w3c/dom/ls/ParseErrorEvent.java
Index: ParseErrorEvent.java
===================================================================
/*
* Copyright (c) 2002 World Wide Web Consortium,
* (Massachusetts Institute of Technology, Institut National de
* Recherche en Informatique et en Automatique, Keio University). All
* Rights Reserved. This program is distributed under the W3C's Software
* Intellectual Property License. This program is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY; without even
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE.
* See W3C License http://www.w3.org/Consortium/Legal/ for more details.
*/
package org.w3c.dom.ls;
import org.w3c.dom.events.Event;
import org.w3c.dom.DOMError;
/**
* DOM Level 3 WD - Experimental.
* ParseErrorEvent is the event that is fired if there's an error in the XML
* document being parsed.
* <p>See also the <a href='http://www.w3.org/TR/2002/WD-DOM-Level-3-ASLS-20020409'>Document Object Model (DOM) Level 3 Abstract Schemas and Load
and Save Specification</a>.
*/
public interface ParseErrorEvent extends Event {
/**
* An non-zero implementation dependent error code describing the error,
* or <code>0</code> if there is no error.
*/
public DOMError getError();
}
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org