~ubuntu-branches/ubuntu/gutsy/poco/gutsy

« back to all changes in this revision

Viewing changes to XML/include/Poco/DOM/Entity.h

  • Committer: Bazaar Package Importer
  • Author(s): Krzysztof Burghardt
  • Date: 2007-04-27 18:33:48 UTC
  • Revision ID: james.westby@ubuntu.com-20070427183348-xgnpct0qd6a2ip34
Tags: upstream-1.2.9
ImportĀ upstreamĀ versionĀ 1.2.9

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//
 
2
// Entity.h
 
3
//
 
4
// $Id: //poco/1.2/XML/include/Poco/DOM/Entity.h#1 $
 
5
//
 
6
// Library: XML
 
7
// Package: DOM
 
8
// Module:  DOM
 
9
//
 
10
// Definition of the DOM Entity class.
 
11
//
 
12
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
 
13
// and Contributors.
 
14
//
 
15
// Permission is hereby granted, free of charge, to any person or organization
 
16
// obtaining a copy of the software and accompanying documentation covered by
 
17
// this license (the "Software") to use, reproduce, display, distribute,
 
18
// execute, and transmit the Software, and to prepare derivative works of the
 
19
// Software, and to permit third-parties to whom the Software is furnished to
 
20
// do so, all subject to the following:
 
21
// 
 
22
// The copyright notices in the Software and this entire statement, including
 
23
// the above license grant, this restriction and the following disclaimer,
 
24
// must be included in all copies of the Software, in whole or in part, and
 
25
// all derivative works of the Software, unless such copies or derivative
 
26
// works are solely in the form of machine-executable object code generated by
 
27
// a source language processor.
 
28
// 
 
29
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 
30
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 
31
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
 
32
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
 
33
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
 
34
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 
35
// DEALINGS IN THE SOFTWARE.
 
36
//
 
37
 
 
38
 
 
39
#ifndef DOM_Entity_INCLUDED
 
40
#define DOM_Entity_INCLUDED
 
41
 
 
42
 
 
43
#include "Poco/XML/XML.h"
 
44
#include "Poco/DOM/AbstractContainerNode.h"
 
45
#include "Poco/XML/XMLString.h"
 
46
 
 
47
 
 
48
namespace Poco {
 
49
namespace XML {
 
50
 
 
51
 
 
52
class XML_API Entity: public AbstractContainerNode
 
53
        /// This interface represents an entity, either parsed or unparsed, in an XML
 
54
        /// document. Note that this models the entity itself not the entity declaration.
 
55
        /// Entity declaration modeling has been left for a later Level of the DOM
 
56
        /// specification.
 
57
        /// 
 
58
        /// The nodeName attribute that is inherited from Node contains the name of
 
59
        /// the entity.
 
60
        /// 
 
61
        /// An XML processor may choose to completely expand entities before the structure
 
62
        /// model is passed to the DOM; in this case there will be no EntityReference
 
63
        /// nodes in the document tree.
 
64
        /// 
 
65
        /// XML does not mandate that a non-validating XML processor read and process
 
66
        /// entity declarations made in the external subset or declared in external
 
67
        /// parameter entities. This means that parsed entities declared in the external
 
68
        /// subset need not be expanded by some classes of applications, and that the
 
69
        /// replacement value of the entity may not be available. When the replacement
 
70
        /// value is available, the corresponding Entity node's child list represents
 
71
        /// the structure of that replacement text. Otherwise, the child list is empty.
 
72
        /// 
 
73
        /// The resolution of the children of the Entity (the replacement value) may
 
74
        /// be lazily evaluated; actions by the user (such as calling the childNodes
 
75
        /// method on the Entity Node) are assumed to trigger the evaluation.
 
76
        /// 
 
77
        /// The DOM Level 1 does not support editing Entity nodes; if a user wants to
 
78
        /// make changes to the contents of an Entity, every related EntityReference
 
79
        /// node has to be replaced in the structure model by a clone of the Entity's
 
80
        /// contents, and then the desired changes must be made to each of those clones
 
81
        /// instead. Entity nodes and all their descendants are readonly.
 
82
        /// 
 
83
        /// An Entity node does not have any parent.
 
84
{
 
85
public:
 
86
        const XMLString& publicId() const;
 
87
                /// Returns the public identifier associated with
 
88
                /// the entity, if specified. If the public identifier
 
89
                /// was not specified, this is the empty string.
 
90
 
 
91
        const XMLString& systemId() const;
 
92
                /// Returns the system identifier associated with
 
93
                /// the entity, if specified. If the system identifier
 
94
                /// was not specified, this is the empty string.
 
95
 
 
96
        const XMLString& notationName() const;
 
97
                /// Returns, for unparsed entities, the name of the
 
98
                /// notation for the entity. For parsed entities, this
 
99
                /// is the empty string.
 
100
 
 
101
        // Node
 
102
        const XMLString& nodeName() const;
 
103
        unsigned short nodeType() const;
 
104
 
 
105
protected:
 
106
        Entity(Document* pOwnerDocument, const XMLString& name, const XMLString& publicId, const XMLString& systemId, const XMLString& notationName);
 
107
        Entity(Document* pOwnerDocument, const Entity& entity);
 
108
        ~Entity();
 
109
        
 
110
        Node* copyNode(bool deep, Document* pOwnerDocument) const;
 
111
 
 
112
private:
 
113
        static const XMLString NODE_NAME;
 
114
 
 
115
        XMLString _name;
 
116
        XMLString _publicId;
 
117
        XMLString _systemId;
 
118
        XMLString _notationName;
 
119
 
 
120
        friend class Document;
 
121
};
 
122
 
 
123
 
 
124
//
 
125
// inlines
 
126
//
 
127
inline const XMLString& Entity::publicId() const
 
128
{
 
129
        return _publicId;
 
130
}
 
131
 
 
132
 
 
133
inline const XMLString& Entity::systemId() const
 
134
{
 
135
        return _systemId;
 
136
}
 
137
 
 
138
 
 
139
inline const XMLString& Entity::notationName() const
 
140
{
 
141
        return _notationName;
 
142
}
 
143
 
 
144
 
 
145
} } // namespace Poco::XML
 
146
 
 
147
 
 
148
#endif // DOM_Entity_INCLUDED