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 2001/11/13 03:00:59 UTC
cvs commit: xml-xerces/java/src/org/apache/xerces/dom3/ls DOMBuilder.java DOMBuilderFilter.java DOMEntityResolver.java DOMImplementationLS.java DOMInputSource.java DOMWriter.java DOMWriterFilter.java DocumentLS.java LSLoadEvent.java LSProgressEvent.java ParseErrorEvent.java
elena 01/11/12 18:00:59
Added: java/src/org/apache/xerces/dom3 DOMError.java
DOMErrorHandler.java DOMLocator.java
java/src/org/apache/xerces/dom3/as
ASAttributeDeclaration.java ASContentModel.java
ASDataType.java ASElementDeclaration.java
ASEntityDeclaration.java ASModel.java
ASNamedObjectMap.java ASNotationDeclaration.java
ASObject.java ASObjectList.java
CharacterDataEditAS.java DOMASBuilder.java
DOMASException.java DOMASWriter.java
DOMImplementationAS.java DocumentAS.java
DocumentEditAS.java ElementEditAS.java
NodeEditAS.java
java/src/org/apache/xerces/dom3/ls DOMBuilder.java
DOMBuilderFilter.java DOMEntityResolver.java
DOMImplementationLS.java DOMInputSource.java
DOMWriter.java DOMWriterFilter.java DocumentLS.java
LSLoadEvent.java LSProgressEvent.java
ParseErrorEvent.java
Log:
DOM Level 3 experimental interfaces
Revision Changes Path
1.1 xml-xerces/java/src/org/apache/xerces/dom3/DOMError.java
Index: DOMError.java
===================================================================
/*
* Copyright (c) 2001 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.apache.xerces.dom3;
/**
* <code>DOMError</code> is an interface that describes an error.
* <p>See also the <a href='http://www.w3.org/2001/09/WD-DOM-Level-3-Core-20010919'>Document Object Model (DOM) Level 3 Core Specification</a>.
*/
public interface DOMError {
/**
* The severity of the error described by the <code>DOMError</code> is
* warning
*/
public static final short SEVERITY_WARNING = 0;
/**
* The severity of the error described by the <code>DOMError</code> is
* error
*/
public static final short SEVERITY_ERROR = 1;
/**
* The severity of the error described by the <code>DOMError</code> is
* fatal error
*/
public static final short SEVERITY_FATAL_ERROR = 2;
/**
* The severity of the error, either <code>SEVERITY_WARNING</code>,
* <code>SEVERITY_ERROR</code>, or <code>SEVERITY_FATAL_ERROR</code>.
*/
public short getSeverity();
/**
* An implementation specific string describing the error that occured.
*/
public String getMessage();
/**
* The byte or character offset into the input source, if we're parsing a
* file or a byte stream then this will be the byte offset into that
* stream, but if a character media is parsed then the offset will be
* the character offset.exception is a reserved word, we need to rename
* it.
*/
public Object getException();
/**
* The location of the error.
*/
public DOMLocator getLocation();
}
1.1 xml-xerces/java/src/org/apache/xerces/dom3/DOMErrorHandler.java
Index: DOMErrorHandler.java
===================================================================
/*
* Copyright (c) 2001 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.apache.xerces.dom3;
/**
* <code>DOMErrorHandler</code> is a callback interface that the DOM
* implementation can call when reporting errors that happens while
* processing XML data, or when doing some other processing (e.g. validating
* a document).
* <p>The application that is using the DOM implementation is expected to
* implement this interface.How does one register an error handler in the
* core? Passed as an argument to super-duper-normalize or registered on the
* DOMImplementation?
* <p>See also the <a href='http://www.w3.org/2001/09/WD-DOM-Level-3-Core-20010919'>Document Object Model (DOM) Level 3 Core Specification</a>.
*/
public interface DOMErrorHandler {
/**
* This method is called on the error handler when an error occures.
* @param error The error object that describes the error, this object
* may be reused by the DOM implementation across multiple calls to
* the handleEvent method.
* @return If the handleError method returns <code>true</code> the DOM
* implementation should continue as if the error didn't happen when
* possible, if the method returns <code>false</code> then the DOM
* implementation should stop the current processing when possible.
*/
public boolean handleError(DOMError error);
}
1.1 xml-xerces/java/src/org/apache/xerces/dom3/DOMLocator.java
Index: DOMLocator.java
===================================================================
/*
* Copyright (c) 2001 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.apache.xerces.dom3;
import org.w3c.dom.Node;
/**
* <code>DOMLocator</code> is an interface that describes a location (e.g.
* where an error occured).
* <p>See also the <a href='http://www.w3.org/2001/09/WD-DOM-Level-3-Core-20010919'>Document Object Model (DOM) Level 3 Core Specification</a>.
*/
public interface DOMLocator {
/**
* The line number where the error occured, or -1 if there is no line
* number available.
*/
public int getLineNumber();
/**
* The column number where the error occured, or -1 if there is no column
* number available.
*/
public int getColumnNumber();
/**
* The byte or character offset into the input source, if we're parsing a
* file or a byte stream then this will be the byte offset into that
* stream, but if a character media is parsed then the offset will be
* the character offset.
*/
public int getOffset();
/**
* The DOM Node where the error occured, or null if there is no Node
* available.
*/
public Node getErrorNode();
/**
* The URI where the error occured, or null if there is no URI available.
*/
public String getUri();
}
1.1 xml-xerces/java/src/org/apache/xerces/dom3/as/ASAttributeDeclaration.java
Index: ASAttributeDeclaration.java
===================================================================
/*
* Copyright (c) 2001 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.apache.xerces.dom3.as;
/**
* An attribute declaration in the context of a <code>ASObject</code>.The
* constant 'REQUIRED' is missing from this interface.
* <p>See also the <a href='http://www.w3.org/TR/2001/WD-DOM-Level-3-ASLS-20011025'>Document Object Model (DOM) Level 3 Abstract Schemas and Load
and Save Specification</a>.
*/
public interface ASAttributeDeclaration extends ASObject {
// VALUE_TYPES
/**
* Describes that the attribute does not have any value constraint.
*/
public static final short VALUE_NONE = 0;
/**
* Indicates that the there is a default value constraint.
*/
public static final short VALUE_DEFAULT = 1;
/**
* Indicates that there is a fixed value constraint for this attribute.
*/
public static final short VALUE_FIXED = 2;
/**
* Datatype of the attribute.
*/
public ASDataType getDataType();
/**
* Datatype of the attribute.
*/
public void setDataType(ASDataType dataType);
/**
* Default or fixed value.
*/
public String getDataValue();
/**
* Default or fixed value.
*/
public void setDataValue(String dataValue);
/**
* Valid attribute values, separated by commas, in a string.
*/
public String getEnumAttr();
/**
* Valid attribute values, separated by commas, in a string.
*/
public void setEnumAttr(String enumAttr);
/**
* Owner elements <code>ASObject</code> of attribute, meaning that an
* attribute declaration can be shared by multiple elements.
*/
public ASObjectList getOwnerElements();
/**
* Owner elements <code>ASObject</code> of attribute, meaning that an
* attribute declaration can be shared by multiple elements.
*/
public void setOwnerElements(ASObjectList ownerElements);
/**
* Constraint type if any for this attribute.
*/
public short getDefaultType();
/**
* Constraint type if any for this attribute.
*/
public void setDefaultType(short defaultType);
}
1.1 xml-xerces/java/src/org/apache/xerces/dom3/as/ASContentModel.java
Index: ASContentModel.java
===================================================================
/*
* Copyright (c) 2001 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.apache.xerces.dom3.as;
/**
* The content model of a declared element.
* <p>See also the <a href='http://www.w3.org/TR/2001/WD-DOM-Level-3-ASLS-20011025'>Document Object Model (DOM) Level 3 Abstract Schemas and Load
and Save Specification</a>.
*/
public interface ASContentModel extends ASObject {
/**
* Signifies unbounded upper limit. The MAX_VALUE value is
* <code>0xFFFFFFFF FFFFFFFF</code>. This needs to be better defined in
* the generated bindings.
*/
public static final int AS_UNBOUNDED = Integer.MAX_VALUE;
// ASContentModelType
/**
* This constant value signifies a sequence operator. For example, in a
* DTD, this would be the '<code>,</code>' operator.
*/
public static final short AS_SEQUENCE = 0;
/**
* This constant value signifies a choice operator. For example, in a DTD,
* this would be the '<code>|</code>' operator.
*/
public static final short AS_CHOICE = 1;
/**
* All of the above.
*/
public static final short AS_ALL = 2;
/**
* None of the above, i.e., neither a choice nor sequence operator.
*/
public static final short AS_NONE = 3;
/**
* One of <code>AS_CHOICE</code>, <code>AS_SEQUENCE</code>,
* <code>AS_ALL</code> or <code>AS_NONE</code>. The operator is applied
* to all the components(ASObjects) in the <code>subModels</code>. For
* example, if the list operator is <code>AS_CHOICE</code> and the
* components in subModels are a, b and c then the abstract schema for
* the element being declared is <code>(a|b|c)</code>.
*/
public short getListOperator();
/**
* One of <code>AS_CHOICE</code>, <code>AS_SEQUENCE</code>,
* <code>AS_ALL</code> or <code>AS_NONE</code>. The operator is applied
* to all the components(ASObjects) in the <code>subModels</code>. For
* example, if the list operator is <code>AS_CHOICE</code> and the
* components in subModels are a, b and c then the abstract schema for
* the element being declared is <code>(a|b|c)</code>.
*/
public void setListOperator(short listOperator);
/**
* min occurrence for this content particle. Its value may be 0 or a
* positive integer.
*/
public int getMinOccurs();
/**
* min occurrence for this content particle. Its value may be 0 or a
* positive integer.
*/
public void setMinOccurs(int minOccurs);
/**
* maximum occurrence for this content particle. Its value may be
* <code>0</code>, a positive integer, or <code>AS_UNBOUNDED</code> to
* indicate that no upper limit has been set.
*/
public int getMaxOccurs();
/**
* maximum occurrence for this content particle. Its value may be
* <code>0</code>, a positive integer, or <code>AS_UNBOUNDED</code> to
* indicate that no upper limit has been set.
*/
public void setMaxOccurs(int maxOccurs);
/**
* Pointers to <code>ASObject</code>s such as
* <code> ASElementDeclaration</code>s and further
* <code>ASContentModel</code>s.
*/
public ASObjectList getSubModels();
/**
* Pointers to <code>ASObject</code>s such as
* <code> ASElementDeclaration</code>s and further
* <code>ASContentModel</code>s.
*/
public void setSubModels(ASObjectList subModels);
/**
* Removes the <code>ASObject</code> in the submodel. Nodes that already
* exist in the list are moved as needed.
* @param oldNode The node to be removed.
*/
public void removesubModel(ASObject oldNode);
/**
* Inserts a new node in the submodel. Nodes that already exist in the
* list are moved as needed.
* @param newNode The new node to be inserted.
* @exception DOMASException
* <code>DUPLICATE_NAME_ERR</code>: Raised if a element declaration
* already exists with the same name within an <code>AS_CHOICE</code>
* operator.
*/
public void insertsubModel(ASObject newNode)
throws DOMASException;
/**
* Appends a new node to the end of the list representing the
* <code>subModels</code>.
* @param newNode The new node to be appended.
* @return the length of the <code>subModels</code>.
* @exception DOMASException
* <code>DUPLICATE_NAME_ERR</code>: Raised if a element declaration
* already exists with the same name within an <code>AS_CHOICE</code>
* operator.
* <br> <code>TYPE_ERR</code>: Raised if type is neither an
* <code>ASContentModel</code> nor an <code>ASElementDeclaration</code>
* .
*/
public int appendsubModel(ASObject newNode)
throws DOMASException;
}
1.1 xml-xerces/java/src/org/apache/xerces/dom3/as/ASDataType.java
Index: ASDataType.java
===================================================================
/*
* Copyright (c) 2001 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.apache.xerces.dom3.as;
/**
* The datatypes supported by DOM AS implementations. Further datatypes may be
* added in the Schema/PSVI spec.
* <p>See also the <a href='http://www.w3.org/TR/2001/WD-DOM-Level-3-ASLS-20011025'>Document Object Model (DOM) Level 3 Abstract Schemas and Load
and Save Specification</a>.
*/
public interface ASDataType {
/**
* One of the enumerated codes representing the data type.
*/
public short getDataType();
// DATA_TYPES
/**
* A code representing the string data type as defined in .
*/
public static final short STRING_DATATYPE = 1;
/**
* The NOTATION data type as defined in .
*/
public static final short NOTATION_DATATYPE = 10;
/**
* The ID data type as defined in .
*/
public static final short ID_DATATYPE = 11;
/**
* The IDREF data type as defined in .
*/
public static final short IDREF_DATATYPE = 12;
/**
* The IDREFS data type as defined in .
*/
public static final short IDREFS_DATATYPE = 13;
/**
* The ENTITY data type as defined in .
*/
public static final short ENTITY_DATATYPE = 14;
/**
* The ENTITIES data type as defined in .
*/
public static final short ENTITIES_DATATYPE = 15;
/**
* The NMTOKEN data type as defined in .
*/
public static final short NMTOKEN_DATATYPE = 16;
/**
* The NMTOKENS data type as defined in .
*/
public static final short NMTOKENS_DATATYPE = 17;
/**
* A code representing the boolean data type as defined in .
*/
public static final short BOOLEAN_DATATYPE = 100;
/**
* A code representing the float data type as defined in .
*/
public static final short FLOAT_DATATYPE = 101;
/**
* A code representing the double data type as defined in .
*/
public static final short DOUBLE_DATATYPE = 102;
/**
* The decimal data type as defined in .
*/
public static final short DECIMAL_DATATYPE = 103;
/**
* The hexbinary data type as defined in .
*/
public static final short HEXBINARY_DATATYPE = 104;
/**
* The base64binary data type as defined in .
*/
public static final short BASE64BINARY_DATATYPE = 105;
/**
* Then uri reference data type as defined in .
*/
public static final short ANYURI_DATATYPE = 106;
/**
* Then XML qualified name data type as defined in .
*/
public static final short QNAME_DATATYPE = 107;
/**
* The duration data type as defined in .
*/
public static final short DURATION_DATATYPE = 108;
/**
* The datetime data type as defined in .
*/
public static final short DATETIME_DATATYPE = 109;
/**
* The date data type as defined in .
*/
public static final short DATE_DATATYPE = 110;
/**
* The time data type as defined in .
*/
public static final short TIME_DATATYPE = 111;
/**
* The yearmonth data type as defined in .
*/
public static final short GYEARMONTH_DATATYPE = 112;
/**
* The year data type as defined in .
*/
public static final short GYEAR_DATATYPE = 113;
/**
* The monthday data type as defined in .
*/
public static final short GMONTHDAY_DATATYPE = 114;
/**
* The day data type as defined in .
*/
public static final short GDAY_DATATYPE = 115;
/**
* The month data type as defined in .
*/
public static final short GMONTH_DATATYPE = 116;
/**
* The integer data type as defined in .
*/
public static final short INTEGER = 117;
/**
* A code representing the Name data type as defined in .
*/
public static final short NAME_DATATYPE = 200;
/**
* A code representing the NCName data type as defined in .
*/
public static final short NCNAME_DATATYPE = 201;
/**
* A code representing the Normalized string data type as defined in .
*/
public static final short NORMALIZEDSTRING_DATATYPE = 202;
/**
* The token data type as defined in .
*/
public static final short TOKEN_DATATYPE = 203;
/**
* The Language data type as defined in .
*/
public static final short LANGUAGE_DATATYPE = 204;
/**
* The Non-positive integer data type as defined in .
*/
public static final short NONPOSITIVEINTEGER_DATATYPE = 205;
/**
* Then negative integer data type as defined in .
*/
public static final short NEGATIVEINTEGER_DATATYPE = 206;
/**
* Then long data type as defined in .
*/
public static final short LONG_DATATYPE = 207;
/**
* The integer data type as defined in .
*/
public static final short INT_DATATYPE = 208;
/**
* The short data type as defined in .
*/
public static final short SHORT_DATATYPE = 209;
/**
* The byte data type as defined in .
*/
public static final short BYTE_DATATYPE = 210;
/**
* The non-negative integer data type as defined in .
*/
public static final short NONNEGATIVEINTEGER_DATATYPE = 211;
/**
* The unsigned long data type as defined in .
*/
public static final short UNSIGNEDLONG_DATATYPE = 212;
/**
* The unsigned integer data type as defined in .
*/
public static final short UNSIGNEDINT_DATATYPE = 213;
/**
* The unsigned short data type as defined in .
*/
public static final short UNSIGNEDSHORT_DATATYPE = 214;
/**
* The unsigned byte data type as defined in .
*/
public static final short UNSIGNEDBYTE_DATATYPE = 215;
/**
* The positive integer data type as defined in .
*/
public static final short POSITIVEINTEGER_DATATYPE = 216;
/**
* The other simple data type as defined in .
*/
public static final short OTHER_SIMPLE_DATATYPE = 1000;
/**
* The user-defined complex data type as defined in .
*/
public static final short COMPLEX_DATATYPE = 1001;
}
1.1 xml-xerces/java/src/org/apache/xerces/dom3/as/ASElementDeclaration.java
Index: ASElementDeclaration.java
===================================================================
/*
* Copyright (c) 2001 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.apache.xerces.dom3.as;
/**
* The element name along with the content specification in the context of an
* <code>ASObject</code>.
* <p>See also the <a href='http://www.w3.org/TR/2001/WD-DOM-Level-3-ASLS-20011025'>Document Object Model (DOM) Level 3 Abstract Schemas and Load
and Save Specification</a>.
*/
public interface ASElementDeclaration extends ASObject {
// CONTENT_MODEL_TYPES
/**
* Represents an EMPTY content type for an Element declaration.
*/
public static final short EMPTY_CONTENTTYPE = 1;
/**
* Represents an ANY content type for an Element declaration.
*/
public static final short ANY_CONTENTTYPE = 2;
/**
* Represents a MIXED content type for an Element declaration. Note that
* <code>isPCDataOnly</code> would also need to checked, in addition to
* this, if an element's content model was simply text, as an example.
*/
public static final short MIXED_CONTENTTYPE = 3;
/**
* Represents an ELEMENTS only content type for an Element declaration.
*/
public static final short ELEMENTS_CONTENTTYPE = 4;
/**
* A boolean defining whether the element order and number of the child
* elements for mixed content type has to be respected or not. For
* example XML Schema defined mixed content types the order is important
* and needs to be respected whether for DTD based AS the order and
* number of child elements are not important.
*/
public boolean getStrictMixedContent();
/**
* A boolean defining whether the element order and number of the child
* elements for mixed content type has to be respected or not. For
* example XML Schema defined mixed content types the order is important
* and needs to be respected whether for DTD based AS the order and
* number of child elements are not important.
*/
public void setStrictMixedContent(boolean strictMixedContent);
/**
* Datatype of the element.
*/
public ASDataType getElementType();
/**
* Datatype of the element.
*/
public void setElementType(ASDataType elementType);
/**
* Boolean defining whether the element type contains child elements and
* PCDATA or PCDATA only for mixed element types. <code>true</code> if
* the element is of type PCDATA only. Relevant only for mixed content
* type elements.
*/
public boolean getIsPCDataOnly();
/**
* Boolean defining whether the element type contains child elements and
* PCDATA or PCDATA only for mixed element types. <code>true</code> if
* the element is of type PCDATA only. Relevant only for mixed content
* type elements.
*/
public void setIsPCDataOnly(boolean isPCDataOnly);
/**
* The content type of the element. One of <code>EMPTY_CONTENTTYPE</code>,
* <code>ANY_CONTENTTYPE</code>, <code>MIXED_CONTENTTYPE</code>,
* <code>ELEMENTS_CONTENTTYPE</code>.
*/
public short getContentType();
/**
* The content type of the element. One of <code>EMPTY_CONTENTTYPE</code>,
* <code>ANY_CONTENTTYPE</code>, <code>MIXED_CONTENTTYPE</code>,
* <code>ELEMENTS_CONTENTTYPE</code>.
*/
public void setContentType(short contentType);
/**
* the URI reference representing the system identifier for the notation
* declaration, if present, <code>null</code> otherwise.
*/
public String getSystemId();
/**
* the URI reference representing the system identifier for the notation
* declaration, if present, <code>null</code> otherwise.
*/
public void setSystemId(String systemId);
/**
* The content model of element.
*/
public ASContentModel getAsCM();
/**
* The content model of element.
*/
public void setAsCM(ASContentModel asCM);
/**
* The<code>ASNamedObjectMap</code> containing
* <code>ASAttributeDeclarations</code> for all the attributes that can
* appear on this type of element.
*/
public ASNamedObjectMap getASAttributeDecls();
/**
* The<code>ASNamedObjectMap</code> containing
* <code>ASAttributeDeclarations</code> for all the attributes that can
* appear on this type of element.
*/
public void setASAttributeDecls(ASNamedObjectMap ASAttributeDecls);
/**
* Adds an <code>ASAttributeDeclaration</code> for the element being
* declared.
* @param attributeDecl The new attribute to add. If the attribute
* declaration already exists for the element, the call does not have
* any effect.
*/
public void addASAttributeDecl(ASAttributeDeclaration attributeDecl);
/**
* Removes an <code>ASAttributeDeclaration</code> from the element being
* declared.
* @param attributeDecl The attribute declaraition to be removed. If the
* attribute declaration does not exist for the element, the call does
* not have any effect.
* @return <code>null</code> if the attribute does not exist. Otherwise
* returns the attribute being removed.
*/
public ASAttributeDeclaration removeASAttributeDecl(ASAttributeDeclaration attributeDecl);
}
1.1 xml-xerces/java/src/org/apache/xerces/dom3/as/ASEntityDeclaration.java
Index: ASEntityDeclaration.java
===================================================================
/*
* Copyright (c) 2001 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.apache.xerces.dom3.as;
/**
* Models a general entity declaration in an abstract schema. The abstract
* schema does not handle any parameter entity. It is assumed that the
* parameter entities are expanded by the implementation as the abstract
* schema is built.
* <p>See also the <a href='http://www.w3.org/TR/2001/WD-DOM-Level-3-ASLS-20011025'>Document Object Model (DOM) Level 3 Abstract Schemas and Load
and Save Specification</a>.
*/
public interface ASEntityDeclaration extends ASObject {
// EntityType
/**
* constant defining an internal entity.
*/
public static final short INTERNAL_ENTITY = 1;
/**
* constant defining an external entity.
*/
public static final short EXTERNAL_ENTITY = 2;
/**
* The type of the entity as defined above.
*/
public short getEntityType();
/**
* The type of the entity as defined above.
*/
public void setEntityType(short entityType);
/**
* The replacement text for the internal entity. The entity references
* within the replacement text are kept intact. For an entity of type
* <code>EXTERNAL_ENTITY</code>, this is <code>null</code>.
*/
public String getEntityValue();
/**
* The replacement text for the internal entity. The entity references
* within the replacement text are kept intact. For an entity of type
* <code>EXTERNAL_ENTITY</code>, this is <code>null</code>.
*/
public void setEntityValue(String entityValue);
/**
* the URI reference representing the system identifier for the notation
* declaration, if present, <code>null</code> otherwise.
*/
public String getSystemId();
/**
* the URI reference representing the system identifier for the notation
* declaration, if present, <code>null</code> otherwise.
*/
public void setSystemId(String systemId);
/**
* The string representing the public identifier for this notation
* declaration, if present; <code>null</code> otherwise.
*/
public String getPublicId();
/**
* The string representing the public identifier for this notation
* declaration, if present; <code>null</code> otherwise.
*/
public void setPublicId(String publicId);
}
1.1 xml-xerces/java/src/org/apache/xerces/dom3/as/ASModel.java
Index: ASModel.java
===================================================================
/*
* Copyright (c) 2001 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.apache.xerces.dom3.as;
import org.w3c.dom.DOMException;
/**
* To begin with, an abstract schema is a generic structure that could
* contain both internal and external subsets. An <code>ASModel</code> is an
* abstract object that could map to a DTD , an XML Schema , a database
* schema, etc. An <code>ASModel</code> could represent either an internal
* or an external subset; hence an abstract schema could be composed of an
* <code>ASModel</code> representing the internal subset and an
* <code>ASModel</code> representing the external subset. Note that the
* <code>ASModel</code> representing the external subset could consult the
* <code>ASModel</code> representing the internal subset. Furthermore, the
* <code>ASModel</code> representing the internal subset could be set to
* null by the <code>setInternalAS</code> method as a mechanism for
* "removal". In addition, only one <code>ASModel</code> representing the
* external subset can be specified as "active" and it is possible that none
* are "active". Finally, the <code>ASModel</code> contains the factory
* methods needed to create a various types of ASObjects like
* <code>ASElementDeclaration</code>, <code>ASAttributeDeclaration</code>,
* etc.
* <p>See also the <a href='http://www.w3.org/TR/2001/WD-DOM-Level-3-ASLS-20011025'>Document Object Model (DOM) Level 3 Abstract Schemas and Load
and Save Specification</a>.
*/
public interface ASModel extends ASObject {
/**
* <code>true</code> if this <code>ASModel</code> defines the document
* structure in terms of namespaces and local names ; <code>false</code>
* if the document structure is defined only in terms of
* <code>QNames</code>.
*/
public boolean getIsNamespaceAware();
/**
* 0 if used internally, 1 if used externally, 2 if not all. An exception
* will be raised if it is incompatibly shared or in use as an internal
* subset.
*/
public short getUsageLocation();
/**
* The URI reference.
*/
public String getAsLocation();
/**
* The URI reference.
*/
public void setAsLocation(String asLocation);
/**
* The hint to locating an ASModel.
*/
public String getAsHint();
/**
* The hint to locating an ASModel.
*/
public void setAsHint(String asHint);
/**
* Instead of returning an all-in-one <code>ASObject</code> with
* <code>ASModel</code> methods, have discernible top-level/"global"
* element declarations. If one attempts to add, set, or remove a node
* type other than the intended one, a hierarchy exception (or
* equivalent is thrown).
*/
public ASNamedObjectMap getElementDeclarations();
/**
* Instead of returning an all-in-one <code>ASObject</code> with
* <code>ASModel</code> methods, have discernible top-level/"global"
* attribute declarations. If one attempts to add, set, or remove a node
* type other than the intended one, a hierarchy exception (or
* equivalent is thrown).
*/
public ASNamedObjectMap getAttributeDeclarations();
/**
* Instead of returning an all-in-one <code>ASObject</code> with
* <code>ASModel</code> methods, have discernible top-level/"global"
* notation declarations. If one attempts to add, set, or remove a node
* type other than the intended one, a hierarchy exception (or
* equivalent is thrown).
*/
public ASNamedObjectMap getNotationDeclarations();
/**
* Instead of returning an all-in-one <code>ASObject</code> with
* <code>ASModel</code> methods, have discernible top-level/"global"
* entity declarations. If one attempts to add, set, or remove a node
* type other than the intended one, a hierarchy exception (or
* equivalent is thrown).
*/
public ASNamedObjectMap getEntityDeclarations();
/**
* Instead of returning an all-in-one <code>ASObject</code> with
* <code>ASModel</code> methods, have discernible top-level/"global
* content model declarations. If one attempts to add, set, or remove a
* node type other than the intended one, a hierarchy exception (or
* equivalent is thrown).
*/
public ASNamedObjectMap getContentModelDeclarations();
/**
* This method will allow the nesting or "importation" of ASModels.
* @param abstractSchema ASModel to be set. Subsequent calls will nest
* the ASModels within the specified <code>ownerASModel</code>.
*/
public void setASModel(ASModel abstractSchema);
/**
* To retrieve a list of nested ASModels without reference to names.
* @return A list of ASModels.
*/
public ASObjectList getASModels();
/**
* Removes only the specified <code>ASModel</code> from the list of
* <code>ASModel</code>s.
* @param as AS to be removed.
*/
public void removeAS(ASModel as);
/**
* Determines if an <code>ASModel</code> itself is valid, i.e., confirming
* that it's well-formed and valid per its own formal grammar.
* @return <code>true</code> if the <code>ASModel</code> is valid,
* <code>false</code> otherwise.
*/
public boolean validate();
/**
* Creates an element declaration for the element type specified.
* @param namespaceURI The <code>namespace URI</code> of the element type
* being declared.
* @param name The name of the element. The format of the name could be
* an NCName as defined by XML Namespaces or a Name as defined by XML
* 1.0; it's ASModel-dependent.
* @return A new <code>ASElementDeclaration</code> object with
* <code>name</code> attribute set to <code>tagname</code> and
* <code>namespaceURI</code> set to <code>systemId</code>. Other
* attributes of the element declaration are set through
* <code>ASElementDeclaration</code> interface methods.
* @exception DOMException
* INVALID_CHARACTER_ERR: Raised if the specified name contains an
* illegal character.
*/
public ASElementDeclaration createASElementDeclaration(String namespaceURI,
String name)
throws DOMException;
/**
* Creates an attribute declaration.
* @param namespaceURI The namespace URI of the attribute being declared.
* @param name The name of the attribute. The format of the name could be
* an NCName as defined by XML Namespaces or a Name as defined by XML
* 1.0; it's ASModel-dependent.
* @return A new <code>ASAttributeDeclaration</code> object with
* appropriate attributes set by input parameters.
* @exception DOMException
* INVALID_CHARACTER_ERR: Raised if the input <code>name</code>
* parameter contains an illegal character.
*/
public ASAttributeDeclaration createASAttributeDeclaration(String namespaceURI,
String name)
throws DOMException;
/**
* Creates a new notation declaration.
* @param namespaceURI The namespace URI of the notation being declared.
* @param name The name of the notation. The format of the name could be
* an NCName as defined by XML Namespaces or a Name as defined by XML
* 1.0; it's ASModel-dependent.
* @param systemId The system identifier for the notation declaration.
* @param publicId The public identifier for the notation declaration.
* @return A new <code>ASNotationDeclaration</code> object with
* <code>notationName</code> attribute set to <code>name</code> and
* <code>publicId</code> and <code>systemId</code> set to the
* corresponding fields.
* @exception DOMException
* INVALID_CHARACTER_ERR: Raised if the specified name contains an
* illegal character.
*/
public ASNotationDeclaration createASNotationDeclaration(String namespaceURI,
String name,
String systemId,
String publicId)
throws DOMException;
/**
* Creates an ASEntityDeclaration.
* @param name The name of the entity being declared.
* @return A new <code>ASEntityDeclaration</code> object with
* <code>entityName</code> attribute set to name.
* @exception DOMException
* INVALID_CHARACTER_ERR: Raised if the specified name contains an
* illegal character.
*/
public ASEntityDeclaration createASEntityDeclaration(String name)
throws DOMException;
/**
* Creates an object which describes part of an
* <code>ASElementDeclaration</code>'s content model.
* @param minOccurs The minimum occurrence for the subModels of this
* <code>ASContentModel</code>.
* @param maxOccurs The maximum occurrence for the subModels of this
* <code>ASContentModel</code>.
* @param operator operator of type <code>AS_CHOICE</code>,
* <code>AS_SEQUENCE</code>, <code>AS_ALL</code> or
* <code>AS_NONE</code>.
* @return A new <code>ASContentModel</code> object.
* @exception DOMASException
* A DOMASException, e.g., <code>minOccurs > maxOccurs</code>.
*/
public ASContentModel createASContentModel(int minOccurs,
int maxOccurs,
short operator)
throws DOMASException;
}
1.1 xml-xerces/java/src/org/apache/xerces/dom3/as/ASNamedObjectMap.java
Index: ASNamedObjectMap.java
===================================================================
/*
* Copyright (c) 2001 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.apache.xerces.dom3.as;
import org.w3c.dom.DOMException;
/**
* Objects implementing the <code>ASNamedObjectMap</code> interface are used
* to represent collections of abstract schema nodes that can be accessed by
* name. Note that <code>ASNamedObjectMap</code> does not inherit from
* <code>ASObjectList</code>; <code>ASNamedObjectMaps</code> are not
* maintained in any particular order. Objects contained in an object
* implementing <code>ASNamedObjectMap</code> may also be accessed by an
* ordinal index, but this is simply to allow convenient enumeration of the
* contents of a <code>ASNamedObjectMap</code>, and does not imply that the
* DOM specifies an order to these <code>ASObjects</code>.
* <p><code>ASNamedObjectMap</code> object in the DOM are live.
* <p>See also the <a href='http://www.w3.org/TR/2001/WD-DOM-Level-3-ASLS-20011025'>Document Object Model (DOM) Level 3 Abstract Schemas and Load
and Save Specification</a>.
*/
public interface ASNamedObjectMap {
/**
* The number of <code>ASObjects</code> in the <code>ASObjectList</code>.
* The range of valid child node indices is 0 to <code>length-1</code>
* inclusive.
*/
public int getLength();
/**
* Retrieves an <code>ASObject</code> specified by name.
* @param name The <code>nodeName</code> of an <code>ASObject</code> to
* retrieve.
* @return An <code>ASObject</code> with specified node name and
* <code>null</code> if the map does not contain an element with the
* given name.
*/
public ASObject getNamedItem(String name);
/**
* Retrieves an <code>ASObject</code> specified by local name and
* namespace URI.
* @param namespaceURI The namespace URI of the <code>ASObject</code> to
* retrieve.
* @param localName The local name of the <code>ASObject</code> to
* retrieve.
* @return A <code>ASObject</code> (of any type) with the specified local
* name and namespace URI, or <code>null</code> if they do not
* identify any <code>ASObject</code> in this map.
*/
public ASObject getNamedItemNS(String namespaceURI,
String localName);
/**
* Returns the <code>index</code>th item in the map. The index starts at
* <code>0</code>. If <code>index</code> is greater than or equal to the
* number of nodes in the list, this returns <code>null</code>.
* @param index The position in the map from which the item is to be
* retrieved.
* @return The <code>ASObject</code> at the <code>index</code>th position
* in the <code>ASNamedObjectMap</code>, or <code>null</code> if that
* is not a valid index.
*/
public ASObject item(int index);
/**
* Removes an <code>ASObject</code> specified by a <code>nodeName</code>.
* @param name The <code>nodeName</code> of the <code>ASObject</code> to
* be removed.
* @return The <code>ASObject</code> removed from this map if an
* <code>ASObject</code> with such a name exists.
* @exception DOMException
* NOT_FOUND_ERR: Raised if there is no node named <code>name</code> in
* this map.
* <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly.
*/
public ASObject removeNamedItem(String name)
throws DOMException;
/**
* Removes an <code>ASObject</code> specified by a namespace URI and a
* local name.
* @param namespaceURI The namespace URI of the <code>ASObject</code> to
* be removed.
* @param localName The local name of the <code>ASObject</code> to remove.
* @return The <code>ASObject</code> removed from this map if an
* <code>ASObject</code> with such a local name and namespace URI
* exists.
* @exception DOMException
* NOT_FOUND_ERR: Raised if there is no node with the specified
* <code>namespaceURI</code> and <code>localName</code> in this map.
* <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly.
*/
public ASObject removeNamedItemNS(String namespaceURI,
String localName)
throws DOMException;
/**
* Adds an <code>ASObject</code> using its <code>nodeName</code>
* attribute. If an <code>ASObject</code> with that name is already
* present in this map, it is replaced by the new one.
* @param newASObject The <code>ASObject</code> to be inserted in the map
* with its <code>nodeName</code> as the key.
* @return If the new node replaces an existing one, the replaced node is
* returned, otherwise <code>null</code>.
* @exception DOMException
* WRONG_DOCUMENT_ERR: Raised if <code>arg</code> was created from a
* different <code>ASModel</code> than the one that created this map.
* <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly.
* <br>HIERARCHY_REQUEST_ERR: Raised if an attempt is made to add a node
* doesn't belong in this <code>ASNamedObjectMap</code>.
*/
public ASObject setNamedItem(ASObject newASObject)
throws DOMException;
/**
* Adds an <code>ASObject</code> using its <code>namespaceURI</code> and
* <code>localName</code>. If an <code>ASObject</code> with the same
* <code>namespaceURI</code> and <code>localName</code> is already
* present in this map, it is replaced by the new one.
* @param newASObject The <code>ASObject</code> to be inserted in the
* map.The <code>ASObject</code> will later be accessible using the
* value of its <code>namespaceURI</code> and <code>localName</code>
* attributes.
* @return If the new node replaces an existing one, the replaced node is
* returned, otherwise <code>null</code>.
* @exception DOMException
* <code>WRONG_DOCUMENT_ERR</code>: Raised if <code>arg</code> was
* created from a different <code>ASModel</code> than the one that
* created this map.
* <br><code>NO_MODIFICATION_ALLOWED_ERR</code>: Raised if this map is
* readonly.
* <br><code>HIERARCHY_REQUEST_ERR</code>: Raised if an attempt is made
* to add a node doesn't belong in this <code>ASNamedObjectMap</code>.
*/
public ASObject setNamedItemNS(ASObject newASObject)
throws DOMException;
}
1.1 xml-xerces/java/src/org/apache/xerces/dom3/as/ASNotationDeclaration.java
Index: ASNotationDeclaration.java
===================================================================
/*
* Copyright (c) 2001 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.apache.xerces.dom3.as;
/**
* This interface represents a notation declaration.
* <p>See also the <a href='http://www.w3.org/TR/2001/WD-DOM-Level-3-ASLS-20011025'>Document Object Model (DOM) Level 3 Abstract Schemas and Load
and Save Specification</a>.
*/
public interface ASNotationDeclaration extends ASObject {
/**
* the URI reference representing the system identifier for the notation
* declaration, if present, <code>null</code> otherwise.
*/
public String getSystemId();
/**
* the URI reference representing the system identifier for the notation
* declaration, if present, <code>null</code> otherwise.
*/
public void setSystemId(String systemId);
/**
* The string representing the public identifier for this notation
* declaration, if present; <code>null</code> otherwise.
*/
public String getPublicId();
/**
* The string representing the public identifier for this notation
* declaration, if present; <code>null</code> otherwise.
*/
public void setPublicId(String publicId);
}
1.1 xml-xerces/java/src/org/apache/xerces/dom3/as/ASObject.java
Index: ASObject.java
===================================================================
/*
* Copyright (c) 2001 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.apache.xerces.dom3.as;
/**
* The <code>ASObject</code> interface is analogous to a <code>Node</code> in
* , e.g., an element declaration.
* <p>Opaque.
* <p>See also the <a href='http://www.w3.org/TR/2001/WD-DOM-Level-3-ASLS-20011025'>Document Object Model (DOM) Level 3 Abstract Schemas and Load
and Save Specification</a>.
*/
public interface ASObject {
// ASObjectType
/**
* The node is an <code>ASElementDeclaration</code>.
*/
public static final short AS_ELEMENT_DECLARATION = 1;
/**
* The node is an <code>ASAttributeDeclaration</code>.
*/
public static final short AS_ATTRIBUTE_DECLARATION = 2;
/**
* The node is a <code>ASNotationDeclaration</code>.
*/
public static final short AS_NOTATION_DECLARATION = 3;
/**
* The node is an <code>ASEntityDeclaration</code>.
*/
public static final short AS_ENTITY_DECLARATION = 4;
/**
* The node is a <code>ASContentModel</code>.
*/
public static final short AS_CONTENTMODEL = 5;
/**
* The node is a <code>ASModel</code>.
*/
public static final short AS_MODEL = 6;
/**
* A code representing the underlying object as defined above.
*/
public short getAsNodeType();
/**
* The <code>ASModel</code> object associated with this
* <code>ASObject</code>. For a node of type <code>AS_MODEL</code>, this
* is <code>null</code>.
*/
public ASModel getOwnerASModel();
/**
* The <code>ASModel</code> object associated with this
* <code>ASObject</code>. For a node of type <code>AS_MODEL</code>, this
* is <code>null</code>.
*/
public void setOwnerASModel(ASModel ownerASModel);
/**
* The <code>name</code> of this <code>ASObject</code> depending on the
* <code>ASObject</code> type.
*/
public String getNodeName();
/**
* The <code>name</code> of this <code>ASObject</code> depending on the
* <code>ASObject</code> type.
*/
public void setNodeName(String nodeName);
/**
* The namespace prefix of this node, or <code>null</code> if it is
* unspecified.
*/
public String getPrefix();
/**
* The namespace prefix of this node, or <code>null</code> if it is
* unspecified.
*/
public void setPrefix(String prefix);
/**
* Returns the local part of the qualified name of this
* <code>ASObject</code>.
*/
public String getLocalName();
/**
* Returns the local part of the qualified name of this
* <code>ASObject</code>.
*/
public void setLocalName(String localName);
/**
* The namespace URI of this node, or <code>null</code> if it is
* unspecified. defines how a namespace URI is attached to schema
* components.
*/
public String getNamespaceURI();
/**
* The namespace URI of this node, or <code>null</code> if it is
* unspecified. defines how a namespace URI is attached to schema
* components.
*/
public void setNamespaceURI(String namespaceURI);
/**
* Creates a copy of this <code>ASObject</code>. See text for
* <code>cloneNode</code> off of <code>Node</code> but substitute AS
* functionality.
* @param deep Setting the <code>deep</code> flag on, causes the whole
* subtree to be duplicated. Setting it to <code>false</code> only
* duplicates its immediate child nodes.
* @return Cloned <code>ASObject</code>.
*/
public ASObject cloneASObject(boolean deep);
}
1.1 xml-xerces/java/src/org/apache/xerces/dom3/as/ASObjectList.java
Index: ASObjectList.java
===================================================================
/*
* Copyright (c) 2001 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.apache.xerces.dom3.as;
/**
* The <code>ASObjectList</code> interface provides the abstraction of an
* ordered collection of AS nodes, without defining or constraining how this
* collection is implemented. <code>ASObjectList</code> objects in the DOM
* AS are live.
* <p>See also the <a href='http://www.w3.org/TR/2001/WD-DOM-Level-3-ASLS-20011025'>Document Object Model (DOM) Level 3 Abstract Schemas and Load
and Save Specification</a>.
*/
public interface ASObjectList {
/**
* The number of <code>ASObjects</code> in the list. The range of valid
* child node indices is 0 to <code>length-1</code> inclusive.
*/
public int getLength();
/**
* Returns the <code>index</code>th item in the collection. The index
* starts at 0. If <code>index</code> is greater than or equal to the
* number of nodes in the list, this returns <code>null</code>.
* @param index index into the collection.
* @return The <code>ASObject</code> at the <code>index</code>th position
* in the <code>ASObjectList</code>, or <code>null</code> if that is
* not a valid index.
*/
public ASObject item(int index);
}
1.1 xml-xerces/java/src/org/apache/xerces/dom3/as/CharacterDataEditAS.java
Index: CharacterDataEditAS.java
===================================================================
/*
* Copyright (c) 2001 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.apache.xerces.dom3.as;
/**
* This interface extends the <code>NodeEditAS</code> interface with
* additional methods for document editing. An object implementing this
* interface must also implement NodeEditAS interface.
* <p>See also the <a href='http://www.w3.org/TR/2001/WD-DOM-Level-3-ASLS-20011025'>Document Object Model (DOM) Level 3 Abstract Schemas and Load
and Save Specification</a>.
*/
public interface CharacterDataEditAS extends NodeEditAS {
/**
* <code>true</code> if content only whitespace; <code>false</code> for
* non-whitespace.
*/
public boolean getIsWhitespaceOnly();
/**
* Determines if data can be set.
* @param offset Offset.
* @param count Argument to be set.
* @return <code>true</code> if no reason it can't be done;
* <code>false</code> if it can't be done.
*/
public boolean canSetData(int offset,
int count);
/**
* Determines if data can be appended.
* @param arg Argument to be appended.
* @return <code>true</code> if no reason it can't be done;
* <code>false</code> if it can't be done.
*/
public boolean canAppendData(String arg);
/**
* Determines if data can be replaced.
* @param offset Offset.
* @param count Replacement.
* @param arg Argument to be set.
* @return <code>true</code> if no reason it can't be done;
* <code>false</code> if it can't be done.
*/
public boolean canReplaceData(int offset,
int count,
String arg);
/**
* Determines if data can be inserted.
* @param offset Offset.
* @param arg Argument to be set.
* @return <code>true</code> if no reason it can't be done;
* <code>false</code> if it can't be done.
*/
public boolean canInsertData(int offset,
String arg);
/**
* Determines if data can be deleted.
* @param offset Offset.
* @param count Number of 16-bit units to delete.
* @return <code>true</code> if no reason it can't be done;
* <code>false</code> if it can't be done.
*/
public boolean canDeleteData(int offset,
int count);
}
1.1 xml-xerces/java/src/org/apache/xerces/dom3/as/DOMASBuilder.java
Index: DOMASBuilder.java
===================================================================
/*
* Copyright (c) 2001 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.apache.xerces.dom3.as;
import org.apache.xerces.dom3.ls.DOMInputSource;
import org.apache.xerces.dom3.ls.DOMBuilder;
/**
* An Abstract Schema parser interface.
* <p><code>DOMASBuilder</code> provides an API for parsing Abstract Schemas
* and building the corresponding <code>ASModel</code> tree.
* <p>See also the <a href='http://www.w3.org/TR/2001/WD-DOM-Level-3-ASLS-20011025'>Document Object Model (DOM) Level 3 Abstract Schemas and Load
and Save Specification</a>.
*/
public interface DOMASBuilder extends DOMBuilder {
/**
* Associate an <code>ASModel</code> with a <code>DOMBuilder</code>. This
* <code>ASModel</code> will be used by the "
* <code>validate-if-schema</code>" and "
* <code>datatype-normalization</code>" options during the load of a new
* <code>Document</code>.
*/
public ASModel getAbstractSchema();
/**
* Associate an <code>ASModel</code> with a <code>DOMBuilder</code>. This
* <code>ASModel</code> will be used by the "
* <code>validate-if-schema</code>" and "
* <code>datatype-normalization</code>" options during the load of a new
* <code>Document</code>.
*/
public void setAbstractSchema(ASModel abstractSchema);
/**
* Parse a Abstract Schema from a location identified by an URI reference.
* @param uri The location of the Abstract Schema to be read.
* @return The newly created Abstract Schema.
* @exception DOMASException
* Exceptions raised by <code>parseASURI()</code> originate with the
* installed ErrorHandler, and thus depend on the implementation of
* the <code>DOMErrorHandler</code> interfaces. The default error
* handlers will raise a <code>DOMASException</code> if any form of
* Abstract Schema inconsistencies or warning occurs during the parse,
* but application defined errorHandlers are not required to do so.
* <br> WRONG_MIME_TYPE_ERR: Raised when <code>mimeTypeCheck</code> is
* <code>true</code> and the input source has an incorrect MIME Type.
* See the attribute <code>mimeTypeCheck</code>.
* @exception DOMSystemException
* Exceptions raised by <code>parseURI()</code> originate with the
* installed ErrorHandler, and thus depend on the implementation of
* the <code>DOMErrorHandler</code> interfaces. The default error
* handlers will raise a DOMSystemException if any form I/O or other
* system error occurs during the parse, but application defined error
* handlers are not required to do so.
*/
public ASModel parseASURI(String uri)
throws DOMASException, Exception;
/**
* Parse a Abstract Schema from a location identified by an
* <code>DOMInputSource</code>.
* @param is The <code>DOMInputSource</code> from which the source
* Abstract Schema is to be read.
* @return The newly created <code>ASModel</code>.
* @exception DOMASException
* Exceptions raised by <code>parseASURI()</code> originate with the
* installed ErrorHandler, and thus depend on the implementation of
* the <code>DOMErrorHandler</code> interfaces. The default error
* handlers will raise a <code>DOMASException</code> if any form of
* Abstract Schema inconsistencies or warning occurs during the parse,
* but application defined errorHandlers are not required to do so.
* <br> Raise a WRONG_MIME_TYPE_ERR when <code>mimeTypeCheck</code> is
* <code>true</code> and the inputsource has an incorrect MIME Type.
* See attribute <code>mimeTypeCheck</code>.
* @exception DOMSystemException
* Exceptions raised by <code>parseURI()</code> originate with the
* installed ErrorHandler, and thus depend on the implementation of
* the <code>DOMErrorHandler</code> interfaces. The default error
* handlers will raise a DOMSystemException if any form I/O or other
* system error occurs during the parse, but application defined error
* handlers are not required to do so.
*/
public ASModel parseASInputSource(DOMInputSource is)
throws DOMASException, Exception;
}
1.1 xml-xerces/java/src/org/apache/xerces/dom3/as/DOMASException.java
Index: DOMASException.java
===================================================================
/*
* Copyright (c) 2001 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.apache.xerces.dom3.as;
/**
* Abstract Schemas operations may throw a <code>DOMSystemException</code> as
* described in their descriptions.
* <p>See also the <a href='http://www.w3.org/TR/2001/WD-DOM-Level-3-ASLS-20011025'>Document Object Model (DOM) Level 3 Abstract Schemas and Load
and Save Specification</a>.
*/
public class DOMASException extends RuntimeException {
public DOMASException(short code, String message) {
super(message);
this.code = code;
}
public short code;
// ASExceptionCode
/**
* If an element declaration already exists with the same name within an
* <code>AS_CHOICE</code> operator.
*/
public static final short DUPLICATE_NAME_ERR = 1;
/**
* If the type of the <code>ASObject</code> is neither an
* <code>ASContentModel</code> nor an <code>ASElementDeclaration</code>.
*/
public static final short TYPE_ERR = 2;
/**
* If the <code>DocumentEditAS</code> related to the node does not have
* any active <code>ASModel</code> and <code>wfValidityCheckLevel</code>
* is set to <code>PARTIAL</code> or <code>STRICT_VALIDITY_CHECK</code>.
*/
public static final short NO_AS_AVAILABLE = 3;
/**
* When <code>mimeTypeCheck</code> is <code>true</code> and the input
* source has an incorrect MIME Type. See the attribute
* <code>mimeTypeCheck</code>.
*/
public static final short WRONG_MIME_TYPE_ERR = 4;
}
1.1 xml-xerces/java/src/org/apache/xerces/dom3/as/DOMASWriter.java
Index: DOMASWriter.java
===================================================================
/*
* Copyright (c) 2001 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.apache.xerces.dom3.as;
import org.apache.xerces.dom3.ls.DOMWriter;
/**
* A Abstract Schema serialization interface.
* <p> DOMASWriters provides an API for serializing Abstract Schemas out in
* the form of a source Abstract Schema. The Abstract Schema is written to
* an output stream, the type of which depends on the specific language
* bindings in use.
* <p> DOMASWriter is a generic Abstract Schema serialization interface. It
* can be applied to both an internal Abstract Schema and/or an external
* Abstract Schema. DOMASWriter is applied to serialize a single Abstract
* Schema. Serializing a document with an active Internal Abstract Schema
* will serialize this internal Abstract Schema with the document as it is
* part of the Document (see <code>DOMWriter</code>).
* <p>See also the <a href='http://www.w3.org/TR/2001/WD-DOM-Level-3-ASLS-20011025'>Document Object Model (DOM) Level 3 Abstract Schemas and Load
and Save Specification</a>.
*/
public interface DOMASWriter extends DOMWriter {
/**
* Write out the specified Abstract Schema to the specified destination.
* Does it write a DTD or an XML Schema (or something else)? Is it
* possible to use this method to convert a DTD to an XML Schema?
* @param destination The destination for the data to be written.
* @param model The Abstract Schema to serialize.
* @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 void writeASModel(java.io.OutputStream destination,
ASModel model)
throws Exception;
}
1.1 xml-xerces/java/src/org/apache/xerces/dom3/as/DOMImplementationAS.java
Index: DOMImplementationAS.java
===================================================================
/*
* Copyright (c) 2001 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.apache.xerces.dom3.as;
/**
* This interface allows creation of an <code>ASModel</code>. The expectation
* is that an instance of the <code>DOMImplementationAS</code> interface can
* be obtained by using binding-specific casting methods on an instance of
* the <code>DOMImplementation</code> interface when the DOM implementation
* supports the feature "<code>AS-EDIT</code>".
* <p>See also the <a href='http://www.w3.org/TR/2001/WD-DOM-Level-3-ASLS-20011025'>Document Object Model (DOM) Level 3 Abstract Schemas and Load
and Save Specification</a>.
*/
public interface DOMImplementationAS {
/**
* Creates an ASModel.
* @param isNamespaceAware Allow creation of <code>ASModel</code> with
* this attribute set to a specific value.
* @return A <code>null</code> return indicates failure.what is a
* failure? Could be a system error.
*/
public ASModel createAS(boolean isNamespaceAware);
/**
* Creates an <code>DOMASBuilder</code>.Do we need the method since we
* already have <code>DOMImplementationLS.createDOMBuilder</code>?
* @return
*/
public DOMASBuilder createDOMASBuilder();
/**
* Creates an <code>DOMASWriter</code>.
* @return
*/
public DOMASWriter createDOMASWriter();
}
1.1 xml-xerces/java/src/org/apache/xerces/dom3/as/DocumentAS.java
Index: DocumentAS.java
===================================================================
/*
* Copyright (c) 2001 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.apache.xerces.dom3.as;
import org.w3c.dom.DOMException;
/**
* This interface extends the <code>Document</code> interface with additional
* methods for both document and AS editing.
* <p>See also the <a href='http://www.w3.org/TR/2001/WD-DOM-Level-3-ASLS-20011025'>Document Object Model (DOM) Level 3 Abstract Schemas and Load
and Save Specification</a>.
*/
public interface DocumentAS {
/**
* The active external ASModel. Note that the active external
* <code>ASModel</code> is responsible for consulting the internal
* ASModel, so if an attribute is declared in the internal
* <code>ASModel</code> and the corresponding <code>ownerElements</code>
* points to a <code>ASElementDeclaration</code>s defined in the active
* external ASModel, changing the active external ASModel will cause the
* <code>ownerElements</code> to be recomputed. If the
* <code>ownerElements</code> is not defined in the newly active
* external ASModel, the <code>ownerElements</code> will be an empty
* node list.
*/
public ASModel getActiveASModel();
/**
* The active external ASModel. Note that the active external
* <code>ASModel</code> is responsible for consulting the internal
* ASModel, so if an attribute is declared in the internal
* <code>ASModel</code> and the corresponding <code>ownerElements</code>
* points to a <code>ASElementDeclaration</code>s defined in the active
* external ASModel, changing the active external ASModel will cause the
* <code>ownerElements</code> to be recomputed. If the
* <code>ownerElements</code> is not defined in the newly active
* external ASModel, the <code>ownerElements</code> will be an empty
* node list.
*/
public void setActiveASModel(ASModel activeASModel);
/**
* A list of <code>ASObject</code>s of type <code>AS_MODEL</code>s
* associated with a document. The <code>addAS</code> method associates
* a <code>ASModel</code> with a document.
*/
public ASObjectList getBoundASModels();
/**
* A list of <code>ASObject</code>s of type <code>AS_MODEL</code>s
* associated with a document. The <code>addAS</code> method associates
* a <code>ASModel</code> with a document.
*/
public void setBoundASModels(ASObjectList boundASModels);
/**
* Retrieve the internal <code>ASModel</code> of a document.
* @return <code>ASModel</code>.
*/
public ASModel getInternalAS();
/**
* Sets the internal subset <code>ASModel</code> of a document. This could
* be null as a mechanism for "removal".
* @param as <code>ASModel</code> to be the internal subset of the
* document.
*/
public void setInternalAS(ASModel as);
/**
* Associate a <code>ASModel</code> with a document. Can be invoked
* multiple times to result in a list of <code>ASModel</code>s. Note
* that only one internal <code>ASModel</code> is associated with the
* document, however, and that only one of the possible list of
* <code>ASModel</code>s is active at any one time.
* @param as <code>ASModel</code> to be associated with the document.
*/
public void addAS(ASModel as);
/**
* Removes a <code>ASModel</code> associated with a document. Can be
* invoked multiple times to remove a number of these in the list of
* <code>ASModel</code>s.
* @param as The <code>ASModel</code> to be removed.
*/
public void removeAS(ASModel as);
/**
* Gets the AS editing object describing this elementThis method needs to
* be changed and others added.
* @return ASElementDeclaration object if the implementation supports "
* <code>AS-EDIT</code>" feature. Otherwise <code>null</code>.
* @exception DOMException
* NOT_FOUND_ERR: Raised if no <code>ASModel</code> is present.
*/
public ASElementDeclaration getElementDeclaration()
throws DOMException;
/**
* Validates the document against the <code>ASModel</code>.
* @exception DOMASException
*
*/
public void validate()
throws DOMASException;
}
1.1 xml-xerces/java/src/org/apache/xerces/dom3/as/DocumentEditAS.java
Index: DocumentEditAS.java
===================================================================
/*
* Copyright (c) 2001 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.apache.xerces.dom3.as;
/**
* This interface extends the <code>NodeEditAS</code> interface with
* additional methods for both document and AS editing.
* <p>See also the <a href='http://www.w3.org/TR/2001/WD-DOM-Level-3-ASLS-20011025'>Document Object Model (DOM) Level 3 Abstract Schemas and Load
and Save Specification</a>.
*/
public interface DocumentEditAS extends NodeEditAS {
/**
* An attribute specifying whether continuous checking for the validity of
* the document is enforced or not. Setting this to <code>true</code>
* will result in an exception being thrown, i.e.,
* <code>VALIDATION_ERR</code>, for documents that are invalid at the
* time of the call. If the document is invalid, then this attribute
* will remain <code>false</code>. This attribute is <code>false</code>
* by default.Add VALIDATION_ERR code to the list of constants in
* DOMASException.
*/
public boolean getContinuousValidityChecking();
/**
* An attribute specifying whether continuous checking for the validity of
* the document is enforced or not. Setting this to <code>true</code>
* will result in an exception being thrown, i.e.,
* <code>VALIDATION_ERR</code>, for documents that are invalid at the
* time of the call. If the document is invalid, then this attribute
* will remain <code>false</code>. This attribute is <code>false</code>
* by default.Add VALIDATION_ERR code to the list of constants in
* DOMASException.
*/
public void setContinuousValidityChecking(boolean continuousValidityChecking);
}
1.1 xml-xerces/java/src/org/apache/xerces/dom3/as/ElementEditAS.java
Index: ElementEditAS.java
===================================================================
/*
* Copyright (c) 2001 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.apache.xerces.dom3.as;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.w3c.dom.Attr;
/**
* This interface extends the <code>Element</code> interface with additional
* methods for guided document editing. An object implementing this
* interface must also implement NodeEditAS interface.
* <p>See also the <a href='http://www.w3.org/TR/2001/WD-DOM-Level-3-ASLS-20011025'>Document Object Model (DOM) Level 3 Abstract Schemas and Load
and Save Specification</a>.
*/
public interface ElementEditAS extends NodeEditAS {
/**
* The list of qualified element names defined in the abstract schema.
*/
public NodeList getDefinedElementTypes();
/**
* Determines element content type.
* @return Constant for one of EMPTY_CONTENTTYPE, ANY_CONTENTTYPE,
* MIXED_CONTENTTYPE, ELEMENTS_CONTENTTYPE.
*/
public short contentType();
/**
* Determines if the value for specified attribute can be set.
* @param attrname Name of attribute.
* @param attrval Value to be assigned to the attribute.
* @return <code>true</code> if no reason it can't be done;
* <code>false</code> if it can't be done.
*/
public boolean canSetAttribute(String attrname,
String attrval);
/**
* Determines if an attribute node can be added with respect to the
* validity check level.This is an attribute node, there is no need for
* canSetAttributreNodeNS!
* @param attrNode <code>Node</code> in which the attribute can possibly
* be set.
* @return <code>true</code> if no reason it can't be done;
* <code>false</code> if it can't be done.
*/
public boolean canSetAttributeNode(Attr attrNode);
/**
* Determines if the attribute with given namespace and qualified name can
* be created if not already present in the attribute list of the
* element. If the attribute with same qualified name and namespaceURI
* is already present in the elements attribute list it tests for the
* value of the attribute and its prefix to the new value. See DOM core
* <code>setAttributeNS</code>.
* @param name Qualified name of attribute.
* @param attrval Value to be assigned to the attribute.
* @param namespaceURI <code>namespaceURI</code> of namespace.
* @return <code>true</code> if no reason it can't be done;
* <code>false</code> if it can't be done.
*/
public boolean canSetAttributeNS(String name,
String attrval,
String namespaceURI);
/**
* Verifies if an attribute by the given name can be removed.
* @param attrname Name of attribute.
* @return <code>true</code> if no reason it can't be done;
* <code>false</code> if it can't be done.
*/
public boolean canRemoveAttribute(String attrname);
/**
* Verifies if an attribute by the given local name and namespace can be
* removed.
* @param attrname Local name of the attribute to be removed.
* @param namespaceURI The namespace URI of the attribute to remove.
* @return <code>true</code> if no reason it can't be done;
* <code>false</code> if it can't be done.
*/
public boolean canRemoveAttributeNS(String attrname,
String namespaceURI);
/**
* Determines if an attribute node can be removed.
* @param attrNode The <code>Attr</code> node to remove from the
* attribute list.
* @return <code>true</code> if no reason it can't be done;
* <code>false</code> if it can't be done.
*/
public boolean canRemoveAttributeNode(Node attrNode);
/**
* Returns an <code>NodeList</code> containing the possible
* <code>Element</code> names that can appear as children of this type
* of element.
* @return List of possible children element types of this element.
*/
public NodeList getChildElements();
/**
* Returns an <code>NodeList</code> containing the possible
* <code>Element</code> names that can appear as a parent of this type
* of element.
* @return List of possible parent element types of this element.
*/
public NodeList getParentElements();
/**
* Returns an <code>NodeList</code> containing all the possible
* <code>Attr</code>s that can appear with this type of element.
* @return List of possible attributes of this element.
*/
public NodeList getAttributeList();
/**
* Determines if this element is defined in the currently active AS.
* @param elemTypeName Name of element.
* @return A boolean that is <code>true</code> if the element is defined,
* <code>false</code> otherwise.
*/
public boolean isElementDefined(String elemTypeName);
/**
* Determines if this element in this namespace is defined in the
* currently active AS.
* @param elemTypeName Name of element.
* @param namespaceURI <code>namespaceURI</code> of namespace.
* @param name Qualified name of namespace. This is for sub-elements.
* @return A boolean that is <code>true</code> if the element is defined,
* <code>false</code> otherwise.
*/
public boolean isElementDefinedNS(String elemTypeName,
String namespaceURI,
String name);
}
1.1 xml-xerces/java/src/org/apache/xerces/dom3/as/NodeEditAS.java
Index: NodeEditAS.java
===================================================================
/*
* Copyright (c) 2001 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.apache.xerces.dom3.as;
import org.w3c.dom.Node;
/**
* This interface extends a <code>Node</code> from with additional methods
* for guided document editing. The expectation is that an instance of the
* <code>DOMImplementationAS</code> interface can be obtained by using
* binding-specific casting methods on an instance of the
* <code>DOMImplementation</code> interface when the DOM implementation
* supports the feature "<code>AS-DOC</code>".
* <p>See also the <a href='http://www.w3.org/TR/2001/WD-DOM-Level-3-ASLS-20011025'>Document Object Model (DOM) Level 3 Abstract Schemas and Load
and Save Specification</a>.
*/
public interface NodeEditAS {
// ASCheckType
/**
* Check for well-formedness of this node.
*/
public static final short WF_CHECK = 1;
/**
* Check for namespace well-formedness includes <code>WF_CHECK</code>.
*/
public static final short NS_WF_CHECK = 2;
/**
* Checks for whether this node is partially valid. It includes
* <code>NS_WF_CHECK</code>.
*/
public static final short PARTIAL_VALIDITY_CHECK = 3;
/**
* Checks for strict validity of the node with respect to active AS which
* by definition includes <code>NS_WF_CHECK</code>.
*/
public static final short STRICT_VALIDITY_CHECK = 4;
/**
* Determines whether the <code>insertBefore</code> operation from the
* <code>Node</code> interface would make this document invalid with
* respect to the currently active AS. Describe "valid" when referring
* to partially completed documents.
* @param newChild <code>Node</code> to be inserted.
* @param refChild Reference <code>Node</code>.
* @return <code>true</code> if no reason it can't be done;
* <code>false</code> if it can't be done.
*/
public boolean canInsertBefore(Node newChild,
Node refChild);
/**
* Has the same arguments as <code>RemoveChild</code>.
* @param oldChild <code>Node</code> to be removed.
* @return <code>true</code> if no reason it can't be done;
* <code>false</code> if it can't be done.
*/
public boolean canRemoveChild(Node oldChild);
/**
* Has the same arguments as <code>ReplaceChild</code>.
* @param newChild New <code>Node</code>.
* @param oldChild <code>Node</code> to be replaced.
* @return <code>true</code> if no reason it can't be done;
* <code>false</code> if it can't be done.
*/
public boolean canReplaceChild(Node newChild,
Node oldChild);
/**
* Has the same arguments as <code>AppendChild</code>.
* @param newChild <code>Node</code> to be appended.
* @return <code>true</code> if no reason it can't be done;
* <code>false</code> if it can't be done.
*/
public boolean canAppendChild(Node newChild);
/**
* Determines if the Node is valid relative to currently active AS. It
* doesn't normalize before checking if the document is valid. To do so,
* one would need to explicitly call a normalize method.
* @param deep Setting the <code>deep</code> flag on causes the
* <code>isNodeValid</code> method to check for the whole subtree of
* the current node for validity. Setting it to <code>false</code>
* only checks the current node and its immediate child nodes. The
* <code>validate</code> method on the <code>DocumentAS</code>
* interface, however, checks to determine whether the entire document
* is valid.
* @param wFValidityCheckLevel Flag to tell at what level validity and
* well-formedness checking is done.
* @return <code>true</code> if the node is valid/well-formed in the
* current context and check level defined by
* <code>wfValidityCheckLevel</code>, <code>false</code> if not.
* @exception DOMASException
* <code>NO_AS_AVAILABLE</code>: Raised if the
* <code>DocumentEditAS</code> related to this node does not have any
* active <code>ASModel</code> and <code>wfValidityCheckLevel</code>
* is set to <code>PARTIAL</code> or <code>STRICT_VALIDITY_CHECK</code>
* .
*/
public boolean isNodeValid(boolean deep,
short wFValidityCheckLevel)
throws DOMASException;
}
1.1 xml-xerces/java/src/org/apache/xerces/dom3/ls/DOMBuilder.java
Index: DOMBuilder.java
===================================================================
/*
* Copyright (c) 2001 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.apache.xerces.dom3.ls;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.DOMException;
import org.apache.xerces.dom3.DOMErrorHandler;
/**
* 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 garantee 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 modified 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> The Document Object Model Level 3 Load and Save does not provide a way
* to disable the namespace resolution: Namespaces are always taken into
* account during loading and saving operations.
* <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: ls-load:
* The document that's being loaded is completely parsed, see the definition
* of <code>LSLoadEvent</code>ls-progress: Progress notification, see the
* definition of <code>LSProgressEvent</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>"namespace-declarations"</code></dt>
* <dd>
* <dl>
* <dt>
* <code>true</code></dt>
* <dd>[required] (default) include the namespace declaration
* attributes, specified or defaulted from the schema or the DTD, in the DOM
* document. See also the section Declaring Namespaces in . </dd>
* <dt>
* <code>false</code></dt>
* <dd>[optional] discard all namespace declaration
* attributes. The Namespace prefixes will be retained even if this feature
* is set to <code>false</code>. </dd>
* </dl></dd>
* <dt><code>"validation"</code></dt>
* <dd>
* <dl>
* <dt><code>true</code></dt>
* <dd>[
* optional] report validation errors (setting <code>true</code> also will
* force the <code>external-general-entities</code> and
* <code>external-parameter-entities</code> features to be <code>true</code>
* .) Also note that the <code>validate-if-schema</code> feature will alter
* the validation behavior when this feature is set <code>true</code>. </dd>
* <dt>
* <code>false</code></dt>
* <dd>[required] (default) do not report validation errors. </dd>
* </dl></dd>
* <dt>
* <code>"external-parameter-entities"</code></dt>
* <dd>
* <dl>
* <dt><code>true</code></dt>
* <dd>[required] (
* default)load external parameter entities. </dd>
* <dt><code>false</code></dt>
* <dd>[optional]do
* not load external parameter entities. </dd>
* <dt>default value</dt>
* <dd><code>true</code></dd>
* </dl></dd>
* <dt>
* <code>"external-general-entities"</code></dt>
* <dd>
* <dl>
* <dt><code>true</code></dt>
* <dd>[required] (
* default) include all external general (text) entities. </dd>
* <dt><code>false</code></dt>
* <dd>[
* optional]do not include external general entities. </dd>
* </dl></dd>
* <dt>
* <code>"external-dtd-subset"</code></dt>
* <dd>
* <dl>
* <dt><code>true</code></dt>
* <dd>[required] (default)
* load the external dtd and also all external parameter entities. </dd>
* <dt>
* <code>false</code></dt>
* <dd>[optional] do not load the dtd nor external parameter
* entities. </dd>
* </dl></dd>
* <dt><code>"validate-if-schema"</code></dt>
* <dd>
* <dl>
* <dt><code>true</code></dt>
* <dd>[optional]
* when both this feature and validation are <code>true</code>, enable
* validation only if the document being processed has a schema (i.e. XML
* schema, DTD, any other type of schema, note that this is unrelated to the
* abstract schema specification). Documents without schemas are parsed
* without validation. </dd>
* <dt><code>false</code></dt>
* <dd>[required] (default) the validation
* feature alone controls whether the document is checked for validity.
* Documents without a schemas are not valid. </dd>
* </dl></dd>
* <dt>
* <code>"validate-against-dtd"</code></dt>
* <dd>
* <dl>
* <dt><code>true</code></dt>
* <dd>[optional] Prefere
* validation against the DTD over any other schema referenced in the XML
* file. </dd>
* <dt><code>false</code></dt>
* <dd>[required] (default) Let the parser decide what
* to validate against if there are references to multiple types of schemas. </dd>
* </dl></dd>
* <dt>
* <code>"datatype-normalization"</code></dt>
* <dd>
* <dl>
* <dt><code>true</code></dt>
* <dd>[required] Let the
* (non-DTD) validation process do its datatype normalization that is
* defined in the used schema language. We should define "datatype
* normalization". </dd>
* <dt><code>false</code></dt>
* <dd>[required] (default) Disable datatype
* normalization. The XML 1.0 attribute value normalization is garantee to
* occur in that case. </dd>
* </dl></dd>
* <dt><code>"create-entity-ref-nodes"</code></dt>
* <dd>
* <dl>
* <dt>
* <code>true</code></dt>
* <dd>[required] (default) Create <code>EntityReference</code>
* nodes in the DOM document. It will also set
* <code>create-entity-nodes</code> to be <code>true</code>. </dd>
* <dt>
* <code>false</code></dt>
* <dd>[optional] omit all <code>EntityReference</code> nodes
* from the DOM document, putting the entity expansions directly in their
* place. <code>Text</code> nodes are into "normal" form.
* <code>EntityReference</code> nodes to non-defined entities will still be
* created in the DOM document. </dd>
* </dl></dd>
* <dt><code>"create-entity-nodes"</code></dt>
* <dd>
* <dl>
* <dt>
* <code>true</code></dt>
* <dd>[required] (default) Create <code>Entity</code> nodes in
* the DOM document. </dd>
* <dt><code>false</code></dt>
* <dd>[optional] Omit all
* <code>entity</code> nodes from the DOM document. It will also set
* <code>create-entity-ref-nodes</code> to <code>false</code>. </dd>
* </dl></dd>
* <dt>
* <code>"whitespace-in-element-content"</code></dt>
* <dd>
* <dl>
* <dt><code>true</code></dt>
* <dd>[required] (
* default) Include white space characters appearing within element content
* (see 2.10 "White Space Handling"). </dd>
* <dt><code>false</code></dt>
* <dd>[optional] Omit
* white space characters appearing within element content. Note that white
* space characters within element content will only be omitted if it can be
* identified as such, and not all parsers may be able to do so (see 2.10
* "White Space Handling"). </dd>
* </dl></dd>
* <dt><code>"create-cdata-nodes"</code></dt>
* <dd>
* <dl>
* <dt>
* <code>true</code></dt>
* <dd>[required] (default) Create <code>CDATASection</code>
* nodes in response to the appearance of CDATA sections in the XML
* document. </dd>
* <dt><code>false</code></dt>
* <dd>[optional] Do not create
* <code>CDATASection</code> nodes in the DOM document. The content of any
* CDATA sections in the XML document appears in the DOM as if it had been
* normal (non-CDATA) content. If a CDATA section is adjacent to other
* content, the combined content appears in a single <code>Text</code> node,
* i.e. the <code>Text</code> nodes are into "normal" form. </dd>
* </dl></dd>
* <dt>
* <code>"comments"</code></dt>
* <dd>
* <dl>
* <dt><code>true</code></dt>
* <dd>[required] (default) Include XML
* comments in the DOM document. </dd>
* <dt><code>false</code></dt>
* <dd>[required] Discard XML
* comments, do not create <code>Comment</code> nodes in the DOM Document
* resulting from a parse. </dd>
* </dl></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>"load-as-infoset"</code></dt>
* <dd>
* <dl>
* <dt><code>true</code></dt>
* <dd>[optional] Load the
* document and store only the information defined in the XML Information
* Set . This will force the following features to <code>false</code>:
* <code>namespace-declarations</code>, <code>validate-if-schema</code>,
* <code>create-entity-ref-nodes</code>, <code>create-entity-nodes</code>,
* <code>create-cdata-nodes</code>. This will force the following features
* to <code>true</code>: <code>datatype-normalization</code>,
* <code>whitespace-in-element-content</code>, <code>comments</code>,
* <code>charset-overrides-xml-encoding</code>. Other features are not
* changed unless explicity specified in the description of the features.
* Note that querying this feature with <code>getFeature</code> will return
* <code>true</code> only if the individual features specified above are
* appropriately set. </dd>
* <dt><code>false</code></dt>
* <dd> Setting <code>load-as-infoset</code>
* to <code>false</code> has no effect. </dd>
* </dl></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>
* </dl>
* <p>See also the <a href='http://www.w3.org/TR/2001/WD-DOM-Level-3-ASLS-20011025'>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>DOMDcoumentBuilder</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, if the implementation is unable to pass the node
* where the error occures the document Node is passed to the error
* handler. 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>DOMDcoumentBuilder</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, if the implementation is unable to pass the node
* where the error occures the document Node is passed to the error
* handler. 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
* Raise a NOT_SUPPORTED_ERR exception when the <code>DOMBuilder</code>
* recognizes the feature name but cannot set the requested value.
* <br>Raise a NOT_FOUND_ERR 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
* Raise a NOT_FOUND_ERR 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 an URI reference .
* If the URI contains a fragment identifier (see section 4.1 in ), the
* behavior is not defined by this specification.
* @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.
* @exception DOMSystemException
* Exceptions raised by <code>parseURI</code> originate with the
* installed ErrorHandler, and thus depend on the implementation of
* the <code>DOMErrorHandler</code> interfaces. The default error
* handlers will raise a DOMSystemException if any form I/O or other
* system error occurs during the parse, but application defined error
* handlers are not required to do so.
*/
public Document parseURI(String uri)
throws Exception;
/**
* Parse an XML document from a resource identified by an
* <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 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 parsing the input source to the context node. For
* this action to work, the context node must be an <code>Element</code>.
*/
public static final short ACTION_APPEND = 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 an
* <code>DOMInputSource</code> and insert the content into an existing
* document at the position epcified 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.
* @param is The <code>DOMInputSource</code> from which the source
* document is to be read.
* @param cnode The <code>Node</code> that is used as the context for
* the data that is being parsed.
* @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
* HIERARCHY_REQUEST_ERR: Thrown if this action results in an invalid
* hierarchy (i.e. a Document with more than one document element).
*/
public void parseWithContext(DOMInputSource is,
Node cnode,
short action)
throws DOMException;
}
1.1 xml-xerces/java/src/org/apache/xerces/dom3/ls/DOMBuilderFilter.java
Index: DOMBuilderFilter.java
===================================================================
/*
* Copyright (c) 2001 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.apache.xerces.dom3.ls;
import org.w3c.dom.Node;
/**
* <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.The description of these methods is not complete
* <p>See also the <a href='http://www.w3.org/TR/2001/WD-DOM-Level-3-ASLS-20011025'>Document Object Model (DOM) Level 3 Abstract Schemas and Load
and Save Specification</a>.
*/
public interface DOMBuilderFilter {
/**
* 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>startNode</code> function.
* <br>The element node passed to <code>startNode</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>startNode</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 startNode?
* @return <code>ACCEPT</code> if this <code>Element</code> should be
* included in the DOM document being built. <code>REJECT</code> if
* the <code>Element</code> and all of its children should be
* rejected. <code>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.
*/
public int startNode(Node snode);
/**
* This method will be called by the parser at the completion of the parse
* of each node. The node will exist and be complete, as will all of its
* children, and their children, recursively. The parent node will also
* exist, although that node may be incomplete, as 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. This node
* may also be removed from its parent node, which will prevent it from
* appearing in the final document at the completion of the parse. Aside
* from this one operation on the node's parent, the state of the rest
* of the document outside of this node is not defined, and the affect
* of any attempt to navigate to or 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.
* @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>ACCEPT</code> if this <code>Node</code> should be
* included in the DOM document being built. <code>REJECT</code> if
* the <code>Node</code> and all of its children should be rejected.
*/
public int endNode(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/apache/xerces/dom3/ls/DOMEntityResolver.java
Index: DOMEntityResolver.java
===================================================================
/*
* Copyright (c) 2001 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.apache.xerces.dom3.ls;
/**
* <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> property 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 URI types other than URIs. <code>DOMEtityResolver</code> is based on
* the SAX2 <code>EntityResolver</code> interface.
* <p>See also the <a href='http://www.w3.org/TR/2001/WD-DOM-Level-3-ASLS-20011025'>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
* (i.e. .
* @param baseURI The URI reference representing the 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/apache/xerces/dom3/ls/DOMImplementationLS.java
Index: DOMImplementationLS.java
===================================================================
/*
* Copyright (c) 2001 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.apache.xerces.dom3.ls;
import org.w3c.dom.DOMException;
/**
* <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/2001/WD-DOM-Level-3-ASLS-20011025'>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.
* @return The newly created <code>DOMBuilder</code> object, this
* <code>DOMBuilder</code> is either synchronous or asynchronous
* depending on the value of the <code>type</code> argument.
* @exception DOMException
* Raise a NOT_SUPPORTED_ERR exception if MODE_ASYNCHRONOUS is not
* supported.
*/
public DOMBuilder createDOMBuilder(short mode)
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>DOMBuilder</code> object, this
* <code>DOMBuilder</code> is either synchronous or asynchronous
* depending on the value of the <code>type</code> argument.
*/
public DOMInputSource createDOMInputSource();
}
1.1 xml-xerces/java/src/org/apache/xerces/dom3/ls/DOMInputSource.java
Index: DOMInputSource.java
===================================================================
/*
* Copyright (c) 2001 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.apache.xerces.dom3.ls;
/**
* 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.
* <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> An <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/2001/WD-DOM-Level-3-ASLS-20011025'>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 property. Setting the encoding in this way
* will override any encoding specified in the XML declaration itself.
*/
public DOMInputSource 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 property. Setting the encoding in this way
* will override any encoding specified in the XML declaration itself.
*/
public void setByteStream(DOMInputSource 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/apache/xerces/dom3/ls/DOMWriter.java
Index: DOMWriter.java
===================================================================
/*
* Copyright (c) 2001 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.apache.xerces.dom3.ls;
import org.w3c.dom.Node;
import org.w3c.dom.DOMException;
import org.apache.xerces.dom3.DOMErrorHandler;
/**
* DOMWriter 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. During
* serialization of XML data, namespace fixup is done when possible.
* <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 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 References nodes are
* serializes 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. All other
* node types (Element, Text, etc.) are serialized to their corresponding
* XML source form.
* <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 seralizing 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>output-default-values</code> feature is
* set to <code>true</code>. If the <code>output-default-values</code> flag
* is set to <code>false</code> and the <code>use-abstract-schema</code>
* feature is set to <code>true</code> the abstract schema will be used to
* determine if a value is specified or not, if
* <code>use-abstract-schema</code> is not set 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 &foo;, also mention this in the load part of
* this spec.
* <p> When serializing a document the DOMWriter checks to see if the document
* element in the document is a DOM Level 1 element or a DOM Level 2 (or
* higher) element (this check is done by looking at the localName of the
* root element). If the root element is a DOM Level 1 element then the
* DOMWriter will issue an error if a DOM Level 2 (or higher) element is
* found while serializing. Likewise if the document element is a DOM Level
* 2 (or higher) element and the DOMWriter sees a DOM Level 1 element an
* error is issued. Mixing DOM Level 1 elements with DOM Level 2 (or higher)
* is not supported.
* <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 properties that must be recognized by all
* implementations.
* <dl>
* <dt><code>"normalize-characters"</code></dt>
* <dd>
* <dl>
* <dt><code>true</code></dt>
* <dd>[
* optional] (default) Perform the W3C Text Normalization of the characters
* in document as they are written out. Only the characters being written
* are (potentially) altered. The DOM document itself is unchanged. </dd>
* <dt>
* <code>false</code></dt>
* <dd>[required] do not perform character normalization. </dd>
* </dl></dd>
* <dt>
* <code>"split-cdata-sections"</code></dt>
* <dd>
* <dl>
* <dt><code>true</code></dt>
* <dd>[required] (default)
* Split CDATA sections containing the CDATA section termination marker
* ']]>' or characters that can not be represented in the output
* encoding, and output the characters using numeric character references.
* If a CDATA section is split a warning is issued. </dd>
* <dt><code>false</code></dt>
* <dd>[
* required] Signal an error if a <code>CDATASection</code> contains an
* unrepresentable character. </dd>
* </dl></dd>
* <dt><code>"validation"</code></dt>
* <dd>
* <dl>
* <dt><code>true</code></dt>
* <dd>[
* optional] Use the abstract schema to validate the document as it is being
* serialized. If validation errors are found the error handler is notified
* about the error. Setting this state will also set the feature
* <code>use-abstract-schema</code> to <code>true</code>. </dd>
* <dt><code>false</code></dt>
* <dd>[
* required] (default) Don't validate the document as it is being
* serialized. </dd>
* </dl></dd>
* <dt><code>"expand-entity-references"</code></dt>
* <dd>
* <dl>
* <dt><code>true</code></dt>
* <dd>[
* optional] Expand <code>EntityReference</code> nodes when serializing. </dd>
* <dt>
* <code>false</code></dt>
* <dd>[required] (default) Serialize all
* <code>EntityReference</code> nodes as XML entity references. </dd>
* </dl></dd>
* <dt>
* <code>"whitespace-in-element-content"</code></dt>
* <dd>
* <dl>
* <dt><code>true</code></dt>
* <dd>[required] (
* default) Output all white spaces in the document. </dd>
* <dt><code>false</code></dt>
* <dd>[
* optional] Only output white space that is not within element content. The
* implementation is expected to use the
* <code>isWhitespaceInElementContent</code> flag on <code>Text</code> nodes
* to determine if a text node should be written out or not. </dd>
* </dl></dd>
* <dt>
* <code>"discard-default-content"</code></dt>
* <dd>
* <dl>
* <dt><code>true</code></dt>
* <dd>[required] (default
* ) Use whatever information available to the implementation (i.e. XML
* schema, DTD, the <code>specified</code> flag on <code>Attr</code> nodes,
* and so on) to decide what attributes and content should be serialized or
* not. Note that the <code>specified</code> flag on <code>Attr</code> nodes
* in itself is not always reliable, it is only reliable when it is set to
* <code>false</code> since the only case where it can be set to
* <code>false</code> is if the attribute was created by a Level 1
* implementation. </dd>
* <dt><code>false</code></dt>
* <dd>[required] Output all attributes and
* all content. </dd>
* </dl></dd>
* <dt><code>"format-canonical"</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 "format-pretty-print"
* to false. </dd>
* <dt><code>false</code></dt>
* <dd>[required] (default) Don't 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 "format-canonical" to false. </dd>
* <dt><code>false</code></dt>
* <dd>[required]
* (default) Don't pretty-print the result. </dd>
* </dl></dd>
* </dl>
* <p>See also the <a href='http://www.w3.org/TR/2001/WD-DOM-Level-3-ASLS-20011025'>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
* Raise a NOT_SUPPORTED_ERR exception 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
* Raise a NOT_FOUND_ERR 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 includes an encoding declaration, 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 includes an encoding declaration, 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 actual character encoding that was last used by this formatter.
* This convenience method allows the encoding that was used when
* serializing a document to be directly obtained.
*/
public String getLastEncoding();
/**
* The end-of-line sequence of characters to be used in the XML being
* written out. The only permitted values are these:
* <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. The only permitted values are these:
* <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);
/**
* 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. 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.
* @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 string. 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.
* @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: 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/apache/xerces/dom3/ls/DOMWriterFilter.java
Index: DOMWriterFilter.java
===================================================================
/*
* Copyright (c) 2001 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.apache.xerces.dom3.ls;
import org.w3c.dom.traversal.NodeFilter;
/**
* <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/2001/WD-DOM-Level-3-ASLS-20011025'>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/apache/xerces/dom3/ls/DocumentLS.java
Index: DocumentLS.java
===================================================================
/*
* Copyright (c) 2001 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.apache.xerces.dom3.ls;
import org.w3c.dom.Node;
import org.w3c.dom.DOMException;
/**
* 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/2001/WD-DOM-Level-3-ASLS-20011025'>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 property is
* <code>false</code>.
* <br>Setting the value of this attribute might throw NOT_SUPPORTED_ERR
* if the implementation doesn't support the mode the attribute is being
* set to. Should the DOM spec define the default value of this
* property? 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.
*/
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 property is
* <code>false</code>.
* <br>Setting the value of this attribute might throw NOT_SUPPORTED_ERR
* if the implementation doesn't support the mode the attribute is being
* set to. Should the DOM spec define the default value of this
* property? 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.
*/
public void setAsync(boolean async);
/**
* 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>).
* @param uri The URI reference for the XML file to be loaded. If this is
* a relative URI...
* @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.
* @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/apache/xerces/dom3/ls/LSLoadEvent.java
Index: LSLoadEvent.java
===================================================================
/*
* Copyright (c) 2001 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.apache.xerces.dom3.ls;
import org.w3c.dom.Document;
import org.w3c.dom.events.Event;
/**
* 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/2001/WD-DOM-Level-3-ASLS-20011025'>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/apache/xerces/dom3/ls/LSProgressEvent.java
Index: LSProgressEvent.java
===================================================================
/*
* Copyright (c) 2001 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.apache.xerces.dom3.ls;
import org.w3c.dom.events.Event;
/**
* This interface represents a progress event object that notifies the
* application about progress as a document is parsed. This event is
* optional and the rate at which this event is fired is implementation
* dependent.
* <p>See also the <a href='http://www.w3.org/TR/2001/WD-DOM-Level-3-ASLS-20011025'>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/apache/xerces/dom3/ls/ParseErrorEvent.java
Index: ParseErrorEvent.java
===================================================================
/*
* Copyright (c) 2001 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.apache.xerces.dom3.ls;
import org.w3c.dom.events.Event;
import org.apache.xerces.dom3.DOMError;
/**
* 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/2001/WD-DOM-Level-3-ASLS-20011025'>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