Author: vgritsenko Date: Wed Aug 22 16:39:13 2007 New Revision: 568771 URL: http://svn.apache.org/viewvc?rev=568771&view=rev Log: add readonly document constructor javadoc
Modified: xml/xindice/trunk/java/src/org/apache/xindice/xml/dom/DOMCompressor.java xml/xindice/trunk/java/src/org/apache/xindice/xml/dom/DocumentImpl.java xml/xindice/trunk/java/src/org/apache/xindice/xml/dom/NodeImpl.java Modified: xml/xindice/trunk/java/src/org/apache/xindice/xml/dom/DOMCompressor.java URL: http://svn.apache.org/viewvc/xml/xindice/trunk/java/src/org/apache/xindice/xml/dom/DOMCompressor.java?rev=568771&r1=568770&r2=568771&view=diff ============================================================================== --- xml/xindice/trunk/java/src/org/apache/xindice/xml/dom/DOMCompressor.java (original) +++ xml/xindice/trunk/java/src/org/apache/xindice/xml/dom/DOMCompressor.java Wed Aug 22 16:39:13 2007 @@ -45,6 +45,7 @@ private static final Log log = LogFactory.getLog(DOMCompressor.class); + public DOMCompressor(OutputStream os, SymbolTable st) { super(os, st); } @@ -53,8 +54,8 @@ * writeNode writes a Node to the compressed output stream. This method * is recursive and will write all children of the specific Node. * - * @param node The Node to write - * @throws IOException If the write failed + * @param node the node to write + * @throws IOException if the write to underlying stream has failed */ public void writeNode(Node node) throws IOException { // Check if it's node of ours @@ -157,7 +158,7 @@ case Node.ENTITY_REFERENCE_NODE: { String value = node.getNodeName(); - byte signature = Signatures.NODE_TEXT | Signatures.TEXT_ENTITY; + byte signature = /* Signatures.NODE_TEXT | */ Signatures.TEXT_ENTITY; short symbol = 0; int encoding = 0; if (value.equals("&")) { Modified: xml/xindice/trunk/java/src/org/apache/xindice/xml/dom/DocumentImpl.java URL: http://svn.apache.org/viewvc/xml/xindice/trunk/java/src/org/apache/xindice/xml/dom/DocumentImpl.java?rev=568771&r1=568770&r2=568771&view=diff ============================================================================== --- xml/xindice/trunk/java/src/org/apache/xindice/xml/dom/DocumentImpl.java (original) +++ xml/xindice/trunk/java/src/org/apache/xindice/xml/dom/DocumentImpl.java Wed Aug 22 16:39:13 2007 @@ -103,6 +103,19 @@ } /** + * Create document from the compressed data with specified read only state. + * + * @param data compressed document data + * @param symbols symbol table used to compress a document + * @param source identifies document origin + * @param readOnly if true, document will be marked read only. + */ + public DocumentImpl(byte[] data, SymbolTable symbols, NodeSource source, boolean readOnly) { + this(data, symbols, source); + this.readOnly = readOnly; + } + + /** * Create a compressed document out of another document. * * @param doc document to copy @@ -111,7 +124,6 @@ super(null, true); boolean compress = true; - if (doc instanceof CompressedDocument) { CompressedDocument c = (CompressedDocument) doc; symbols = c.getSymbols(); @@ -248,19 +260,21 @@ } /** - * This is a convenience attribute that allows direct access to the child + * This is a convenience method that allows direct access to the child * node that is the root element of the document. For HTML documents, this * is the element with the tagName "HTML". */ public Element getDocumentElement() { checkLoaded(); - Iterator iter = childNodes.iterator(); - while (iter.hasNext()) { - Node node = (Node) iter.next(); + + Iterator i = childNodes.iterator(); + while (i.hasNext()) { + Node node = (Node) i.next(); if (node.getNodeType() == Node.ELEMENT_NODE) { return (Element) node; } } + return null; } Modified: xml/xindice/trunk/java/src/org/apache/xindice/xml/dom/NodeImpl.java URL: http://svn.apache.org/viewvc/xml/xindice/trunk/java/src/org/apache/xindice/xml/dom/NodeImpl.java?rev=568771&r1=568770&r2=568771&view=diff ============================================================================== --- xml/xindice/trunk/java/src/org/apache/xindice/xml/dom/NodeImpl.java (original) +++ xml/xindice/trunk/java/src/org/apache/xindice/xml/dom/NodeImpl.java Wed Aug 22 16:39:13 2007 @@ -374,15 +374,16 @@ * @param refChild The reference node, i.e., the node before which the new * node must be inserted. * @return The node being inserted. - * @exception DOMException - * HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not + * @exception DOMException <ul> + * <li>HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not * allow children of the type of the <code>newChild</code> node, or if * the node to insert is one of this node's ancestors. - * <br>WRONG_DOCUMENT_ERR: Raised if <code>newChild</code> was created + * <li>WRONG_DOCUMENT_ERR: Raised if <code>newChild</code> was created * from a different document than the one that created this node. - * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. - * <br>NOT_FOUND_ERR: Raised if <code>refChild</code> is not a child of + * <li>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. + * <li>NOT_FOUND_ERR: Raised if <code>refChild</code> is not a child of * this node. + * </ul> */ public Node insertBefore(Node newChild, Node refChild) throws DOMException { throw EX_HIERARCHY_REQUEST; @@ -406,12 +407,12 @@ /** * The value of this node, depending on its type; see the table above. * When it is defined to be <code>null</code> , setting it has no effect. - * @exception DOMException - * NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly. - * @exception DOMException - * DOMSTRING_SIZE_ERR: Raised when it would return more characters + * @exception DOMException <ul> + * <li>NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly. + * <li>DOMSTRING_SIZE_ERR: Raised when it would return more characters * than fit in a <code>DOMString</code> variable on the implementation * platform. + * </ul> */ public void setNodeValue(String nodeValue) throws DOMException { throw EX_NO_DATA_ALLOWED; @@ -445,12 +446,12 @@ /** * The value of this node, depending on its type; see the table above. - * @exception DOMException - * NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly. - * @exception DOMException - * DOMSTRING_SIZE_ERR: Raised when it would return more characters than + * @exception DOMException <ul> + * <li>NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly. + * <li>DOMSTRING_SIZE_ERR: Raised when it would return more characters than * fit in a <code>DOMString</code> variable on the implementation * platform. + * </ul> */ public String getNodeValue() throws DOMException { checkLoaded(); @@ -954,6 +955,7 @@ * somehow. * @param data The piece of data to attach to this node. * @param key The key to associate this data to. + * @param handler user data handler * @return The object previously associated to this node and the given * key or <code>null</code>. * @since DOM Level 3 @@ -1000,6 +1002,9 @@ } /** + * Not implemented yet. + * + * @return null * @since DOM Level 3 */ public String getBaseURI() { @@ -1113,6 +1118,9 @@ } /** + * @param feature feature name + * @param version feature version + * @return requested feature value, if any * @since DOM Level 3 */ public Object getFeature(String feature, String version) { @@ -1124,6 +1132,8 @@ } /** + * @param namespaceURI namespace URI to check + * @return true if specified namespace is the default namespace * @since DOM Level 3 */ public boolean isDefaultNamespace(String namespaceURI) { @@ -1288,7 +1298,13 @@ } */ - /** Invoke user data handlers with provided parameters. */ + /** + * Invoke user data handlers with provided parameters. + * + * @param op operation code + * @param src source node + * @param dst destination node + */ protected void invokeHandlers(short op, Node src, Node dst) { if (!(src instanceof NodeImpl)) { return;