source: NonGTP/Xerces/xercesc/dom/DOMDocument.hpp @ 188

Revision 188, 39.8 KB checked in by mattausch, 19 years ago (diff)

added xercesc to support

Line 
1#ifndef DOMDocument_HEADER_GUARD_
2#define DOMDocument_HEADER_GUARD_
3
4/*
5 * The Apache Software License, Version 1.1
6 *
7 * Copyright (c) 2001-2002 The Apache Software Foundation.  All rights
8 * reserved.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 *
14 * 1. Redistributions of source code must retain the above copyright
15 *    notice, this list of conditions and the following disclaimer.
16 *
17 * 2. Redistributions in binary form must reproduce the above copyright
18 *    notice, this list of conditions and the following disclaimer in
19 *    the documentation and/or other materials provided with the
20 *    distribution.
21 *
22 * 3. The end-user documentation included with the redistribution,
23 *    if any, must include the following acknowledgment:
24 *       "This product includes software developed by the
25 *        Apache Software Foundation (http://www.apache.org/)."
26 *    Alternately, this acknowledgment may appear in the software itself,
27 *    if and wherever such third-party acknowledgments normally appear.
28 *
29 * 4. The names "Xerces" and "Apache Software Foundation" must
30 *    not be used to endorse or promote products derived from this
31 *    software without prior written permission. For written
32 *    permission, please contact apache\@apache.org.
33 *
34 * 5. Products derived from this software may not be called "Apache",
35 *    nor may "Apache" appear in their name, without prior written
36 *    permission of the Apache Software Foundation.
37 *
38 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
39 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
40 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
41 * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
42 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
43 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
44 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
45 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
46 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
47 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
48 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
49 * SUCH DAMAGE.
50 * ====================================================================
51 *
52 * This software consists of voluntary contributions made by many
53 * individuals on behalf of the Apache Software Foundation, and was
54 * originally based on software copyright (c) 2001, International
55 * Business Machines, Inc., http://www.ibm.com .  For more information
56 * on the Apache Software Foundation, please see
57 * <http://www.apache.org/>.
58 */
59
60/*
61 * $Id: DOMDocument.hpp,v 1.15 2003/08/20 11:31:22 gareth Exp $
62*/
63
64#include <xercesc/util/XercesDefs.hpp>
65#include "DOMNode.hpp"
66#include "DOMDocumentRange.hpp"
67#include "DOMDocumentTraversal.hpp"
68#include "DOMXPathEvaluator.hpp"
69
70XERCES_CPP_NAMESPACE_BEGIN
71
72class DOMConfiguration;
73class DOMDocumentType;
74class DOMElement;
75class DOMDocumentFragment;
76class DOMComment;
77class DOMCDATASection;
78class DOMProcessingInstruction;
79class DOMAttr;
80class DOMEntity;
81class DOMEntityReference;
82class DOMImplementation;
83class DOMNodeFilter;
84class DOMNodeList;
85class DOMNotation;
86class DOMText;
87class DOMNode;
88
89
90/**
91 * The <code>DOMDocument</code> interface represents the entire XML
92 * document. Conceptually, it is the root of the document tree, and provides
93 * the primary access to the document's data.
94 * <p>Since elements, text nodes, comments, processing instructions, etc.
95 * cannot exist outside the context of a <code>DOMDocument</code>, the
96 * <code>DOMDocument</code> interface also contains the factory methods needed
97 * to create these objects. The <code>DOMNode</code> objects created have a
98 * <code>ownerDocument</code> attribute which associates them with the
99 * <code>DOMDocument</code> within whose context they were created.
100 * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113'>Document Object Model (DOM) Level 2 Core Specification</a>.
101 */
102
103class CDOM_EXPORT DOMDocument: public DOMDocumentRange,
104 public DOMXPathEvaluator,
105 public DOMDocumentTraversal,
106 public DOMNode {
107
108
109protected:
110    // -----------------------------------------------------------------------
111    //  Hidden constructors
112    // -----------------------------------------------------------------------
113    /** @name Hidden constructors */
114    //@{   
115    DOMDocument() {};
116    //@}
117
118private:
119    // -----------------------------------------------------------------------
120    // Unimplemented constructors and operators
121    // -----------------------------------------------------------------------
122    /** @name Unimplemented constructors and operators */
123    //@{
124    DOMDocument(const DOMDocument &);
125    DOMDocument & operator = (const DOMDocument &);
126    //@}
127
128public:
129    // -----------------------------------------------------------------------
130    //  All constructors are hidden, just the destructor is available
131    // -----------------------------------------------------------------------
132    /** @name Destructor */
133    //@{
134    /**
135     * Destructor
136     *
137     */
138    virtual ~DOMDocument() {};
139    //@}
140
141    // -----------------------------------------------------------------------
142    // Virtual DOMDocument interface
143    // -----------------------------------------------------------------------
144    /** @name Functions introduced in DOM Level 1 */
145    //@{
146    /**
147     * Creates an element of the type specified. Note that the instance
148     * returned implements the <code>DOMElement</code> interface, so attributes
149     * can be specified directly on the returned object.
150     * <br>In addition, if there are known attributes with default values,
151     * <code>DOMAttr</code> nodes representing them are automatically created
152     * and attached to the element.
153     * <br>To create an element with a qualified name and namespace URI, use
154     * the <code>createElementNS</code> method.
155     * @param tagName The name of the element type to instantiate. For XML,
156     *   this is case-sensitive.
157     * @return A new <code>DOMElement</code> object with the
158     *   <code>nodeName</code> attribute set to <code>tagName</code>, and
159     *   <code>localName</code>, <code>prefix</code>, and
160     *   <code>namespaceURI</code> set to <code>null</code>.
161     * @exception DOMException
162     *   INVALID_CHARACTER_ERR: Raised if the specified name contains an
163     *   illegal character.
164     * @since DOM Level 1
165     */
166    virtual DOMElement     *createElement(const XMLCh *tagName) = 0;
167
168    /**
169     * Creates an empty <code>DOMDocumentFragment</code> object.
170     * @return A new <code>DOMDocumentFragment</code>.
171     * @since DOM Level 1
172     */
173    virtual DOMDocumentFragment   *createDocumentFragment() = 0;
174
175    /**
176     * Creates a <code>DOMText</code> node given the specified string.
177     * @param data The data for the node.
178     * @return The new <code>DOMText</code> object.
179     * @since DOM Level 1
180     */
181    virtual DOMText         *createTextNode(const XMLCh *data) = 0;
182
183    /**
184     * Creates a <code>DOMComment</code> node given the specified string.
185     * @param data The data for the node.
186     * @return The new <code>DOMComment</code> object.
187     * @since DOM Level 1
188     */
189    virtual DOMComment      *createComment(const XMLCh *data) = 0;
190
191    /**
192     * Creates a <code>DOMCDATASection</code> node whose value is the specified
193     * string.
194     * @param data The data for the <code>DOMCDATASection</code> contents.
195     * @return The new <code>DOMCDATASection</code> object.
196     * @since DOM Level 1
197     */
198    virtual DOMCDATASection   *createCDATASection(const XMLCh *data) = 0;
199
200    /**
201     * Creates a <code>DOMProcessingInstruction</code> node given the specified
202     * name and data strings.
203     * @param target The target part of the processing instruction.
204     * @param data The data for the node.
205     * @return The new <code>DOMProcessingInstruction</code> object.
206     * @exception DOMException
207     *   INVALID_CHARACTER_ERR: Raised if the specified target contains an
208     *   illegal character.
209     * @since DOM Level 1
210     */
211    virtual DOMProcessingInstruction *createProcessingInstruction(const XMLCh *target,
212        const XMLCh *data) = 0;
213
214
215    /**
216     * Creates an <code>DOMAttr</code> of the given name. Note that the
217     * <code>DOMAttr</code> instance can then be set on an <code>DOMElement</code>
218     * using the <code>setAttributeNode</code> method.
219     * <br>To create an attribute with a qualified name and namespace URI, use
220     * the <code>createAttributeNS</code> method.
221     * @param name The name of the attribute.
222     * @return A new <code>DOMAttr</code> object with the <code>nodeName</code>
223     *   attribute set to <code>name</code>, and <code>localName</code>,
224     *   <code>prefix</code>, and <code>namespaceURI</code> set to
225     *   <code>null</code>. The value of the attribute is the empty string.
226     * @exception DOMException
227     *   INVALID_CHARACTER_ERR: Raised if the specified name contains an
228     *   illegal character.
229     * @since DOM Level 1
230     */
231    virtual DOMAttr     *createAttribute(const XMLCh *name) = 0;
232
233
234    /**
235     * Creates an <code>DOMEntityReference</code> object. In addition, if the
236     * referenced entity is known, the child list of the
237     * <code>DOMEntityReference</code> node is made the same as that of the
238     * corresponding <code>DOMEntity</code> node.If any descendant of the
239     * <code>DOMEntity</code> node has an unbound namespace prefix, the
240     * corresponding descendant of the created <code>DOMEntityReference</code>
241     * node is also unbound; (its <code>namespaceURI</code> is
242     * <code>null</code>). The DOM Level 2 does not support any mechanism to
243     * resolve namespace prefixes.
244     * @param name The name of the entity to reference.
245     * @return The new <code>DOMEntityReference</code> object.
246     * @exception DOMException
247     *   INVALID_CHARACTER_ERR: Raised if the specified name contains an
248     *   illegal character.
249     * @since DOM Level 1
250     */
251    virtual DOMEntityReference    *createEntityReference(const XMLCh *name) = 0;
252
253    /**
254     * The Document Type Declaration (see <code>DOMDocumentType</code>)
255     * associated with this document. For XML
256     * documents without a document type declaration this returns
257     * <code>null</code>. The DOM Level 2 does not support editing the
258     * Document Type Declaration. <code>docType</code> cannot be altered in
259     * any way, including through the use of methods inherited from the
260     * <code>DOMNode</code> interface, such as <code>insertNode</code> or
261     * <code>removeNode</code>.
262     * @since DOM Level 1
263     */
264    virtual DOMDocumentType       *getDoctype() const = 0;
265
266    /**
267     * The <code>DOMImplementation</code> object that handles this document. A
268     * DOM application may use objects from multiple implementations.
269     * @since DOM Level 1
270     */
271    virtual DOMImplementation  *getImplementation() const = 0;
272
273    /**
274     * This is a convenience attribute that allows direct access to the child
275     * node that is the root element of the document.
276     * @since DOM Level 1
277     */
278    virtual DOMElement     *getDocumentElement() const = 0;
279
280    /**
281     * Returns a <code>DOMNodeList</code> of all the <code>DOMElement(s)</code> with a
282     * given tag name in the order in which they are encountered in a
283     * preorder traversal of the <code>DOMDocument</code> tree.
284     *
285     * The returned node list is "live", in that changes
286     * to the document tree made after a nodelist was initially
287     * returned will be immediately reflected in the node list.
288     * @param tagname The name of the tag to match on. The special value "*"
289     *   matches all tags.
290     * @return A new <code>DOMNodeList</code> object containing all the matched
291     *   <code>DOMElement(s)</code>.
292     * @since DOM Level 1
293     */
294    virtual DOMNodeList      *getElementsByTagName(const XMLCh *tagname) const = 0;
295
296    //@}
297
298    /** @name Functions introduced in DOM Level 2. */
299    //@{
300
301    /**
302     * Imports a node from another document to this document. The returned
303     * node has no parent; (<code>parentNode</code> is <code>null</code>).
304     * The source node is not altered or removed from the original document;
305     * this method creates a new copy of the source node.
306     * <br>For all nodes, importing a node creates a node object owned by the
307     * importing document, with attribute values identical to the source
308     * node's <code>nodeName</code> and <code>nodeType</code>, plus the
309     * attributes related to namespaces (<code>prefix</code>,
310     * <code>localName</code>, and <code>namespaceURI</code>). As in the
311     * <code>cloneNode</code> operation on a <code>DOMNode</code>, the source
312     * node is not altered.
313     * <br>Additional information is copied as appropriate to the
314     * <code>nodeType</code>, attempting to mirror the behavior expected if
315     * a fragment of XML source was copied from one document to
316     * another, recognizing that the two documents may have different DTDs
317     * in the XML case. The following list describes the specifics for each
318     * type of node.
319     * <dl>
320     * <dt>ATTRIBUTE_NODE</dt>
321     * <dd>The <code>ownerElement</code> attribute
322     * is set to <code>null</code> and the <code>specified</code> flag is
323     * set to <code>true</code> on the generated <code>DOMAttr</code>. The
324     * descendants of the source <code>DOMAttr</code> are recursively imported
325     * and the resulting nodes reassembled to form the corresponding subtree.
326     * Note that the <code>deep</code> parameter has no effect on
327     * <code>DOMAttr</code> nodes; they always carry their children with them
328     * when imported.</dd>
329     * <dt>DOCUMENT_FRAGMENT_NODE</dt>
330     * <dd>If the <code>deep</code> option
331     * was set to <code>true</code>, the descendants of the source element
332     * are recursively imported and the resulting nodes reassembled to form
333     * the corresponding subtree. Otherwise, this simply generates an empty
334     * <code>DOMDocumentFragment</code>.</dd>
335     * <dt>DOCUMENT_NODE</dt>
336     * <dd><code>DOMDocument</code>
337     * nodes cannot be imported.</dd>
338     * <dt>DOCUMENT_TYPE_NODE</dt>
339     * <dd><code>DOMDocumentType</code>
340     * nodes cannot be imported.</dd>
341     * <dt>ELEMENT_NODE</dt>
342     * <dd>Specified attribute nodes of the
343     * source element are imported, and the generated <code>DOMAttr</code>
344     * nodes are attached to the generated <code>DOMElement</code>. Default
345     * attributes are not copied, though if the document being imported into
346     * defines default attributes for this element name, those are assigned.
347     * If the <code>importNode</code> <code>deep</code> parameter was set to
348     * <code>true</code>, the descendants of the source element are
349     * recursively imported and the resulting nodes reassembled to form the
350     * corresponding subtree.</dd>
351     * <dt>ENTITY_NODE</dt>
352     * <dd><code>DOMEntity</code> nodes can be
353     * imported, however in the current release of the DOM the
354     * <code>DOMDocumentType</code> is readonly. Ability to add these imported
355     * nodes to a <code>DOMDocumentType</code> will be considered for addition
356     * to a future release of the DOM.On import, the <code>publicId</code>,
357     * <code>systemId</code>, and <code>notationName</code> attributes are
358     * copied. If a <code>deep</code> import is requested, the descendants
359     * of the the source <code>DOMEntity</code> are recursively imported and
360     * the resulting nodes reassembled to form the corresponding subtree.</dd>
361     * <dt>
362     * ENTITY_REFERENCE_NODE</dt>
363     * <dd>Only the <code>DOMEntityReference</code> itself is
364     * copied, even if a <code>deep</code> import is requested, since the
365     * source and destination documents might have defined the entity
366     * differently. If the document being imported into provides a
367     * definition for this entity name, its value is assigned.</dd>
368     * <dt>NOTATION_NODE</dt>
369     * <dd>
370     * <code>DOMNotation</code> nodes can be imported, however in the current
371     * release of the DOM the <code>DOMDocumentType</code> is readonly. Ability
372     * to add these imported nodes to a <code>DOMDocumentType</code> will be
373     * considered for addition to a future release of the DOM.On import, the
374     * <code>publicId</code> and <code>systemId</code> attributes are copied.
375     * Note that the <code>deep</code> parameter has no effect on
376     * <code>DOMNotation</code> nodes since they never have any children.</dd>
377     * <dt>
378     * PROCESSING_INSTRUCTION_NODE</dt>
379     * <dd>The imported node copies its
380     * <code>target</code> and <code>data</code> values from those of the
381     * source node.</dd>
382     * <dt>TEXT_NODE, CDATA_SECTION_NODE, COMMENT_NODE</dt>
383     * <dd>These three
384     * types of nodes inheriting from <code>DOMCharacterData</code> copy their
385     * <code>data</code> and <code>length</code> attributes from those of
386     * the source node.</dd>
387     * </dl>
388     * @param importedNode The node to import.
389     * @param deep If <code>true</code>, recursively import the subtree under
390     *   the specified node; if <code>false</code>, import only the node
391     *   itself, as explained above. This has no effect on <code>DOMAttr</code>
392     *   , <code>DOMEntityReference</code>, and <code>DOMNotation</code> nodes.
393     * @return The imported node that belongs to this <code>DOMDocument</code>.
394     * @exception DOMException
395     *   NOT_SUPPORTED_ERR: Raised if the type of node being imported is not
396     *   supported.
397     * @since DOM Level 2
398     */
399    virtual DOMNode        *importNode(DOMNode *importedNode, bool deep) = 0;
400
401    /**
402     * Creates an element of the given qualified name and namespace URI.
403     * @param namespaceURI The namespace URI of the element to create.
404     * @param qualifiedName The qualified name of the element type to
405     *   instantiate.
406     * @return A new <code>DOMElement</code> object with the following
407     *   attributes:
408     * <table border='1'>
409     * <tr>
410     * <td valign='top' rowspan='1' colspan='1'><code>Attribute</code></td>
411     * <td valign='top' rowspan='1' colspan='1'>
412     *   <code>Value</code></td>
413     * </tr>
414     * <tr>
415     * <td valign='top' rowspan='1' colspan='1'><code>DOMNode.nodeName</code></td>
416     * <td valign='top' rowspan='1' colspan='1'>
417     *   <code>qualifiedName</code></td>
418     * </tr>
419     * <tr>
420     * <td valign='top' rowspan='1' colspan='1'><code>DOMNode.namespaceURI</code></td>
421     * <td valign='top' rowspan='1' colspan='1'>
422     *   <code>namespaceURI</code></td>
423     * </tr>
424     * <tr>
425     * <td valign='top' rowspan='1' colspan='1'><code>DOMNode.prefix</code></td>
426     * <td valign='top' rowspan='1' colspan='1'>prefix, extracted
427     *   from <code>qualifiedName</code>, or <code>null</code> if there is
428     *   no prefix</td>
429     * </tr>
430     * <tr>
431     * <td valign='top' rowspan='1' colspan='1'><code>DOMNode.localName</code></td>
432     * <td valign='top' rowspan='1' colspan='1'>local name, extracted from
433     *   <code>qualifiedName</code></td>
434     * </tr>
435     * <tr>
436     * <td valign='top' rowspan='1' colspan='1'><code>DOMElement.tagName</code></td>
437     * <td valign='top' rowspan='1' colspan='1'>
438     *   <code>qualifiedName</code></td>
439     * </tr>
440     * </table>
441     * @exception DOMException
442     *   INVALID_CHARACTER_ERR: Raised if the specified qualified name
443     *   contains an illegal character, per the XML 1.0 specification .
444     *   <br>NAMESPACE_ERR: Raised if the <code>qualifiedName</code> is
445     *   malformed per the Namespaces in XML specification, if the
446     *   <code>qualifiedName</code> has a prefix and the
447     *   <code>namespaceURI</code> is <code>null</code>, or if the
448     *   <code>qualifiedName</code> has a prefix that is "xml" and the
449     *   <code>namespaceURI</code> is different from "
450     *   http://www.w3.org/XML/1998/namespace" .
451     *   <br>NOT_SUPPORTED_ERR: Always thrown if the current document does not
452     *   support the <code>"XML"</code> feature, since namespaces were
453     *   defined by XML.
454     * @since DOM Level 2
455     */
456    virtual DOMElement         *createElementNS(const XMLCh *namespaceURI,
457                                                      const XMLCh *qualifiedName) = 0;
458
459    /**
460     * Creates an attribute of the given qualified name and namespace URI.
461     * @param namespaceURI The namespace URI of the attribute to create.
462     * @param qualifiedName The qualified name of the attribute to
463     *   instantiate.
464     * @return A new <code>DOMAttr</code> object with the following attributes:
465     * <table border='1'>
466     * <tr>
467     * <td valign='top' rowspan='1' colspan='1'><code>Attribute</code></td>
468     * <td valign='top' rowspan='1' colspan='1'>
469     *   <code>Value</code></td>
470     * </tr>
471     * <tr>
472     * <td valign='top' rowspan='1' colspan='1'><code>DOMNode.nodeName</code></td>
473     * <td valign='top' rowspan='1' colspan='1'>qualifiedName</td>
474     * </tr>
475     * <tr>
476     * <td valign='top' rowspan='1' colspan='1'>
477     *   <code>DOMNode.namespaceURI</code></td>
478     * <td valign='top' rowspan='1' colspan='1'><code>namespaceURI</code></td>
479     * </tr>
480     * <tr>
481     * <td valign='top' rowspan='1' colspan='1'>
482     *   <code>DOMNode.prefix</code></td>
483     * <td valign='top' rowspan='1' colspan='1'>prefix, extracted from
484     *   <code>qualifiedName</code>, or <code>null</code> if there is no
485     *   prefix</td>
486     * </tr>
487     * <tr>
488     * <td valign='top' rowspan='1' colspan='1'><code>DOMNode.localName</code></td>
489     * <td valign='top' rowspan='1' colspan='1'>local name, extracted from
490     *   <code>qualifiedName</code></td>
491     * </tr>
492     * <tr>
493     * <td valign='top' rowspan='1' colspan='1'><code>DOMAttr.name</code></td>
494     * <td valign='top' rowspan='1' colspan='1'>
495     *   <code>qualifiedName</code></td>
496     * </tr>
497     * <tr>
498     * <td valign='top' rowspan='1' colspan='1'><code>DOMNode.nodeValue</code></td>
499     * <td valign='top' rowspan='1' colspan='1'>the empty
500     *   string</td>
501     * </tr>
502     * </table>
503     * @exception DOMException
504     *   INVALID_CHARACTER_ERR: Raised if the specified qualified name
505     *   contains an illegal character, per the XML 1.0 specification .
506     *   <br>NAMESPACE_ERR: Raised if the <code>qualifiedName</code> is
507     *   malformed per the Namespaces in XML specification, if the
508     *   <code>qualifiedName</code> has a prefix and the
509     *   <code>namespaceURI</code> is <code>null</code>, if the
510     *   <code>qualifiedName</code> has a prefix that is "xml" and the
511     *   <code>namespaceURI</code> is different from "
512     *   http://www.w3.org/XML/1998/namespace", or if the
513     *   <code>qualifiedName</code>, or its prefix, is "xmlns" and the
514     *   <code>namespaceURI</code> is different from "
515     *   http://www.w3.org/2000/xmlns/".
516     *   <br>NOT_SUPPORTED_ERR: Always thrown if the current document does not
517     *   support the <code>"XML"</code> feature, since namespaces were
518     *   defined by XML.
519     * @since DOM Level 2
520     */
521    virtual DOMAttr        *createAttributeNS(const XMLCh *namespaceURI,
522                                                    const XMLCh *qualifiedName) = 0;
523
524    /**
525     * Returns a <code>DOMNodeList</code> of all the <code>DOMElement(s)</code> with a
526     * given local name and namespace URI in the order in which they are
527     * encountered in a preorder traversal of the <code>DOMDocument</code> tree.
528     * @param namespaceURI The namespace URI of the elements to match on. The
529     *   special value "*" matches all namespaces.
530     * @param localName The local name of the elements to match on. The
531     *   special value "*" matches all local names.
532     * @return A new <code>DOMNodeList</code> object containing all the matched
533     *   <code>DOMElement(s)</code>.
534     * @since DOM Level 2
535     */
536    virtual DOMNodeList        *getElementsByTagNameNS(const XMLCh *namespaceURI,
537                                                             const XMLCh *localName) const = 0;
538
539    /**
540     * Returns the <code>DOMElement</code> whose <code>ID</code> is given by
541     * <code>elementId</code>. If no such element exists, returns
542     * <code>null</code>. Behavior is not defined if more than one element
543     * has this <code>ID</code>. The DOM implementation must have
544     * information that says which attributes are of type ID. Attributes
545     * with the name "ID" are not of type ID unless so defined.
546     * Implementations that do not know whether attributes are of type ID or
547     * not are expected to return <code>null</code>.
548     * @param elementId The unique <code>id</code> value for an element.
549     * @return The matching element.
550     * @since DOM Level 2
551     */
552    virtual  DOMElement        * getElementById(const XMLCh *elementId) const = 0;
553    //@}
554
555    /** @name Functions introduced in DOM Level 3. */
556    //@{
557
558    /**
559     * An attribute specifying the actual encoding of this document. This is
560     * <code>null</code> otherwise.
561     * <br> This attribute represents the property [character encoding scheme]
562     * defined in.
563     *
564     * <p><b>"Experimental - subject to change"</b></p>
565     *
566     * @since DOM Level 3
567     */
568    virtual const XMLCh*           getActualEncoding() const = 0;
569
570    /**
571     * An attribute specifying the actual encoding of this document. This is
572     * <code>null</code> otherwise.
573     * <br> This attribute represents the property [character encoding scheme]
574     * defined in .
575     *
576     * <p><b>"Experimental - subject to change"</b></p>
577     *
578     * @since DOM Level 3
579     */
580    virtual void                   setActualEncoding(const XMLCh* actualEncoding) = 0;
581
582    /**
583     * An attribute specifying, as part of the XML declaration, the encoding
584     * of this document. This is <code>null</code> when unspecified.
585     *
586     * <p><b>"Experimental - subject to change"</b></p>
587     *
588     * @since DOM Level 3
589     */
590    virtual const XMLCh*           getEncoding() const = 0;
591
592    /**
593     * An attribute specifying, as part of the XML declaration, the encoding
594     * of this document. This is <code>null</code> when unspecified.
595     *
596     * <p><b>"Experimental - subject to change"</b></p>
597     *
598     * @since DOM Level 3
599     */
600    virtual void                   setEncoding(const XMLCh* encoding) = 0;
601
602    /**
603     * An attribute specifying, as part of the XML declaration, whether this
604     * document is standalone.
605     * <br> This attribute represents the property [standalone] defined in .
606     *
607     * <p><b>"Experimental - subject to change"</b></p>
608     *
609     * @since DOM Level 3
610     */
611    virtual bool                   getStandalone() const = 0;
612
613    /**
614     * An attribute specifying, as part of the XML declaration, whether this
615     * document is standalone.
616     * <br> This attribute represents the property [standalone] defined in .
617     *
618     * <p><b>"Experimental - subject to change"</b></p>
619     *
620     * @since DOM Level 3
621     */
622    virtual void                   setStandalone(bool standalone) = 0;
623
624    /**
625     * An attribute specifying, as part of the XML declaration, the version
626     * number of this document. This is <code>null</code> when unspecified.
627     * <br> This attribute represents the property [version] defined in .
628     *
629     * <p><b>"Experimental - subject to change"</b></p>
630     *
631     * @since DOM Level 3
632     */
633    virtual const XMLCh*           getVersion() const = 0;
634
635    /**
636     * An attribute specifying, as part of the XML declaration, the version
637     * number of this document. This is <code>null</code> when unspecified.
638     * <br> This attribute represents the property [version] defined in .
639     *
640     * <p><b>"Experimental - subject to change"</b></p>
641     *
642     * @since DOM Level 3
643     */
644    virtual void                   setVersion(const XMLCh* version) = 0;
645
646    /**
647     * The location of the document or <code>null</code> if undefined.
648     * <br>Beware that when the <code>DOMDocument</code> supports the feature
649     * "HTML" , the href attribute of the HTML BASE element takes precedence
650     * over this attribute.
651     *
652     * <p><b>"Experimental - subject to change"</b></p>
653     *
654     * @since DOM Level 3
655     */
656    virtual const XMLCh*           getDocumentURI() const = 0;
657    /**
658     * The location of the document or <code>null</code> if undefined.
659     * <br>Beware that when the <code>DOMDocument</code> supports the feature
660     * "HTML" , the href attribute of the HTML BASE element takes precedence
661     * over this attribute.
662     *
663     * <p><b>"Experimental - subject to change"</b></p>
664     *
665     * @since DOM Level 3
666     */
667    virtual void                   setDocumentURI(const XMLCh* documentURI) = 0;
668
669    /**
670     * An attribute specifying whether errors checking is enforced or not.
671     * When set to <code>false</code>, the implementation is free to not
672     * test every possible error case normally defined on DOM operations,
673     * and not raise any <code>DOMException</code>. In case of error, the
674     * behavior is undefined. This attribute is <code>true</code> by
675     * defaults.
676     *
677     * <p><b>"Experimental - subject to change"</b></p>
678     *
679     * @since DOM Level 3
680     */
681    virtual bool                   getStrictErrorChecking() const = 0;
682    /**
683     * An attribute specifying whether errors checking is enforced or not.
684     * When set to <code>false</code>, the implementation is free to not
685     * test every possible error case normally defined on DOM operations,
686     * and not raise any <code>DOMException</code>. In case of error, the
687     * behavior is undefined. This attribute is <code>true</code> by
688     * defaults.
689     *
690     * <p><b>"Experimental - subject to change"</b></p>
691     *
692     * @since DOM Level 3
693     */
694    virtual void                   setStrictErrorChecking(bool strictErrorChecking) = 0;
695
696    /**
697     * Rename an existing node. When possible this simply changes the name of
698     * the given node, otherwise this creates a new node with the specified
699     * name and replaces the existing node with the new node as described
700     * below. This only applies to nodes of type <code>ELEMENT_NODE</code>
701     * and <code>ATTRIBUTE_NODE</code>.
702     * <br>When a new node is created, the following operations are performed:
703     * the new node is created, any registered event listener is registered
704     * on the new node, any user data attached to the old node is removed
705     * from that node, the old node is removed from its parent if it has
706     * one, the children are moved to the new node, if the renamed node is
707     * an <code>DOMElement</code> its attributes are moved to the new node, the
708     * new node is inserted at the position the old node used to have in its
709     * parent's child nodes list if it has one, the user data that was
710     * attached to the old node is attach to the new node, the user data
711     * event <code>NODE_RENAMED</code> is fired.
712     * <br>When the node being renamed is an <code>DOMAttr</code> that is
713     * attached to an <code>DOMElement</code>, the node is first removed from
714     * the <code>DOMElement</code> attributes map. Then, once renamed, either
715     * by modifying the existing node or creating a new one as described
716     * above, it is put back.
717     *
718     * <p><b>"Experimental - subject to change"</b></p>
719     *
720     * @param n The node to rename.
721     * @param namespaceURI The new namespaceURI.
722     * @param name The new qualified name.
723     * @return The renamed node. This is either the specified node or the new
724     *   node that was created to replace the specified node.
725     * @exception DOMException
726     *   NOT_SUPPORTED_ERR: Raised when the type of the specified node is
727     *   neither <code>ELEMENT_NODE</code> nor <code>ATTRIBUTE_NODE</code>.
728     *   <br>WRONG_DOCUMENT_ERR: Raised when the specified node was created
729     *   from a different document than this document.
730     *   <br>NAMESPACE_ERR: Raised if the <code>qualifiedName</code> is
731     *   malformed per the Namespaces in XML specification, if the
732     *   <code>qualifiedName</code> has a prefix and the
733     *   <code>namespaceURI</code> is <code>null</code>, or if the
734     *   <code>qualifiedName</code> has a prefix that is "xml" and the
735     *   <code>namespaceURI</code> is different from "
736     *   http://www.w3.org/XML/1998/namespace" . Also raised, when the node
737     *   being renamed is an attribute, if the <code>qualifiedName</code>,
738     *   or its prefix, is "xmlns" and the <code>namespaceURI</code> is
739     *   different from "http://www.w3.org/2000/xmlns/".
740     * @since DOM Level 3
741     */
742    virtual DOMNode* renameNode(DOMNode* n, const XMLCh* namespaceURI, const XMLCh* name) = 0;
743
744
745    /**
746     * Changes the <code>ownerDocument</code> of a node, its children, as well
747     * as the attached attribute nodes if there are any. If the node has a
748     * parent it is first removed from its parent child list. This
749     * effectively allows moving a subtree from one document to another. The
750     * following list describes the specifics for each type of node.
751     *
752     * <p><b>"Experimental - subject to change"</b></p>
753     *
754     * <dl>
755     * <dt>
756     * ATTRIBUTE_NODE</dt>
757     * <dd>The <code>ownerElement</code> attribute is set to
758     * <code>null</code> and the <code>specified</code> flag is set to
759     * <code>true</code> on the adopted <code>DOMAttr</code>. The descendants
760     * of the source <code>DOMAttr</code> are recursively adopted.</dd>
761     * <dt>
762     * DOCUMENT_FRAGMENT_NODE</dt>
763     * <dd>The descendants of the source node are
764     * recursively adopted.</dd>
765     * <dt>DOCUMENT_NODE</dt>
766     * <dd><code>DOMDocument</code> nodes cannot
767     * be adopted.</dd>
768     * <dt>DOCUMENT_TYPE_NODE</dt>
769     * <dd><code>DOMDocumentType</code> nodes cannot
770     * be adopted.</dd>
771     * <dt>ELEMENT_NODE</dt>
772     * <dd>Specified attribute nodes of the source
773     * element are adopted, and the generated <code>DOMAttr</code> nodes.
774     * Default attributes are discarded, though if the document being
775     * adopted into defines default attributes for this element name, those
776     * are assigned. The descendants of the source element are recursively
777     * adopted.</dd>
778     * <dt>ENTITY_NODE</dt>
779     * <dd><code>DOMEntity</code> nodes cannot be adopted.</dd>
780     * <dt>
781     * ENTITY_REFERENCE_NODE</dt>
782     * <dd>Only the <code>DOMEntityReference</code> node
783     * itself is adopted, the descendants are discarded, since the source
784     * and destination documents might have defined the entity differently.
785     * If the document being imported into provides a definition for this
786     * entity name, its value is assigned.</dd>
787     * <dt>NOTATION_NODE</dt>
788     * <dd><code>DOMNotation</code>
789     * nodes cannot be adopted.</dd>
790     * <dt>PROCESSING_INSTRUCTION_NODE, TEXT_NODE,
791     * CDATA_SECTION_NODE, COMMENT_NODE</dt>
792     * <dd>These nodes can all be adopted. No
793     * specifics.</dd>
794     * </dl>
795     * @param source The node to move into this document.
796     * @return The adopted node, or <code>null</code> if this operation
797     *   fails, such as when the source node comes from a different
798     *   implementation.
799     * @exception DOMException
800     *   NOT_SUPPORTED_ERR: Raised if the source node is of type
801     *   <code>DOCUMENT</code>, <code>DOCUMENT_TYPE</code>.
802     *   <br>NO_MODIFICATION_ALLOWED_ERR: Raised when the source node is
803     *   readonly.
804     * @since DOM Level 3
805     */
806    virtual DOMNode*               adoptNode(DOMNode* source) = 0;
807
808    /**
809     * This method acts as if the document was going through a save and load
810     * cycle, putting the document in a "normal" form. The actual result
811     * depends on the features being set. See <code>DOMConfiguration</code> for
812     * details.
813     *
814     * <p><b>"Experimental - subject to change"</b></p>
815     *
816     * <br>Noticeably this method normalizes <code>DOMText</code> nodes, makes
817     * the document "namespace wellformed", according to the algorithm
818     * described below in pseudo code, by adding missing namespace
819     * declaration attributes and adding or changing namespace prefixes,
820     * updates the replacement tree of <code>DOMEntityReference</code> nodes,
821     * normalizes attribute values, etc.
822     * <br>Mutation events, when supported, are generated to reflect the
823     * changes occuring on the document.
824     * Note that this is a partial implementation. Not all the required features are implemented.
825     * Currently <code>DOMAttr</code> and <code>DOMText</code> nodes are normalized.
826     * Features to remove <code>DOMComment</code> and <code>DOMCDATASection</code> work.
827     * The feature to normalize namespaces is implemented. This feature is called
828     * "namespaces" and is incorectly documented in the current WD.
829     * @since DOM Level 3
830     *
831     */
832    virtual void                   normalizeDocument() = 0;
833
834
835    /**
836     * The configuration used when Document.normalizeDocument is invoked.
837     *
838     * @return The <code>DOMConfiguration</code> from this <code>DOMDocument</code>
839     *
840     * Note that this is a partial implementation. Not all the required features are
841     * implemented and this is only used by normalizeDocument.
842     * Currently <code>DOMAttr</code> and <code>DOMText</code> nodes are normalized.
843     * Features to remove <code>DOMComment</code> and <code>DOMCDATASection</code> work.
844     * The feature to normalize namespaces is implemented. This feature is called
845     * "namespaces" and is incorectly documented in the current WD.
846     *
847     * <p><b>"Experimental - subject to change"</b></p>
848     * @since DOM Level 3
849     */
850    virtual DOMConfiguration*      getDOMConfiguration() const = 0;
851
852    // -----------------------------------------------------------------------
853    // Non-standard extension
854    // -----------------------------------------------------------------------
855    /** @name Non-standard extension */
856    //@{
857    /**
858     * Non-standard extension
859     *
860     * Create a new entity.
861     * @param name The name of the entity to instantiate
862     *
863     */
864    virtual DOMEntity     *createEntity(const XMLCh *name) = 0;
865
866    /**
867     * Non-standard extension
868     *
869     * Create a DOMDocumentType node.
870     * @return A <code>DOMDocumentType</code> that references the newly
871     *  created DOMDocumentType node.
872     *
873     */
874    virtual DOMDocumentType *createDocumentType(const XMLCh *name) = 0;
875
876
877    /**
878     * Non-standard extension.
879     *
880     * Create a Notation.
881     * @param name The name of the notation to instantiate
882     * @return A <code>DOMNotation</code> that references the newly
883     *  created DOMNotation node.
884     */
885    virtual DOMNotation *createNotation(const XMLCh *name) = 0;
886
887    /**
888     * Non-standard extension.
889     *
890     * Creates an element of the given qualified name and
891     * namespace URI, and also stores line/column number info.
892     * Used by internally XSDXercesDOMParser during schema traversal.
893     *
894     * @see createElementNS(const XMLCh *namespaceURI, const XMLCh *qualifiedName)
895     */
896    virtual DOMElement         *createElementNS(const XMLCh *namespaceURI,
897                                                  const XMLCh *qualifiedName,
898                                                  const XMLSSize_t lineNum,
899                                                  const XMLSSize_t columnNum) = 0;
900    //@}
901
902};
903
904XERCES_CPP_NAMESPACE_END
905
906#endif
Note: See TracBrowser for help on using the repository browser.