Coverage Report

Created: 2026-06-07 06:33

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/poco/XML/include/Poco/DOM/Entity.h
Line
Count
Source
1
//
2
// Entity.h
3
//
4
// Library: XML
5
// Package: DOM
6
// Module:  DOM
7
//
8
// Definition of the DOM Entity class.
9
//
10
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
11
// and Contributors.
12
//
13
// SPDX-License-Identifier: BSL-1.0
14
//
15
16
17
#ifndef DOM_Entity_INCLUDED
18
#define DOM_Entity_INCLUDED
19
20
21
#include "Poco/XML/XML.h"
22
#include "Poco/DOM/AbstractContainerNode.h"
23
#include "Poco/XML/XMLString.h"
24
25
26
namespace Poco::XML {
27
28
29
class XML_API Entity: public AbstractContainerNode
30
  /// This interface represents an entity, either parsed or unparsed, in an XML
31
  /// document. Note that this models the entity itself not the entity declaration.
32
  /// Entity declaration modeling has been left for a later Level of the DOM
33
  /// specification.
34
  ///
35
  /// The nodeName attribute that is inherited from Node contains the name of
36
  /// the entity.
37
  ///
38
  /// An XML processor may choose to completely expand entities before the structure
39
  /// model is passed to the DOM; in this case there will be no EntityReference
40
  /// nodes in the document tree.
41
  ///
42
  /// XML does not mandate that a non-validating XML processor read and process
43
  /// entity declarations made in the external subset or declared in external
44
  /// parameter entities. This means that parsed entities declared in the external
45
  /// subset need not be expanded by some classes of applications, and that the
46
  /// replacement value of the entity may not be available. When the replacement
47
  /// value is available, the corresponding Entity node's child list represents
48
  /// the structure of that replacement text. Otherwise, the child list is empty.
49
  ///
50
  /// The resolution of the children of the Entity (the replacement value) may
51
  /// be lazily evaluated; actions by the user (such as calling the childNodes
52
  /// method on the Entity Node) are assumed to trigger the evaluation.
53
  ///
54
  /// The DOM Level 1 does not support editing Entity nodes; if a user wants to
55
  /// make changes to the contents of an Entity, every related EntityReference
56
  /// node has to be replaced in the structure model by a clone of the Entity's
57
  /// contents, and then the desired changes must be made to each of those clones
58
  /// instead. Entity nodes and all their descendants are readonly.
59
  ///
60
  /// An Entity node does not have any parent.
61
{
62
public:
63
  const XMLString& publicId() const;
64
    /// Returns the public identifier associated with
65
    /// the entity, if specified. If the public identifier
66
    /// was not specified, this is the empty string.
67
68
  const XMLString& systemId() const;
69
    /// Returns the system identifier associated with
70
    /// the entity, if specified. If the system identifier
71
    /// was not specified, this is the empty string.
72
73
  const XMLString& notationName() const;
74
    /// Returns, for unparsed entities, the name of the
75
    /// notation for the entity. For parsed entities, this
76
    /// is the empty string.
77
78
  // Node
79
  const XMLString& nodeName() const;
80
  unsigned short nodeType() const;
81
82
protected:
83
  Entity(Document* pOwnerDocument, const XMLString& name, const XMLString& publicId, const XMLString& systemId, const XMLString& notationName);
84
  Entity(Document* pOwnerDocument, const Entity& entity);
85
  ~Entity();
86
87
  Node* copyNode(bool deep, Document* pOwnerDocument) const;
88
89
private:
90
  static const XMLString NODE_NAME;
91
92
  XMLString _name;
93
  XMLString _publicId;
94
  XMLString _systemId;
95
  XMLString _notationName;
96
97
  friend class Document;
98
};
99
100
101
//
102
// inlines
103
//
104
inline const XMLString& Entity::publicId() const
105
0
{
106
0
  return _publicId;
107
0
}
108
109
110
inline const XMLString& Entity::systemId() const
111
0
{
112
0
  return _systemId;
113
0
}
114
115
116
inline const XMLString& Entity::notationName() const
117
0
{
118
0
  return _notationName;
119
0
}
120
121
122
} // namespace Poco::XML
123
124
125
#endif // DOM_Entity_INCLUDED