📄 namednodemap.h
字号:
//
// NamedNodeMap.h
//
// $Id: //poco/Main/XML/include/DOM/NamedNodeMap.h#5 $
//
// Definition of the DOM NamedNodeMap interface.
//
// Copyright (c) 2004, Guenter Obiltschnig/Applied Informatics.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// 3. Redistributions in any form must be accompanied by information on
// how to obtain complete source code for this software and any
// accompanying software that uses this software. The source code
// must either be included in the distribution or be available for no
// more than the cost of distribution plus a nominal fee, and must be
// freely redistributable under reasonable conditions. For an
// executable file, complete source code means the source code for all
// modules it contains. It does not include source code for modules or
// files that typically accompany the major components of the operating
// system on which the executable file runs.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
#ifndef DOM_NamedNodeMap_INCLUDED
#define DOM_NamedNodeMap_INCLUDED
#ifndef XML_XML_INCLUDED
#include "XML/XML.h"
#endif
#ifndef DOM_DOMObject_INCLUDED
#include "DOM/DOMObject.h"
#endif
#ifndef XML_XMLString_INCLUDED
#include "XML/XMLString.h"
#endif
XML_BEGIN
class Node;
class XML_API NamedNodeMap: public DOMObject
/// Objects implementing the NamedNodeMap interface are used to represent collections
/// of nodes that can be accessed by name. Note that NamedNodeMap does not inherit
/// from NodeList; NamedNodeMaps are not maintained in any particular order.
/// Objects contained in an object implementing NamedNodeMap may also be accessed
/// by an ordinal index, but this is simply to allow convenient enumeration
/// of the contents of a NamedNodeMap, and does not imply that the DOM specifies
/// an order to these Nodes.
///
/// NamedNodeMap objects in the DOM are live.
///
/// A NamedNodeMap returned from a method must be released with a call to
/// release() when no longer needed.
{
public:
virtual Node* getNamedItem(const XMLString& name) const = 0;
/// Retrieves a node specified by name.
virtual Node* setNamedItem(Node* arg) = 0;
/// Adds a node using its nodeName attribute. If a node with that name is already
/// present in this map, it is replaced by the new one.
/// As the nodeName attribute is used to derive the name which the node must
/// be stored under, multiple nodes of certain types (those that have a "special"
/// string value) cannot be stored as the names would clash. This is seen as
/// preferable to allowing nodes to be aliased.
virtual Node* removeNamedItem(const XMLString& name) = 0;
/// Removes a node specified by name. When this map contains the attributes
/// attached to an element, if the removed attribute is known to have a default
/// value, an attribute immediately appears containing the default value.
virtual Node* item(unsigned long index) const = 0;
/// Returns the index'th item in the map. If index is greater
/// than or equal to the number of nodes in the map, this
/// returns null.
virtual unsigned long length() const = 0;
/// Returns the number of nodes in the map. The range of valid
/// child node indices is 0 to length - 1 inclusive.
// DOM Level 2
virtual Node* getNamedItemNS(const XMLString& namespaceURI, const XMLString& localName) const = 0;
/// Retrieves a node specified by name.
virtual Node* setNamedItemNS(Node* arg) = 0;
/// Adds a node using its nodeName attribute.
/// If a node with that namespace URI and that local name is already
/// present in this map, it is replaced by the new one.
virtual Node* removeNamedItemNS(const XMLString& namespaceURI, const XMLString& localName) = 0;
/// Removes a node specified by name.
protected:
virtual ~NamedNodeMap();
};
XML_END
#endif // DOM_NamedNodeMap_INCLUDED
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -