diff options
author | orivej <orivej@yandex-team.ru> | 2022-02-10 16:44:49 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:44:49 +0300 |
commit | 718c552901d703c502ccbefdfc3c9028d608b947 (patch) | |
tree | 46534a98bbefcd7b1f3faa5b52c138ab27db75b7 /contrib/libs/poco/XML/include/Poco | |
parent | e9656aae26e0358d5378e5b63dcac5c8dbe0e4d0 (diff) | |
download | ydb-718c552901d703c502ccbefdfc3c9028d608b947.tar.gz |
Restoring authorship annotation for <orivej@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/libs/poco/XML/include/Poco')
75 files changed, 9571 insertions, 9571 deletions
diff --git a/contrib/libs/poco/XML/include/Poco/DOM/AbstractContainerNode.h b/contrib/libs/poco/XML/include/Poco/DOM/AbstractContainerNode.h index 60dc9589d7..0bc75b6ac4 100644 --- a/contrib/libs/poco/XML/include/Poco/DOM/AbstractContainerNode.h +++ b/contrib/libs/poco/XML/include/Poco/DOM/AbstractContainerNode.h @@ -1,78 +1,78 @@ -// -// AbstractContainerNode.h -// -// Library: XML -// Package: DOM -// Module: DOM -// -// Definition of the AbstractContainerNode class. -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef DOM_AbstractContainerNode_INCLUDED -#define DOM_AbstractContainerNode_INCLUDED - - -#include "Poco/XML/XML.h" -#include "Poco/DOM/AbstractNode.h" - - -namespace Poco { -namespace XML { - - -class XML_API AbstractContainerNode: public AbstractNode - /// AbstractContainerNode is an implementation of Node - /// that stores and manages child nodes. - /// - /// Child nodes are organized in a single linked list. -{ -public: - // Node - Node* firstChild() const; - Node* lastChild() const; - Node* insertBefore(Node* newChild, Node* refChild); - Node* replaceChild(Node* newChild, Node* oldChild); - Node* removeChild(Node* oldChild); - Node* appendChild(Node* newChild); - bool hasChildNodes() const; - bool hasAttributes() const; - Node* getNodeByPath(const XMLString& path) const; - Node* getNodeByPathNS(const XMLString& path, const NSMap& nsMap) const; - -protected: - AbstractContainerNode(Document* pOwnerDocument); - AbstractContainerNode(Document* pOwnerDocument, const AbstractContainerNode& node); - ~AbstractContainerNode(); - - void dispatchNodeRemovedFromDocument(); - void dispatchNodeInsertedIntoDocument(); - - static const Node* findNode(XMLString::const_iterator& it, const XMLString::const_iterator& end, const Node* pNode, const NSMap* pNSMap); - static const Node* findElement(const XMLString& name, const Node* pNode, const NSMap* pNSMap); - static const Node* findElement(int index, const Node* pNode, const NSMap* pNSMap); - static const Node* findElement(const XMLString& attr, const XMLString& value, const Node* pNode, const NSMap* pNSMap); - static const Attr* findAttribute(const XMLString& name, const Node* pNode, const NSMap* pNSMap); - bool hasAttributeValue(const XMLString& name, const XMLString& value, const NSMap* pNSMap) const; - static bool namesAreEqual(const Node* pNode1, const Node* pNode2, const NSMap* pNSMap); - static bool namesAreEqual(const Node* pNode, const XMLString& name, const NSMap* pNSMap); - - static const XMLString WILDCARD; - -private: - AbstractNode* _pFirstChild; - - friend class AbstractNode; - friend class NodeAppender; -}; - - -} } // namespace Poco::XML - - -#endif // DOM_AbstractContainerNode_INCLUDED +// +// AbstractContainerNode.h +// +// Library: XML +// Package: DOM +// Module: DOM +// +// Definition of the AbstractContainerNode class. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef DOM_AbstractContainerNode_INCLUDED +#define DOM_AbstractContainerNode_INCLUDED + + +#include "Poco/XML/XML.h" +#include "Poco/DOM/AbstractNode.h" + + +namespace Poco { +namespace XML { + + +class XML_API AbstractContainerNode: public AbstractNode + /// AbstractContainerNode is an implementation of Node + /// that stores and manages child nodes. + /// + /// Child nodes are organized in a single linked list. +{ +public: + // Node + Node* firstChild() const; + Node* lastChild() const; + Node* insertBefore(Node* newChild, Node* refChild); + Node* replaceChild(Node* newChild, Node* oldChild); + Node* removeChild(Node* oldChild); + Node* appendChild(Node* newChild); + bool hasChildNodes() const; + bool hasAttributes() const; + Node* getNodeByPath(const XMLString& path) const; + Node* getNodeByPathNS(const XMLString& path, const NSMap& nsMap) const; + +protected: + AbstractContainerNode(Document* pOwnerDocument); + AbstractContainerNode(Document* pOwnerDocument, const AbstractContainerNode& node); + ~AbstractContainerNode(); + + void dispatchNodeRemovedFromDocument(); + void dispatchNodeInsertedIntoDocument(); + + static const Node* findNode(XMLString::const_iterator& it, const XMLString::const_iterator& end, const Node* pNode, const NSMap* pNSMap); + static const Node* findElement(const XMLString& name, const Node* pNode, const NSMap* pNSMap); + static const Node* findElement(int index, const Node* pNode, const NSMap* pNSMap); + static const Node* findElement(const XMLString& attr, const XMLString& value, const Node* pNode, const NSMap* pNSMap); + static const Attr* findAttribute(const XMLString& name, const Node* pNode, const NSMap* pNSMap); + bool hasAttributeValue(const XMLString& name, const XMLString& value, const NSMap* pNSMap) const; + static bool namesAreEqual(const Node* pNode1, const Node* pNode2, const NSMap* pNSMap); + static bool namesAreEqual(const Node* pNode, const XMLString& name, const NSMap* pNSMap); + + static const XMLString WILDCARD; + +private: + AbstractNode* _pFirstChild; + + friend class AbstractNode; + friend class NodeAppender; +}; + + +} } // namespace Poco::XML + + +#endif // DOM_AbstractContainerNode_INCLUDED diff --git a/contrib/libs/poco/XML/include/Poco/DOM/AbstractNode.h b/contrib/libs/poco/XML/include/Poco/DOM/AbstractNode.h index cedcc73920..fd0761e572 100644 --- a/contrib/libs/poco/XML/include/Poco/DOM/AbstractNode.h +++ b/contrib/libs/poco/XML/include/Poco/DOM/AbstractNode.h @@ -1,125 +1,125 @@ -// -// AbstractNode.h -// -// Library: XML -// Package: DOM -// Module: DOM -// -// Definition of the AbstractNode class. -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef DOM_AbstractNode_INCLUDED -#define DOM_AbstractNode_INCLUDED - - -#include "Poco/XML/XML.h" -#include "Poco/DOM/Node.h" -#include "Poco/DOM/MutationEvent.h" -#include "Poco/XML/XMLString.h" - - -namespace Poco { -namespace XML { - - -class AbstractContainerNode; -class Attr; -class EventDispatcher; - - -class XML_API AbstractNode: public Node - /// AbstractNode provides a basic implementation - /// of the Node interface for all types of nodes - /// that do not contain other nodes. -{ -public: - // Node - const XMLString& nodeName() const; - const XMLString& getNodeValue() const; - void setNodeValue(const XMLString& value); - Node* parentNode() const; - NodeList* childNodes() const; - Node* firstChild() const; - Node* lastChild() const; - Node* previousSibling() const; - Node* nextSibling() const; - NamedNodeMap* attributes() const; - Document* ownerDocument() const; - Node* insertBefore(Node* newChild, Node* refChild); - Node* replaceChild(Node* newChild, Node* oldChild); - Node* removeChild(Node* oldChild); - Node* appendChild(Node* newChild); - bool hasChildNodes() const; - Node* cloneNode(bool deep) const; - void normalize(); - bool isSupported(const XMLString& feature, const XMLString& version) const; - const XMLString& namespaceURI() const; - XMLString prefix() const; - const XMLString& localName() const; - bool hasAttributes() const; - - // EventTarget - void addEventListener(const XMLString& type, EventListener* listener, bool useCapture); - void removeEventListener(const XMLString& type, EventListener* listener, bool useCapture); - bool dispatchEvent(Event* evt); - - // Extensions - XMLString innerText() const; - Node* getNodeByPath(const XMLString& path) const; - Node* getNodeByPathNS(const XMLString& path, const NSMap& nsMap) const; - - virtual void autoRelease(); - -protected: - AbstractNode(Document* pOwnerDocument); - AbstractNode(Document* pOwnerDocument, const AbstractNode& node); - ~AbstractNode(); - - virtual Node* copyNode(bool deep, Document* pOwnerDocument) const = 0; - - virtual bool events() const; - virtual bool eventsSuspended() const; - void captureEvent(Event* evt); - void bubbleEvent(Event* evt); - void dispatchSubtreeModified(); - void dispatchNodeInserted(); - void dispatchNodeRemoved(); - virtual void dispatchNodeRemovedFromDocument(); - virtual void dispatchNodeInsertedIntoDocument(); - void dispatchAttrModified(Attr* pAttr, MutationEvent::AttrChangeType changeType, const XMLString& prevValue, const XMLString& newValue); - void dispatchCharacterDataModified(const XMLString& prevValue, const XMLString& newValue); - void setOwnerDocument(Document* pOwnerDocument); - - static const XMLString EMPTY_STRING; - -private: - AbstractNode(); - - AbstractContainerNode* _pParent; - AbstractNode* _pNext; - Document* _pOwner; - EventDispatcher* _pEventDispatcher; - - static const XMLString NODE_NAME; - - friend class AbstractContainerNode; - friend class Document; - friend class DocumentFragment; - friend class Element; - friend class Attr; - friend class CharacterData; - friend class DOMBuilder; - friend class NodeAppender; -}; - - -} } // namespace Poco::XML - - -#endif // DOM_AbstractNode_INCLUDED +// +// AbstractNode.h +// +// Library: XML +// Package: DOM +// Module: DOM +// +// Definition of the AbstractNode class. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef DOM_AbstractNode_INCLUDED +#define DOM_AbstractNode_INCLUDED + + +#include "Poco/XML/XML.h" +#include "Poco/DOM/Node.h" +#include "Poco/DOM/MutationEvent.h" +#include "Poco/XML/XMLString.h" + + +namespace Poco { +namespace XML { + + +class AbstractContainerNode; +class Attr; +class EventDispatcher; + + +class XML_API AbstractNode: public Node + /// AbstractNode provides a basic implementation + /// of the Node interface for all types of nodes + /// that do not contain other nodes. +{ +public: + // Node + const XMLString& nodeName() const; + const XMLString& getNodeValue() const; + void setNodeValue(const XMLString& value); + Node* parentNode() const; + NodeList* childNodes() const; + Node* firstChild() const; + Node* lastChild() const; + Node* previousSibling() const; + Node* nextSibling() const; + NamedNodeMap* attributes() const; + Document* ownerDocument() const; + Node* insertBefore(Node* newChild, Node* refChild); + Node* replaceChild(Node* newChild, Node* oldChild); + Node* removeChild(Node* oldChild); + Node* appendChild(Node* newChild); + bool hasChildNodes() const; + Node* cloneNode(bool deep) const; + void normalize(); + bool isSupported(const XMLString& feature, const XMLString& version) const; + const XMLString& namespaceURI() const; + XMLString prefix() const; + const XMLString& localName() const; + bool hasAttributes() const; + + // EventTarget + void addEventListener(const XMLString& type, EventListener* listener, bool useCapture); + void removeEventListener(const XMLString& type, EventListener* listener, bool useCapture); + bool dispatchEvent(Event* evt); + + // Extensions + XMLString innerText() const; + Node* getNodeByPath(const XMLString& path) const; + Node* getNodeByPathNS(const XMLString& path, const NSMap& nsMap) const; + + virtual void autoRelease(); + +protected: + AbstractNode(Document* pOwnerDocument); + AbstractNode(Document* pOwnerDocument, const AbstractNode& node); + ~AbstractNode(); + + virtual Node* copyNode(bool deep, Document* pOwnerDocument) const = 0; + + virtual bool events() const; + virtual bool eventsSuspended() const; + void captureEvent(Event* evt); + void bubbleEvent(Event* evt); + void dispatchSubtreeModified(); + void dispatchNodeInserted(); + void dispatchNodeRemoved(); + virtual void dispatchNodeRemovedFromDocument(); + virtual void dispatchNodeInsertedIntoDocument(); + void dispatchAttrModified(Attr* pAttr, MutationEvent::AttrChangeType changeType, const XMLString& prevValue, const XMLString& newValue); + void dispatchCharacterDataModified(const XMLString& prevValue, const XMLString& newValue); + void setOwnerDocument(Document* pOwnerDocument); + + static const XMLString EMPTY_STRING; + +private: + AbstractNode(); + + AbstractContainerNode* _pParent; + AbstractNode* _pNext; + Document* _pOwner; + EventDispatcher* _pEventDispatcher; + + static const XMLString NODE_NAME; + + friend class AbstractContainerNode; + friend class Document; + friend class DocumentFragment; + friend class Element; + friend class Attr; + friend class CharacterData; + friend class DOMBuilder; + friend class NodeAppender; +}; + + +} } // namespace Poco::XML + + +#endif // DOM_AbstractNode_INCLUDED diff --git a/contrib/libs/poco/XML/include/Poco/DOM/Attr.h b/contrib/libs/poco/XML/include/Poco/DOM/Attr.h index 13ace7ecce..3498a0385b 100644 --- a/contrib/libs/poco/XML/include/Poco/DOM/Attr.h +++ b/contrib/libs/poco/XML/include/Poco/DOM/Attr.h @@ -1,180 +1,180 @@ -// -// Attr.h -// -// Library: XML -// Package: DOM -// Module: DOM -// -// Definition of the DOM Attr class. -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef DOM_Attr_INCLUDED -#define DOM_Attr_INCLUDED - - -#include "Poco/XML/XML.h" -#include "Poco/DOM/AbstractNode.h" -#include "Poco/DOM/Element.h" -#include "Poco/XML/Name.h" - - -namespace Poco { -namespace XML { - - -class XML_API Attr: public AbstractNode - /// The Attr interface represents an attribute in an Element object. Typically - /// the allowable values for the attribute are defined in a document type definition. - /// - /// Attr objects inherit the Node interface, but since they are not actually - /// child nodes of the element they describe, the DOM does not consider them - /// part of the document tree. Thus, the Node attributes parentNode, previousSibling, - /// and nextSibling have a null value for Attr objects. The DOM takes the view - /// that attributes are properties of elements rather than having a separate - /// identity from the elements they are associated with; this should make it - /// more efficient to implement such features as default attributes associated - /// with all elements of a given type. Furthermore, Attr nodes may not be immediate - /// children of a DocumentFragment. However, they can be associated with Element - /// nodes contained within a DocumentFragment. In short, users and implementors - /// of the DOM need to be aware that Attr nodes have some things in common with - /// other objects inheriting the Node interface, but they also are quite distinct. - /// - /// The attribute's effective value is determined as follows: if this attribute - /// has been explicitly assigned any value, that value is the attribute's effective - /// value; otherwise, if there is a declaration for this attribute, and that - /// declaration includes a default value, then that default value is the attribute's - /// effective value; otherwise, the attribute does not exist on this element - /// in the structure model until it has been explicitly added. Note that the - /// nodeValue attribute on the Attr instance can also be used to retrieve the - /// string version of the attribute's value(s). - /// - /// In XML, where the value of an attribute can contain entity references, the - /// child nodes of the Attr node provide a representation in which entity references - /// are not expanded. These child nodes may be either Text or EntityReference - /// nodes. Because the attribute type may be unknown, there are no tokenized - /// attribute values. -{ -public: - const XMLString& name() const; - /// Returns the name of this attribute. - - bool specified() const; - /// If this attribute was explicitly given a value in the original document, - /// this is true; otherwise, it is false. Note that the implementation is in - /// charge of this attribute, not the user. If the user changes the value of - /// the attribute (even if it ends up having the same value as the default value) - /// then the specified flag is automatically flipped to true. To re-specify - /// the attribute as the default value from the DTD, the user must delete the - /// attribute. The implementation will then make a new attribute available with - /// specified set to false and the default value (if one exists). - /// In summary: - /// - /// * If the attribute has an assigned value in the document then specified - /// is true, and the value is the assigned value. - /// * If the attribute has no assigned value in the document and has a default - /// value in the DTD, then specified is false, and the value is the default - /// value in the DTD. - /// * If the attribute has no assigned value in the document and has a value - /// of #IMPLIED in the DTD, then the attribute does not appear in the structure - /// model of the document. - /// * If the attribute is not associated to any element (i.e. because it - /// was just created or was obtained from some removal or cloning operation) - /// specified is true. - - const XMLString& value() const; - /// Returns the value of the attribute as a string. Character - /// and general entity references are replaced with their values. See also the - /// method getAttribute on the Element interface. - - const XMLString& getValue() const; - /// Returns the value of the attribute as a string. Character - /// and general entity references are replaced with their values. See also the - /// method getAttribute on the Element interface. - - void setValue(const XMLString& value); - /// Sets the value of the attribute as a string. - /// This creates a Text node with the unparsed contents of the string. - /// I.e. any characters that an XML processor would recognize as markup are - /// instead treated as literal text. See also the method setAttribute on the - /// Element interface. - - // DOM Level 2 - Element* ownerElement() const; - /// The Element node this attribute is attached to or null - /// if this attribute is not in use. - - // Node - Node* parentNode() const; - const XMLString& nodeName() const; - const XMLString& getNodeValue() const; - void setNodeValue(const XMLString& value); - unsigned short nodeType() const; - Node* previousSibling() const; - const XMLString& namespaceURI() const; - XMLString prefix() const; - const XMLString& localName() const; - - // Non-standard extensions - XMLString innerText() const; - -protected: - Attr(Document* pOwnerDocument, Element* pOwnerElement, const XMLString& namespaceURI, const XMLString& localName, const XMLString& qname, const XMLString& value, bool specified = true); - Attr(Document* pOwnerDocument, const Attr& attr); - ~Attr(); - - Node* copyNode(bool deep, Document* pOwnerDocument) const; - -private: - const Name& _name; - XMLString _value; - bool _specified; - - friend class Document; - friend class Element; - friend class DOMBuilder; -}; - - -// -// inlines -// -inline const XMLString& Attr::name() const -{ - return _name.qname(); -} - - -inline const XMLString& Attr::value() const -{ - return _value; -} - - -inline const XMLString& Attr::getValue() const -{ - return _value; -} - - -inline bool Attr::specified() const -{ - return _specified; -} - - -inline Element* Attr::ownerElement() const -{ - return static_cast<Element*>(_pParent); -} - - -} } // namespace Poco::XML - - -#endif // DOM_Attr_INCLUDED +// +// Attr.h +// +// Library: XML +// Package: DOM +// Module: DOM +// +// Definition of the DOM Attr class. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef DOM_Attr_INCLUDED +#define DOM_Attr_INCLUDED + + +#include "Poco/XML/XML.h" +#include "Poco/DOM/AbstractNode.h" +#include "Poco/DOM/Element.h" +#include "Poco/XML/Name.h" + + +namespace Poco { +namespace XML { + + +class XML_API Attr: public AbstractNode + /// The Attr interface represents an attribute in an Element object. Typically + /// the allowable values for the attribute are defined in a document type definition. + /// + /// Attr objects inherit the Node interface, but since they are not actually + /// child nodes of the element they describe, the DOM does not consider them + /// part of the document tree. Thus, the Node attributes parentNode, previousSibling, + /// and nextSibling have a null value for Attr objects. The DOM takes the view + /// that attributes are properties of elements rather than having a separate + /// identity from the elements they are associated with; this should make it + /// more efficient to implement such features as default attributes associated + /// with all elements of a given type. Furthermore, Attr nodes may not be immediate + /// children of a DocumentFragment. However, they can be associated with Element + /// nodes contained within a DocumentFragment. In short, users and implementors + /// of the DOM need to be aware that Attr nodes have some things in common with + /// other objects inheriting the Node interface, but they also are quite distinct. + /// + /// The attribute's effective value is determined as follows: if this attribute + /// has been explicitly assigned any value, that value is the attribute's effective + /// value; otherwise, if there is a declaration for this attribute, and that + /// declaration includes a default value, then that default value is the attribute's + /// effective value; otherwise, the attribute does not exist on this element + /// in the structure model until it has been explicitly added. Note that the + /// nodeValue attribute on the Attr instance can also be used to retrieve the + /// string version of the attribute's value(s). + /// + /// In XML, where the value of an attribute can contain entity references, the + /// child nodes of the Attr node provide a representation in which entity references + /// are not expanded. These child nodes may be either Text or EntityReference + /// nodes. Because the attribute type may be unknown, there are no tokenized + /// attribute values. +{ +public: + const XMLString& name() const; + /// Returns the name of this attribute. + + bool specified() const; + /// If this attribute was explicitly given a value in the original document, + /// this is true; otherwise, it is false. Note that the implementation is in + /// charge of this attribute, not the user. If the user changes the value of + /// the attribute (even if it ends up having the same value as the default value) + /// then the specified flag is automatically flipped to true. To re-specify + /// the attribute as the default value from the DTD, the user must delete the + /// attribute. The implementation will then make a new attribute available with + /// specified set to false and the default value (if one exists). + /// In summary: + /// + /// * If the attribute has an assigned value in the document then specified + /// is true, and the value is the assigned value. + /// * If the attribute has no assigned value in the document and has a default + /// value in the DTD, then specified is false, and the value is the default + /// value in the DTD. + /// * If the attribute has no assigned value in the document and has a value + /// of #IMPLIED in the DTD, then the attribute does not appear in the structure + /// model of the document. + /// * If the attribute is not associated to any element (i.e. because it + /// was just created or was obtained from some removal or cloning operation) + /// specified is true. + + const XMLString& value() const; + /// Returns the value of the attribute as a string. Character + /// and general entity references are replaced with their values. See also the + /// method getAttribute on the Element interface. + + const XMLString& getValue() const; + /// Returns the value of the attribute as a string. Character + /// and general entity references are replaced with their values. See also the + /// method getAttribute on the Element interface. + + void setValue(const XMLString& value); + /// Sets the value of the attribute as a string. + /// This creates a Text node with the unparsed contents of the string. + /// I.e. any characters that an XML processor would recognize as markup are + /// instead treated as literal text. See also the method setAttribute on the + /// Element interface. + + // DOM Level 2 + Element* ownerElement() const; + /// The Element node this attribute is attached to or null + /// if this attribute is not in use. + + // Node + Node* parentNode() const; + const XMLString& nodeName() const; + const XMLString& getNodeValue() const; + void setNodeValue(const XMLString& value); + unsigned short nodeType() const; + Node* previousSibling() const; + const XMLString& namespaceURI() const; + XMLString prefix() const; + const XMLString& localName() const; + + // Non-standard extensions + XMLString innerText() const; + +protected: + Attr(Document* pOwnerDocument, Element* pOwnerElement, const XMLString& namespaceURI, const XMLString& localName, const XMLString& qname, const XMLString& value, bool specified = true); + Attr(Document* pOwnerDocument, const Attr& attr); + ~Attr(); + + Node* copyNode(bool deep, Document* pOwnerDocument) const; + +private: + const Name& _name; + XMLString _value; + bool _specified; + + friend class Document; + friend class Element; + friend class DOMBuilder; +}; + + +// +// inlines +// +inline const XMLString& Attr::name() const +{ + return _name.qname(); +} + + +inline const XMLString& Attr::value() const +{ + return _value; +} + + +inline const XMLString& Attr::getValue() const +{ + return _value; +} + + +inline bool Attr::specified() const +{ + return _specified; +} + + +inline Element* Attr::ownerElement() const +{ + return static_cast<Element*>(_pParent); +} + + +} } // namespace Poco::XML + + +#endif // DOM_Attr_INCLUDED diff --git a/contrib/libs/poco/XML/include/Poco/DOM/AttrMap.h b/contrib/libs/poco/XML/include/Poco/DOM/AttrMap.h index 41f34fd638..ba09d16a18 100644 --- a/contrib/libs/poco/XML/include/Poco/DOM/AttrMap.h +++ b/contrib/libs/poco/XML/include/Poco/DOM/AttrMap.h @@ -1,65 +1,65 @@ -// -// AttrMap.h -// -// Library: XML -// Package: DOM -// Module: DOM -// -// Definition of the AttrMap class. -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef DOM_AttrMap_INCLUDED -#define DOM_AttrMap_INCLUDED - - -#include "Poco/XML/XML.h" -#include "Poco/DOM/NamedNodeMap.h" - - -namespace Poco { -namespace XML { - - -class Element; - - -class XML_API AttrMap: public NamedNodeMap - // This implementation of NamedNodeMap is - // returned by Element::attributes() -{ -public: - Node* getNamedItem(const XMLString& name) const; - Node* setNamedItem(Node* arg); - Node* removeNamedItem(const XMLString& name); - Node* item(unsigned long index) const; - unsigned long length() const; - - Node* getNamedItemNS(const XMLString& namespaceURI, const XMLString& localName) const; - Node* setNamedItemNS(Node* arg); - Node* removeNamedItemNS(const XMLString& namespaceURI, const XMLString& localName); - - void autoRelease(); - -protected: - AttrMap(Element* pElement); - ~AttrMap(); - -private: - AttrMap(); - - Element* _pElement; - - friend class Element; -}; - - -} } // namespace Poco::XML - - -#endif // DOM_AttrMap_INCLUDED +// +// AttrMap.h +// +// Library: XML +// Package: DOM +// Module: DOM +// +// Definition of the AttrMap class. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef DOM_AttrMap_INCLUDED +#define DOM_AttrMap_INCLUDED + + +#include "Poco/XML/XML.h" +#include "Poco/DOM/NamedNodeMap.h" + + +namespace Poco { +namespace XML { + + +class Element; + + +class XML_API AttrMap: public NamedNodeMap + // This implementation of NamedNodeMap is + // returned by Element::attributes() +{ +public: + Node* getNamedItem(const XMLString& name) const; + Node* setNamedItem(Node* arg); + Node* removeNamedItem(const XMLString& name); + Node* item(unsigned long index) const; + unsigned long length() const; + + Node* getNamedItemNS(const XMLString& namespaceURI, const XMLString& localName) const; + Node* setNamedItemNS(Node* arg); + Node* removeNamedItemNS(const XMLString& namespaceURI, const XMLString& localName); + + void autoRelease(); + +protected: + AttrMap(Element* pElement); + ~AttrMap(); + +private: + AttrMap(); + + Element* _pElement; + + friend class Element; +}; + + +} } // namespace Poco::XML + + +#endif // DOM_AttrMap_INCLUDED diff --git a/contrib/libs/poco/XML/include/Poco/DOM/AutoPtr.h b/contrib/libs/poco/XML/include/Poco/DOM/AutoPtr.h index 85f83d49f7..5be1728f95 100644 --- a/contrib/libs/poco/XML/include/Poco/DOM/AutoPtr.h +++ b/contrib/libs/poco/XML/include/Poco/DOM/AutoPtr.h @@ -1,35 +1,35 @@ -// -// AutoPtr.h -// -// Library: XML -// Package: DOM -// Module: DOM -// -// Import Poco::AutoPtr into the XML namespace. -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef DOM_DOMAutoPtr_INCLUDED -#define DOM_DOMAutoPtr_INCLUDED - - -#include "Poco/XML/XML.h" -#include "Poco/AutoPtr.h" - - -namespace Poco { -namespace XML { - - -using Poco::AutoPtr; - - -} } // namespace Poco::XML - - -#endif // DOM_DOMAutoPtr_INCLUDED +// +// AutoPtr.h +// +// Library: XML +// Package: DOM +// Module: DOM +// +// Import Poco::AutoPtr into the XML namespace. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef DOM_DOMAutoPtr_INCLUDED +#define DOM_DOMAutoPtr_INCLUDED + + +#include "Poco/XML/XML.h" +#include "Poco/AutoPtr.h" + + +namespace Poco { +namespace XML { + + +using Poco::AutoPtr; + + +} } // namespace Poco::XML + + +#endif // DOM_DOMAutoPtr_INCLUDED diff --git a/contrib/libs/poco/XML/include/Poco/DOM/CDATASection.h b/contrib/libs/poco/XML/include/Poco/DOM/CDATASection.h index 7a0e82b18a..c38c7d1da7 100644 --- a/contrib/libs/poco/XML/include/Poco/DOM/CDATASection.h +++ b/contrib/libs/poco/XML/include/Poco/DOM/CDATASection.h @@ -1,84 +1,84 @@ -// -// CDATASection.h -// -// Library: XML -// Package: DOM -// Module: DOM -// -// Definition of the DOM CDATASection class. -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef DOM_CDATASection_INCLUDED -#define DOM_CDATASection_INCLUDED - - -#include "Poco/XML/XML.h" -#include "Poco/DOM/Text.h" - - -namespace Poco { -namespace XML { - - -class XML_API CDATASection: public Text - /// CDATA sections are used to escape blocks of text containing characters that - /// would otherwise be regarded as markup. The only delimiter that is recognized - /// in a CDATA section is the "]]>" string that ends the CDATA section. CDATA - /// sections cannot be nested. Their primary purpose is for including material - /// such as XML fragments, without needing to escape all the delimiters. - /// - /// The DOMString attribute of the Text node holds the text that is contained - /// by the CDATA section. Note that this may contain characters that need to - /// be escaped outside of CDATA sections and that, depending on the character - /// encoding ("charset") chosen for serialization, it may be impossible to write - /// out some characters as part of a CDATA section. - /// - /// The CDATASection interface inherits from the CharacterData interface through - /// the Text interface. Adjacent CDATASection nodes are not merged by use of - /// the normalize method on the Element interface. - /// - /// Note: Because no markup is recognized within a CDATASection, character numeric - /// references cannot be used as an escape mechanism when serializing. Therefore, - /// action needs to be taken when serializing a CDATASection with a character - /// encoding where some of the contained characters cannot be represented. Failure - /// to do so would not produce well-formed XML. - /// One potential solution in the serialization process is to end the CDATA - /// section before the character, output the character using a character reference - /// or entity reference, and open a new CDATA section for any further characters - /// in the text node. Note, however, that some code conversion libraries at - /// the time of writing do not return an error or exception when a character - /// is missing from the encoding, making the task of ensuring that data is not - /// corrupted on serialization more difficult. -{ -public: - // Text - Text* splitText(unsigned long offset); - - // Node - const XMLString& nodeName() const; - unsigned short nodeType() const; - -protected: - CDATASection(Document* pOwnerDocument, const XMLString& data); - CDATASection(Document* pOwnerDocument, const CDATASection& sec); - ~CDATASection(); - - Node* copyNode(bool deep, Document* pOwnerDocument) const; - -private: - static const XMLString NODE_NAME; - - friend class Document; -}; - - -} } // namespace Poco::XML - - -#endif // DOM_CDATASection_INCLUDED +// +// CDATASection.h +// +// Library: XML +// Package: DOM +// Module: DOM +// +// Definition of the DOM CDATASection class. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef DOM_CDATASection_INCLUDED +#define DOM_CDATASection_INCLUDED + + +#include "Poco/XML/XML.h" +#include "Poco/DOM/Text.h" + + +namespace Poco { +namespace XML { + + +class XML_API CDATASection: public Text + /// CDATA sections are used to escape blocks of text containing characters that + /// would otherwise be regarded as markup. The only delimiter that is recognized + /// in a CDATA section is the "]]>" string that ends the CDATA section. CDATA + /// sections cannot be nested. Their primary purpose is for including material + /// such as XML fragments, without needing to escape all the delimiters. + /// + /// The DOMString attribute of the Text node holds the text that is contained + /// by the CDATA section. Note that this may contain characters that need to + /// be escaped outside of CDATA sections and that, depending on the character + /// encoding ("charset") chosen for serialization, it may be impossible to write + /// out some characters as part of a CDATA section. + /// + /// The CDATASection interface inherits from the CharacterData interface through + /// the Text interface. Adjacent CDATASection nodes are not merged by use of + /// the normalize method on the Element interface. + /// + /// Note: Because no markup is recognized within a CDATASection, character numeric + /// references cannot be used as an escape mechanism when serializing. Therefore, + /// action needs to be taken when serializing a CDATASection with a character + /// encoding where some of the contained characters cannot be represented. Failure + /// to do so would not produce well-formed XML. + /// One potential solution in the serialization process is to end the CDATA + /// section before the character, output the character using a character reference + /// or entity reference, and open a new CDATA section for any further characters + /// in the text node. Note, however, that some code conversion libraries at + /// the time of writing do not return an error or exception when a character + /// is missing from the encoding, making the task of ensuring that data is not + /// corrupted on serialization more difficult. +{ +public: + // Text + Text* splitText(unsigned long offset); + + // Node + const XMLString& nodeName() const; + unsigned short nodeType() const; + +protected: + CDATASection(Document* pOwnerDocument, const XMLString& data); + CDATASection(Document* pOwnerDocument, const CDATASection& sec); + ~CDATASection(); + + Node* copyNode(bool deep, Document* pOwnerDocument) const; + +private: + static const XMLString NODE_NAME; + + friend class Document; +}; + + +} } // namespace Poco::XML + + +#endif // DOM_CDATASection_INCLUDED diff --git a/contrib/libs/poco/XML/include/Poco/DOM/CharacterData.h b/contrib/libs/poco/XML/include/Poco/DOM/CharacterData.h index af5697da7f..29d73519b1 100644 --- a/contrib/libs/poco/XML/include/Poco/DOM/CharacterData.h +++ b/contrib/libs/poco/XML/include/Poco/DOM/CharacterData.h @@ -1,123 +1,123 @@ -// -// CharacterData.h -// -// Library: XML -// Package: DOM -// Module: DOM -// -// Definition of the DOM CharacterData class. -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef DOM_CharacterData_INCLUDED -#define DOM_CharacterData_INCLUDED - - -#include "Poco/XML/XML.h" -#include "Poco/DOM/AbstractNode.h" -#include "Poco/XML/XMLString.h" - - -namespace Poco { -namespace XML { - - -class XML_API CharacterData: public AbstractNode - /// The CharacterData interface extends Node with a set of attributes and methods - /// for accessing character data in the DOM. For clarity this set is defined - /// here rather than on each object that uses these attributes and methods. - /// No DOM objects correspond directly to CharacterData, though Text and others - /// do inherit the interface from it. All offsets in this interface start from 0. - /// - /// Text strings in the DOM are represented in either UTF-8 (if XML_UNICODE_WCHAR_T is - /// not defined) or in UTF-16 (if XML_UNICODE_WCHAR_T is defined). - /// Indexing on character data is done in XMLChar units. -{ -public: - const XMLString& data() const; - /// Returns the character data of the node that - /// implements the interface. - - const XMLString& getData() const; - /// Returns the character data of the node that - /// implements the interface. - - void setData(const XMLString& data); - /// Sets the character data of the node that - /// implements the interface. - - unsigned long length() const; - /// Returns the number of XMLChars that are available - /// through getData and substringData. This may have the - /// value zero. - - XMLString substringData(unsigned long offset, unsigned long count) const; - /// Extracts a range of data from the node. - /// If offset and count exceeds the length, then all - /// the characters to the end of the data are returned. - - void appendData(const XMLString& arg); - /// Append the string to the end of the character data - /// of the node. - - void insertData(unsigned long offset, const XMLString& arg); - /// Insert a string at the specified character offset. - - void deleteData(unsigned long offset, unsigned long count); - /// Remove a range of characters from the node. - - void replaceData(unsigned long offset, unsigned long count, const XMLString& arg); - /// Replace the characters starting at the specified character - /// offset with the specified string. - - // Non-standard extensions - XMLString trimmedData() const; - /// Returns the character data of that node with - /// all surrounding whitespace removed. - /// - /// This method is an extension to the W3C Document Object Model. - - // Node - const XMLString& getNodeValue() const; - void setNodeValue(const XMLString& value); - -protected: - CharacterData(Document* pOwnerDocument, const XMLString& data); - CharacterData(Document* pOwnerDocument, const CharacterData& data); - ~CharacterData(); - -private: - XMLString _data; -}; - - -// -// inlines -// -inline const XMLString& CharacterData::data() const -{ - return _data; -} - - -inline const XMLString& CharacterData::getData() const -{ - return _data; -} - - -inline unsigned long CharacterData::length() const -{ - return (unsigned long) _data.length(); -} - - -} } // namespace Poco::XML - - -#endif // DOM_CharacterData_INCLUDED +// +// CharacterData.h +// +// Library: XML +// Package: DOM +// Module: DOM +// +// Definition of the DOM CharacterData class. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef DOM_CharacterData_INCLUDED +#define DOM_CharacterData_INCLUDED + + +#include "Poco/XML/XML.h" +#include "Poco/DOM/AbstractNode.h" +#include "Poco/XML/XMLString.h" + + +namespace Poco { +namespace XML { + + +class XML_API CharacterData: public AbstractNode + /// The CharacterData interface extends Node with a set of attributes and methods + /// for accessing character data in the DOM. For clarity this set is defined + /// here rather than on each object that uses these attributes and methods. + /// No DOM objects correspond directly to CharacterData, though Text and others + /// do inherit the interface from it. All offsets in this interface start from 0. + /// + /// Text strings in the DOM are represented in either UTF-8 (if XML_UNICODE_WCHAR_T is + /// not defined) or in UTF-16 (if XML_UNICODE_WCHAR_T is defined). + /// Indexing on character data is done in XMLChar units. +{ +public: + const XMLString& data() const; + /// Returns the character data of the node that + /// implements the interface. + + const XMLString& getData() const; + /// Returns the character data of the node that + /// implements the interface. + + void setData(const XMLString& data); + /// Sets the character data of the node that + /// implements the interface. + + unsigned long length() const; + /// Returns the number of XMLChars that are available + /// through getData and substringData. This may have the + /// value zero. + + XMLString substringData(unsigned long offset, unsigned long count) const; + /// Extracts a range of data from the node. + /// If offset and count exceeds the length, then all + /// the characters to the end of the data are returned. + + void appendData(const XMLString& arg); + /// Append the string to the end of the character data + /// of the node. + + void insertData(unsigned long offset, const XMLString& arg); + /// Insert a string at the specified character offset. + + void deleteData(unsigned long offset, unsigned long count); + /// Remove a range of characters from the node. + + void replaceData(unsigned long offset, unsigned long count, const XMLString& arg); + /// Replace the characters starting at the specified character + /// offset with the specified string. + + // Non-standard extensions + XMLString trimmedData() const; + /// Returns the character data of that node with + /// all surrounding whitespace removed. + /// + /// This method is an extension to the W3C Document Object Model. + + // Node + const XMLString& getNodeValue() const; + void setNodeValue(const XMLString& value); + +protected: + CharacterData(Document* pOwnerDocument, const XMLString& data); + CharacterData(Document* pOwnerDocument, const CharacterData& data); + ~CharacterData(); + +private: + XMLString _data; +}; + + +// +// inlines +// +inline const XMLString& CharacterData::data() const +{ + return _data; +} + + +inline const XMLString& CharacterData::getData() const +{ + return _data; +} + + +inline unsigned long CharacterData::length() const +{ + return (unsigned long) _data.length(); +} + + +} } // namespace Poco::XML + + +#endif // DOM_CharacterData_INCLUDED diff --git a/contrib/libs/poco/XML/include/Poco/DOM/ChildNodesList.h b/contrib/libs/poco/XML/include/Poco/DOM/ChildNodesList.h index aa7ece1db8..2f387ddfe5 100644 --- a/contrib/libs/poco/XML/include/Poco/DOM/ChildNodesList.h +++ b/contrib/libs/poco/XML/include/Poco/DOM/ChildNodesList.h @@ -1,55 +1,55 @@ -// -// ChildNodesList.h -// -// Library: XML -// Package: DOM -// Module: DOM -// -// Definition of the ChildNodesList class. -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef DOM_ChildNodesList_INCLUDED -#define DOM_ChildNodesList_INCLUDED - - -#include "Poco/XML/XML.h" -#include "Poco/DOM/NodeList.h" - - -namespace Poco { -namespace XML { - - -class XML_API ChildNodesList: public NodeList - // This implementation of NodeList is returned - // by Node::getChildNodes(). -{ -public: - Node* item(unsigned long index) const; - unsigned long length() const; - - void autoRelease(); - -protected: - ChildNodesList(const Node* pParent); - ~ChildNodesList(); - -private: - ChildNodesList(); - - const Node* _pParent; - - friend class AbstractNode; -}; - - -} } // namespace Poco::XML - - -#endif // DOM_ChildNodesList_INCLUDED +// +// ChildNodesList.h +// +// Library: XML +// Package: DOM +// Module: DOM +// +// Definition of the ChildNodesList class. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef DOM_ChildNodesList_INCLUDED +#define DOM_ChildNodesList_INCLUDED + + +#include "Poco/XML/XML.h" +#include "Poco/DOM/NodeList.h" + + +namespace Poco { +namespace XML { + + +class XML_API ChildNodesList: public NodeList + // This implementation of NodeList is returned + // by Node::getChildNodes(). +{ +public: + Node* item(unsigned long index) const; + unsigned long length() const; + + void autoRelease(); + +protected: + ChildNodesList(const Node* pParent); + ~ChildNodesList(); + +private: + ChildNodesList(); + + const Node* _pParent; + + friend class AbstractNode; +}; + + +} } // namespace Poco::XML + + +#endif // DOM_ChildNodesList_INCLUDED diff --git a/contrib/libs/poco/XML/include/Poco/DOM/Comment.h b/contrib/libs/poco/XML/include/Poco/DOM/Comment.h index d1de793064..5e2437e9bb 100644 --- a/contrib/libs/poco/XML/include/Poco/DOM/Comment.h +++ b/contrib/libs/poco/XML/include/Poco/DOM/Comment.h @@ -1,58 +1,58 @@ -// -// Comment.h -// -// Library: XML -// Package: DOM -// Module: DOM -// -// Definition of the DOM Comment class. -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef DOM_Comment_INCLUDED -#define DOM_Comment_INCLUDED - - -#include "Poco/XML/XML.h" -#include "Poco/DOM/CharacterData.h" -#include "Poco/XML/XMLString.h" - - -namespace Poco { -namespace XML { - - -class XML_API Comment: public CharacterData - /// This interface inherits from CharacterData and represents the content of - /// a comment, i.e., all the characters between the starting '<!--' and ending - /// '-->'. Note that this is the definition of a comment in XML, and, in practice, - /// HTML, although some HTML tools may implement the full SGML comment structure. -{ -public: - // Node - const XMLString& nodeName() const; - unsigned short nodeType() const; - -protected: - Comment(Document* pOwnerDocument, const XMLString& data); - Comment(Document* pOwnerDocument, const Comment& comment); - ~Comment(); - - Node* copyNode(bool deep, Document* pOwnerDocument) const; - -private: - static const XMLString NODE_NAME; - - friend class Document; -}; - - -} } // namespace Poco::XML - - -#endif // DOM_Comment_INCLUDED +// +// Comment.h +// +// Library: XML +// Package: DOM +// Module: DOM +// +// Definition of the DOM Comment class. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef DOM_Comment_INCLUDED +#define DOM_Comment_INCLUDED + + +#include "Poco/XML/XML.h" +#include "Poco/DOM/CharacterData.h" +#include "Poco/XML/XMLString.h" + + +namespace Poco { +namespace XML { + + +class XML_API Comment: public CharacterData + /// This interface inherits from CharacterData and represents the content of + /// a comment, i.e., all the characters between the starting '<!--' and ending + /// '-->'. Note that this is the definition of a comment in XML, and, in practice, + /// HTML, although some HTML tools may implement the full SGML comment structure. +{ +public: + // Node + const XMLString& nodeName() const; + unsigned short nodeType() const; + +protected: + Comment(Document* pOwnerDocument, const XMLString& data); + Comment(Document* pOwnerDocument, const Comment& comment); + ~Comment(); + + Node* copyNode(bool deep, Document* pOwnerDocument) const; + +private: + static const XMLString NODE_NAME; + + friend class Document; +}; + + +} } // namespace Poco::XML + + +#endif // DOM_Comment_INCLUDED diff --git a/contrib/libs/poco/XML/include/Poco/DOM/DOMBuilder.h b/contrib/libs/poco/XML/include/Poco/DOM/DOMBuilder.h index ad91da45f4..0e6c57da47 100644 --- a/contrib/libs/poco/XML/include/Poco/DOM/DOMBuilder.h +++ b/contrib/libs/poco/XML/include/Poco/DOM/DOMBuilder.h @@ -1,112 +1,112 @@ -// -// DOMBuilder.h -// -// Library: XML -// Package: DOM -// Module: DOMBuilder -// -// Definition of the DOMBuilder class. -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef DOM_DOMBuilder_INCLUDED -#define DOM_DOMBuilder_INCLUDED - - -#include "Poco/XML/XML.h" -#include "Poco/SAX/ContentHandler.h" -#include "Poco/SAX/LexicalHandler.h" -#include "Poco/SAX/DTDHandler.h" -#include "Poco/XML/XMLString.h" - - -namespace Poco { -namespace XML { - - -class XMLReader; -class Document; -class InputSource; -class AbstractNode; -class AbstractContainerNode; -class NamePool; - - -class XML_API DOMBuilder: protected DTDHandler, protected ContentHandler, protected LexicalHandler - /// This class builds a tree representation of an - /// XML document, according to the W3C Document Object Model, Level 1 and 2 - /// specifications. - /// - /// The actual XML parsing is done by an XMLReader, which - /// must be supplied to the DOMBuilder. -{ -public: - DOMBuilder(XMLReader& xmlReader, NamePool* pNamePool = 0); - /// Creates a DOMBuilder using the given XMLReader. - /// If a NamePool is given, it becomes the Document's NamePool. - - virtual ~DOMBuilder(); - /// Destroys the DOMBuilder. - - virtual Document* parse(const XMLString& uri); - /// Parse an XML document from a location identified by an URI. - - virtual Document* parse(InputSource* pInputSource); - /// Parse an XML document from a location identified by an InputSource. - - virtual Document* parseMemoryNP(const char* xml, std::size_t size); - /// Parses an XML document from memory. - -protected: - // DTDHandler - void notationDecl(const XMLString& name, const XMLString* publicId, const XMLString* systemId); - void unparsedEntityDecl(const XMLString& name, const XMLString* publicId, const XMLString& systemId, const XMLString& notationName); - - // ContentHandler - void setDocumentLocator(const Locator* loc); - void startDocument(); - void endDocument(); - void startElement(const XMLString& uri, const XMLString& localName, const XMLString& qname, const Attributes& attributes); - void endElement(const XMLString& uri, const XMLString& localName, const XMLString& qname); - void characters(const XMLChar ch[], int start, int length); - void ignorableWhitespace(const XMLChar ch[], int start, int length); - void processingInstruction(const XMLString& target, const XMLString& data); - void startPrefixMapping(const XMLString& prefix, const XMLString& uri); - void endPrefixMapping(const XMLString& prefix); - void skippedEntity(const XMLString& name); - - // LexicalHandler - void startDTD(const XMLString& name, const XMLString& publicId, const XMLString& systemId); - void endDTD(); - void startEntity(const XMLString& name); - void endEntity(const XMLString& name); - void startCDATA(); - void endCDATA(); - void comment(const XMLChar ch[], int start, int length); - - void appendNode(AbstractNode* pNode); - - void setupParse(); - -private: - static const XMLString EMPTY_STRING; - - XMLReader& _xmlReader; - NamePool* _pNamePool; - Document* _pDocument; - AbstractContainerNode* _pParent; - AbstractNode* _pPrevious; - bool _inCDATA; - bool _namespaces; -}; - - -} } // namespace Poco::XML - - -#endif // DOM_DOMBuilder_INCLUDED +// +// DOMBuilder.h +// +// Library: XML +// Package: DOM +// Module: DOMBuilder +// +// Definition of the DOMBuilder class. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef DOM_DOMBuilder_INCLUDED +#define DOM_DOMBuilder_INCLUDED + + +#include "Poco/XML/XML.h" +#include "Poco/SAX/ContentHandler.h" +#include "Poco/SAX/LexicalHandler.h" +#include "Poco/SAX/DTDHandler.h" +#include "Poco/XML/XMLString.h" + + +namespace Poco { +namespace XML { + + +class XMLReader; +class Document; +class InputSource; +class AbstractNode; +class AbstractContainerNode; +class NamePool; + + +class XML_API DOMBuilder: protected DTDHandler, protected ContentHandler, protected LexicalHandler + /// This class builds a tree representation of an + /// XML document, according to the W3C Document Object Model, Level 1 and 2 + /// specifications. + /// + /// The actual XML parsing is done by an XMLReader, which + /// must be supplied to the DOMBuilder. +{ +public: + DOMBuilder(XMLReader& xmlReader, NamePool* pNamePool = 0); + /// Creates a DOMBuilder using the given XMLReader. + /// If a NamePool is given, it becomes the Document's NamePool. + + virtual ~DOMBuilder(); + /// Destroys the DOMBuilder. + + virtual Document* parse(const XMLString& uri); + /// Parse an XML document from a location identified by an URI. + + virtual Document* parse(InputSource* pInputSource); + /// Parse an XML document from a location identified by an InputSource. + + virtual Document* parseMemoryNP(const char* xml, std::size_t size); + /// Parses an XML document from memory. + +protected: + // DTDHandler + void notationDecl(const XMLString& name, const XMLString* publicId, const XMLString* systemId); + void unparsedEntityDecl(const XMLString& name, const XMLString* publicId, const XMLString& systemId, const XMLString& notationName); + + // ContentHandler + void setDocumentLocator(const Locator* loc); + void startDocument(); + void endDocument(); + void startElement(const XMLString& uri, const XMLString& localName, const XMLString& qname, const Attributes& attributes); + void endElement(const XMLString& uri, const XMLString& localName, const XMLString& qname); + void characters(const XMLChar ch[], int start, int length); + void ignorableWhitespace(const XMLChar ch[], int start, int length); + void processingInstruction(const XMLString& target, const XMLString& data); + void startPrefixMapping(const XMLString& prefix, const XMLString& uri); + void endPrefixMapping(const XMLString& prefix); + void skippedEntity(const XMLString& name); + + // LexicalHandler + void startDTD(const XMLString& name, const XMLString& publicId, const XMLString& systemId); + void endDTD(); + void startEntity(const XMLString& name); + void endEntity(const XMLString& name); + void startCDATA(); + void endCDATA(); + void comment(const XMLChar ch[], int start, int length); + + void appendNode(AbstractNode* pNode); + + void setupParse(); + +private: + static const XMLString EMPTY_STRING; + + XMLReader& _xmlReader; + NamePool* _pNamePool; + Document* _pDocument; + AbstractContainerNode* _pParent; + AbstractNode* _pPrevious; + bool _inCDATA; + bool _namespaces; +}; + + +} } // namespace Poco::XML + + +#endif // DOM_DOMBuilder_INCLUDED diff --git a/contrib/libs/poco/XML/include/Poco/DOM/DOMException.h b/contrib/libs/poco/XML/include/Poco/DOM/DOMException.h index 456526f111..3285a7c526 100644 --- a/contrib/libs/poco/XML/include/Poco/DOM/DOMException.h +++ b/contrib/libs/poco/XML/include/Poco/DOM/DOMException.h @@ -1,112 +1,112 @@ -// -// DOMException.h -// -// Library: XML -// Package: DOM -// Module: DOM -// -// Definition of the DOM DOMException class. -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef DOM_DOMException_INCLUDED -#define DOM_DOMException_INCLUDED - - -#include "Poco/XML/XML.h" -#include "Poco/XML/XMLException.h" - - -namespace Poco { -namespace XML { - - -class XML_API DOMException: public XMLException - /// DOM operations only raise exceptions in "exceptional" circumstances, i.e., - /// when an operation is impossible to perform (either for logical reasons, - /// because data is lost, or because the implementation has become unstable). - /// In general, DOM methods return specific error values in ordinary processing - /// situations, such as out-of-bound errors when using NodeList. - /// - /// Implementations should raise other exceptions under other circumstances. - /// For example, implementations should raise an implementation-dependent exception - /// if a null argument is passed when null was not expected. -{ -public: - enum - { - INDEX_SIZE_ERR = 1, /// index or size is negative or greater than allowed value - DOMSTRING_SIZE_ERR, /// the specified range of text does not fit into a DOMString (not used) - HIERARCHY_REQUEST_ERR, /// a node is inserted somewhere it doesn't belong - WRONG_DOCUMENT_ERR, /// a node is used in a different document than the one that created it - INVALID_CHARACTER_ERR, /// an invalid character is specified (not used) - NO_DATA_ALLOWED_ERR, /// data is specified for a node which does not support data - NO_MODIFICATION_ALLOWED_ERR, /// an attempt is made to modify an object where modifications are not allowed - NOT_FOUND_ERR, /// an attempt was made to reference a node in a context where it does not exist - NOT_SUPPORTED_ERR, /// the implementation does not support the type of object requested - INUSE_ATTRIBUTE_ERR, /// an attempt is made to add an attribute that is already in use elsewhere - INVALID_STATE_ERR, /// a parameter or an operation is not supported by the underlying object - SYNTAX_ERR, /// an invalid or illegal string is specified - INVALID_MODIFICATION_ERR, /// an attempt is made to modify the type of the underlying object - NAMESPACE_ERR, /// an attempt is made to create or change an object in a way which is incorrect with regard to namespaces - INVALID_ACCESS_ERR, /// an attempt is made to use an object that is not, or is no longer, usable - - _NUMBER_OF_MESSAGES - }; - - DOMException(unsigned short code); - /// Creates a DOMException with the given error code. - - DOMException(const DOMException& exc); - /// Creates a DOMException by copying another one. - - ~DOMException() noexcept; - /// Destroys the DOMException. - - DOMException& operator = (const DOMException& exc); - +// +// DOMException.h +// +// Library: XML +// Package: DOM +// Module: DOM +// +// Definition of the DOM DOMException class. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef DOM_DOMException_INCLUDED +#define DOM_DOMException_INCLUDED + + +#include "Poco/XML/XML.h" +#include "Poco/XML/XMLException.h" + + +namespace Poco { +namespace XML { + + +class XML_API DOMException: public XMLException + /// DOM operations only raise exceptions in "exceptional" circumstances, i.e., + /// when an operation is impossible to perform (either for logical reasons, + /// because data is lost, or because the implementation has become unstable). + /// In general, DOM methods return specific error values in ordinary processing + /// situations, such as out-of-bound errors when using NodeList. + /// + /// Implementations should raise other exceptions under other circumstances. + /// For example, implementations should raise an implementation-dependent exception + /// if a null argument is passed when null was not expected. +{ +public: + enum + { + INDEX_SIZE_ERR = 1, /// index or size is negative or greater than allowed value + DOMSTRING_SIZE_ERR, /// the specified range of text does not fit into a DOMString (not used) + HIERARCHY_REQUEST_ERR, /// a node is inserted somewhere it doesn't belong + WRONG_DOCUMENT_ERR, /// a node is used in a different document than the one that created it + INVALID_CHARACTER_ERR, /// an invalid character is specified (not used) + NO_DATA_ALLOWED_ERR, /// data is specified for a node which does not support data + NO_MODIFICATION_ALLOWED_ERR, /// an attempt is made to modify an object where modifications are not allowed + NOT_FOUND_ERR, /// an attempt was made to reference a node in a context where it does not exist + NOT_SUPPORTED_ERR, /// the implementation does not support the type of object requested + INUSE_ATTRIBUTE_ERR, /// an attempt is made to add an attribute that is already in use elsewhere + INVALID_STATE_ERR, /// a parameter or an operation is not supported by the underlying object + SYNTAX_ERR, /// an invalid or illegal string is specified + INVALID_MODIFICATION_ERR, /// an attempt is made to modify the type of the underlying object + NAMESPACE_ERR, /// an attempt is made to create or change an object in a way which is incorrect with regard to namespaces + INVALID_ACCESS_ERR, /// an attempt is made to use an object that is not, or is no longer, usable + + _NUMBER_OF_MESSAGES + }; + + DOMException(unsigned short code); + /// Creates a DOMException with the given error code. + + DOMException(const DOMException& exc); + /// Creates a DOMException by copying another one. + + ~DOMException() noexcept; + /// Destroys the DOMException. + + DOMException& operator = (const DOMException& exc); + const char* name() const noexcept; - /// Returns a static string describing the exception. - + /// Returns a static string describing the exception. + const char* className() const noexcept; - /// Returns the name of the exception class. - - Poco::Exception* clone() const; - /// Creates an exact copy of the exception. - - void rethrow() const; - /// (Re)Throws the exception. - - unsigned short code() const; - /// Returns the DOM exception code. - -protected: - static const std::string& message(unsigned short code); - -private: - DOMException(); - - unsigned short _code; - - static const std::string MESSAGES[_NUMBER_OF_MESSAGES]; -}; - - -// -// inlines -// -inline unsigned short DOMException::code() const -{ - return _code; -} - - -} } // namespace Poco::XML - - -#endif // DOM_DOMException_INCLUDED + /// Returns the name of the exception class. + + Poco::Exception* clone() const; + /// Creates an exact copy of the exception. + + void rethrow() const; + /// (Re)Throws the exception. + + unsigned short code() const; + /// Returns the DOM exception code. + +protected: + static const std::string& message(unsigned short code); + +private: + DOMException(); + + unsigned short _code; + + static const std::string MESSAGES[_NUMBER_OF_MESSAGES]; +}; + + +// +// inlines +// +inline unsigned short DOMException::code() const +{ + return _code; +} + + +} } // namespace Poco::XML + + +#endif // DOM_DOMException_INCLUDED diff --git a/contrib/libs/poco/XML/include/Poco/DOM/DOMImplementation.h b/contrib/libs/poco/XML/include/Poco/DOM/DOMImplementation.h index 0c2d7af187..3a9aa6cdd8 100644 --- a/contrib/libs/poco/XML/include/Poco/DOM/DOMImplementation.h +++ b/contrib/libs/poco/XML/include/Poco/DOM/DOMImplementation.h @@ -1,82 +1,82 @@ -// -// DOMImplementation.h -// -// Library: XML -// Package: DOM -// Module: DOM -// -// Definition of the DOM DOMImplementation class. -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef DOM_DOMImplementation_INCLUDED -#define DOM_DOMImplementation_INCLUDED - - -#include "Poco/XML/XML.h" -#include "Poco/XML/XMLString.h" - - -namespace Poco { -namespace XML { - - -class DocumentType; -class Document; -class NamePool; - - -class XML_API DOMImplementation - /// The DOMImplementation interface provides a number of methods for - /// performing operations that are independent of any particular instance - /// of the document object model. - /// In this implementation, DOMImplementation is implemented as a singleton. -{ -public: - DOMImplementation(); - /// Creates the DOMImplementation. - - ~DOMImplementation(); - /// Destroys the DOMImplementation. - - bool hasFeature(const XMLString& feature, const XMLString& version) const; - /// Tests if the DOM implementation implements a specific feature. - /// - /// The only supported features are "XML", version "1.0" and "Core", - /// "Events", "MutationEvents" and "Traversal", version "2.0". - - // DOM Level 2 - DocumentType* createDocumentType(const XMLString& name, const XMLString& publicId, const XMLString& systemId) const; - /// Creates an empty DocumentType node. Entity declarations and notations - /// are not made available. Entity reference expansions and default attribute - /// additions do not occur. - - Document* createDocument(const XMLString& namespaceURI, const XMLString& qualifiedName, DocumentType* doctype) const; - /// Creates an XML Document object of the specified type with its document element. - /// - /// Note: You can also create a Document directly using the new operator. - - static const DOMImplementation& instance(); - /// Returns a reference to the default DOMImplementation - /// object. - -private: - static const XMLString FEATURE_XML; - static const XMLString FEATURE_CORE; - static const XMLString FEATURE_EVENTS; - static const XMLString FEATURE_MUTATIONEVENTS; - static const XMLString FEATURE_TRAVERSAL; - static const XMLString VERSION_1_0; - static const XMLString VERSION_2_0; -}; - - -} } // namespace Poco::XML - - -#endif // DOM_DOMImplementation_INCLUDED +// +// DOMImplementation.h +// +// Library: XML +// Package: DOM +// Module: DOM +// +// Definition of the DOM DOMImplementation class. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef DOM_DOMImplementation_INCLUDED +#define DOM_DOMImplementation_INCLUDED + + +#include "Poco/XML/XML.h" +#include "Poco/XML/XMLString.h" + + +namespace Poco { +namespace XML { + + +class DocumentType; +class Document; +class NamePool; + + +class XML_API DOMImplementation + /// The DOMImplementation interface provides a number of methods for + /// performing operations that are independent of any particular instance + /// of the document object model. + /// In this implementation, DOMImplementation is implemented as a singleton. +{ +public: + DOMImplementation(); + /// Creates the DOMImplementation. + + ~DOMImplementation(); + /// Destroys the DOMImplementation. + + bool hasFeature(const XMLString& feature, const XMLString& version) const; + /// Tests if the DOM implementation implements a specific feature. + /// + /// The only supported features are "XML", version "1.0" and "Core", + /// "Events", "MutationEvents" and "Traversal", version "2.0". + + // DOM Level 2 + DocumentType* createDocumentType(const XMLString& name, const XMLString& publicId, const XMLString& systemId) const; + /// Creates an empty DocumentType node. Entity declarations and notations + /// are not made available. Entity reference expansions and default attribute + /// additions do not occur. + + Document* createDocument(const XMLString& namespaceURI, const XMLString& qualifiedName, DocumentType* doctype) const; + /// Creates an XML Document object of the specified type with its document element. + /// + /// Note: You can also create a Document directly using the new operator. + + static const DOMImplementation& instance(); + /// Returns a reference to the default DOMImplementation + /// object. + +private: + static const XMLString FEATURE_XML; + static const XMLString FEATURE_CORE; + static const XMLString FEATURE_EVENTS; + static const XMLString FEATURE_MUTATIONEVENTS; + static const XMLString FEATURE_TRAVERSAL; + static const XMLString VERSION_1_0; + static const XMLString VERSION_2_0; +}; + + +} } // namespace Poco::XML + + +#endif // DOM_DOMImplementation_INCLUDED diff --git a/contrib/libs/poco/XML/include/Poco/DOM/DOMObject.h b/contrib/libs/poco/XML/include/Poco/DOM/DOMObject.h index 40b29fb2cf..8cbcba5165 100644 --- a/contrib/libs/poco/XML/include/Poco/DOM/DOMObject.h +++ b/contrib/libs/poco/XML/include/Poco/DOM/DOMObject.h @@ -1,103 +1,103 @@ -// -// DOMObject.h -// -// Library: XML -// Package: DOM -// Module: DOM -// -// Definition of the DOMObject class. -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef DOM_DOMObject_INCLUDED -#define DOM_DOMObject_INCLUDED - - -#include "Poco/XML/XML.h" - - -namespace Poco { -namespace XML { - - -class XML_API DOMObject - /// The base class for all objects in the Document Object Model. - /// - /// DOMObject defines the rules for memory management - /// in this implementation of the DOM. Violation of these - /// rules, which are outlined in the following, results - /// in memory leaks or dangling pointers. - /// - /// Every object created by new or by a factory - /// method (for example, Document::create*) must be released - /// with a call to release() or autoRelease() when it - /// is no longer needed. - /// - /// Every object created by cloning or importing another - /// object must be released. - /// For every call to duplicate() there must be a matching - /// call to release(). - /// An object obtained via any other way must not be - /// released, except ownership of it has been explicitly - /// taken with a call to duplicate(). - /// - /// While DOMObjects are safe for use in multithreaded programs, - /// a DOMObject or one of its subclasses must not be accessed - /// from multiple threads simultaneously. -{ -public: - DOMObject(); - /// Creates the DOMObject. - /// The object's reference count is initialized to one. - - void duplicate() const; - /// Increases the object's reference count. - - void release() const; - /// Decreases the object's reference count. - /// If the reference count reaches zero, - /// the object is deleted. - - virtual void autoRelease() = 0; - /// Adds the object to an appropriate - /// AutoReleasePool, which is usually the - /// AutoReleasePool managed by the Document - /// to which this object belongs. - -protected: - virtual ~DOMObject(); - /// Destroys the DOMObject. - -private: - DOMObject(const DOMObject&); - DOMObject& operator = (const DOMObject&); - - mutable int _rc; -}; - - -// -// inlines -// -inline void DOMObject::duplicate() const -{ - ++_rc; -} - - -inline void DOMObject::release() const -{ - if (--_rc == 0) - delete this; -} - - -} } // namespace Poco::XML - - -#endif // DOM_DOMObject_INCLUDED +// +// DOMObject.h +// +// Library: XML +// Package: DOM +// Module: DOM +// +// Definition of the DOMObject class. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef DOM_DOMObject_INCLUDED +#define DOM_DOMObject_INCLUDED + + +#include "Poco/XML/XML.h" + + +namespace Poco { +namespace XML { + + +class XML_API DOMObject + /// The base class for all objects in the Document Object Model. + /// + /// DOMObject defines the rules for memory management + /// in this implementation of the DOM. Violation of these + /// rules, which are outlined in the following, results + /// in memory leaks or dangling pointers. + /// + /// Every object created by new or by a factory + /// method (for example, Document::create*) must be released + /// with a call to release() or autoRelease() when it + /// is no longer needed. + /// + /// Every object created by cloning or importing another + /// object must be released. + /// For every call to duplicate() there must be a matching + /// call to release(). + /// An object obtained via any other way must not be + /// released, except ownership of it has been explicitly + /// taken with a call to duplicate(). + /// + /// While DOMObjects are safe for use in multithreaded programs, + /// a DOMObject or one of its subclasses must not be accessed + /// from multiple threads simultaneously. +{ +public: + DOMObject(); + /// Creates the DOMObject. + /// The object's reference count is initialized to one. + + void duplicate() const; + /// Increases the object's reference count. + + void release() const; + /// Decreases the object's reference count. + /// If the reference count reaches zero, + /// the object is deleted. + + virtual void autoRelease() = 0; + /// Adds the object to an appropriate + /// AutoReleasePool, which is usually the + /// AutoReleasePool managed by the Document + /// to which this object belongs. + +protected: + virtual ~DOMObject(); + /// Destroys the DOMObject. + +private: + DOMObject(const DOMObject&); + DOMObject& operator = (const DOMObject&); + + mutable int _rc; +}; + + +// +// inlines +// +inline void DOMObject::duplicate() const +{ + ++_rc; +} + + +inline void DOMObject::release() const +{ + if (--_rc == 0) + delete this; +} + + +} } // namespace Poco::XML + + +#endif // DOM_DOMObject_INCLUDED diff --git a/contrib/libs/poco/XML/include/Poco/DOM/DOMParser.h b/contrib/libs/poco/XML/include/Poco/DOM/DOMParser.h index 69d0f5aaac..4ae22dbe2e 100644 --- a/contrib/libs/poco/XML/include/Poco/DOM/DOMParser.h +++ b/contrib/libs/poco/XML/include/Poco/DOM/DOMParser.h @@ -1,114 +1,114 @@ -// -// DOMParser.h -// -// Library: XML -// Package: DOM -// Module: DOMParser -// -// Definition of the DOMParser class. -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef DOM_DOMParser_INCLUDED -#define DOM_DOMParser_INCLUDED - - -#include "Poco/XML/XML.h" -#include "Poco/SAX/SAXParser.h" - - -namespace Poco { -namespace XML { - - -class NamePool; -class Document; -class InputSource; -class EntityResolver; - - -class XML_API DOMParser - /// This is a convenience class that combines a - /// DOMBuilder with a SAXParser, with the optional - /// support of a WhitespaceFilter. -{ -public: - explicit DOMParser(NamePool* pNamePool = 0); - /// Creates a new DOMParser. - /// If a NamePool is given, it becomes the Document's NamePool. - - explicit DOMParser(unsigned long namePoolSize); - /// Creates a new DOMParser, using the given NamePool size. - /// - /// The given namePoolSize should be a suitable prime number, - /// e.g. 251, 509, 1021 or 4093, depending on the expected - /// size of the document. - - ~DOMParser(); - /// Destroys the DOMParser. - - void setEncoding(const XMLString& encoding); - /// Sets the encoding used by the parser if no - /// encoding is specified in the XML document. - - const XMLString& getEncoding() const; - /// Returns the name of the encoding used by - /// the parser if no encoding is specified in - /// the XML document. - - void addEncoding(const XMLString& name, Poco::TextEncoding* pEncoding); - /// Adds an encoding to the parser. - - void setFeature(const XMLString& name, bool state); - /// Set the state of a feature. - /// - /// If a feature is not recognized by the DOMParser, it is - /// passed on to the underlying XMLReader. - /// - /// The only currently supported feature is - /// http://www.appinf.com/features/no-whitespace-in-element-content - /// which, when activated, causes the WhitespaceFilter to - /// be used. - - bool getFeature(const XMLString& name) const; - /// Look up the value of a feature. - /// - /// If a feature is not recognized by the DOMParser, the - /// DOMParser queries the underlying SAXParser for the feature. - - Document* parse(const XMLString& uri); - /// Parse an XML document from a location identified by an URI. - - Document* parse(InputSource* pInputSource); - /// Parse an XML document from a location identified by an InputSource. - - Document* parseString(const std::string& xml); - /// Parse an XML document from a string. - - Document* parseMemory(const char* xml, std::size_t size); - /// Parse an XML document from memory. - - EntityResolver* getEntityResolver() const; - /// Returns the entity resolver used by the underlying SAXParser. - - void setEntityResolver(EntityResolver* pEntityResolver); - /// Sets the entity resolver on the underlying SAXParser. - - static const XMLString FEATURE_FILTER_WHITESPACE; - -private: - SAXParser _saxParser; - NamePool* _pNamePool; - bool _filterWhitespace; -}; - - -} } // namespace Poco::XML - - -#endif // DOM_DOMParser_INCLUDED +// +// DOMParser.h +// +// Library: XML +// Package: DOM +// Module: DOMParser +// +// Definition of the DOMParser class. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef DOM_DOMParser_INCLUDED +#define DOM_DOMParser_INCLUDED + + +#include "Poco/XML/XML.h" +#include "Poco/SAX/SAXParser.h" + + +namespace Poco { +namespace XML { + + +class NamePool; +class Document; +class InputSource; +class EntityResolver; + + +class XML_API DOMParser + /// This is a convenience class that combines a + /// DOMBuilder with a SAXParser, with the optional + /// support of a WhitespaceFilter. +{ +public: + explicit DOMParser(NamePool* pNamePool = 0); + /// Creates a new DOMParser. + /// If a NamePool is given, it becomes the Document's NamePool. + + explicit DOMParser(unsigned long namePoolSize); + /// Creates a new DOMParser, using the given NamePool size. + /// + /// The given namePoolSize should be a suitable prime number, + /// e.g. 251, 509, 1021 or 4093, depending on the expected + /// size of the document. + + ~DOMParser(); + /// Destroys the DOMParser. + + void setEncoding(const XMLString& encoding); + /// Sets the encoding used by the parser if no + /// encoding is specified in the XML document. + + const XMLString& getEncoding() const; + /// Returns the name of the encoding used by + /// the parser if no encoding is specified in + /// the XML document. + + void addEncoding(const XMLString& name, Poco::TextEncoding* pEncoding); + /// Adds an encoding to the parser. + + void setFeature(const XMLString& name, bool state); + /// Set the state of a feature. + /// + /// If a feature is not recognized by the DOMParser, it is + /// passed on to the underlying XMLReader. + /// + /// The only currently supported feature is + /// http://www.appinf.com/features/no-whitespace-in-element-content + /// which, when activated, causes the WhitespaceFilter to + /// be used. + + bool getFeature(const XMLString& name) const; + /// Look up the value of a feature. + /// + /// If a feature is not recognized by the DOMParser, the + /// DOMParser queries the underlying SAXParser for the feature. + + Document* parse(const XMLString& uri); + /// Parse an XML document from a location identified by an URI. + + Document* parse(InputSource* pInputSource); + /// Parse an XML document from a location identified by an InputSource. + + Document* parseString(const std::string& xml); + /// Parse an XML document from a string. + + Document* parseMemory(const char* xml, std::size_t size); + /// Parse an XML document from memory. + + EntityResolver* getEntityResolver() const; + /// Returns the entity resolver used by the underlying SAXParser. + + void setEntityResolver(EntityResolver* pEntityResolver); + /// Sets the entity resolver on the underlying SAXParser. + + static const XMLString FEATURE_FILTER_WHITESPACE; + +private: + SAXParser _saxParser; + NamePool* _pNamePool; + bool _filterWhitespace; +}; + + +} } // namespace Poco::XML + + +#endif // DOM_DOMParser_INCLUDED diff --git a/contrib/libs/poco/XML/include/Poco/DOM/DOMSerializer.h b/contrib/libs/poco/XML/include/Poco/DOM/DOMSerializer.h index b535105dca..593d433861 100644 --- a/contrib/libs/poco/XML/include/Poco/DOM/DOMSerializer.h +++ b/contrib/libs/poco/XML/include/Poco/DOM/DOMSerializer.h @@ -1,122 +1,122 @@ -// -// DOMSerializer.h -// -// Library: XML -// Package: DOM -// Module: DOMSerializer -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef DOM_DOMSerializer_INCLUDED -#define DOM_DOMSerializer_INCLUDED - - -#include "Poco/XML/XML.h" -#include "Poco/SAX/XMLReader.h" - - -namespace Poco { -namespace XML { - - -class Node; -class Element; -class Text; -class Comment; -class ProcessingInstruction; -class Entity; -class CDATASection; -class Notation; -class Document; -class DocumentType; -class DocumentFragment; -class DeclHandler; -class LexicalHandler; - - -class XML_API DOMSerializer: public XMLReader - /// The DOMSerializer serializes a DOM document - /// into a sequence of SAX events which are - /// reported to the registered SAX event - /// handlers. - /// - /// The DOMWriter uses a DOMSerializer with an - /// XMLWriter to serialize a DOM document into - /// textual XML. -{ -public: - DOMSerializer(); - /// Creates the DOMSerializer. - - ~DOMSerializer(); - /// Destroys the DOMSerializer. - - void serialize(const Node* pNode); - /// Serializes a DOM node and its children - /// into a sequence of SAX events, which are - /// reported to the registered SAX event - /// handlers. - - // XMLReader - void setEntityResolver(EntityResolver* pResolver); - EntityResolver* getEntityResolver() const; - void setDTDHandler(DTDHandler* pDTDHandler); - DTDHandler* getDTDHandler() const; - void setContentHandler(ContentHandler* pContentHandler); - ContentHandler* getContentHandler() const; - void setErrorHandler(ErrorHandler* pErrorHandler); - ErrorHandler* getErrorHandler() const; - - void setFeature(const XMLString& featureId, bool state); - bool getFeature(const XMLString& featureId) const; - void setProperty(const XMLString& propertyId, const XMLString& value); - void setProperty(const XMLString& propertyId, void* value); - void* getProperty(const XMLString& propertyId) const; - -protected: - void parse(InputSource* pSource); - /// The DOMSerializer cannot parse an InputSource, - /// so this method simply throws an XMLException when invoked. - - void parse(const XMLString& systemId); - /// The DOMSerializer cannot parse from a system identifier, - /// so this method simply throws an XMLException when invoked. - - void parseMemoryNP(const char* xml, std::size_t size); - /// The DOMSerializer cannot parse from a system identifier, - /// so this method simply throws an XMLException when invoked. - - void iterate(const Node* pNode) const; - void handleNode(const Node* pNode) const; - void handleElement(const Element* pElement) const; - void handleCharacterData(const Text* pText) const; - void handleComment(const Comment* pComment) const; - void handlePI(const ProcessingInstruction* pPI) const; - void handleCDATASection(const CDATASection* pCDATA) const; - void handleDocument(const Document* pDocument) const; - void handleDocumentType(const DocumentType* pDocumentType) const; - void handleFragment(const DocumentFragment* pFragment) const; - void handleNotation(const Notation* pNotation) const; - void handleEntity(const Entity* pEntity) const; - -private: - EntityResolver* _pEntityResolver; - DTDHandler* _pDTDHandler; - ContentHandler* _pContentHandler; - ErrorHandler* _pErrorHandler; - DeclHandler* _pDeclHandler; - LexicalHandler* _pLexicalHandler; - - static const XMLString CDATA; -}; - - -} } // namespace Poco::XML - - -#endif // DOM_DOMSerializer_INCLUDED +// +// DOMSerializer.h +// +// Library: XML +// Package: DOM +// Module: DOMSerializer +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef DOM_DOMSerializer_INCLUDED +#define DOM_DOMSerializer_INCLUDED + + +#include "Poco/XML/XML.h" +#include "Poco/SAX/XMLReader.h" + + +namespace Poco { +namespace XML { + + +class Node; +class Element; +class Text; +class Comment; +class ProcessingInstruction; +class Entity; +class CDATASection; +class Notation; +class Document; +class DocumentType; +class DocumentFragment; +class DeclHandler; +class LexicalHandler; + + +class XML_API DOMSerializer: public XMLReader + /// The DOMSerializer serializes a DOM document + /// into a sequence of SAX events which are + /// reported to the registered SAX event + /// handlers. + /// + /// The DOMWriter uses a DOMSerializer with an + /// XMLWriter to serialize a DOM document into + /// textual XML. +{ +public: + DOMSerializer(); + /// Creates the DOMSerializer. + + ~DOMSerializer(); + /// Destroys the DOMSerializer. + + void serialize(const Node* pNode); + /// Serializes a DOM node and its children + /// into a sequence of SAX events, which are + /// reported to the registered SAX event + /// handlers. + + // XMLReader + void setEntityResolver(EntityResolver* pResolver); + EntityResolver* getEntityResolver() const; + void setDTDHandler(DTDHandler* pDTDHandler); + DTDHandler* getDTDHandler() const; + void setContentHandler(ContentHandler* pContentHandler); + ContentHandler* getContentHandler() const; + void setErrorHandler(ErrorHandler* pErrorHandler); + ErrorHandler* getErrorHandler() const; + + void setFeature(const XMLString& featureId, bool state); + bool getFeature(const XMLString& featureId) const; + void setProperty(const XMLString& propertyId, const XMLString& value); + void setProperty(const XMLString& propertyId, void* value); + void* getProperty(const XMLString& propertyId) const; + +protected: + void parse(InputSource* pSource); + /// The DOMSerializer cannot parse an InputSource, + /// so this method simply throws an XMLException when invoked. + + void parse(const XMLString& systemId); + /// The DOMSerializer cannot parse from a system identifier, + /// so this method simply throws an XMLException when invoked. + + void parseMemoryNP(const char* xml, std::size_t size); + /// The DOMSerializer cannot parse from a system identifier, + /// so this method simply throws an XMLException when invoked. + + void iterate(const Node* pNode) const; + void handleNode(const Node* pNode) const; + void handleElement(const Element* pElement) const; + void handleCharacterData(const Text* pText) const; + void handleComment(const Comment* pComment) const; + void handlePI(const ProcessingInstruction* pPI) const; + void handleCDATASection(const CDATASection* pCDATA) const; + void handleDocument(const Document* pDocument) const; + void handleDocumentType(const DocumentType* pDocumentType) const; + void handleFragment(const DocumentFragment* pFragment) const; + void handleNotation(const Notation* pNotation) const; + void handleEntity(const Entity* pEntity) const; + +private: + EntityResolver* _pEntityResolver; + DTDHandler* _pDTDHandler; + ContentHandler* _pContentHandler; + ErrorHandler* _pErrorHandler; + DeclHandler* _pDeclHandler; + LexicalHandler* _pLexicalHandler; + + static const XMLString CDATA; +}; + + +} } // namespace Poco::XML + + +#endif // DOM_DOMSerializer_INCLUDED diff --git a/contrib/libs/poco/XML/include/Poco/DOM/DOMWriter.h b/contrib/libs/poco/XML/include/Poco/DOM/DOMWriter.h index 5a5132d566..c953ac19ef 100644 --- a/contrib/libs/poco/XML/include/Poco/DOM/DOMWriter.h +++ b/contrib/libs/poco/XML/include/Poco/DOM/DOMWriter.h @@ -1,127 +1,127 @@ -// -// DOMWriter.h -// -// Library: XML -// Package: DOM -// Module: DOMWriter -// -// Definition of class DOMWriter. -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef DOM_DOMWriter_INCLUDED -#define DOM_DOMWriter_INCLUDED - - -#include "Poco/XML/XML.h" -#include "Poco/XML/XMLString.h" -#include "Poco/XML/XMLStream.h" -#include "Poco/TextEncoding.h" - - -namespace Poco { -namespace XML { - - -class Node; -class Document; - - -class XML_API DOMWriter - /// The DOMWriter uses a DOMSerializer with an - /// XMLWriter to serialize a DOM document into - /// textual XML. -{ -public: - DOMWriter(); - /// Creates a DOMWriter. - - ~DOMWriter(); - /// Destroys a DOMWriter. - - void setEncoding(const std::string& encodingName, Poco::TextEncoding& textEncoding); - /// Sets the encoding, which will be reflected in the written XML declaration. - - const std::string& getEncoding() const; - /// Returns the encoding name set with setEncoding. - - void setOptions(int options); - /// Sets options for the internal XMLWriter. - /// - /// See class XMLWriter for available options. - - int getOptions() const; - /// Returns the options for the internal XMLWriter. - - void setNewLine(const std::string& newLine); - /// Sets the line ending characters for the internal - /// XMLWriter. See XMLWriter::setNewLine() for a list - /// of supported values. - - const std::string& getNewLine() const; - /// Returns the line ending characters used by the - /// internal XMLWriter. - - void setIndent(const std::string& indent); - /// Sets the string used for one indentation step. - /// - /// The default is a single TAB character. - /// The given string should only contain TAB or SPACE - /// characters (e.g., a single TAB character, or - /// two to four SPACE characters). - - const std::string& getIndent() const; - /// Returns the string used for one indentation step. - - void writeNode(XMLByteOutputStream& ostr, const Node* pNode); - /// Writes the XML for the given node to the specified stream. - - void writeNode(const std::string& systemId, const Node* pNode); - /// Writes the XML for the given node to the file specified in systemId, - /// using a standard file output stream (Poco::FileOutputStream). - -private: - std::string _encodingName; - Poco::TextEncoding* _pTextEncoding; - int _options; - std::string _newLine; - std::string _indent; -}; - - -// -// inlines -// -inline const std::string& DOMWriter::getEncoding() const -{ - return _encodingName; -} - - -inline int DOMWriter::getOptions() const -{ - return _options; -} - - -inline const std::string& DOMWriter::getNewLine() const -{ - return _newLine; -} - - -inline const std::string& DOMWriter::getIndent() const -{ - return _indent; -} - - -} } // namespace Poco::XML - - -#endif // DOM_DOMWriter_INCLUDED +// +// DOMWriter.h +// +// Library: XML +// Package: DOM +// Module: DOMWriter +// +// Definition of class DOMWriter. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef DOM_DOMWriter_INCLUDED +#define DOM_DOMWriter_INCLUDED + + +#include "Poco/XML/XML.h" +#include "Poco/XML/XMLString.h" +#include "Poco/XML/XMLStream.h" +#include "Poco/TextEncoding.h" + + +namespace Poco { +namespace XML { + + +class Node; +class Document; + + +class XML_API DOMWriter + /// The DOMWriter uses a DOMSerializer with an + /// XMLWriter to serialize a DOM document into + /// textual XML. +{ +public: + DOMWriter(); + /// Creates a DOMWriter. + + ~DOMWriter(); + /// Destroys a DOMWriter. + + void setEncoding(const std::string& encodingName, Poco::TextEncoding& textEncoding); + /// Sets the encoding, which will be reflected in the written XML declaration. + + const std::string& getEncoding() const; + /// Returns the encoding name set with setEncoding. + + void setOptions(int options); + /// Sets options for the internal XMLWriter. + /// + /// See class XMLWriter for available options. + + int getOptions() const; + /// Returns the options for the internal XMLWriter. + + void setNewLine(const std::string& newLine); + /// Sets the line ending characters for the internal + /// XMLWriter. See XMLWriter::setNewLine() for a list + /// of supported values. + + const std::string& getNewLine() const; + /// Returns the line ending characters used by the + /// internal XMLWriter. + + void setIndent(const std::string& indent); + /// Sets the string used for one indentation step. + /// + /// The default is a single TAB character. + /// The given string should only contain TAB or SPACE + /// characters (e.g., a single TAB character, or + /// two to four SPACE characters). + + const std::string& getIndent() const; + /// Returns the string used for one indentation step. + + void writeNode(XMLByteOutputStream& ostr, const Node* pNode); + /// Writes the XML for the given node to the specified stream. + + void writeNode(const std::string& systemId, const Node* pNode); + /// Writes the XML for the given node to the file specified in systemId, + /// using a standard file output stream (Poco::FileOutputStream). + +private: + std::string _encodingName; + Poco::TextEncoding* _pTextEncoding; + int _options; + std::string _newLine; + std::string _indent; +}; + + +// +// inlines +// +inline const std::string& DOMWriter::getEncoding() const +{ + return _encodingName; +} + + +inline int DOMWriter::getOptions() const +{ + return _options; +} + + +inline const std::string& DOMWriter::getNewLine() const +{ + return _newLine; +} + + +inline const std::string& DOMWriter::getIndent() const +{ + return _indent; +} + + +} } // namespace Poco::XML + + +#endif // DOM_DOMWriter_INCLUDED diff --git a/contrib/libs/poco/XML/include/Poco/DOM/DTDMap.h b/contrib/libs/poco/XML/include/Poco/DOM/DTDMap.h index 2a475c358e..82b8af7e0e 100644 --- a/contrib/libs/poco/XML/include/Poco/DOM/DTDMap.h +++ b/contrib/libs/poco/XML/include/Poco/DOM/DTDMap.h @@ -1,67 +1,67 @@ -// -// DTDMap.h -// -// Library: XML -// Package: DOM -// Module: DOM -// -// Definition of the DTDMap class. -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef DOM_DTDMap_INCLUDED -#define DOM_DTDMap_INCLUDED - - -#include "Poco/XML/XML.h" -#include "Poco/DOM/NamedNodeMap.h" - - -namespace Poco { -namespace XML { - - -class DocumentType; - - -class XML_API DTDMap: public NamedNodeMap - /// This implementation of NamedNodeMap - /// is returned by DocumentType::entities() - /// and DocumentType::notations(). -{ -public: - Node* getNamedItem(const XMLString& name) const; - Node* setNamedItem(Node* arg); - Node* removeNamedItem(const XMLString& name); - Node* item(unsigned long index) const; - unsigned long length() const; - - Node* getNamedItemNS(const XMLString& namespaceURI, const XMLString& localName) const; - Node* setNamedItemNS(Node* arg); - Node* removeNamedItemNS(const XMLString& namespaceURI, const XMLString& localName); - - void autoRelease(); - -protected: - DTDMap(const DocumentType* pDocumentType, unsigned short type); - ~DTDMap(); - -private: - DTDMap(); - - const DocumentType* _pDocumentType; - unsigned short _type; - - friend class DocumentType; -}; - - -} } // namespace Poco::XML - - -#endif // DOM_DTDMap_INCLUDED +// +// DTDMap.h +// +// Library: XML +// Package: DOM +// Module: DOM +// +// Definition of the DTDMap class. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef DOM_DTDMap_INCLUDED +#define DOM_DTDMap_INCLUDED + + +#include "Poco/XML/XML.h" +#include "Poco/DOM/NamedNodeMap.h" + + +namespace Poco { +namespace XML { + + +class DocumentType; + + +class XML_API DTDMap: public NamedNodeMap + /// This implementation of NamedNodeMap + /// is returned by DocumentType::entities() + /// and DocumentType::notations(). +{ +public: + Node* getNamedItem(const XMLString& name) const; + Node* setNamedItem(Node* arg); + Node* removeNamedItem(const XMLString& name); + Node* item(unsigned long index) const; + unsigned long length() const; + + Node* getNamedItemNS(const XMLString& namespaceURI, const XMLString& localName) const; + Node* setNamedItemNS(Node* arg); + Node* removeNamedItemNS(const XMLString& namespaceURI, const XMLString& localName); + + void autoRelease(); + +protected: + DTDMap(const DocumentType* pDocumentType, unsigned short type); + ~DTDMap(); + +private: + DTDMap(); + + const DocumentType* _pDocumentType; + unsigned short _type; + + friend class DocumentType; +}; + + +} } // namespace Poco::XML + + +#endif // DOM_DTDMap_INCLUDED diff --git a/contrib/libs/poco/XML/include/Poco/DOM/Document.h b/contrib/libs/poco/XML/include/Poco/DOM/Document.h index e66c0e6b51..7afb517267 100644 --- a/contrib/libs/poco/XML/include/Poco/DOM/Document.h +++ b/contrib/libs/poco/XML/include/Poco/DOM/Document.h @@ -1,285 +1,285 @@ -// -// Document.h -// -// Library: XML -// Package: DOM -// Module: DOM -// -// Definition of the DOM Document class. -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef DOM_Document_INCLUDED -#define DOM_Document_INCLUDED - - -#include "Poco/XML/XML.h" -#include "Poco/DOM/AbstractContainerNode.h" -#include "Poco/DOM/DocumentEvent.h" -#include "Poco/DOM/Element.h" -#include "Poco/XML/XMLString.h" -#include "Poco/XML/NamePool.h" -#include "Poco/AutoReleasePool.h" - - -namespace Poco { -namespace XML { - - -class NamePool; -class DocumentType; -class DOMImplementation; -class DocumentFragment; -class Text; -class Comment; -class CDATASection; -class ProcessingInstruction; -class Attr; -class EntityReference; -class NodeList; -class Entity; -class Notation; - - -class XML_API Document: public AbstractContainerNode, public DocumentEvent - /// The Document interface represents the entire HTML or XML document. Conceptually, - /// it is the root of the document tree, and provides the primary access to the - /// document's data. - /// - /// Since elements, text nodes, comments, processing instructions, etc. cannot exist - /// outside the context of a Document, the Document interface also contains the - /// factory methods needed to create these objects. The Node objects created have a - /// ownerDocument attribute which associates them with the Document within whose - /// context they were created. -{ -public: - typedef Poco::AutoReleasePool<DOMObject> AutoReleasePool; - - explicit Document(NamePool* pNamePool = 0); - /// Creates a new document. If pNamePool == 0, the document - /// creates its own name pool, otherwise it uses the given name pool. - /// Sharing a name pool makes sense for documents containing instances - /// of the same schema, thus reducing memory usage. - - explicit Document(unsigned long namePoolSize); - /// Creates a new document using a name pool with the given size, which - /// should be a prime number (e.g., 251, 509, 1021, 4093). - - Document(DocumentType* pDocumentType, NamePool* pNamePool = 0); - /// Creates a new document. If pNamePool == 0, the document - /// creates its own name pool, otherwise it uses the given name pool. - /// Sharing a name pool makes sense for documents containing instances - /// of the same schema, thus reducing memory usage. - - Document(DocumentType* pDocumentType, unsigned long namePoolSize); - /// Creates a new document using a name pool with the given size, which - /// should be a prime number (e.g., 251, 509, 1021, 4093). - - NamePool& namePool(); - /// Returns a pointer to the documents Name Pool. - - AutoReleasePool& autoReleasePool(); - /// Returns a pointer to the documents Auto Release Pool. - - void collectGarbage(); - /// Releases all objects in the Auto Release Pool. - - void suspendEvents(); - /// Suspends all events until resumeEvents() is called. - - void resumeEvents(); - /// Resumes all events suspended with suspendEvent(); - - bool eventsSuspended() const; - /// Returns true if events are suspended. - - bool events() const; - /// Returns true if events are not suspended. - - const DocumentType* doctype() const; - /// The Document Type Declaration (see DocumentType) associated with this document. - /// For HTML documents as well as XML documents without a document type declaration - /// this returns null. The DOM Level 1 does not support editing the Document - /// Type Declaration. docType cannot be altered in any way, including through - /// the use of methods inherited from the Node interface, such as insertNode - /// or removeNode. - - const DOMImplementation& implementation() const; - /// The DOMImplementation object that handles this document. A DOM application - /// may use objects from multiple implementations. - - Element* documentElement() const; - /// This is a convenience attribute 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". - - Element* createElement(const XMLString& tagName) const; - /// Creates an element of the type specified. Note that the instance returned - /// implements the Element interface, so attributes can be specified directly - /// on the returned object. - /// - /// In addition, if there are known attributes with default values, Attr nodes - /// representing them are automatically created and attached to the element. - - DocumentFragment* createDocumentFragment() const; - /// Creates an empty DocumentFragment object. - - Text* createTextNode(const XMLString& data) const; - /// Creates a text node given the specified string. - - Comment* createComment(const XMLString& data) const; - /// Creates a comment node given the specified string. - - CDATASection* createCDATASection(const XMLString& data) const; - /// Creates a CDATASection node whose value is the specified string. - - ProcessingInstruction* createProcessingInstruction(const XMLString& target, const XMLString& data) const; - /// Creates a ProcessingInstruction node given the specified target and data strings. - - Attr* createAttribute(const XMLString& name) const; - /// Creates an Attr of the given name. Note that the Attr instance can then - /// be set on an Element using the setAttributeNode method. - - EntityReference* createEntityReference(const XMLString& name) const; - /// Creates an EntityReference object. In addition, if the referenced entity - /// is known, the child list of the EntityReference node is made the same as - /// that of the corresponding Entity node. - - NodeList* getElementsByTagName(const XMLString& name) const; - /// Returns a NodeList of all Elements with a given tag name in the order - /// in which they would be encountered in a preorder traversal of the - /// document tree. - /// - /// The returned NodeList must be released with a call to release() - /// when no longer needed. - - // DOM Level 2 - Node* importNode(Node* importedNode, bool deep); - /// Imports a node from another document to this document. The returned node - /// has no parent; (parentNode is null). The source node is not altered or removed - /// from the original document; this method creates a new copy of the source - /// node. - /// For all nodes, importing a node creates a node object owned by the importing - /// document, with attribute values identical to the source node's nodeName - /// and nodeType, plus the attributes related to namespaces (prefix, localName, - /// and namespaceURI). As in the cloneNode operation on a Node, the source node - /// is not altered. - /// Additional information is copied as appropriate to the nodeType, attempting - /// to mirror the behavior expected if a fragment of XML or HTML source was - /// copied from one document to another, recognizing that the two documents - /// may have different DTDs in the XML case. - - Element* createElementNS(const XMLString& namespaceURI, const XMLString& qualifiedName) const; - /// Creates an element of the given qualified name and namespace URI. - - Attr* createAttributeNS(const XMLString& namespaceURI, const XMLString& qualifiedName) const; - /// Creates an attribute of the given qualified name and namespace URI. - - NodeList* getElementsByTagNameNS(const XMLString& namespaceURI, const XMLString& localName) const; - /// Returns a NodeList of all the Elements with a given local name and - /// namespace URI in the order in which they are encountered in a - /// preorder traversal of the Document tree. - - Element* getElementById(const XMLString& elementId) const; - /// Returns the Element whose ID is given by elementId. If no such - /// element exists, returns null. Behavior is not defined if more - /// than one element has this ID. - /// - /// Note: The DOM implementation must have information that says - /// which attributes are of type ID. Attributes with the name "ID" - /// are not of type ID unless so defined. Implementations that do - /// not know whether attributes are of type ID or not are expected to - /// return null. This implementation therefore returns null. - /// - /// See also the non-standard two argument variant of getElementById() - /// and getElementByIdNS(). - - // DocumentEvent - Event* createEvent(const XMLString& eventType) const; - - // Node - const XMLString& nodeName() const; - unsigned short nodeType() const; - - // EventTarget - bool dispatchEvent(Event* evt); - - // Extensions - Entity* createEntity(const XMLString& name, const XMLString& publicId, const XMLString& systemId, const XMLString& notationName) const; - /// Creates an Entity with the given name, publicId, systemId and notationName. - /// - /// This method is not part of the W3C Document Object Model. - - Notation* createNotation(const XMLString& name, const XMLString& publicId, const XMLString& systemId) const; - /// Creates a Notation with the given name, publicId and systemId. - /// - /// This method is not part of the W3C Document Object Model. - - Element* getElementById(const XMLString& elementId, const XMLString& idAttribute) const; - /// Returns the first Element whose ID attribute (given in idAttribute) - /// has the given elementId. If no such element exists, returns null. - /// - /// This method is an extension to the W3C Document Object Model. - - Element* getElementByIdNS(const XMLString& elementId, const XMLString& idAttributeURI, const XMLString& idAttributeLocalName) const; - /// Returns the first Element whose ID attribute (given in idAttributeURI and idAttributeLocalName) - /// has the given elementId. If no such element exists, returns null. - /// - /// This method is an extension to the W3C Document Object Model. - -protected: - ~Document(); - - Node* copyNode(bool deep, Document* pOwnerDocument) const; - - DocumentType* getDoctype(); - void setDoctype(DocumentType* pDoctype); - -private: - DocumentType* _pDocumentType; - NamePool* _pNamePool; - AutoReleasePool _autoReleasePool; - int _eventSuspendLevel; - - static const XMLString NODE_NAME; - - friend class DOMBuilder; -}; - - -// -// inlines -// -inline NamePool& Document::namePool() -{ - return *_pNamePool; -} - - -inline Document::AutoReleasePool& Document::autoReleasePool() -{ - return _autoReleasePool; -} - - -inline const DocumentType* Document::doctype() const -{ - return _pDocumentType; -} - - -inline DocumentType* Document::getDoctype() -{ - return _pDocumentType; -} - - -} } // namespace Poco::XML - - -#endif // DOM_Document_INCLUDED +// +// Document.h +// +// Library: XML +// Package: DOM +// Module: DOM +// +// Definition of the DOM Document class. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef DOM_Document_INCLUDED +#define DOM_Document_INCLUDED + + +#include "Poco/XML/XML.h" +#include "Poco/DOM/AbstractContainerNode.h" +#include "Poco/DOM/DocumentEvent.h" +#include "Poco/DOM/Element.h" +#include "Poco/XML/XMLString.h" +#include "Poco/XML/NamePool.h" +#include "Poco/AutoReleasePool.h" + + +namespace Poco { +namespace XML { + + +class NamePool; +class DocumentType; +class DOMImplementation; +class DocumentFragment; +class Text; +class Comment; +class CDATASection; +class ProcessingInstruction; +class Attr; +class EntityReference; +class NodeList; +class Entity; +class Notation; + + +class XML_API Document: public AbstractContainerNode, public DocumentEvent + /// The Document interface represents the entire HTML or XML document. Conceptually, + /// it is the root of the document tree, and provides the primary access to the + /// document's data. + /// + /// Since elements, text nodes, comments, processing instructions, etc. cannot exist + /// outside the context of a Document, the Document interface also contains the + /// factory methods needed to create these objects. The Node objects created have a + /// ownerDocument attribute which associates them with the Document within whose + /// context they were created. +{ +public: + typedef Poco::AutoReleasePool<DOMObject> AutoReleasePool; + + explicit Document(NamePool* pNamePool = 0); + /// Creates a new document. If pNamePool == 0, the document + /// creates its own name pool, otherwise it uses the given name pool. + /// Sharing a name pool makes sense for documents containing instances + /// of the same schema, thus reducing memory usage. + + explicit Document(unsigned long namePoolSize); + /// Creates a new document using a name pool with the given size, which + /// should be a prime number (e.g., 251, 509, 1021, 4093). + + Document(DocumentType* pDocumentType, NamePool* pNamePool = 0); + /// Creates a new document. If pNamePool == 0, the document + /// creates its own name pool, otherwise it uses the given name pool. + /// Sharing a name pool makes sense for documents containing instances + /// of the same schema, thus reducing memory usage. + + Document(DocumentType* pDocumentType, unsigned long namePoolSize); + /// Creates a new document using a name pool with the given size, which + /// should be a prime number (e.g., 251, 509, 1021, 4093). + + NamePool& namePool(); + /// Returns a pointer to the documents Name Pool. + + AutoReleasePool& autoReleasePool(); + /// Returns a pointer to the documents Auto Release Pool. + + void collectGarbage(); + /// Releases all objects in the Auto Release Pool. + + void suspendEvents(); + /// Suspends all events until resumeEvents() is called. + + void resumeEvents(); + /// Resumes all events suspended with suspendEvent(); + + bool eventsSuspended() const; + /// Returns true if events are suspended. + + bool events() const; + /// Returns true if events are not suspended. + + const DocumentType* doctype() const; + /// The Document Type Declaration (see DocumentType) associated with this document. + /// For HTML documents as well as XML documents without a document type declaration + /// this returns null. The DOM Level 1 does not support editing the Document + /// Type Declaration. docType cannot be altered in any way, including through + /// the use of methods inherited from the Node interface, such as insertNode + /// or removeNode. + + const DOMImplementation& implementation() const; + /// The DOMImplementation object that handles this document. A DOM application + /// may use objects from multiple implementations. + + Element* documentElement() const; + /// This is a convenience attribute 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". + + Element* createElement(const XMLString& tagName) const; + /// Creates an element of the type specified. Note that the instance returned + /// implements the Element interface, so attributes can be specified directly + /// on the returned object. + /// + /// In addition, if there are known attributes with default values, Attr nodes + /// representing them are automatically created and attached to the element. + + DocumentFragment* createDocumentFragment() const; + /// Creates an empty DocumentFragment object. + + Text* createTextNode(const XMLString& data) const; + /// Creates a text node given the specified string. + + Comment* createComment(const XMLString& data) const; + /// Creates a comment node given the specified string. + + CDATASection* createCDATASection(const XMLString& data) const; + /// Creates a CDATASection node whose value is the specified string. + + ProcessingInstruction* createProcessingInstruction(const XMLString& target, const XMLString& data) const; + /// Creates a ProcessingInstruction node given the specified target and data strings. + + Attr* createAttribute(const XMLString& name) const; + /// Creates an Attr of the given name. Note that the Attr instance can then + /// be set on an Element using the setAttributeNode method. + + EntityReference* createEntityReference(const XMLString& name) const; + /// Creates an EntityReference object. In addition, if the referenced entity + /// is known, the child list of the EntityReference node is made the same as + /// that of the corresponding Entity node. + + NodeList* getElementsByTagName(const XMLString& name) const; + /// Returns a NodeList of all Elements with a given tag name in the order + /// in which they would be encountered in a preorder traversal of the + /// document tree. + /// + /// The returned NodeList must be released with a call to release() + /// when no longer needed. + + // DOM Level 2 + Node* importNode(Node* importedNode, bool deep); + /// Imports a node from another document to this document. The returned node + /// has no parent; (parentNode is null). The source node is not altered or removed + /// from the original document; this method creates a new copy of the source + /// node. + /// For all nodes, importing a node creates a node object owned by the importing + /// document, with attribute values identical to the source node's nodeName + /// and nodeType, plus the attributes related to namespaces (prefix, localName, + /// and namespaceURI). As in the cloneNode operation on a Node, the source node + /// is not altered. + /// Additional information is copied as appropriate to the nodeType, attempting + /// to mirror the behavior expected if a fragment of XML or HTML source was + /// copied from one document to another, recognizing that the two documents + /// may have different DTDs in the XML case. + + Element* createElementNS(const XMLString& namespaceURI, const XMLString& qualifiedName) const; + /// Creates an element of the given qualified name and namespace URI. + + Attr* createAttributeNS(const XMLString& namespaceURI, const XMLString& qualifiedName) const; + /// Creates an attribute of the given qualified name and namespace URI. + + NodeList* getElementsByTagNameNS(const XMLString& namespaceURI, const XMLString& localName) const; + /// Returns a NodeList of all the Elements with a given local name and + /// namespace URI in the order in which they are encountered in a + /// preorder traversal of the Document tree. + + Element* getElementById(const XMLString& elementId) const; + /// Returns the Element whose ID is given by elementId. If no such + /// element exists, returns null. Behavior is not defined if more + /// than one element has this ID. + /// + /// Note: The DOM implementation must have information that says + /// which attributes are of type ID. Attributes with the name "ID" + /// are not of type ID unless so defined. Implementations that do + /// not know whether attributes are of type ID or not are expected to + /// return null. This implementation therefore returns null. + /// + /// See also the non-standard two argument variant of getElementById() + /// and getElementByIdNS(). + + // DocumentEvent + Event* createEvent(const XMLString& eventType) const; + + // Node + const XMLString& nodeName() const; + unsigned short nodeType() const; + + // EventTarget + bool dispatchEvent(Event* evt); + + // Extensions + Entity* createEntity(const XMLString& name, const XMLString& publicId, const XMLString& systemId, const XMLString& notationName) const; + /// Creates an Entity with the given name, publicId, systemId and notationName. + /// + /// This method is not part of the W3C Document Object Model. + + Notation* createNotation(const XMLString& name, const XMLString& publicId, const XMLString& systemId) const; + /// Creates a Notation with the given name, publicId and systemId. + /// + /// This method is not part of the W3C Document Object Model. + + Element* getElementById(const XMLString& elementId, const XMLString& idAttribute) const; + /// Returns the first Element whose ID attribute (given in idAttribute) + /// has the given elementId. If no such element exists, returns null. + /// + /// This method is an extension to the W3C Document Object Model. + + Element* getElementByIdNS(const XMLString& elementId, const XMLString& idAttributeURI, const XMLString& idAttributeLocalName) const; + /// Returns the first Element whose ID attribute (given in idAttributeURI and idAttributeLocalName) + /// has the given elementId. If no such element exists, returns null. + /// + /// This method is an extension to the W3C Document Object Model. + +protected: + ~Document(); + + Node* copyNode(bool deep, Document* pOwnerDocument) const; + + DocumentType* getDoctype(); + void setDoctype(DocumentType* pDoctype); + +private: + DocumentType* _pDocumentType; + NamePool* _pNamePool; + AutoReleasePool _autoReleasePool; + int _eventSuspendLevel; + + static const XMLString NODE_NAME; + + friend class DOMBuilder; +}; + + +// +// inlines +// +inline NamePool& Document::namePool() +{ + return *_pNamePool; +} + + +inline Document::AutoReleasePool& Document::autoReleasePool() +{ + return _autoReleasePool; +} + + +inline const DocumentType* Document::doctype() const +{ + return _pDocumentType; +} + + +inline DocumentType* Document::getDoctype() +{ + return _pDocumentType; +} + + +} } // namespace Poco::XML + + +#endif // DOM_Document_INCLUDED diff --git a/contrib/libs/poco/XML/include/Poco/DOM/DocumentEvent.h b/contrib/libs/poco/XML/include/Poco/DOM/DocumentEvent.h index 14bcf270b8..67727009b2 100644 --- a/contrib/libs/poco/XML/include/Poco/DOM/DocumentEvent.h +++ b/contrib/libs/poco/XML/include/Poco/DOM/DocumentEvent.h @@ -1,65 +1,65 @@ -// -// DocumentEvent.h -// -// Library: XML -// Package: DOM -// Module: DOM -// -// Definition of the DOM DocumentEvent interface. -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef DOM_DocumentEvent_INCLUDED -#define DOM_DocumentEvent_INCLUDED - - -#include "Poco/XML/XML.h" -#include "Poco/XML/XMLString.h" - - -namespace Poco { -namespace XML { - - -class Event; - - -class XML_API DocumentEvent - /// The DocumentEvent interface provides a mechanism by which the user can create - /// an Event of a type supported by the implementation. It is expected that - /// the DocumentEvent interface will be implemented on the same object which - /// implements the Document interface in an implementation which supports the - /// Event model. -{ -public: - virtual Event* createEvent(const XMLString& eventType) const = 0; - /// Creates an event of the specified type. - /// - /// The eventType parameter specifies the type of Event interface to be created. - /// If the Event interface specified is supported by the implementation this - /// method will return a new Event of the interface type requested. If the Event - /// is to be dispatched via the dispatchEvent method the appropriate event init - /// method must be called after creation in order to initialize the Event's - /// values. As an example, a user wishing to synthesize some kind of UIEvent - /// would call createEvent with the parameter "UIEvents". The initUIEvent method - /// could then be called on the newly created UIEvent to set the specific type - /// of UIEvent to be dispatched and set its context information. - /// The createEvent method is used in creating Events when it is either inconvenient - /// or unnecessary for the user to create an Event themselves. In cases where - /// the implementation provided Event is insufficient, users may supply their - /// own Event implementations for use with the dispatchEvent method. - -protected: - virtual ~DocumentEvent(); -}; - - -} } // namespace Poco::XML - - -#endif // DOM_DocumentEvent_INCLUDED +// +// DocumentEvent.h +// +// Library: XML +// Package: DOM +// Module: DOM +// +// Definition of the DOM DocumentEvent interface. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef DOM_DocumentEvent_INCLUDED +#define DOM_DocumentEvent_INCLUDED + + +#include "Poco/XML/XML.h" +#include "Poco/XML/XMLString.h" + + +namespace Poco { +namespace XML { + + +class Event; + + +class XML_API DocumentEvent + /// The DocumentEvent interface provides a mechanism by which the user can create + /// an Event of a type supported by the implementation. It is expected that + /// the DocumentEvent interface will be implemented on the same object which + /// implements the Document interface in an implementation which supports the + /// Event model. +{ +public: + virtual Event* createEvent(const XMLString& eventType) const = 0; + /// Creates an event of the specified type. + /// + /// The eventType parameter specifies the type of Event interface to be created. + /// If the Event interface specified is supported by the implementation this + /// method will return a new Event of the interface type requested. If the Event + /// is to be dispatched via the dispatchEvent method the appropriate event init + /// method must be called after creation in order to initialize the Event's + /// values. As an example, a user wishing to synthesize some kind of UIEvent + /// would call createEvent with the parameter "UIEvents". The initUIEvent method + /// could then be called on the newly created UIEvent to set the specific type + /// of UIEvent to be dispatched and set its context information. + /// The createEvent method is used in creating Events when it is either inconvenient + /// or unnecessary for the user to create an Event themselves. In cases where + /// the implementation provided Event is insufficient, users may supply their + /// own Event implementations for use with the dispatchEvent method. + +protected: + virtual ~DocumentEvent(); +}; + + +} } // namespace Poco::XML + + +#endif // DOM_DocumentEvent_INCLUDED diff --git a/contrib/libs/poco/XML/include/Poco/DOM/DocumentFragment.h b/contrib/libs/poco/XML/include/Poco/DOM/DocumentFragment.h index 105a2171db..22d8d94440 100644 --- a/contrib/libs/poco/XML/include/Poco/DOM/DocumentFragment.h +++ b/contrib/libs/poco/XML/include/Poco/DOM/DocumentFragment.h @@ -1,84 +1,84 @@ -// -// DocumentFragment.h -// -// Library: XML -// Package: DOM -// Module: DOM -// -// Definition of the DOM DocumentFragment class. -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef DOM_DocumentFragment_INCLUDED -#define DOM_DocumentFragment_INCLUDED - - -#include "Poco/XML/XML.h" -#include "Poco/DOM/AbstractContainerNode.h" -#include "Poco/XML/XMLString.h" - - -namespace Poco { -namespace XML { - - -class XML_API DocumentFragment: public AbstractContainerNode - /// DocumentFragment is a "lightweight" or "minimal" Document object. It is - /// very common to want to be able to extract a portion of a document's tree - /// or to create a new fragment of a document. Imagine implementing a user command - /// like cut or rearranging a document by moving fragments around. It is desirable - /// to have an object which can hold such fragments and it is quite natural - /// to use a Node for this purpose. While it is true that a Document object - /// could fulfill this role, a Document object can potentially be a heavyweight - /// object, depending on the underlying implementation. What is really needed - /// for this is a very lightweight object. DocumentFragment is such an object. - /// - /// Furthermore, various operations -- such as inserting nodes as children of - /// another Node -- may take DocumentFragment objects as arguments; this results - /// in all the child nodes of the DocumentFragment being moved to the child - /// list of this node. - /// - /// The children of a DocumentFragment node are zero or more nodes representing - /// the tops of any sub-trees defining the structure of the document. DocumentFragment - /// nodes do not need to be well-formed XML documents (although they do need - /// to follow the rules imposed upon well-formed XML parsed entities, which - /// can have multiple top nodes). For example, a DocumentFragment might have - /// only one child and that child node could be a Text node. Such a structure - /// model represents neither an HTML document nor a well-formed XML document. - /// - /// When a DocumentFragment is inserted into a Document (or indeed any other - /// Node that may take children) the children of the DocumentFragment and not - /// the DocumentFragment itself are inserted into the Node. This makes the DocumentFragment - /// very useful when the user wishes to create nodes that are siblings; the - /// DocumentFragment acts as the parent of these nodes so that the user can - /// use the standard methods from the Node interface, such as insertBefore and - /// appendChild. -{ -public: - // Node - const XMLString& nodeName() const; - unsigned short nodeType() const; - -protected: - DocumentFragment(Document* pOwnerDocument); - DocumentFragment(Document* pOwnerDocument, const DocumentFragment& fragment); - ~DocumentFragment(); - - Node* copyNode(bool deep, Document* pOwnerDocument) const; - -private: - static const XMLString NODE_NAME; - - friend class Document; -}; - - -} } // namespace Poco::XML - - -#endif // DOM_DocumentFragment_INCLUDED +// +// DocumentFragment.h +// +// Library: XML +// Package: DOM +// Module: DOM +// +// Definition of the DOM DocumentFragment class. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef DOM_DocumentFragment_INCLUDED +#define DOM_DocumentFragment_INCLUDED + + +#include "Poco/XML/XML.h" +#include "Poco/DOM/AbstractContainerNode.h" +#include "Poco/XML/XMLString.h" + + +namespace Poco { +namespace XML { + + +class XML_API DocumentFragment: public AbstractContainerNode + /// DocumentFragment is a "lightweight" or "minimal" Document object. It is + /// very common to want to be able to extract a portion of a document's tree + /// or to create a new fragment of a document. Imagine implementing a user command + /// like cut or rearranging a document by moving fragments around. It is desirable + /// to have an object which can hold such fragments and it is quite natural + /// to use a Node for this purpose. While it is true that a Document object + /// could fulfill this role, a Document object can potentially be a heavyweight + /// object, depending on the underlying implementation. What is really needed + /// for this is a very lightweight object. DocumentFragment is such an object. + /// + /// Furthermore, various operations -- such as inserting nodes as children of + /// another Node -- may take DocumentFragment objects as arguments; this results + /// in all the child nodes of the DocumentFragment being moved to the child + /// list of this node. + /// + /// The children of a DocumentFragment node are zero or more nodes representing + /// the tops of any sub-trees defining the structure of the document. DocumentFragment + /// nodes do not need to be well-formed XML documents (although they do need + /// to follow the rules imposed upon well-formed XML parsed entities, which + /// can have multiple top nodes). For example, a DocumentFragment might have + /// only one child and that child node could be a Text node. Such a structure + /// model represents neither an HTML document nor a well-formed XML document. + /// + /// When a DocumentFragment is inserted into a Document (or indeed any other + /// Node that may take children) the children of the DocumentFragment and not + /// the DocumentFragment itself are inserted into the Node. This makes the DocumentFragment + /// very useful when the user wishes to create nodes that are siblings; the + /// DocumentFragment acts as the parent of these nodes so that the user can + /// use the standard methods from the Node interface, such as insertBefore and + /// appendChild. +{ +public: + // Node + const XMLString& nodeName() const; + unsigned short nodeType() const; + +protected: + DocumentFragment(Document* pOwnerDocument); + DocumentFragment(Document* pOwnerDocument, const DocumentFragment& fragment); + ~DocumentFragment(); + + Node* copyNode(bool deep, Document* pOwnerDocument) const; + +private: + static const XMLString NODE_NAME; + + friend class Document; +}; + + +} } // namespace Poco::XML + + +#endif // DOM_DocumentFragment_INCLUDED diff --git a/contrib/libs/poco/XML/include/Poco/DOM/DocumentType.h b/contrib/libs/poco/XML/include/Poco/DOM/DocumentType.h index 3d8909798b..011251563a 100644 --- a/contrib/libs/poco/XML/include/Poco/DOM/DocumentType.h +++ b/contrib/libs/poco/XML/include/Poco/DOM/DocumentType.h @@ -1,125 +1,125 @@ -// -// DocumentType.h -// -// Library: XML -// Package: DOM -// Module: DOM -// -// Definition of the DOM DocumentType class. -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef DOM_DocumentType_INCLUDED -#define DOM_DocumentType_INCLUDED - - -#include "Poco/XML/XML.h" -#include "Poco/DOM/AbstractContainerNode.h" - - -namespace Poco { -namespace XML { - - -class NamedNodeMap; - - -class XML_API DocumentType: public AbstractContainerNode - /// Each Document has a doctype attribute whose value is either null or a DocumentType - /// object. The DocumentType interface in the DOM Level 1 Core provides an - /// interface to the list of entities that are defined for the document, and - /// little else because the effect of namespaces and the various XML scheme - /// efforts on DTD representation are not clearly understood as of this writing. - /// - /// The DOM Level 1 doesn't support editing DocumentType nodes. -{ -public: - const XMLString& name() const; - /// The name of the DTD; i.e., the name immediately following the - /// DOCTYPE keyword. - - NamedNodeMap* entities() const; - /// A NamedNodeMap containing the general entities, - /// both external and internal, declared in the DTD. - /// Duplicates are discarded. - /// - /// Note: In this implementation, only the - /// external entities are reported. - /// Every node in this map also implements the - /// Entity interface. +// +// DocumentType.h +// +// Library: XML +// Package: DOM +// Module: DOM +// +// Definition of the DOM DocumentType class. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef DOM_DocumentType_INCLUDED +#define DOM_DocumentType_INCLUDED + + +#include "Poco/XML/XML.h" +#include "Poco/DOM/AbstractContainerNode.h" + + +namespace Poco { +namespace XML { + + +class NamedNodeMap; + + +class XML_API DocumentType: public AbstractContainerNode + /// Each Document has a doctype attribute whose value is either null or a DocumentType + /// object. The DocumentType interface in the DOM Level 1 Core provides an + /// interface to the list of entities that are defined for the document, and + /// little else because the effect of namespaces and the various XML scheme + /// efforts on DTD representation are not clearly understood as of this writing. + /// + /// The DOM Level 1 doesn't support editing DocumentType nodes. +{ +public: + const XMLString& name() const; + /// The name of the DTD; i.e., the name immediately following the + /// DOCTYPE keyword. + + NamedNodeMap* entities() const; + /// A NamedNodeMap containing the general entities, + /// both external and internal, declared in the DTD. + /// Duplicates are discarded. /// - /// The returned NamedNodeMap must be released with a call - /// to release() when no longer needed. - - NamedNodeMap* notations() const; - /// A NamedNodeMap containing the notations declared in the DTD. Duplicates - /// are discarded. Every node in this map also implements the Notation interface. - /// The DOM Level 1 does not support editing notations, therefore notations - /// cannot be altered in any way. - /// - /// The returned NamedNodeMap must be released with a call - /// to release() when no longer needed. - - // DOM Level 2 - const XMLString& publicId() const; - /// Returns the public identifier of the external DTD subset. - - const XMLString& systemId() const; - /// Returns the system identifier of the external DTD subset. - - const XMLString& internalSubset() const; - /// Returns the internal DTD subset. This implementation - /// returns an empty string. - - // Node - const XMLString& nodeName() const; - unsigned short nodeType() const; - -protected: - DocumentType(Document* pOwner, const XMLString& name, const XMLString& publicId, const XMLString& systemId); - DocumentType(Document* pOwner, const DocumentType& dt); - ~DocumentType(); - - Node* copyNode(bool deep, Document* pOwnerDocument) const; - -private: - XMLString _name; - XMLString _publicId; - XMLString _systemId; - - friend class DOMImplementation; - friend class Document; - friend class DOMBuilder; -}; - - -// -// inlines -// -inline const XMLString& DocumentType::name() const -{ - return _name; -} - - -inline const XMLString& DocumentType::publicId() const -{ - return _publicId; -} - - -inline const XMLString& DocumentType::systemId() const -{ - return _systemId; -} - - -} } // namespace Poco::XML - - -#endif // DOM_DocumentType_INCLUDED + /// Note: In this implementation, only the + /// external entities are reported. + /// Every node in this map also implements the + /// Entity interface. + /// + /// The returned NamedNodeMap must be released with a call + /// to release() when no longer needed. + + NamedNodeMap* notations() const; + /// A NamedNodeMap containing the notations declared in the DTD. Duplicates + /// are discarded. Every node in this map also implements the Notation interface. + /// The DOM Level 1 does not support editing notations, therefore notations + /// cannot be altered in any way. + /// + /// The returned NamedNodeMap must be released with a call + /// to release() when no longer needed. + + // DOM Level 2 + const XMLString& publicId() const; + /// Returns the public identifier of the external DTD subset. + + const XMLString& systemId() const; + /// Returns the system identifier of the external DTD subset. + + const XMLString& internalSubset() const; + /// Returns the internal DTD subset. This implementation + /// returns an empty string. + + // Node + const XMLString& nodeName() const; + unsigned short nodeType() const; + +protected: + DocumentType(Document* pOwner, const XMLString& name, const XMLString& publicId, const XMLString& systemId); + DocumentType(Document* pOwner, const DocumentType& dt); + ~DocumentType(); + + Node* copyNode(bool deep, Document* pOwnerDocument) const; + +private: + XMLString _name; + XMLString _publicId; + XMLString _systemId; + + friend class DOMImplementation; + friend class Document; + friend class DOMBuilder; +}; + + +// +// inlines +// +inline const XMLString& DocumentType::name() const +{ + return _name; +} + + +inline const XMLString& DocumentType::publicId() const +{ + return _publicId; +} + + +inline const XMLString& DocumentType::systemId() const +{ + return _systemId; +} + + +} } // namespace Poco::XML + + +#endif // DOM_DocumentType_INCLUDED diff --git a/contrib/libs/poco/XML/include/Poco/DOM/Element.h b/contrib/libs/poco/XML/include/Poco/DOM/Element.h index 90217baab8..4d7cf0dd34 100644 --- a/contrib/libs/poco/XML/include/Poco/DOM/Element.h +++ b/contrib/libs/poco/XML/include/Poco/DOM/Element.h @@ -1,219 +1,219 @@ -// -// Element.h -// -// Library: XML -// Package: DOM -// Module: DOM -// -// Definition of the DOM Element class. -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef DOM_Element_INCLUDED -#define DOM_Element_INCLUDED - - -#include "Poco/XML/XML.h" -#include "Poco/DOM/AbstractContainerNode.h" -#include "Poco/XML/Name.h" - - -namespace Poco { -namespace XML { - - -class Attr; -class NodeList; -class Document; - - -class XML_API Element: public AbstractContainerNode - /// The Element interface represents an element in an XML document. - /// Elements may have attributes associated with them; since the Element interface - /// inherits from Node, the generic Node interface attribute attributes may - /// be used to retrieve the set of all attributes for an element. There are - /// methods on the Element interface to retrieve either an Attr object by name - /// or an attribute value by name. In XML, where an attribute value may contain - /// entity references, an Attr object should be retrieved to examine the possibly - /// fairly complex sub-tree representing the attribute value. -{ -public: - const XMLString& tagName() const; - /// Returns the name of the element. - /// - /// For example, in +// +// Element.h +// +// Library: XML +// Package: DOM +// Module: DOM +// +// Definition of the DOM Element class. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef DOM_Element_INCLUDED +#define DOM_Element_INCLUDED + + +#include "Poco/XML/XML.h" +#include "Poco/DOM/AbstractContainerNode.h" +#include "Poco/XML/Name.h" + + +namespace Poco { +namespace XML { + + +class Attr; +class NodeList; +class Document; + + +class XML_API Element: public AbstractContainerNode + /// The Element interface represents an element in an XML document. + /// Elements may have attributes associated with them; since the Element interface + /// inherits from Node, the generic Node interface attribute attributes may + /// be used to retrieve the set of all attributes for an element. There are + /// methods on the Element interface to retrieve either an Attr object by name + /// or an attribute value by name. In XML, where an attribute value may contain + /// entity references, an Attr object should be retrieved to examine the possibly + /// fairly complex sub-tree representing the attribute value. +{ +public: + const XMLString& tagName() const; + /// Returns the name of the element. + /// + /// For example, in + /// + /// <elementExample id="demo"> + /// ... + /// </elementExample> + /// + /// tagName has the value "elementExample". Note that this is case-preserving in XML, + /// as are all of the operations of the DOM. + + const XMLString& getAttribute(const XMLString& name) const; + /// Retrieves an attribute value by name. /// - /// <elementExample id="demo"> - /// ... - /// </elementExample> - /// - /// tagName has the value "elementExample". Note that this is case-preserving in XML, - /// as are all of the operations of the DOM. - - const XMLString& getAttribute(const XMLString& name) const; - /// Retrieves an attribute value by name. - /// - /// Returns the attribute's value, if the attribute - /// exists, or an empty string otherwise. - - void setAttribute(const XMLString& name, const XMLString& value); - /// Adds a new attribute. If an attribute with that name is already present - /// in the element, its value is changed to be that of the value parameter. - /// This value is a simple string; it is not parsed as it is being set. So any - /// markup (such as syntax to be recognized as an entity reference) is treated - /// as literal text, and needs to be appropriately escaped by the implementation - /// when it is written out. - - void removeAttribute(const XMLString& name); - /// Removes an attribute by name. - - Attr* getAttributeNode(const XMLString& name) const; - /// Retrieves an Attr node by name. - - Attr* setAttributeNode(Attr* newAttr); - /// Adds a new attribute. If an attribute with that name is already - /// present in the element, it is replaced by the new one. - - Attr* addAttributeNodeNP(Attr* oldAttr, Attr* newAttr); - /// For internal use only. - /// Adds a new attribute after oldAttr. - /// If oldAttr is 0, newAttr is set as first attribute. - /// Returns newAttr. - /// Does not fire any events. - - Attr* removeAttributeNode(Attr* oldAttr); - /// Removes the specified attribute. - - NodeList* getElementsByTagName(const XMLString& name) const; - /// Returns a NodeList of all descendant elements with a given tag - /// name, in the order in which they would be encountered in a - /// preorder traversal of the Element tree. - /// - /// The special name "*" matches all tags. - /// - /// The returned NodeList must be released with a call - /// to release() when no longer needed. - - void normalize(); - /// Puts all Text nodes in the full depth of the sub-tree underneath this Element, - /// including attribute nodes, into a "normal" form where only markup (e.g., - /// tags, comments, processing instructions, CDATA sections, and entity references) - /// separates Text nodes, i.e., there are no adjacent Text nodes. This can be - /// used to ensure that the DOM view of a document is the same as if it were - /// saved and re-loaded, and is useful when operations (such as XPointer - /// lookups) that depend on a particular document tree structure are to be used. + /// Returns the attribute's value, if the attribute + /// exists, or an empty string otherwise. + + void setAttribute(const XMLString& name, const XMLString& value); + /// Adds a new attribute. If an attribute with that name is already present + /// in the element, its value is changed to be that of the value parameter. + /// This value is a simple string; it is not parsed as it is being set. So any + /// markup (such as syntax to be recognized as an entity reference) is treated + /// as literal text, and needs to be appropriately escaped by the implementation + /// when it is written out. + + void removeAttribute(const XMLString& name); + /// Removes an attribute by name. + + Attr* getAttributeNode(const XMLString& name) const; + /// Retrieves an Attr node by name. + + Attr* setAttributeNode(Attr* newAttr); + /// Adds a new attribute. If an attribute with that name is already + /// present in the element, it is replaced by the new one. + + Attr* addAttributeNodeNP(Attr* oldAttr, Attr* newAttr); + /// For internal use only. + /// Adds a new attribute after oldAttr. + /// If oldAttr is 0, newAttr is set as first attribute. + /// Returns newAttr. + /// Does not fire any events. + + Attr* removeAttributeNode(Attr* oldAttr); + /// Removes the specified attribute. + + NodeList* getElementsByTagName(const XMLString& name) const; + /// Returns a NodeList of all descendant elements with a given tag + /// name, in the order in which they would be encountered in a + /// preorder traversal of the Element tree. + /// + /// The special name "*" matches all tags. /// - /// Note: In cases where the document contains CDATASections, the normalize - /// operation alone may not be sufficient, since XPointers do not differentiate - /// between Text nodes and CDATASection nodes. - - // DOM Level 2 - const XMLString& getAttributeNS(const XMLString& namespaceURI, const XMLString& localName) const; - /// Retrieves an attribute value by name. - /// - /// Returns the attribute's value, if the attribute - /// exists, or an empty string otherwise. - - void setAttributeNS(const XMLString& namespaceURI, const XMLString& qualifiedName, const XMLString& value); - /// Adds a new attribute. If an attribute with that name - /// is already present in the element, its value is changed - /// to be that of the value parameter. - - void removeAttributeNS(const XMLString& namespaceURI, const XMLString& localName); - /// Removes an attribute by name. - - Attr* getAttributeNodeNS(const XMLString& namespaceURI, const XMLString& localName) const; - /// Retrieves an Attr node by name. - - Attr* setAttributeNodeNS(Attr* newAttr); - /// Adds a new attribute. If an attribute with that name is already - /// present in the element, it is replaced by the new one. - - bool hasAttribute(const XMLString& name) const; - /// Returns true if and only if the element has the specified attribute. - - bool hasAttributeNS(const XMLString& namespaceURI, const XMLString& localName) const; - /// Returns true if and only if the element has the specified attribute. - - NodeList* getElementsByTagNameNS(const XMLString& namespaceURI, const XMLString& localName) const; - /// Returns a NodeList of all the descendant Elements with a given local name and namespace URI - /// in the order in which they are encountered in a preorder traversal of this Element tree. - /// - /// The special value "*" matches all namespaces, or local names respectively. - /// - /// The returned NodeList must be released with a call - /// to release() when no longer needed. - - const XMLString& namespaceURI() const; - XMLString prefix() const; - const XMLString& localName() const; - bool hasAttributes() const; - XMLString innerText() const; - - Element* getChildElement(const XMLString& name) const; - /// Returns the first child element with the given name, or null - /// if such an element does not exist. - /// - /// This method is an extension to the W3C Document Object Model. - - Element* getChildElementNS(const XMLString& namespaceURI, const XMLString& localName) const; - /// Returns the first child element with the given namespaceURI and localName, - /// or null if such an element does not exist. - /// - /// This method is an extension to the W3C Document Object Model. - - Element* getElementById(const XMLString& elementId, const XMLString& idAttribute) const; - /// Returns the first Element whose ID attribute (given in idAttribute) - /// has the given elementId. If no such element exists, returns null. - /// - /// This method is an extension to the W3C Document Object Model. - - Element* getElementByIdNS(const XMLString& elementId, const XMLString& idAttributeURI, const XMLString& idAttributeLocalName) const; - /// Returns the first Element whose ID attribute (given in idAttributeURI and idAttributeLocalName) - /// has the given elementId. If no such element exists, returns null. - /// - /// This method is an extension to the W3C Document Object Model. - - // Node - const XMLString& nodeName() const; - NamedNodeMap* attributes() const; - unsigned short nodeType() const; - -protected: - Element(Document* pOwnerDocument, const XMLString& namespaceURI, const XMLString& localName, const XMLString& qname); - Element(Document* pOwnerDocument, const Element& elem); - ~Element(); - - Node* copyNode(bool deep, Document* pOwnerDocument) const; - - void dispatchNodeRemovedFromDocument(); - void dispatchNodeInsertedIntoDocument(); - -private: - const Name& _name; - Attr* _pFirstAttr; - - friend class Attr; - friend class Document; - friend class AttrMap; -}; - - -// -// inlines -// -inline const XMLString& Element::tagName() const -{ - return _name.qname(); -} - - -} } // namespace Poco::XML - - -#endif // DOM_Element_INCLUDED + /// The returned NodeList must be released with a call + /// to release() when no longer needed. + + void normalize(); + /// Puts all Text nodes in the full depth of the sub-tree underneath this Element, + /// including attribute nodes, into a "normal" form where only markup (e.g., + /// tags, comments, processing instructions, CDATA sections, and entity references) + /// separates Text nodes, i.e., there are no adjacent Text nodes. This can be + /// used to ensure that the DOM view of a document is the same as if it were + /// saved and re-loaded, and is useful when operations (such as XPointer + /// lookups) that depend on a particular document tree structure are to be used. + /// + /// Note: In cases where the document contains CDATASections, the normalize + /// operation alone may not be sufficient, since XPointers do not differentiate + /// between Text nodes and CDATASection nodes. + + // DOM Level 2 + const XMLString& getAttributeNS(const XMLString& namespaceURI, const XMLString& localName) const; + /// Retrieves an attribute value by name. + /// + /// Returns the attribute's value, if the attribute + /// exists, or an empty string otherwise. + + void setAttributeNS(const XMLString& namespaceURI, const XMLString& qualifiedName, const XMLString& value); + /// Adds a new attribute. If an attribute with that name + /// is already present in the element, its value is changed + /// to be that of the value parameter. + + void removeAttributeNS(const XMLString& namespaceURI, const XMLString& localName); + /// Removes an attribute by name. + + Attr* getAttributeNodeNS(const XMLString& namespaceURI, const XMLString& localName) const; + /// Retrieves an Attr node by name. + + Attr* setAttributeNodeNS(Attr* newAttr); + /// Adds a new attribute. If an attribute with that name is already + /// present in the element, it is replaced by the new one. + + bool hasAttribute(const XMLString& name) const; + /// Returns true if and only if the element has the specified attribute. + + bool hasAttributeNS(const XMLString& namespaceURI, const XMLString& localName) const; + /// Returns true if and only if the element has the specified attribute. + + NodeList* getElementsByTagNameNS(const XMLString& namespaceURI, const XMLString& localName) const; + /// Returns a NodeList of all the descendant Elements with a given local name and namespace URI + /// in the order in which they are encountered in a preorder traversal of this Element tree. + /// + /// The special value "*" matches all namespaces, or local names respectively. + /// + /// The returned NodeList must be released with a call + /// to release() when no longer needed. + + const XMLString& namespaceURI() const; + XMLString prefix() const; + const XMLString& localName() const; + bool hasAttributes() const; + XMLString innerText() const; + + Element* getChildElement(const XMLString& name) const; + /// Returns the first child element with the given name, or null + /// if such an element does not exist. + /// + /// This method is an extension to the W3C Document Object Model. + + Element* getChildElementNS(const XMLString& namespaceURI, const XMLString& localName) const; + /// Returns the first child element with the given namespaceURI and localName, + /// or null if such an element does not exist. + /// + /// This method is an extension to the W3C Document Object Model. + + Element* getElementById(const XMLString& elementId, const XMLString& idAttribute) const; + /// Returns the first Element whose ID attribute (given in idAttribute) + /// has the given elementId. If no such element exists, returns null. + /// + /// This method is an extension to the W3C Document Object Model. + + Element* getElementByIdNS(const XMLString& elementId, const XMLString& idAttributeURI, const XMLString& idAttributeLocalName) const; + /// Returns the first Element whose ID attribute (given in idAttributeURI and idAttributeLocalName) + /// has the given elementId. If no such element exists, returns null. + /// + /// This method is an extension to the W3C Document Object Model. + + // Node + const XMLString& nodeName() const; + NamedNodeMap* attributes() const; + unsigned short nodeType() const; + +protected: + Element(Document* pOwnerDocument, const XMLString& namespaceURI, const XMLString& localName, const XMLString& qname); + Element(Document* pOwnerDocument, const Element& elem); + ~Element(); + + Node* copyNode(bool deep, Document* pOwnerDocument) const; + + void dispatchNodeRemovedFromDocument(); + void dispatchNodeInsertedIntoDocument(); + +private: + const Name& _name; + Attr* _pFirstAttr; + + friend class Attr; + friend class Document; + friend class AttrMap; +}; + + +// +// inlines +// +inline const XMLString& Element::tagName() const +{ + return _name.qname(); +} + + +} } // namespace Poco::XML + + +#endif // DOM_Element_INCLUDED diff --git a/contrib/libs/poco/XML/include/Poco/DOM/ElementsByTagNameList.h b/contrib/libs/poco/XML/include/Poco/DOM/ElementsByTagNameList.h index 98af2e8207..a44e5af43b 100644 --- a/contrib/libs/poco/XML/include/Poco/DOM/ElementsByTagNameList.h +++ b/contrib/libs/poco/XML/include/Poco/DOM/ElementsByTagNameList.h @@ -1,86 +1,86 @@ -// -// ElementsByTagNameList.h -// -// Library: XML -// Package: DOM -// Module: DOM -// -// Definition of the ElementsByTagNameList and ElementsByTagNameListNS classes. -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef DOM_ElementsByTagNameList_INCLUDED -#define DOM_ElementsByTagNameList_INCLUDED - - -#include "Poco/XML/XML.h" -#include "Poco/DOM/NodeList.h" -#include "Poco/XML/XMLString.h" - - -namespace Poco { -namespace XML { - - -class XML_API ElementsByTagNameList: public NodeList - // This implementation of NodeList is returned - // by Document::getElementsByTagName() and - // Element::getElementsByTagName(). -{ -public: - Node* item(unsigned long index) const; - unsigned long length() const; - void autoRelease(); - -protected: - ElementsByTagNameList(const Node* pParent, const XMLString& name); - ~ElementsByTagNameList(); - - Node* find(const Node* pParent, unsigned long index) const; - - const Node* _pParent; - XMLString _name; - mutable unsigned long _count; - - friend class AbstractContainerNode; - friend class Element; - friend class Document; -}; - - -class XML_API ElementsByTagNameListNS: public NodeList - // This implementation of NodeList is returned - // by Document::getElementsByTagNameNS() and - // Element::getElementsByTagNameNS(). -{ -public: - virtual Node* item(unsigned long index) const; - virtual unsigned long length() const; - virtual void autoRelease(); - -protected: - ElementsByTagNameListNS(const Node* pParent, const XMLString& namespaceURI, const XMLString& localName); - ~ElementsByTagNameListNS(); - - Node* find(const Node* pParent, unsigned long index) const; - - const Node* _pParent; - XMLString _localName; - XMLString _namespaceURI; - mutable unsigned long _count; - - friend class AbstractContainerNode; - friend class Element; - friend class Document; -}; - - -} } // namespace Poco::XML - - -#endif // DOM_ElementsByTagNameList_INCLUDED +// +// ElementsByTagNameList.h +// +// Library: XML +// Package: DOM +// Module: DOM +// +// Definition of the ElementsByTagNameList and ElementsByTagNameListNS classes. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef DOM_ElementsByTagNameList_INCLUDED +#define DOM_ElementsByTagNameList_INCLUDED + + +#include "Poco/XML/XML.h" +#include "Poco/DOM/NodeList.h" +#include "Poco/XML/XMLString.h" + + +namespace Poco { +namespace XML { + + +class XML_API ElementsByTagNameList: public NodeList + // This implementation of NodeList is returned + // by Document::getElementsByTagName() and + // Element::getElementsByTagName(). +{ +public: + Node* item(unsigned long index) const; + unsigned long length() const; + void autoRelease(); + +protected: + ElementsByTagNameList(const Node* pParent, const XMLString& name); + ~ElementsByTagNameList(); + + Node* find(const Node* pParent, unsigned long index) const; + + const Node* _pParent; + XMLString _name; + mutable unsigned long _count; + + friend class AbstractContainerNode; + friend class Element; + friend class Document; +}; + + +class XML_API ElementsByTagNameListNS: public NodeList + // This implementation of NodeList is returned + // by Document::getElementsByTagNameNS() and + // Element::getElementsByTagNameNS(). +{ +public: + virtual Node* item(unsigned long index) const; + virtual unsigned long length() const; + virtual void autoRelease(); + +protected: + ElementsByTagNameListNS(const Node* pParent, const XMLString& namespaceURI, const XMLString& localName); + ~ElementsByTagNameListNS(); + + Node* find(const Node* pParent, unsigned long index) const; + + const Node* _pParent; + XMLString _localName; + XMLString _namespaceURI; + mutable unsigned long _count; + + friend class AbstractContainerNode; + friend class Element; + friend class Document; +}; + + +} } // namespace Poco::XML + + +#endif // DOM_ElementsByTagNameList_INCLUDED diff --git a/contrib/libs/poco/XML/include/Poco/DOM/Entity.h b/contrib/libs/poco/XML/include/Poco/DOM/Entity.h index 40c21f59cd..7fb284b022 100644 --- a/contrib/libs/poco/XML/include/Poco/DOM/Entity.h +++ b/contrib/libs/poco/XML/include/Poco/DOM/Entity.h @@ -1,126 +1,126 @@ -// -// Entity.h -// -// Library: XML -// Package: DOM -// Module: DOM -// -// Definition of the DOM Entity class. -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef DOM_Entity_INCLUDED -#define DOM_Entity_INCLUDED - - -#include "Poco/XML/XML.h" -#include "Poco/DOM/AbstractContainerNode.h" -#include "Poco/XML/XMLString.h" - - -namespace Poco { -namespace XML { - - -class XML_API Entity: public AbstractContainerNode - /// This interface represents an entity, either parsed or unparsed, in an XML - /// document. Note that this models the entity itself not the entity declaration. - /// Entity declaration modeling has been left for a later Level of the DOM - /// specification. - /// - /// The nodeName attribute that is inherited from Node contains the name of - /// the entity. - /// - /// An XML processor may choose to completely expand entities before the structure - /// model is passed to the DOM; in this case there will be no EntityReference - /// nodes in the document tree. - /// - /// XML does not mandate that a non-validating XML processor read and process - /// entity declarations made in the external subset or declared in external - /// parameter entities. This means that parsed entities declared in the external - /// subset need not be expanded by some classes of applications, and that the - /// replacement value of the entity may not be available. When the replacement - /// value is available, the corresponding Entity node's child list represents - /// the structure of that replacement text. Otherwise, the child list is empty. - /// - /// The resolution of the children of the Entity (the replacement value) may - /// be lazily evaluated; actions by the user (such as calling the childNodes - /// method on the Entity Node) are assumed to trigger the evaluation. - /// - /// The DOM Level 1 does not support editing Entity nodes; if a user wants to - /// make changes to the contents of an Entity, every related EntityReference - /// node has to be replaced in the structure model by a clone of the Entity's - /// contents, and then the desired changes must be made to each of those clones - /// instead. Entity nodes and all their descendants are readonly. - /// - /// An Entity node does not have any parent. -{ -public: - const XMLString& publicId() const; - /// Returns the public identifier associated with - /// the entity, if specified. If the public identifier - /// was not specified, this is the empty string. - - const XMLString& systemId() const; - /// Returns the system identifier associated with - /// the entity, if specified. If the system identifier - /// was not specified, this is the empty string. - - const XMLString& notationName() const; - /// Returns, for unparsed entities, the name of the - /// notation for the entity. For parsed entities, this - /// is the empty string. - - // Node - const XMLString& nodeName() const; - unsigned short nodeType() const; - -protected: - Entity(Document* pOwnerDocument, const XMLString& name, const XMLString& publicId, const XMLString& systemId, const XMLString& notationName); - Entity(Document* pOwnerDocument, const Entity& entity); - ~Entity(); - - Node* copyNode(bool deep, Document* pOwnerDocument) const; - -private: - static const XMLString NODE_NAME; - - XMLString _name; - XMLString _publicId; - XMLString _systemId; - XMLString _notationName; - - friend class Document; -}; - - -// -// inlines -// -inline const XMLString& Entity::publicId() const -{ - return _publicId; -} - - -inline const XMLString& Entity::systemId() const -{ - return _systemId; -} - - -inline const XMLString& Entity::notationName() const -{ - return _notationName; -} - - -} } // namespace Poco::XML - - -#endif // DOM_Entity_INCLUDED +// +// Entity.h +// +// Library: XML +// Package: DOM +// Module: DOM +// +// Definition of the DOM Entity class. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef DOM_Entity_INCLUDED +#define DOM_Entity_INCLUDED + + +#include "Poco/XML/XML.h" +#include "Poco/DOM/AbstractContainerNode.h" +#include "Poco/XML/XMLString.h" + + +namespace Poco { +namespace XML { + + +class XML_API Entity: public AbstractContainerNode + /// This interface represents an entity, either parsed or unparsed, in an XML + /// document. Note that this models the entity itself not the entity declaration. + /// Entity declaration modeling has been left for a later Level of the DOM + /// specification. + /// + /// The nodeName attribute that is inherited from Node contains the name of + /// the entity. + /// + /// An XML processor may choose to completely expand entities before the structure + /// model is passed to the DOM; in this case there will be no EntityReference + /// nodes in the document tree. + /// + /// XML does not mandate that a non-validating XML processor read and process + /// entity declarations made in the external subset or declared in external + /// parameter entities. This means that parsed entities declared in the external + /// subset need not be expanded by some classes of applications, and that the + /// replacement value of the entity may not be available. When the replacement + /// value is available, the corresponding Entity node's child list represents + /// the structure of that replacement text. Otherwise, the child list is empty. + /// + /// The resolution of the children of the Entity (the replacement value) may + /// be lazily evaluated; actions by the user (such as calling the childNodes + /// method on the Entity Node) are assumed to trigger the evaluation. + /// + /// The DOM Level 1 does not support editing Entity nodes; if a user wants to + /// make changes to the contents of an Entity, every related EntityReference + /// node has to be replaced in the structure model by a clone of the Entity's + /// contents, and then the desired changes must be made to each of those clones + /// instead. Entity nodes and all their descendants are readonly. + /// + /// An Entity node does not have any parent. +{ +public: + const XMLString& publicId() const; + /// Returns the public identifier associated with + /// the entity, if specified. If the public identifier + /// was not specified, this is the empty string. + + const XMLString& systemId() const; + /// Returns the system identifier associated with + /// the entity, if specified. If the system identifier + /// was not specified, this is the empty string. + + const XMLString& notationName() const; + /// Returns, for unparsed entities, the name of the + /// notation for the entity. For parsed entities, this + /// is the empty string. + + // Node + const XMLString& nodeName() const; + unsigned short nodeType() const; + +protected: + Entity(Document* pOwnerDocument, const XMLString& name, const XMLString& publicId, const XMLString& systemId, const XMLString& notationName); + Entity(Document* pOwnerDocument, const Entity& entity); + ~Entity(); + + Node* copyNode(bool deep, Document* pOwnerDocument) const; + +private: + static const XMLString NODE_NAME; + + XMLString _name; + XMLString _publicId; + XMLString _systemId; + XMLString _notationName; + + friend class Document; +}; + + +// +// inlines +// +inline const XMLString& Entity::publicId() const +{ + return _publicId; +} + + +inline const XMLString& Entity::systemId() const +{ + return _systemId; +} + + +inline const XMLString& Entity::notationName() const +{ + return _notationName; +} + + +} } // namespace Poco::XML + + +#endif // DOM_Entity_INCLUDED diff --git a/contrib/libs/poco/XML/include/Poco/DOM/EntityReference.h b/contrib/libs/poco/XML/include/Poco/DOM/EntityReference.h index 5ecd044b57..a6568a6df9 100644 --- a/contrib/libs/poco/XML/include/Poco/DOM/EntityReference.h +++ b/contrib/libs/poco/XML/include/Poco/DOM/EntityReference.h @@ -1,73 +1,73 @@ -// -// EntityReference.h -// -// Library: XML -// Package: DOM -// Module: DOM -// -// Definition of the DOM EntityReference class. -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef DOM_EntityReference_INCLUDED -#define DOM_EntityReference_INCLUDED - - -#include "Poco/XML/XML.h" -#include "Poco/DOM/AbstractNode.h" -#include "Poco/XML/XMLString.h" - - -namespace Poco { -namespace XML { - - -class XML_API EntityReference: public AbstractNode - /// EntityReference objects may be inserted into the structure model when an - /// entity reference is in the source document, or when the user wishes to insert - /// an entity reference. Note that character references and references to predefined - /// entities are considered to be expanded by the HTML or XML processor so that - /// characters are represented by their Unicode equivalent rather than by an - /// entity reference. Moreover, the XML processor may completely expand references - /// to entities while building the structure model, instead of providing EntityReference - /// objects. If it does provide such objects, then for a given EntityReference - /// node, it may be that there is no Entity node representing the referenced - /// entity. If such an Entity exists, then the child list of the EntityReference - /// node is the same as that of the Entity node. - /// - /// As for Entity nodes, EntityReference nodes and all their descendants are - /// readonly. - /// - /// The resolution of the children of the EntityReference (the replacement value - /// of the referenced Entity) may be lazily evaluated; actions by the user (such - /// as calling the childNodes method on the EntityReference node) are assumed - /// to trigger the evaluation. -{ -public: - // Node - const XMLString& nodeName() const; - unsigned short nodeType() const; - -protected: - EntityReference(Document* pOwnerDocument, const XMLString& name); - EntityReference(Document* pOwnerDocument, const EntityReference& ref); - ~EntityReference(); - - Node* copyNode(bool deep, Document* pOwnerDocument) const; - -private: - XMLString _name; - - friend class Document; -}; - - -} } // namespace Poco::XML - - -#endif // DOM_EntityReference_INCLUDED +// +// EntityReference.h +// +// Library: XML +// Package: DOM +// Module: DOM +// +// Definition of the DOM EntityReference class. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef DOM_EntityReference_INCLUDED +#define DOM_EntityReference_INCLUDED + + +#include "Poco/XML/XML.h" +#include "Poco/DOM/AbstractNode.h" +#include "Poco/XML/XMLString.h" + + +namespace Poco { +namespace XML { + + +class XML_API EntityReference: public AbstractNode + /// EntityReference objects may be inserted into the structure model when an + /// entity reference is in the source document, or when the user wishes to insert + /// an entity reference. Note that character references and references to predefined + /// entities are considered to be expanded by the HTML or XML processor so that + /// characters are represented by their Unicode equivalent rather than by an + /// entity reference. Moreover, the XML processor may completely expand references + /// to entities while building the structure model, instead of providing EntityReference + /// objects. If it does provide such objects, then for a given EntityReference + /// node, it may be that there is no Entity node representing the referenced + /// entity. If such an Entity exists, then the child list of the EntityReference + /// node is the same as that of the Entity node. + /// + /// As for Entity nodes, EntityReference nodes and all their descendants are + /// readonly. + /// + /// The resolution of the children of the EntityReference (the replacement value + /// of the referenced Entity) may be lazily evaluated; actions by the user (such + /// as calling the childNodes method on the EntityReference node) are assumed + /// to trigger the evaluation. +{ +public: + // Node + const XMLString& nodeName() const; + unsigned short nodeType() const; + +protected: + EntityReference(Document* pOwnerDocument, const XMLString& name); + EntityReference(Document* pOwnerDocument, const EntityReference& ref); + ~EntityReference(); + + Node* copyNode(bool deep, Document* pOwnerDocument) const; + +private: + XMLString _name; + + friend class Document; +}; + + +} } // namespace Poco::XML + + +#endif // DOM_EntityReference_INCLUDED diff --git a/contrib/libs/poco/XML/include/Poco/DOM/Event.h b/contrib/libs/poco/XML/include/Poco/DOM/Event.h index 5396aa3f5a..cbdc5f9f50 100644 --- a/contrib/libs/poco/XML/include/Poco/DOM/Event.h +++ b/contrib/libs/poco/XML/include/Poco/DOM/Event.h @@ -1,209 +1,209 @@ -// -// Event.h -// -// Library: XML -// Package: DOM -// Module: DOMEvents -// -// Definition of the DOM Event class. -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef DOM_Event_INCLUDED -#define DOM_Event_INCLUDED - - -#include "Poco/XML/XML.h" -#include "Poco/XML/XMLString.h" -#include "Poco/DOM/DOMObject.h" - - -namespace Poco { -namespace XML { - - -class EventTarget; -class Document; - - -class XML_API Event: public DOMObject - /// The Event interface is used to provide contextual information about an event - /// to the handler processing the event. An object which implements the Event - /// interface is generally passed as the first parameter to an event handler. - /// More specific context information is passed to event handlers by deriving - /// additional interfaces from Event which contain information directly relating - /// to the type of event they accompany. These derived interfaces are also implemented - /// by the object passed to the event listener. -{ -public: - enum PhaseType - { - CAPTURING_PHASE = 1, /// The event is currently being evaluated at the target EventTarget. - AT_TARGET = 2, /// The current event phase is the bubbling phase. - BUBBLING_PHASE = 3 /// The current event phase is the capturing phase. - }; - - const XMLString& type() const; - /// The name of the event (case-insensitive). The name must be an XML name. - - EventTarget* target() const; - /// Used to indicate the EventTarget to which the event was originally dispatched. - - EventTarget* currentTarget() const; - /// Used to indicate the EventTarget whose EventListeners are currently being - /// processed. This is particularly useful during capturing and bubbling. - - PhaseType eventPhase() const; - /// Used to indicate which phase of event flow is currently being evaluated. - - bool bubbles() const; - /// Used to indicate whether or not an event is a bubbling event. - /// If the event can bubble the value is true, else the value is false. - - bool cancelable() const; - /// Used to indicate whether or not an event can have its default action - /// prevented. If the default action can be prevented the value is - /// true, else the value is false. - - Poco::UInt64 timeStamp() const; - /// Used to specify the time (in milliseconds relative to the epoch) at - /// which the event was created. Due to the fact that some - /// systems may not provide this information the value of timeStamp may - /// be not available for all events. When not available, a - /// value of 0 will be returned. Examples of epoch time are the time of the - /// system start or 0:0:0 UTC 1st January 1970. - /// This implementation always returns 0. - - void stopPropagation(); - /// The stopPropagation method is used prevent further propagation of an - /// event during event flow. If this method is called by - /// any EventListener the event will cease propagating through the tree. - /// The event will complete dispatch to all listeners on the - /// current EventTarget before event flow stops. This method may be used - /// during any stage of event flow. - - void preventDefault(); - /// If an event is cancelable, the preventDefault method is used to signify - /// that the event is to be canceled, meaning any default - /// action normally taken by the implementation as a result of - /// the event will not occur. If, during any stage of event flow, the - /// preventDefault method is called the event is canceled. Any default - /// action associated with the event will not occur. Calling - /// this method for a non-cancelable event has no effect. Once - /// preventDefault has been called it will remain in effect throughout - /// the remainder of the event's propagation. This method may be - /// used during any stage of event flow. - - void initEvent(const XMLString& eventType, bool canBubble, bool isCancelable); - /// The initEvent method is used to initialize the value of an - /// Event created through the DocumentEvent interface. This method - /// may only be called before the Event has been dispatched via the - /// dispatchEvent method, though it may be called multiple - /// times during that phase if necessary. If called multiple - /// times the final invocation takes precedence. If called from - /// a subclass of Event interface only the values specified in the - /// initEvent method are modified, all other attributes are left unchanged. - - void autoRelease(); - -protected: - Event(Document* pOwnerDocument, const XMLString& type); - Event(Document* pOwnerDocument, const XMLString& type, EventTarget* pTarget, bool canBubble, bool isCancelable); - ~Event(); - - bool isCanceled() const; - /// returns true if and only if the event has been cancelled. - - bool isStopped() const; - /// returns true if and only if propagation of the event has been stopped. - - void setTarget(EventTarget* pTarget); - /// sets the target - - void setCurrentPhase(PhaseType phase); - /// sets the current phase - - void setCurrentTarget(EventTarget* pTarget); - /// sets the current target - -private: - Document* _pOwner; - XMLString _type; - EventTarget* _pTarget; - EventTarget* _pCurrentTarget; - PhaseType _currentPhase; - bool _bubbles; - bool _cancelable; - bool _canceled; - bool _stopped; - - friend class AbstractNode; -}; - - -// -// inlines -// -inline const XMLString& Event::type() const -{ - return _type; -} - - -inline EventTarget* Event::target() const -{ - return _pTarget; -} - - -inline EventTarget* Event::currentTarget() const -{ - return _pCurrentTarget; -} - - -inline Event::PhaseType Event::eventPhase() const -{ - return _currentPhase; -} - - -inline bool Event::bubbles() const -{ - return _bubbles; -} - - -inline bool Event::cancelable() const -{ - return _cancelable; -} - - -inline Poco::UInt64 Event::timeStamp() const -{ - return 0; -} - - -inline bool Event::isCanceled() const -{ - return _canceled; -} - - -inline bool Event::isStopped() const -{ - return _stopped; -} - - -} } // namespace Poco::XML - - -#endif // DOM_Event_INCLUDED +// +// Event.h +// +// Library: XML +// Package: DOM +// Module: DOMEvents +// +// Definition of the DOM Event class. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef DOM_Event_INCLUDED +#define DOM_Event_INCLUDED + + +#include "Poco/XML/XML.h" +#include "Poco/XML/XMLString.h" +#include "Poco/DOM/DOMObject.h" + + +namespace Poco { +namespace XML { + + +class EventTarget; +class Document; + + +class XML_API Event: public DOMObject + /// The Event interface is used to provide contextual information about an event + /// to the handler processing the event. An object which implements the Event + /// interface is generally passed as the first parameter to an event handler. + /// More specific context information is passed to event handlers by deriving + /// additional interfaces from Event which contain information directly relating + /// to the type of event they accompany. These derived interfaces are also implemented + /// by the object passed to the event listener. +{ +public: + enum PhaseType + { + CAPTURING_PHASE = 1, /// The event is currently being evaluated at the target EventTarget. + AT_TARGET = 2, /// The current event phase is the bubbling phase. + BUBBLING_PHASE = 3 /// The current event phase is the capturing phase. + }; + + const XMLString& type() const; + /// The name of the event (case-insensitive). The name must be an XML name. + + EventTarget* target() const; + /// Used to indicate the EventTarget to which the event was originally dispatched. + + EventTarget* currentTarget() const; + /// Used to indicate the EventTarget whose EventListeners are currently being + /// processed. This is particularly useful during capturing and bubbling. + + PhaseType eventPhase() const; + /// Used to indicate which phase of event flow is currently being evaluated. + + bool bubbles() const; + /// Used to indicate whether or not an event is a bubbling event. + /// If the event can bubble the value is true, else the value is false. + + bool cancelable() const; + /// Used to indicate whether or not an event can have its default action + /// prevented. If the default action can be prevented the value is + /// true, else the value is false. + + Poco::UInt64 timeStamp() const; + /// Used to specify the time (in milliseconds relative to the epoch) at + /// which the event was created. Due to the fact that some + /// systems may not provide this information the value of timeStamp may + /// be not available for all events. When not available, a + /// value of 0 will be returned. Examples of epoch time are the time of the + /// system start or 0:0:0 UTC 1st January 1970. + /// This implementation always returns 0. + + void stopPropagation(); + /// The stopPropagation method is used prevent further propagation of an + /// event during event flow. If this method is called by + /// any EventListener the event will cease propagating through the tree. + /// The event will complete dispatch to all listeners on the + /// current EventTarget before event flow stops. This method may be used + /// during any stage of event flow. + + void preventDefault(); + /// If an event is cancelable, the preventDefault method is used to signify + /// that the event is to be canceled, meaning any default + /// action normally taken by the implementation as a result of + /// the event will not occur. If, during any stage of event flow, the + /// preventDefault method is called the event is canceled. Any default + /// action associated with the event will not occur. Calling + /// this method for a non-cancelable event has no effect. Once + /// preventDefault has been called it will remain in effect throughout + /// the remainder of the event's propagation. This method may be + /// used during any stage of event flow. + + void initEvent(const XMLString& eventType, bool canBubble, bool isCancelable); + /// The initEvent method is used to initialize the value of an + /// Event created through the DocumentEvent interface. This method + /// may only be called before the Event has been dispatched via the + /// dispatchEvent method, though it may be called multiple + /// times during that phase if necessary. If called multiple + /// times the final invocation takes precedence. If called from + /// a subclass of Event interface only the values specified in the + /// initEvent method are modified, all other attributes are left unchanged. + + void autoRelease(); + +protected: + Event(Document* pOwnerDocument, const XMLString& type); + Event(Document* pOwnerDocument, const XMLString& type, EventTarget* pTarget, bool canBubble, bool isCancelable); + ~Event(); + + bool isCanceled() const; + /// returns true if and only if the event has been cancelled. + + bool isStopped() const; + /// returns true if and only if propagation of the event has been stopped. + + void setTarget(EventTarget* pTarget); + /// sets the target + + void setCurrentPhase(PhaseType phase); + /// sets the current phase + + void setCurrentTarget(EventTarget* pTarget); + /// sets the current target + +private: + Document* _pOwner; + XMLString _type; + EventTarget* _pTarget; + EventTarget* _pCurrentTarget; + PhaseType _currentPhase; + bool _bubbles; + bool _cancelable; + bool _canceled; + bool _stopped; + + friend class AbstractNode; +}; + + +// +// inlines +// +inline const XMLString& Event::type() const +{ + return _type; +} + + +inline EventTarget* Event::target() const +{ + return _pTarget; +} + + +inline EventTarget* Event::currentTarget() const +{ + return _pCurrentTarget; +} + + +inline Event::PhaseType Event::eventPhase() const +{ + return _currentPhase; +} + + +inline bool Event::bubbles() const +{ + return _bubbles; +} + + +inline bool Event::cancelable() const +{ + return _cancelable; +} + + +inline Poco::UInt64 Event::timeStamp() const +{ + return 0; +} + + +inline bool Event::isCanceled() const +{ + return _canceled; +} + + +inline bool Event::isStopped() const +{ + return _stopped; +} + + +} } // namespace Poco::XML + + +#endif // DOM_Event_INCLUDED diff --git a/contrib/libs/poco/XML/include/Poco/DOM/EventDispatcher.h b/contrib/libs/poco/XML/include/Poco/DOM/EventDispatcher.h index 4e825df9c4..b97a8dafd5 100644 --- a/contrib/libs/poco/XML/include/Poco/DOM/EventDispatcher.h +++ b/contrib/libs/poco/XML/include/Poco/DOM/EventDispatcher.h @@ -1,97 +1,97 @@ -// -// EventDispatcher.h -// -// Library: XML -// Package: DOM -// Module: DOMEvents -// -// Definition of the EventDispatcher class. -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef DOM_EventDispatcher_INCLUDED -#define DOM_EventDispatcher_INCLUDED - - -#include "Poco/XML/XML.h" -#include "Poco/XML/XMLString.h" -#include <list> - - -namespace Poco { -namespace XML { - - -class Event; -class EventListener; - - -class XML_API EventDispatcher - /// This helper class manages event listener subscriptions - /// and event dispatching for AbstractNode. - /// - /// The EventListener list is managed in such a way that - /// event listeners can be added and removed even - /// from within an EventListener, while events are being - /// dispatched. -{ -public: - EventDispatcher(); - /// Creates the EventDispatcher. - - ~EventDispatcher(); - /// Destroys the EventDispatcher. - - void addEventListener(const XMLString& type, EventListener* listener, bool useCapture); - /// Adds an EventListener to the internal list. - - void removeEventListener(const XMLString& type, EventListener* listener, bool useCapture); - /// Removes an EventListener from the internal list. - /// - /// If a dispatch is currently in progress, the list - /// entry is only marked for deletion. - /// If no dispatch is currently in progress, all EventListeners - /// marked for deletion are removed from the list. - - void dispatchEvent(Event* evt); - /// Dispatches the event. - /// - /// Also removes all EventListeners marked for deletion from the - /// event dispatcher list. - - void captureEvent(Event* evt); - /// Dispatches the event in its capturing phase. - /// - /// Also removes all EventListeners marked for deletion from the - /// event dispatcher list. - - void bubbleEvent(Event* evt); - /// Dispatches the event in its bubbling phase. - /// - /// Also removes all EventListeners marked for deletion from the - /// event dispatcher list. - -private: - struct EventListenerItem - { - XMLString type; - EventListener* pListener; - bool useCapture; - }; - - typedef std::list<EventListenerItem> EventListenerList; - - int _inDispatch; - EventListenerList _listeners; -}; - - -} } // namespace Poco::XML - - -#endif // DOM_EventDispatcher_INCLUDED +// +// EventDispatcher.h +// +// Library: XML +// Package: DOM +// Module: DOMEvents +// +// Definition of the EventDispatcher class. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef DOM_EventDispatcher_INCLUDED +#define DOM_EventDispatcher_INCLUDED + + +#include "Poco/XML/XML.h" +#include "Poco/XML/XMLString.h" +#include <list> + + +namespace Poco { +namespace XML { + + +class Event; +class EventListener; + + +class XML_API EventDispatcher + /// This helper class manages event listener subscriptions + /// and event dispatching for AbstractNode. + /// + /// The EventListener list is managed in such a way that + /// event listeners can be added and removed even + /// from within an EventListener, while events are being + /// dispatched. +{ +public: + EventDispatcher(); + /// Creates the EventDispatcher. + + ~EventDispatcher(); + /// Destroys the EventDispatcher. + + void addEventListener(const XMLString& type, EventListener* listener, bool useCapture); + /// Adds an EventListener to the internal list. + + void removeEventListener(const XMLString& type, EventListener* listener, bool useCapture); + /// Removes an EventListener from the internal list. + /// + /// If a dispatch is currently in progress, the list + /// entry is only marked for deletion. + /// If no dispatch is currently in progress, all EventListeners + /// marked for deletion are removed from the list. + + void dispatchEvent(Event* evt); + /// Dispatches the event. + /// + /// Also removes all EventListeners marked for deletion from the + /// event dispatcher list. + + void captureEvent(Event* evt); + /// Dispatches the event in its capturing phase. + /// + /// Also removes all EventListeners marked for deletion from the + /// event dispatcher list. + + void bubbleEvent(Event* evt); + /// Dispatches the event in its bubbling phase. + /// + /// Also removes all EventListeners marked for deletion from the + /// event dispatcher list. + +private: + struct EventListenerItem + { + XMLString type; + EventListener* pListener; + bool useCapture; + }; + + typedef std::list<EventListenerItem> EventListenerList; + + int _inDispatch; + EventListenerList _listeners; +}; + + +} } // namespace Poco::XML + + +#endif // DOM_EventDispatcher_INCLUDED diff --git a/contrib/libs/poco/XML/include/Poco/DOM/EventException.h b/contrib/libs/poco/XML/include/Poco/DOM/EventException.h index cb82441058..b2f3561fe0 100644 --- a/contrib/libs/poco/XML/include/Poco/DOM/EventException.h +++ b/contrib/libs/poco/XML/include/Poco/DOM/EventException.h @@ -1,81 +1,81 @@ -// -// EventException.h -// -// Library: XML -// Package: DOM -// Module: DOMEvents -// -// Definition of the DOM EventException class. -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef DOM_EventException_INCLUDED -#define DOM_EventException_INCLUDED - - -#include "Poco/XML/XML.h" -#include "Poco/XML/XMLException.h" - - -namespace Poco { -namespace XML { - - -class XML_API EventException: public XMLException - /// Event operations may throw an EventException as - /// specified in their method descriptions. -{ -public: - enum - { - UNSPECIFIED_EVENT_TYPE_ERR = 0 /// If the Event's type was not specified by initializing the - /// event before the method was called. Specification of the Event's - /// type as null or an empty string will also trigger this exception. - }; - - EventException(int code); - /// Creates an EventException with the given error code. - - EventException(const EventException& exc); - /// Creates an EventException by copying another one. - - ~EventException() noexcept; - /// Destroys the EventException. - - EventException& operator = (const EventException& exc); - +// +// EventException.h +// +// Library: XML +// Package: DOM +// Module: DOMEvents +// +// Definition of the DOM EventException class. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef DOM_EventException_INCLUDED +#define DOM_EventException_INCLUDED + + +#include "Poco/XML/XML.h" +#include "Poco/XML/XMLException.h" + + +namespace Poco { +namespace XML { + + +class XML_API EventException: public XMLException + /// Event operations may throw an EventException as + /// specified in their method descriptions. +{ +public: + enum + { + UNSPECIFIED_EVENT_TYPE_ERR = 0 /// If the Event's type was not specified by initializing the + /// event before the method was called. Specification of the Event's + /// type as null or an empty string will also trigger this exception. + }; + + EventException(int code); + /// Creates an EventException with the given error code. + + EventException(const EventException& exc); + /// Creates an EventException by copying another one. + + ~EventException() noexcept; + /// Destroys the EventException. + + EventException& operator = (const EventException& exc); + const char* name() const noexcept; - /// Returns a static string describing the exception. - + /// Returns a static string describing the exception. + const char* className() const noexcept; - /// Returns the name of the exception class. - - unsigned short code() const; - /// Returns the Event exception code. - -protected: - Poco::Exception* clone() const; - -private: - EventException(); -}; - - -// -// inlines -// -inline unsigned short EventException::code() const -{ - return UNSPECIFIED_EVENT_TYPE_ERR; -} - - -} } // namespace Poco::XML - - -#endif // DOM_EventException_INCLUDED + /// Returns the name of the exception class. + + unsigned short code() const; + /// Returns the Event exception code. + +protected: + Poco::Exception* clone() const; + +private: + EventException(); +}; + + +// +// inlines +// +inline unsigned short EventException::code() const +{ + return UNSPECIFIED_EVENT_TYPE_ERR; +} + + +} } // namespace Poco::XML + + +#endif // DOM_EventException_INCLUDED diff --git a/contrib/libs/poco/XML/include/Poco/DOM/EventListener.h b/contrib/libs/poco/XML/include/Poco/DOM/EventListener.h index f0951b10a2..ed358a8194 100644 --- a/contrib/libs/poco/XML/include/Poco/DOM/EventListener.h +++ b/contrib/libs/poco/XML/include/Poco/DOM/EventListener.h @@ -1,57 +1,57 @@ -// -// EventListener.h -// -// Library: XML -// Package: DOM -// Module: DOMEvents -// -// Definition of the DOM EventListener interface. -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef DOM_EventListener_INCLUDED -#define DOM_EventListener_INCLUDED - - -#include "Poco/XML/XML.h" -#include "Poco/XML/XMLString.h" - - -namespace Poco { -namespace XML { - - -class Event; - - -class XML_API EventListener - /// The EventListener interface is the primary method for handling events. Users - /// implement the EventListener interface and register their listener on an - /// EventTarget using the AddEventListener method. The users should also remove - /// their EventListener from its EventTarget after they have completed using - /// the listener. - /// - /// When a Node is copied using the cloneNode method the EventListeners attached - /// to the source Node are not attached to the copied Node. If the user wishes - /// the same EventListeners to be added to the newly created copy the user must - /// add them manually. -{ -public: - virtual void handleEvent(Event* evt) = 0; - /// This method is called whenever an event occurs of the - /// type for which the EventListener interface was registered. - -protected: - virtual ~EventListener(); -}; - - -} } // namespace Poco::XML - - -#endif // DOM_EventListener_INCLUDED +// +// EventListener.h +// +// Library: XML +// Package: DOM +// Module: DOMEvents +// +// Definition of the DOM EventListener interface. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef DOM_EventListener_INCLUDED +#define DOM_EventListener_INCLUDED + + +#include "Poco/XML/XML.h" +#include "Poco/XML/XMLString.h" + + +namespace Poco { +namespace XML { + + +class Event; + + +class XML_API EventListener + /// The EventListener interface is the primary method for handling events. Users + /// implement the EventListener interface and register their listener on an + /// EventTarget using the AddEventListener method. The users should also remove + /// their EventListener from its EventTarget after they have completed using + /// the listener. + /// + /// When a Node is copied using the cloneNode method the EventListeners attached + /// to the source Node are not attached to the copied Node. If the user wishes + /// the same EventListeners to be added to the newly created copy the user must + /// add them manually. +{ +public: + virtual void handleEvent(Event* evt) = 0; + /// This method is called whenever an event occurs of the + /// type for which the EventListener interface was registered. + +protected: + virtual ~EventListener(); +}; + + +} } // namespace Poco::XML + + +#endif // DOM_EventListener_INCLUDED diff --git a/contrib/libs/poco/XML/include/Poco/DOM/EventTarget.h b/contrib/libs/poco/XML/include/Poco/DOM/EventTarget.h index 466d2151ed..34ba6ddbf4 100644 --- a/contrib/libs/poco/XML/include/Poco/DOM/EventTarget.h +++ b/contrib/libs/poco/XML/include/Poco/DOM/EventTarget.h @@ -1,76 +1,76 @@ -// -// EventTarget.h -// -// Library: XML -// Package: DOM -// Module: DOMEvents -// -// Definition of the DOM EventTarget interface. -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef DOM_EventTarget_INCLUDED -#define DOM_EventTarget_INCLUDED - - -#include "Poco/XML/XML.h" -#include "Poco/DOM/DOMObject.h" -#include "Poco/XML/XMLString.h" - - -namespace Poco { -namespace XML { - - -class EventListener; -class Event; - - -class XML_API EventTarget: public DOMObject - /// The EventTarget interface is implemented by all Nodes in an implementation - /// which supports the DOM Event Model. Therefore, this interface can be obtained - /// by using binding-specific casting methods on an instance of the Node interface. - /// The interface allows registration and removal of EventListeners on an EventTarget - /// and dispatch of events to that EventTarget. -{ -public: - virtual void addEventListener(const XMLString& type, EventListener* listener, bool useCapture) = 0; - /// This method allows the registration of event listeners on - /// the event target. If an EventListener is added to an - /// EventTarget while it is processing an event, it will not - /// be triggered by the current actions but may be triggered - /// during a later stage of event flow, such as the bubbling phase. - /// If multiple identical EventListeners are registered on the same - /// EventTarget with the same parameters the duplicate instances are - /// discarded. They do not cause the EventListener to be called twice and since they are - /// discarded they do not need to be removed with the removeEventListener method. - - virtual void removeEventListener(const XMLString& type, EventListener* listener, bool useCapture) = 0; - /// This method allows the removal of event listeners from the event - /// target. If an EventListener is removed from an EventTarget while it is - /// processing an event, it will not be triggered by the current actions. - /// EventListeners can never be invoked after being removed. - /// Calling removeEventListener with arguments which do not identify - /// any currently registered EventListener on the EventTarget has no effect. - - virtual bool dispatchEvent(Event* evt) = 0; - /// This method allows the dispatch of events into the implementations - /// event model. Events dispatched in this manner will have the same capturing and - /// bubbling behavior as events dispatched directly by the - /// implementation. The target of the event is the EventTarget on - /// which dispatchEvent is called. - -protected: - virtual ~EventTarget(); -}; - - -} } // namespace Poco::XML - - -#endif // DOM_EventTarget_INCLUDED +// +// EventTarget.h +// +// Library: XML +// Package: DOM +// Module: DOMEvents +// +// Definition of the DOM EventTarget interface. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef DOM_EventTarget_INCLUDED +#define DOM_EventTarget_INCLUDED + + +#include "Poco/XML/XML.h" +#include "Poco/DOM/DOMObject.h" +#include "Poco/XML/XMLString.h" + + +namespace Poco { +namespace XML { + + +class EventListener; +class Event; + + +class XML_API EventTarget: public DOMObject + /// The EventTarget interface is implemented by all Nodes in an implementation + /// which supports the DOM Event Model. Therefore, this interface can be obtained + /// by using binding-specific casting methods on an instance of the Node interface. + /// The interface allows registration and removal of EventListeners on an EventTarget + /// and dispatch of events to that EventTarget. +{ +public: + virtual void addEventListener(const XMLString& type, EventListener* listener, bool useCapture) = 0; + /// This method allows the registration of event listeners on + /// the event target. If an EventListener is added to an + /// EventTarget while it is processing an event, it will not + /// be triggered by the current actions but may be triggered + /// during a later stage of event flow, such as the bubbling phase. + /// If multiple identical EventListeners are registered on the same + /// EventTarget with the same parameters the duplicate instances are + /// discarded. They do not cause the EventListener to be called twice and since they are + /// discarded they do not need to be removed with the removeEventListener method. + + virtual void removeEventListener(const XMLString& type, EventListener* listener, bool useCapture) = 0; + /// This method allows the removal of event listeners from the event + /// target. If an EventListener is removed from an EventTarget while it is + /// processing an event, it will not be triggered by the current actions. + /// EventListeners can never be invoked after being removed. + /// Calling removeEventListener with arguments which do not identify + /// any currently registered EventListener on the EventTarget has no effect. + + virtual bool dispatchEvent(Event* evt) = 0; + /// This method allows the dispatch of events into the implementations + /// event model. Events dispatched in this manner will have the same capturing and + /// bubbling behavior as events dispatched directly by the + /// implementation. The target of the event is the EventTarget on + /// which dispatchEvent is called. + +protected: + virtual ~EventTarget(); +}; + + +} } // namespace Poco::XML + + +#endif // DOM_EventTarget_INCLUDED diff --git a/contrib/libs/poco/XML/include/Poco/DOM/MutationEvent.h b/contrib/libs/poco/XML/include/Poco/DOM/MutationEvent.h index 33a8521c50..aede86ec63 100644 --- a/contrib/libs/poco/XML/include/Poco/DOM/MutationEvent.h +++ b/contrib/libs/poco/XML/include/Poco/DOM/MutationEvent.h @@ -1,143 +1,143 @@ -// -// MutationEvent.h -// -// Library: XML -// Package: DOM -// Module: DOMEvents -// -// Definition of the DOM MutationEvent class. -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef DOM_MutationEvent_INCLUDED -#define DOM_MutationEvent_INCLUDED - - -#include "Poco/XML/XML.h" -#include "Poco/DOM/Event.h" - - -namespace Poco { -namespace XML { - - -class Node; - - -class XML_API MutationEvent: public Event - /// The MutationEvent interface provides specific contextual - /// information associated with Mutation events. -{ -public: - enum AttrChangeType - { - MODIFICATION = 1, /// The Attr was modified in place. - ADDITION = 2, /// The Attr was just added. - REMOVAL = 3 /// The Attr was just removed. - }; - - Node* relatedNode() const; - /// relatedNode is used to identify a secondary node related to a mutation - /// event. For example, if a mutation event is dispatched - /// to a node indicating that its parent has changed, the relatedNode is the - /// changed parent. If an event is instead dispatched to a - /// subtree indicating a node was changed within it, the relatedNode is - /// the changed node. In the case of the DOMAttrModified - /// event it indicates the Attr node which was modified, added, or removed. - - const XMLString& prevValue() const; - /// prevValue indicates the previous value of the Attr node in DOMAttrModified - /// events, and of the CharacterData node in DOMCharDataModified events. - - const XMLString& newValue() const; - /// newValue indicates the new value of the Attr node in DOMAttrModified - /// events, and of the CharacterData node in DOMCharDataModified events. - - const XMLString& attrName() const; - /// attrName indicates the name of the changed Attr node in a DOMAttrModified event. - - AttrChangeType attrChange() const; - /// attrChange indicates the type of change which triggered the - /// DOMAttrModified event. The values can be MODIFICATION, - /// ADDITION, or REMOVAL. - - void initMutationEvent(const XMLString& type, bool canBubble, bool cancelable, Node* relatedNode, - const XMLString& prevValue, const XMLString& newValue, const XMLString& attrName, AttrChangeType change); - /// The initMutationEvent method is used to initialize the value of a - /// MutationEvent created through the DocumentEvent - /// interface. This method may only be called before the MutationEvent - /// has been dispatched via the dispatchEvent method, - /// though it may be called multiple times during that phase if - /// necessary. If called multiple times, the final invocation takes - /// precedence. - - // Event Types - static const XMLString DOMSubtreeModified; - static const XMLString DOMNodeInserted; - static const XMLString DOMNodeRemoved; - static const XMLString DOMNodeRemovedFromDocument; - static const XMLString DOMNodeInsertedIntoDocument; - static const XMLString DOMAttrModified; - static const XMLString DOMCharacterDataModified; - -protected: - MutationEvent(Document* pOwnerDocument, const XMLString& type); - MutationEvent(Document* pOwnerDocument, const XMLString& type, EventTarget* pTarget, bool canBubble, bool cancelable, Node* relatedNode); - MutationEvent(Document* pOwnerDocument, const XMLString& type, EventTarget* pTarget, bool canBubble, bool cancelable, Node* relatedNode, - const XMLString& prevValue, const XMLString& newValue, const XMLString& attrName, AttrChangeType change); - ~MutationEvent(); - -private: - XMLString _prevValue; - XMLString _newValue; - XMLString _attrName; - AttrChangeType _change; - Node* _pRelatedNode; - - friend class AbstractNode; - friend class Document; -}; - - -// -// inlines -// -inline Node* MutationEvent::relatedNode() const -{ - return _pRelatedNode; -} - - -inline const XMLString& MutationEvent::prevValue() const -{ - return _prevValue; -} - - -inline const XMLString& MutationEvent::newValue() const -{ - return _newValue; -} - - -inline const XMLString& MutationEvent::attrName() const -{ - return _attrName; -} - - -inline MutationEvent::AttrChangeType MutationEvent::attrChange() const -{ - return _change; -} - - -} } // namespace Poco::XML - - -#endif // DOM_MutationEvent_INCLUDED +// +// MutationEvent.h +// +// Library: XML +// Package: DOM +// Module: DOMEvents +// +// Definition of the DOM MutationEvent class. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef DOM_MutationEvent_INCLUDED +#define DOM_MutationEvent_INCLUDED + + +#include "Poco/XML/XML.h" +#include "Poco/DOM/Event.h" + + +namespace Poco { +namespace XML { + + +class Node; + + +class XML_API MutationEvent: public Event + /// The MutationEvent interface provides specific contextual + /// information associated with Mutation events. +{ +public: + enum AttrChangeType + { + MODIFICATION = 1, /// The Attr was modified in place. + ADDITION = 2, /// The Attr was just added. + REMOVAL = 3 /// The Attr was just removed. + }; + + Node* relatedNode() const; + /// relatedNode is used to identify a secondary node related to a mutation + /// event. For example, if a mutation event is dispatched + /// to a node indicating that its parent has changed, the relatedNode is the + /// changed parent. If an event is instead dispatched to a + /// subtree indicating a node was changed within it, the relatedNode is + /// the changed node. In the case of the DOMAttrModified + /// event it indicates the Attr node which was modified, added, or removed. + + const XMLString& prevValue() const; + /// prevValue indicates the previous value of the Attr node in DOMAttrModified + /// events, and of the CharacterData node in DOMCharDataModified events. + + const XMLString& newValue() const; + /// newValue indicates the new value of the Attr node in DOMAttrModified + /// events, and of the CharacterData node in DOMCharDataModified events. + + const XMLString& attrName() const; + /// attrName indicates the name of the changed Attr node in a DOMAttrModified event. + + AttrChangeType attrChange() const; + /// attrChange indicates the type of change which triggered the + /// DOMAttrModified event. The values can be MODIFICATION, + /// ADDITION, or REMOVAL. + + void initMutationEvent(const XMLString& type, bool canBubble, bool cancelable, Node* relatedNode, + const XMLString& prevValue, const XMLString& newValue, const XMLString& attrName, AttrChangeType change); + /// The initMutationEvent method is used to initialize the value of a + /// MutationEvent created through the DocumentEvent + /// interface. This method may only be called before the MutationEvent + /// has been dispatched via the dispatchEvent method, + /// though it may be called multiple times during that phase if + /// necessary. If called multiple times, the final invocation takes + /// precedence. + + // Event Types + static const XMLString DOMSubtreeModified; + static const XMLString DOMNodeInserted; + static const XMLString DOMNodeRemoved; + static const XMLString DOMNodeRemovedFromDocument; + static const XMLString DOMNodeInsertedIntoDocument; + static const XMLString DOMAttrModified; + static const XMLString DOMCharacterDataModified; + +protected: + MutationEvent(Document* pOwnerDocument, const XMLString& type); + MutationEvent(Document* pOwnerDocument, const XMLString& type, EventTarget* pTarget, bool canBubble, bool cancelable, Node* relatedNode); + MutationEvent(Document* pOwnerDocument, const XMLString& type, EventTarget* pTarget, bool canBubble, bool cancelable, Node* relatedNode, + const XMLString& prevValue, const XMLString& newValue, const XMLString& attrName, AttrChangeType change); + ~MutationEvent(); + +private: + XMLString _prevValue; + XMLString _newValue; + XMLString _attrName; + AttrChangeType _change; + Node* _pRelatedNode; + + friend class AbstractNode; + friend class Document; +}; + + +// +// inlines +// +inline Node* MutationEvent::relatedNode() const +{ + return _pRelatedNode; +} + + +inline const XMLString& MutationEvent::prevValue() const +{ + return _prevValue; +} + + +inline const XMLString& MutationEvent::newValue() const +{ + return _newValue; +} + + +inline const XMLString& MutationEvent::attrName() const +{ + return _attrName; +} + + +inline MutationEvent::AttrChangeType MutationEvent::attrChange() const +{ + return _change; +} + + +} } // namespace Poco::XML + + +#endif // DOM_MutationEvent_INCLUDED diff --git a/contrib/libs/poco/XML/include/Poco/DOM/NamedNodeMap.h b/contrib/libs/poco/XML/include/Poco/DOM/NamedNodeMap.h index 7b42ca88f4..209ee6b080 100644 --- a/contrib/libs/poco/XML/include/Poco/DOM/NamedNodeMap.h +++ b/contrib/libs/poco/XML/include/Poco/DOM/NamedNodeMap.h @@ -1,93 +1,93 @@ -// -// NamedNodeMap.h -// -// Library: XML -// Package: DOM -// Module: DOM -// -// Definition of the DOM NamedNodeMap interface. -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef DOM_NamedNodeMap_INCLUDED -#define DOM_NamedNodeMap_INCLUDED - - -#include "Poco/XML/XML.h" -#include "Poco/DOM/DOMObject.h" -#include "Poco/XML/XMLString.h" - - -namespace Poco { -namespace XML { - - -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(); -}; - - -} } // namespace Poco::XML - - -#endif // DOM_NamedNodeMap_INCLUDED +// +// NamedNodeMap.h +// +// Library: XML +// Package: DOM +// Module: DOM +// +// Definition of the DOM NamedNodeMap interface. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef DOM_NamedNodeMap_INCLUDED +#define DOM_NamedNodeMap_INCLUDED + + +#include "Poco/XML/XML.h" +#include "Poco/DOM/DOMObject.h" +#include "Poco/XML/XMLString.h" + + +namespace Poco { +namespace XML { + + +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(); +}; + + +} } // namespace Poco::XML + + +#endif // DOM_NamedNodeMap_INCLUDED diff --git a/contrib/libs/poco/XML/include/Poco/DOM/Node.h b/contrib/libs/poco/XML/include/Poco/DOM/Node.h index f6a3c4afd4..7b04deb4f6 100644 --- a/contrib/libs/poco/XML/include/Poco/DOM/Node.h +++ b/contrib/libs/poco/XML/include/Poco/DOM/Node.h @@ -1,285 +1,285 @@ -// -// Node.h -// -// Library: XML -// Package: DOM -// Module: DOM -// -// Definition of the DOM Node interface. -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef DOM_Node_INCLUDED -#define DOM_Node_INCLUDED - - -#include "Poco/XML/XML.h" -#include "Poco/DOM/EventTarget.h" -#include "Poco/XML/XMLString.h" -#include "Poco/SAX/NamespaceSupport.h" - - -namespace Poco { -namespace XML { - - -class NamedNodeMap; -class Document; -class NodeList; - - -class XML_API Node: public EventTarget - /// The Node interface is the primary datatype for the entire Document Object - /// Model. It represents a single node in the document tree. While all objects - /// implementing the Node interface expose methods for dealing with children, - /// not all objects implementing the Node interface may have children. For - /// example, Text nodes may not have children, and adding children to such - /// nodes results in a DOMException being raised. +// +// Node.h +// +// Library: XML +// Package: DOM +// Module: DOM +// +// Definition of the DOM Node interface. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef DOM_Node_INCLUDED +#define DOM_Node_INCLUDED + + +#include "Poco/XML/XML.h" +#include "Poco/DOM/EventTarget.h" +#include "Poco/XML/XMLString.h" +#include "Poco/SAX/NamespaceSupport.h" + + +namespace Poco { +namespace XML { + + +class NamedNodeMap; +class Document; +class NodeList; + + +class XML_API Node: public EventTarget + /// The Node interface is the primary datatype for the entire Document Object + /// Model. It represents a single node in the document tree. While all objects + /// implementing the Node interface expose methods for dealing with children, + /// not all objects implementing the Node interface may have children. For + /// example, Text nodes may not have children, and adding children to such + /// nodes results in a DOMException being raised. + /// + /// The attributes nodeName, nodeValue and attributes are included as a mechanism + /// to get at node information without casting down to the specific derived + /// interface. In cases where there is no obvious mapping of these attributes + /// for a specific nodeType (e.g., nodeValue for an Element or attributes for + /// a Comment), this returns null. Note that the specialized interfaces may + /// contain additional and more convenient mechanisms to get and set the relevant + /// information. /// - /// The attributes nodeName, nodeValue and attributes are included as a mechanism - /// to get at node information without casting down to the specific derived - /// interface. In cases where there is no obvious mapping of these attributes - /// for a specific nodeType (e.g., nodeValue for an Element or attributes for - /// a Comment), this returns null. Note that the specialized interfaces may - /// contain additional and more convenient mechanisms to get and set the relevant - /// information. - /// - /// This implementation differs in some ways from the W3C DOM recommendations. - /// For example, the DOM specifies that some methods can return null strings. - /// Instead of null strings, this implementation always returns empty strings. -{ -public: - enum - { - ELEMENT_NODE = 1, /// The node is an Element. - ATTRIBUTE_NODE, /// The node is an Attr. - TEXT_NODE, /// The node is a Text node. - CDATA_SECTION_NODE, /// The node is a CDATASection. - ENTITY_REFERENCE_NODE, /// The node is an EntityReference. - ENTITY_NODE, /// The node is an Entity. - PROCESSING_INSTRUCTION_NODE, /// The node is a ProcessingInstruction. - COMMENT_NODE, /// The node is a Comment. - DOCUMENT_NODE, /// The node is a Document. - DOCUMENT_TYPE_NODE, /// The node is a DocumentType. - DOCUMENT_FRAGMENT_NODE, /// The node is a DocumentFragment. - NOTATION_NODE /// The node is a Notation. - }; - - virtual const XMLString& nodeName() const = 0; - /// Returns the name of this node, depending on its type. - - const XMLString& nodeValue() const; - /// Returns the value of this node, depending on its type. - - virtual const XMLString& getNodeValue() const = 0; - /// Returns the value of this node, depending on its type. - - virtual void setNodeValue(const XMLString& value) = 0; - /// Sets the value of this node. Throws an exception - /// if the node is read-only. - - virtual unsigned short nodeType() const = 0; - /// Returns a code representing the type of the underlying object. - - virtual Node* parentNode() const = 0; - /// The parent of this node. All nodes, except Attr, Document, DocumentFragment, - /// Entity, and Notation may have a parent. However, if a node has just been - /// created and not yet added to the tree, or if it has been removed from the - /// tree, this is null. - - virtual NodeList* childNodes() const = 0; - /// Returns a NodeList containing all children of this node. - /// - /// The returned NodeList must be released with a call - /// to release() when no longer needed. - - virtual Node* firstChild() const = 0; - /// Returns the first child of this node. If there is no such - /// node, this returns null. - - virtual Node* lastChild() const = 0; - /// Returns the last child of this node. If there is no such - /// node, this returns null. - - virtual Node* previousSibling() const = 0; - /// Returns the node immediately preceding this node. If there - /// is no such node, this returns null. - - virtual Node* nextSibling() const = 0; - /// Returns the node immediately following this node. If there - /// is no such node, this returns null. - - virtual NamedNodeMap* attributes() const = 0; - /// Returns a NamedNodeMap containing the attributes of this - /// node (if it is an Element) or null otherwise. + /// This implementation differs in some ways from the W3C DOM recommendations. + /// For example, the DOM specifies that some methods can return null strings. + /// Instead of null strings, this implementation always returns empty strings. +{ +public: + enum + { + ELEMENT_NODE = 1, /// The node is an Element. + ATTRIBUTE_NODE, /// The node is an Attr. + TEXT_NODE, /// The node is a Text node. + CDATA_SECTION_NODE, /// The node is a CDATASection. + ENTITY_REFERENCE_NODE, /// The node is an EntityReference. + ENTITY_NODE, /// The node is an Entity. + PROCESSING_INSTRUCTION_NODE, /// The node is a ProcessingInstruction. + COMMENT_NODE, /// The node is a Comment. + DOCUMENT_NODE, /// The node is a Document. + DOCUMENT_TYPE_NODE, /// The node is a DocumentType. + DOCUMENT_FRAGMENT_NODE, /// The node is a DocumentFragment. + NOTATION_NODE /// The node is a Notation. + }; + + virtual const XMLString& nodeName() const = 0; + /// Returns the name of this node, depending on its type. + + const XMLString& nodeValue() const; + /// Returns the value of this node, depending on its type. + + virtual const XMLString& getNodeValue() const = 0; + /// Returns the value of this node, depending on its type. + + virtual void setNodeValue(const XMLString& value) = 0; + /// Sets the value of this node. Throws an exception + /// if the node is read-only. + + virtual unsigned short nodeType() const = 0; + /// Returns a code representing the type of the underlying object. + + virtual Node* parentNode() const = 0; + /// The parent of this node. All nodes, except Attr, Document, DocumentFragment, + /// Entity, and Notation may have a parent. However, if a node has just been + /// created and not yet added to the tree, or if it has been removed from the + /// tree, this is null. + + virtual NodeList* childNodes() const = 0; + /// Returns a NodeList containing all children of this node. /// - /// The returned NamedNodeMap must be released with a call - /// to release() when no longer needed. - - virtual Document* ownerDocument() const = 0; - /// Returns the Document object associated with this node. - /// This is also the Document object used to create new nodes. - /// When this node is a Document, this is null. - - virtual Node* insertBefore(Node* newChild, Node* refChild) = 0; - /// Inserts the node newChild before the existing child node refChild. - /// - /// If refChild is null, insert newChild at the end of the list of children. - /// If newChild is a DocumentFragment object, all of its children are - /// inserted in the same order, before refChild. If the newChild is already - /// in the tree, it is first removed. - - virtual Node* replaceChild(Node* newChild, Node* oldChild) = 0; - /// Replaces the child node oldChild with newChild in the list of children, - /// and returns the oldChild node. - /// If newChild is a DocumentFragment object, oldChild is replaced by all of - /// the DocumentFragment children, which are inserted in the same order. If - /// the newChild is already in the tree, it is first removed. - - virtual Node* removeChild(Node* oldChild) = 0; - /// Removes the child node indicated by oldChild from the list of children - /// and returns it. - - virtual Node* appendChild(Node* newChild) = 0; - /// Appends the node newChild to the end of the list of children of this node. - /// If newChild is already in the tree, it is first removed. - - virtual bool hasChildNodes() const = 0; - /// This is a convenience method to allow easy determination of whether a - /// node has any children. - /// Returns true if the node has any children, false otherwise. - - virtual Node* cloneNode(bool deep) const = 0; - /// Returns a duplicate of this node, i.e., serves as a generic copy constructor - /// for nodes. The duplicate node has no parent; (parentNode is null.). - /// Cloning an Element copies all attributes and their values, including those - /// generated by the XML processor to represent defaulted attributes, but this - /// method does not copy any text it contains unless it is a deep clone, since - /// the text is contained in a child Text node. Cloning an Attribute directly, - /// as opposed to be cloned as part of an Element cloning operation, returns - /// a specified attribute (specified is true). Cloning any other type of node - /// simply returns a copy of this node. - /// Note that cloning an immutable subtree results in a mutable copy, but the - /// children of an EntityReference clone are readonly. In addition, clones of - /// unspecified Attr nodes are specified. And, cloning Document, DocumentType, - /// Entity, and Notation nodes is implementation dependent. - - // DOM Level 2 - virtual void normalize() = 0; - /// Puts all Text nodes in the full depth of the sub-tree underneath this Node, - /// including attribute nodes, into a "normal" form where only structure (e.g., - /// elements, comments, processing instructions, CDATA sections, and entity - /// references) separates Text nodes, i.e., there are neither adjacent Text - /// nodes nor empty Text nodes. This can be used to ensure that the DOM view - /// of a document is the same as if it were saved and re-loaded, and is useful - /// when operations (such as XPointer lookups) that depend on a particular - /// document tree structure are to be used. + /// The returned NodeList must be released with a call + /// to release() when no longer needed. + + virtual Node* firstChild() const = 0; + /// Returns the first child of this node. If there is no such + /// node, this returns null. + + virtual Node* lastChild() const = 0; + /// Returns the last child of this node. If there is no such + /// node, this returns null. + + virtual Node* previousSibling() const = 0; + /// Returns the node immediately preceding this node. If there + /// is no such node, this returns null. + + virtual Node* nextSibling() const = 0; + /// Returns the node immediately following this node. If there + /// is no such node, this returns null. + + virtual NamedNodeMap* attributes() const = 0; + /// Returns a NamedNodeMap containing the attributes of this + /// node (if it is an Element) or null otherwise. + /// + /// The returned NamedNodeMap must be released with a call + /// to release() when no longer needed. + + virtual Document* ownerDocument() const = 0; + /// Returns the Document object associated with this node. + /// This is also the Document object used to create new nodes. + /// When this node is a Document, this is null. + + virtual Node* insertBefore(Node* newChild, Node* refChild) = 0; + /// Inserts the node newChild before the existing child node refChild. /// - /// Note: In cases where the document contains CDATASections, the normalize - /// operation alone may not be sufficient, since XPointers do not differentiate - /// between Text nodes and CDATASection nodes. - - virtual bool isSupported(const XMLString& feature, const XMLString& version) const = 0; - /// Tests whether the DOM implementation implements a specific - /// feature and that feature is supported by this node. - - virtual const XMLString& namespaceURI() const = 0; - /// Returns the namespace URI of the node. - /// This is not a computed value that is the result of a namespace lookup based on an - /// examination of the namespace declarations in scope. It is merely the namespace URI - /// given at creation time. - /// - /// For nodes of any type other than ELEMENT_NODE and ATTRIBUTE_NODE and nodes created with a - /// DOM Level 1 method, such as createElement from the Document interface, this is always the - /// empty string. - - virtual XMLString prefix() const = 0; - /// Returns the namespace prefix from the qualified name of the node. - - virtual const XMLString& localName() const = 0; - /// Returns the local name of the node. - - virtual bool hasAttributes() const = 0; - /// Returns whether this node (if it is an element) has any attributes. - - // Extensions - typedef Poco::XML::NamespaceSupport NSMap; - - virtual XMLString innerText() const = 0; - /// Returns a string containing the concatenated values of the node - /// and all its child nodes. - /// - /// This method is not part of the W3C Document Object Model. - - virtual Node* getNodeByPath(const XMLString& path) const = 0; - /// Searches a node (element or attribute) based on a simplified XPath - /// expression. - /// - /// Only simple XPath expressions are supported. These are the slash - /// notation for specifying paths to elements, and the square bracket - /// expression for finding elements by their index, by attribute value, - /// or finding attributes by names. - /// - /// The slash at the beginning is optional, the evaluation always starts - /// at this element. A double-slash at the beginning recursively searches - /// the entire subtree for the first element. - /// - /// Examples: - /// elem1/elem2/elem3 - /// /elem1/elem2/elem3 - /// /elem1/elem2[1] - /// /elem1/elem2[@attr1] - /// /elem1/elem2[@attr1='value'] - /// //elem2[@attr1='value'] - /// //[@attr1='value'] - /// - /// This method is an extension to the W3C Document Object Model. - - virtual Node* getNodeByPathNS(const XMLString& path, const NSMap& nsMap) const = 0; - /// Searches a node (element or attribute) based on a simplified XPath - /// expression. The given NSMap must contain mappings from namespace - /// prefixes to namespace URIs for all namespace prefixes used in - /// the path expression. - /// - /// Only simple XPath expressions are supported. These are the slash - /// notation for specifying paths to elements, and the square bracket - /// expression for finding elements by their index, by attribute value, - /// or finding attributes by names. - /// - /// The slash at the beginning is optional, the evaluation always starts - /// at this element. A double-slash at the beginning recursively searches - /// the entire subtree for the first element. - /// - /// Examples: - /// /ns1:elem1/ns2:elem2/ns2:elem3 - /// /ns1:elem1/ns2:elem2[1] - /// /ns1:elem1/ns2:elem2[@attr1] - /// /ns1:elem1/ns2:elem2[@attr1='value'] - /// //ns2:elem2[@ns1:attr1='value'] - /// //[@ns1:attr1='value'] - /// - /// This method is an extension to the W3C Document Object Model. - -protected: - virtual ~Node(); -}; - - -// -// inlines -// -inline const XMLString& Node::nodeValue() const -{ - return getNodeValue(); -} - - -} } // namespace Poco::XML - - -#endif // DOM_Node_INCLUDED + /// If refChild is null, insert newChild at the end of the list of children. + /// If newChild is a DocumentFragment object, all of its children are + /// inserted in the same order, before refChild. If the newChild is already + /// in the tree, it is first removed. + + virtual Node* replaceChild(Node* newChild, Node* oldChild) = 0; + /// Replaces the child node oldChild with newChild in the list of children, + /// and returns the oldChild node. + /// If newChild is a DocumentFragment object, oldChild is replaced by all of + /// the DocumentFragment children, which are inserted in the same order. If + /// the newChild is already in the tree, it is first removed. + + virtual Node* removeChild(Node* oldChild) = 0; + /// Removes the child node indicated by oldChild from the list of children + /// and returns it. + + virtual Node* appendChild(Node* newChild) = 0; + /// Appends the node newChild to the end of the list of children of this node. + /// If newChild is already in the tree, it is first removed. + + virtual bool hasChildNodes() const = 0; + /// This is a convenience method to allow easy determination of whether a + /// node has any children. + /// Returns true if the node has any children, false otherwise. + + virtual Node* cloneNode(bool deep) const = 0; + /// Returns a duplicate of this node, i.e., serves as a generic copy constructor + /// for nodes. The duplicate node has no parent; (parentNode is null.). + /// Cloning an Element copies all attributes and their values, including those + /// generated by the XML processor to represent defaulted attributes, but this + /// method does not copy any text it contains unless it is a deep clone, since + /// the text is contained in a child Text node. Cloning an Attribute directly, + /// as opposed to be cloned as part of an Element cloning operation, returns + /// a specified attribute (specified is true). Cloning any other type of node + /// simply returns a copy of this node. + /// Note that cloning an immutable subtree results in a mutable copy, but the + /// children of an EntityReference clone are readonly. In addition, clones of + /// unspecified Attr nodes are specified. And, cloning Document, DocumentType, + /// Entity, and Notation nodes is implementation dependent. + + // DOM Level 2 + virtual void normalize() = 0; + /// Puts all Text nodes in the full depth of the sub-tree underneath this Node, + /// including attribute nodes, into a "normal" form where only structure (e.g., + /// elements, comments, processing instructions, CDATA sections, and entity + /// references) separates Text nodes, i.e., there are neither adjacent Text + /// nodes nor empty Text nodes. This can be used to ensure that the DOM view + /// of a document is the same as if it were saved and re-loaded, and is useful + /// when operations (such as XPointer lookups) that depend on a particular + /// document tree structure are to be used. + /// + /// Note: In cases where the document contains CDATASections, the normalize + /// operation alone may not be sufficient, since XPointers do not differentiate + /// between Text nodes and CDATASection nodes. + + virtual bool isSupported(const XMLString& feature, const XMLString& version) const = 0; + /// Tests whether the DOM implementation implements a specific + /// feature and that feature is supported by this node. + + virtual const XMLString& namespaceURI() const = 0; + /// Returns the namespace URI of the node. + /// This is not a computed value that is the result of a namespace lookup based on an + /// examination of the namespace declarations in scope. It is merely the namespace URI + /// given at creation time. + /// + /// For nodes of any type other than ELEMENT_NODE and ATTRIBUTE_NODE and nodes created with a + /// DOM Level 1 method, such as createElement from the Document interface, this is always the + /// empty string. + + virtual XMLString prefix() const = 0; + /// Returns the namespace prefix from the qualified name of the node. + + virtual const XMLString& localName() const = 0; + /// Returns the local name of the node. + + virtual bool hasAttributes() const = 0; + /// Returns whether this node (if it is an element) has any attributes. + + // Extensions + typedef Poco::XML::NamespaceSupport NSMap; + + virtual XMLString innerText() const = 0; + /// Returns a string containing the concatenated values of the node + /// and all its child nodes. + /// + /// This method is not part of the W3C Document Object Model. + + virtual Node* getNodeByPath(const XMLString& path) const = 0; + /// Searches a node (element or attribute) based on a simplified XPath + /// expression. + /// + /// Only simple XPath expressions are supported. These are the slash + /// notation for specifying paths to elements, and the square bracket + /// expression for finding elements by their index, by attribute value, + /// or finding attributes by names. + /// + /// The slash at the beginning is optional, the evaluation always starts + /// at this element. A double-slash at the beginning recursively searches + /// the entire subtree for the first element. + /// + /// Examples: + /// elem1/elem2/elem3 + /// /elem1/elem2/elem3 + /// /elem1/elem2[1] + /// /elem1/elem2[@attr1] + /// /elem1/elem2[@attr1='value'] + /// //elem2[@attr1='value'] + /// //[@attr1='value'] + /// + /// This method is an extension to the W3C Document Object Model. + + virtual Node* getNodeByPathNS(const XMLString& path, const NSMap& nsMap) const = 0; + /// Searches a node (element or attribute) based on a simplified XPath + /// expression. The given NSMap must contain mappings from namespace + /// prefixes to namespace URIs for all namespace prefixes used in + /// the path expression. + /// + /// Only simple XPath expressions are supported. These are the slash + /// notation for specifying paths to elements, and the square bracket + /// expression for finding elements by their index, by attribute value, + /// or finding attributes by names. + /// + /// The slash at the beginning is optional, the evaluation always starts + /// at this element. A double-slash at the beginning recursively searches + /// the entire subtree for the first element. + /// + /// Examples: + /// /ns1:elem1/ns2:elem2/ns2:elem3 + /// /ns1:elem1/ns2:elem2[1] + /// /ns1:elem1/ns2:elem2[@attr1] + /// /ns1:elem1/ns2:elem2[@attr1='value'] + /// //ns2:elem2[@ns1:attr1='value'] + /// //[@ns1:attr1='value'] + /// + /// This method is an extension to the W3C Document Object Model. + +protected: + virtual ~Node(); +}; + + +// +// inlines +// +inline const XMLString& Node::nodeValue() const +{ + return getNodeValue(); +} + + +} } // namespace Poco::XML + + +#endif // DOM_Node_INCLUDED diff --git a/contrib/libs/poco/XML/include/Poco/DOM/NodeAppender.h b/contrib/libs/poco/XML/include/Poco/DOM/NodeAppender.h index 2d36be2e3c..c7db3a99d7 100644 --- a/contrib/libs/poco/XML/include/Poco/DOM/NodeAppender.h +++ b/contrib/libs/poco/XML/include/Poco/DOM/NodeAppender.h @@ -1,81 +1,81 @@ -// -// NodeAppender.h -// -// Library: XML -// Package: DOM -// Module: NodeAppender -// -// Definition of the NodeAppender class. -// -// Copyright (c) 2007, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef DOM_NodeAppender_INCLUDED -#define DOM_NodeAppender_INCLUDED - - -#include "Poco/XML/XML.h" -#include "Poco/DOM/Node.h" - - -namespace Poco { -namespace XML { - - -class AbstractNode; -class Element; - - -class XML_API NodeAppender - /// The NodeAppender class provides a very fast way to - /// build larger DOM documents. - /// - /// In the DOM, child nodes are usually appended to a parent - /// node using the appendChild() method. For nodes containing - /// more than a few children, this method can be quite slow, - /// due to the way it's implemented, and because of the - /// requirements of the DOM specification. - /// - /// While the NodeAppender is being used on an Element, no - /// children-modifying methods of that Element must be used. - /// - /// This class is not part of the DOM specification. -{ -public: - NodeAppender(Element* parent); - /// Creates the NodeAppender for the given parent node, - /// which must be an Element. - - ~NodeAppender(); - /// Destroys the NodeAppender. - - void appendChild(Node* newChild); - /// Appends the node newChild to the end of the list of children of - /// the parent node specified in the constructor. - /// If the newChild is already in the tree, it is first removed. - /// - /// NewChild can be a DocumentFragment. In this case, all children - /// of the fragment become children of the parent element. - /// - /// In order to speed up the function, no DOM events - /// are fired. - -private: - NodeAppender(); - NodeAppender(const NodeAppender&); - NodeAppender& operator = (const NodeAppender&); - - Element* _pParent; - AbstractNode* _pLast; -}; - - -} } // namespace Poco::XML - - -#endif // #include "Poco/XML/XML.h" - +// +// NodeAppender.h +// +// Library: XML +// Package: DOM +// Module: NodeAppender +// +// Definition of the NodeAppender class. +// +// Copyright (c) 2007, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef DOM_NodeAppender_INCLUDED +#define DOM_NodeAppender_INCLUDED + + +#include "Poco/XML/XML.h" +#include "Poco/DOM/Node.h" + + +namespace Poco { +namespace XML { + + +class AbstractNode; +class Element; + + +class XML_API NodeAppender + /// The NodeAppender class provides a very fast way to + /// build larger DOM documents. + /// + /// In the DOM, child nodes are usually appended to a parent + /// node using the appendChild() method. For nodes containing + /// more than a few children, this method can be quite slow, + /// due to the way it's implemented, and because of the + /// requirements of the DOM specification. + /// + /// While the NodeAppender is being used on an Element, no + /// children-modifying methods of that Element must be used. + /// + /// This class is not part of the DOM specification. +{ +public: + NodeAppender(Element* parent); + /// Creates the NodeAppender for the given parent node, + /// which must be an Element. + + ~NodeAppender(); + /// Destroys the NodeAppender. + + void appendChild(Node* newChild); + /// Appends the node newChild to the end of the list of children of + /// the parent node specified in the constructor. + /// If the newChild is already in the tree, it is first removed. + /// + /// NewChild can be a DocumentFragment. In this case, all children + /// of the fragment become children of the parent element. + /// + /// In order to speed up the function, no DOM events + /// are fired. + +private: + NodeAppender(); + NodeAppender(const NodeAppender&); + NodeAppender& operator = (const NodeAppender&); + + Element* _pParent; + AbstractNode* _pLast; +}; + + +} } // namespace Poco::XML + + +#endif // #include "Poco/XML/XML.h" + diff --git a/contrib/libs/poco/XML/include/Poco/DOM/NodeFilter.h b/contrib/libs/poco/XML/include/Poco/DOM/NodeFilter.h index ae8677bf28..8ddd1b73df 100644 --- a/contrib/libs/poco/XML/include/Poco/DOM/NodeFilter.h +++ b/contrib/libs/poco/XML/include/Poco/DOM/NodeFilter.h @@ -1,146 +1,146 @@ -// -// NodeFilter.h -// -// Library: XML -// Package: DOM -// Module: NodeFilter -// -// Definition of the DOM NodeFilter interface. -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef DOM_NodeFilter_INCLUDED -#define DOM_NodeFilter_INCLUDED - - -#include "Poco/XML/XML.h" -#include "Poco/XML/XMLString.h" - - -namespace Poco { -namespace XML { - - -class Node; - - -class XML_API NodeFilter - /// Filters are objects that know how to "filter out" nodes. If a NodeIterator - /// or TreeWalker is given a NodeFilter, it applies the filter before it returns - /// the next node. If the filter says to accept the node, the traversal logic - /// returns it; otherwise, traversal looks for the next node and pretends that - /// the node that was rejected was not there. - /// - /// The DOM does not provide any filters. NodeFilter is just an interface that - /// users can implement to provide their own filters. - /// - /// NodeFilters do not need to know how to traverse from node to node, nor do - /// they need to know anything about the data structure that is being traversed. - /// This makes it very easy to write filters, since the only thing they have - /// to know how to do is evaluate a single node. One filter may be used with - /// a number of different kinds of traversals, encouraging code reuse. -{ -public: - enum - { - FILTER_ACCEPT = 1, - /// Accept the node. Navigation methods defined for NodeIterator or TreeWalker will return this node. - - FILTER_REJECT = 2, - /// Reject the node. Navigation methods defined for NodeIterator or TreeWalker - /// will not return this node. For TreeWalker, the children of this node will - /// also be rejected. NodeIterators treat this as a synonym for FILTER_SKIP. - - FILTER_SKIP = 3 - /// Skip this single node. Navigation methods defined for NodeIterator or TreeWalker - /// will not return this node. For both NodeIterator and TreeWalker, the children - /// of this node will still be considered. - }; - - enum WhatToShow - /// These are the available values for the whatToShow parameter used in TreeWalkers - /// and NodeIterators. They are the same as the set of possible types for Node, - /// and their values are derived by using a bit position corresponding to the - /// value of nodeType for the equivalent node type. If a bit in whatToShow is - /// set false, that will be taken as a request to skip over this type of node; - /// the behavior in that case is similar to that of FILTER_SKIP. +// +// NodeFilter.h +// +// Library: XML +// Package: DOM +// Module: NodeFilter +// +// Definition of the DOM NodeFilter interface. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef DOM_NodeFilter_INCLUDED +#define DOM_NodeFilter_INCLUDED + + +#include "Poco/XML/XML.h" +#include "Poco/XML/XMLString.h" + + +namespace Poco { +namespace XML { + + +class Node; + + +class XML_API NodeFilter + /// Filters are objects that know how to "filter out" nodes. If a NodeIterator + /// or TreeWalker is given a NodeFilter, it applies the filter before it returns + /// the next node. If the filter says to accept the node, the traversal logic + /// returns it; otherwise, traversal looks for the next node and pretends that + /// the node that was rejected was not there. + /// + /// The DOM does not provide any filters. NodeFilter is just an interface that + /// users can implement to provide their own filters. + /// + /// NodeFilters do not need to know how to traverse from node to node, nor do + /// they need to know anything about the data structure that is being traversed. + /// This makes it very easy to write filters, since the only thing they have + /// to know how to do is evaluate a single node. One filter may be used with + /// a number of different kinds of traversals, encouraging code reuse. +{ +public: + enum + { + FILTER_ACCEPT = 1, + /// Accept the node. Navigation methods defined for NodeIterator or TreeWalker will return this node. + + FILTER_REJECT = 2, + /// Reject the node. Navigation methods defined for NodeIterator or TreeWalker + /// will not return this node. For TreeWalker, the children of this node will + /// also be rejected. NodeIterators treat this as a synonym for FILTER_SKIP. + + FILTER_SKIP = 3 + /// Skip this single node. Navigation methods defined for NodeIterator or TreeWalker + /// will not return this node. For both NodeIterator and TreeWalker, the children + /// of this node will still be considered. + }; + + enum WhatToShow + /// These are the available values for the whatToShow parameter used in TreeWalkers + /// and NodeIterators. They are the same as the set of possible types for Node, + /// and their values are derived by using a bit position corresponding to the + /// value of nodeType for the equivalent node type. If a bit in whatToShow is + /// set false, that will be taken as a request to skip over this type of node; + /// the behavior in that case is similar to that of FILTER_SKIP. + /// + /// Note that if node types greater than 32 are ever introduced, they may not + /// be individually testable via whatToShow. If that need should arise, it can + /// be handled by selecting SHOW_ALL together with an appropriate NodeFilter. + { + SHOW_ALL = 0xFFFFFFFF, + /// Show all Nodes. + + SHOW_ELEMENT = 0x00000001, + /// Show Element nodes. + + SHOW_ATTRIBUTE = 0x00000002, + /// Show Attr nodes. This is meaningful only when creating an iterator or tree-walker + /// with an attribute node as its root; in this case, it means that the attribute + /// node will appear in the first position of the iteration or traversal. Since + /// attributes are never children of other nodes, they do not appear when traversing + /// over the document tree. + + SHOW_TEXT = 0x00000004, + /// Show Text nodes. + + SHOW_CDATA_SECTION = 0x00000008, + /// Show CDATASection nodes. + + SHOW_ENTITY_REFERENCE = 0x00000010, + /// Show EntityReference nodes. + + SHOW_ENTITY = 0x00000020, + /// Show Entity nodes. This is meaningful only when creating an iterator or + /// tree-walker with an Entity node as its root; in this case, it means that + /// the Entity node will appear in the first position of the traversal. Since + /// entities are not part of the document tree, they do not appear when traversing + /// over the document tree. + + SHOW_PROCESSING_INSTRUCTION = 0x00000040, + /// Show ProcessingInstruction nodes. + + SHOW_COMMENT = 0x00000080, + /// Show Comment nodes. + + SHOW_DOCUMENT = 0x00000100, + /// Show Document nodes. + + SHOW_DOCUMENT_TYPE = 0x00000200, + /// Show DocumentType nodes. + + SHOW_DOCUMENT_FRAGMENT = 0x00000400, + /// Show DocumentFragment nodes. + + SHOW_NOTATION = 0x00000800 + /// Show Notation nodes. This is meaningful only when creating an iterator or + /// tree-walker with a Notation node as its root; in this case, it means that + /// the Notation node will appear in the first position of the traversal. Since + /// notations are not part of the document tree, they do not appear when traversing + /// over the document tree. + }; + + virtual short acceptNode(Node* node) = 0; + /// Test whether a specified node is visible in the logical view of a TreeWalker + /// or NodeIterator. This function will be called by the implementation of TreeWalker + /// and NodeIterator; it is not normally called directly from user code. (Though + /// you could do so if you wanted to use the same filter to guide your own application + /// logic.) /// - /// Note that if node types greater than 32 are ever introduced, they may not - /// be individually testable via whatToShow. If that need should arise, it can - /// be handled by selecting SHOW_ALL together with an appropriate NodeFilter. - { - SHOW_ALL = 0xFFFFFFFF, - /// Show all Nodes. - - SHOW_ELEMENT = 0x00000001, - /// Show Element nodes. - - SHOW_ATTRIBUTE = 0x00000002, - /// Show Attr nodes. This is meaningful only when creating an iterator or tree-walker - /// with an attribute node as its root; in this case, it means that the attribute - /// node will appear in the first position of the iteration or traversal. Since - /// attributes are never children of other nodes, they do not appear when traversing - /// over the document tree. - - SHOW_TEXT = 0x00000004, - /// Show Text nodes. - - SHOW_CDATA_SECTION = 0x00000008, - /// Show CDATASection nodes. - - SHOW_ENTITY_REFERENCE = 0x00000010, - /// Show EntityReference nodes. - - SHOW_ENTITY = 0x00000020, - /// Show Entity nodes. This is meaningful only when creating an iterator or - /// tree-walker with an Entity node as its root; in this case, it means that - /// the Entity node will appear in the first position of the traversal. Since - /// entities are not part of the document tree, they do not appear when traversing - /// over the document tree. - - SHOW_PROCESSING_INSTRUCTION = 0x00000040, - /// Show ProcessingInstruction nodes. - - SHOW_COMMENT = 0x00000080, - /// Show Comment nodes. - - SHOW_DOCUMENT = 0x00000100, - /// Show Document nodes. - - SHOW_DOCUMENT_TYPE = 0x00000200, - /// Show DocumentType nodes. - - SHOW_DOCUMENT_FRAGMENT = 0x00000400, - /// Show DocumentFragment nodes. - - SHOW_NOTATION = 0x00000800 - /// Show Notation nodes. This is meaningful only when creating an iterator or - /// tree-walker with a Notation node as its root; in this case, it means that - /// the Notation node will appear in the first position of the traversal. Since - /// notations are not part of the document tree, they do not appear when traversing - /// over the document tree. - }; - - virtual short acceptNode(Node* node) = 0; - /// Test whether a specified node is visible in the logical view of a TreeWalker - /// or NodeIterator. This function will be called by the implementation of TreeWalker - /// and NodeIterator; it is not normally called directly from user code. (Though - /// you could do so if you wanted to use the same filter to guide your own application - /// logic.) - /// - /// Returns FILTER_ACCEPT, FILTER_REJECT or FILTER_SKIP. - -protected: - virtual ~NodeFilter(); -}; - - -} } // namespace Poco::XML - - -#endif // DOM_NodeFilter_INCLUDED + /// Returns FILTER_ACCEPT, FILTER_REJECT or FILTER_SKIP. + +protected: + virtual ~NodeFilter(); +}; + + +} } // namespace Poco::XML + + +#endif // DOM_NodeFilter_INCLUDED diff --git a/contrib/libs/poco/XML/include/Poco/DOM/NodeIterator.h b/contrib/libs/poco/XML/include/Poco/DOM/NodeIterator.h index 1f8e9a063b..fc233a9187 100644 --- a/contrib/libs/poco/XML/include/Poco/DOM/NodeIterator.h +++ b/contrib/libs/poco/XML/include/Poco/DOM/NodeIterator.h @@ -1,167 +1,167 @@ -// -// NodeIterator.h -// -// Library: XML -// Package: DOM -// Module: NodeIterator -// -// Definition of the DOM NodeIterator class. -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef DOM_NodeIterator_INCLUDED -#define DOM_NodeIterator_INCLUDED - - -#include "Poco/XML/XML.h" - - -namespace Poco { -namespace XML { - - -class Node; -class NodeFilter; - - -class XML_API NodeIterator - /// Iterators are used to step through a set of nodes, e.g. the set of nodes - /// in a NodeList, the document subtree governed by a particular Node, the results - /// of a query, or any other set of nodes. The set of nodes to be iterated is - /// determined by the implementation of the NodeIterator. DOM Level 2 specifies - /// a single NodeIterator implementation for document-order traversal of a document - /// subtree. - /// - /// A NodeIterator can be directly instantiated using one of its constructors - - /// the DocumentTraversal interface is not needed and therefore not implemented. - /// Unlike most other DOM classes, NodeIterator supports value semantics. - /// - /// If the NodeIterator's current node is removed from the document, the - /// result of calling any of the movement methods is undefined. This behavior does - /// not conform to the DOM Level 2 Traversal specification. -{ -public: - NodeIterator(Node* root, unsigned long whatToShow, NodeFilter* pFilter = 0); - /// Creates a NodeIterator over the subtree rooted at the specified node. - - NodeIterator(const NodeIterator& iterator); - /// Creates a NodeIterator by copying another NodeIterator. - - NodeIterator& operator = (const NodeIterator& iterator); - /// Assignment operator. - - ~NodeIterator(); - /// Destroys the NodeIterator. - - Node* root() const; - /// The root node of the NodeIterator, as specified when it was created. - - unsigned long whatToShow() const; - /// This attribute determines which node types are presented via the iterator. - /// The available set of constants is defined in the NodeFilter interface. - /// Nodes not accepted by whatToShow will be skipped, but their children may - /// still be considered. Note that this skip takes precedence over the filter, - /// if any. - - NodeFilter* filter() const; - /// The NodeFilter used to screen nodes. - - bool expandEntityReferences() const; - /// The value of this flag determines whether the children of entity reference - /// nodes are visible to the iterator. If false, they and their descendants - /// will be rejected. Note that this rejection takes precedence over whatToShow - /// and the filter. Also note that this is currently the only situation where - /// NodeIterators may reject a complete subtree rather than skipping individual - /// nodes. +// +// NodeIterator.h +// +// Library: XML +// Package: DOM +// Module: NodeIterator +// +// Definition of the DOM NodeIterator class. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef DOM_NodeIterator_INCLUDED +#define DOM_NodeIterator_INCLUDED + + +#include "Poco/XML/XML.h" + + +namespace Poco { +namespace XML { + + +class Node; +class NodeFilter; + + +class XML_API NodeIterator + /// Iterators are used to step through a set of nodes, e.g. the set of nodes + /// in a NodeList, the document subtree governed by a particular Node, the results + /// of a query, or any other set of nodes. The set of nodes to be iterated is + /// determined by the implementation of the NodeIterator. DOM Level 2 specifies + /// a single NodeIterator implementation for document-order traversal of a document + /// subtree. + /// + /// A NodeIterator can be directly instantiated using one of its constructors - + /// the DocumentTraversal interface is not needed and therefore not implemented. + /// Unlike most other DOM classes, NodeIterator supports value semantics. + /// + /// If the NodeIterator's current node is removed from the document, the + /// result of calling any of the movement methods is undefined. This behavior does + /// not conform to the DOM Level 2 Traversal specification. +{ +public: + NodeIterator(Node* root, unsigned long whatToShow, NodeFilter* pFilter = 0); + /// Creates a NodeIterator over the subtree rooted at the specified node. + + NodeIterator(const NodeIterator& iterator); + /// Creates a NodeIterator by copying another NodeIterator. + + NodeIterator& operator = (const NodeIterator& iterator); + /// Assignment operator. + + ~NodeIterator(); + /// Destroys the NodeIterator. + + Node* root() const; + /// The root node of the NodeIterator, as specified when it was created. + + unsigned long whatToShow() const; + /// This attribute determines which node types are presented via the iterator. + /// The available set of constants is defined in the NodeFilter interface. + /// Nodes not accepted by whatToShow will be skipped, but their children may + /// still be considered. Note that this skip takes precedence over the filter, + /// if any. + + NodeFilter* filter() const; + /// The NodeFilter used to screen nodes. + + bool expandEntityReferences() const; + /// The value of this flag determines whether the children of entity reference + /// nodes are visible to the iterator. If false, they and their descendants + /// will be rejected. Note that this rejection takes precedence over whatToShow + /// and the filter. Also note that this is currently the only situation where + /// NodeIterators may reject a complete subtree rather than skipping individual + /// nodes. + /// + /// To produce a view of the document that has entity references expanded and + /// does not expose the entity reference node itself, use the whatToShow flags + /// to hide the entity reference node and set expandEntityReferences to true + /// when creating the iterator. To produce a view of the document that has entity + /// reference nodes but no entity expansion, use the whatToShow flags to show + /// the entity reference node and set expandEntityReferences to false. /// - /// To produce a view of the document that has entity references expanded and - /// does not expose the entity reference node itself, use the whatToShow flags - /// to hide the entity reference node and set expandEntityReferences to true - /// when creating the iterator. To produce a view of the document that has entity - /// reference nodes but no entity expansion, use the whatToShow flags to show - /// the entity reference node and set expandEntityReferences to false. - /// - /// This implementation does not support entity reference expansion and - /// thus always returns false. - - Node* nextNode(); - /// Returns the next node in the set and advances the position of the iterator - /// in the set. After a NodeIterator is created, the first call to nextNode() - /// returns the first node in the set. - - Node* previousNode(); - /// Returns the previous node in the set and moves the position of the NodeIterator - /// backwards in the set. - - Node* currentNodeNP() const; - /// Returns the current node in the set. - /// - /// Leaves the NodeIterator unchanged. - /// - /// Warning: This is a proprietary extension to the DOM Level 2 NodeIterator - /// interface. - - void detach(); - /// Detaches the NodeIterator from the set which it iterated over, releasing - /// any computational resources and placing the iterator in the INVALID state. - /// After detach has been invoked, calls to nextNode or previousNode will raise - /// the exception INVALID_STATE_ERR. - -protected: - bool accept(Node* pNode) const; - Node* next() const; - Node* previous() const; - Node* last(); - -private: - NodeIterator(); - - Node* _pRoot; - unsigned long _whatToShow; - NodeFilter* _pFilter; - Node* _pCurrent; -}; - - -// -// inlines -// -inline Node* NodeIterator::root() const -{ - return _pRoot; -} - - -inline Node* NodeIterator::currentNodeNP() const -{ - return _pCurrent; -} - - -inline unsigned long NodeIterator::whatToShow() const -{ - return _whatToShow; -} - - -inline NodeFilter* NodeIterator::filter() const -{ - return _pFilter; -} - - -inline bool NodeIterator::expandEntityReferences() const -{ - return false; -} - - -} } // namespace Poco::XML - - -#endif // DOM_NodeIterator_INCLUDED + /// This implementation does not support entity reference expansion and + /// thus always returns false. + + Node* nextNode(); + /// Returns the next node in the set and advances the position of the iterator + /// in the set. After a NodeIterator is created, the first call to nextNode() + /// returns the first node in the set. + + Node* previousNode(); + /// Returns the previous node in the set and moves the position of the NodeIterator + /// backwards in the set. + + Node* currentNodeNP() const; + /// Returns the current node in the set. + /// + /// Leaves the NodeIterator unchanged. + /// + /// Warning: This is a proprietary extension to the DOM Level 2 NodeIterator + /// interface. + + void detach(); + /// Detaches the NodeIterator from the set which it iterated over, releasing + /// any computational resources and placing the iterator in the INVALID state. + /// After detach has been invoked, calls to nextNode or previousNode will raise + /// the exception INVALID_STATE_ERR. + +protected: + bool accept(Node* pNode) const; + Node* next() const; + Node* previous() const; + Node* last(); + +private: + NodeIterator(); + + Node* _pRoot; + unsigned long _whatToShow; + NodeFilter* _pFilter; + Node* _pCurrent; +}; + + +// +// inlines +// +inline Node* NodeIterator::root() const +{ + return _pRoot; +} + + +inline Node* NodeIterator::currentNodeNP() const +{ + return _pCurrent; +} + + +inline unsigned long NodeIterator::whatToShow() const +{ + return _whatToShow; +} + + +inline NodeFilter* NodeIterator::filter() const +{ + return _pFilter; +} + + +inline bool NodeIterator::expandEntityReferences() const +{ + return false; +} + + +} } // namespace Poco::XML + + +#endif // DOM_NodeIterator_INCLUDED diff --git a/contrib/libs/poco/XML/include/Poco/DOM/NodeList.h b/contrib/libs/poco/XML/include/Poco/DOM/NodeList.h index 1f8c12f4cd..ce7af280a8 100644 --- a/contrib/libs/poco/XML/include/Poco/DOM/NodeList.h +++ b/contrib/libs/poco/XML/include/Poco/DOM/NodeList.h @@ -1,61 +1,61 @@ -// -// NodeList.h -// -// Library: XML -// Package: DOM -// Module: DOM -// -// Definition of the DOM NodeList interface. -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef DOM_NodeList_INCLUDED -#define DOM_NodeList_INCLUDED - - -#include "Poco/XML/XML.h" -#include "Poco/DOM/DOMObject.h" - - -namespace Poco { -namespace XML { - - -class Node; - - -class XML_API NodeList: public DOMObject - /// The NodeList interface provides the abstraction of an ordered - /// collection of nodes, without defining or constraining how this - /// collection is implemented. - /// - /// The items in the NodeList are accessible via an integral index, - /// starting from 0. - /// - /// A NodeList returned from a method must be released with a call to - /// release() when no longer needed. -{ -public: - virtual Node* item(unsigned long index) const = 0; - /// Returns the index'th item in the collection. If index is - /// greater than or equal to the number of nodes in the list, - /// this returns null. - - virtual unsigned long length() const = 0; - /// Returns the number of nodes in the list. The range of valid - /// node indices is 0 to length - 1 inclusive. - -protected: - virtual ~NodeList(); -}; - - -} } // namespace Poco::XML - - -#endif // DOM_NodeList_INCLUDED +// +// NodeList.h +// +// Library: XML +// Package: DOM +// Module: DOM +// +// Definition of the DOM NodeList interface. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef DOM_NodeList_INCLUDED +#define DOM_NodeList_INCLUDED + + +#include "Poco/XML/XML.h" +#include "Poco/DOM/DOMObject.h" + + +namespace Poco { +namespace XML { + + +class Node; + + +class XML_API NodeList: public DOMObject + /// The NodeList interface provides the abstraction of an ordered + /// collection of nodes, without defining or constraining how this + /// collection is implemented. + /// + /// The items in the NodeList are accessible via an integral index, + /// starting from 0. + /// + /// A NodeList returned from a method must be released with a call to + /// release() when no longer needed. +{ +public: + virtual Node* item(unsigned long index) const = 0; + /// Returns the index'th item in the collection. If index is + /// greater than or equal to the number of nodes in the list, + /// this returns null. + + virtual unsigned long length() const = 0; + /// Returns the number of nodes in the list. The range of valid + /// node indices is 0 to length - 1 inclusive. + +protected: + virtual ~NodeList(); +}; + + +} } // namespace Poco::XML + + +#endif // DOM_NodeList_INCLUDED diff --git a/contrib/libs/poco/XML/include/Poco/DOM/Notation.h b/contrib/libs/poco/XML/include/Poco/DOM/Notation.h index c9824b0e05..4bc823a026 100644 --- a/contrib/libs/poco/XML/include/Poco/DOM/Notation.h +++ b/contrib/libs/poco/XML/include/Poco/DOM/Notation.h @@ -1,93 +1,93 @@ -// -// Notation.h -// -// Library: XML -// Package: DOM -// Module: DOM -// -// Definition of the DOM Notation class. -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef DOM_Notation_INCLUDED -#define DOM_Notation_INCLUDED - - -#include "Poco/XML/XML.h" -#include "Poco/DOM/AbstractNode.h" -#include "Poco/XML/XMLString.h" - - -namespace Poco { -namespace XML { - - -class XML_API Notation: public AbstractNode - /// This interface represents a notation declared in the DTD. A notation either - /// declares, by name, the format of an unparsed entity (see section 4.7 of - /// the XML 1.0 specification <http://www.w3.org/TR/2004/REC-xml-20040204/>), - /// or is used for formal declaration of processing - /// instruction targets (see section 2.6 of the XML 1.0 specification). - /// The nodeName attribute inherited from Node is set to the declared name of - /// the notation. - /// - /// The DOM Level 1 does not support editing Notation nodes; they are therefore - /// readonly. - /// - /// A Notation node does not have any parent. -{ -public: - const XMLString& publicId() const; - /// Returns the public identifier of this notation. - /// If not specified, this is an empty string (and not null, - /// as in the DOM specification). - - const XMLString& systemId() const; - /// Returns the system identifier of this notation. - /// If not specified, this is an empty string (and not null, - /// as in the DOM specification). - - // Node - const XMLString& nodeName() const; - unsigned short nodeType() const; - -protected: - Notation(Document* pOwnerDocument, const XMLString& name, const XMLString& publicId, const XMLString& systemId); - Notation(Document* pOwnerDocument, const Notation& notation); - ~Notation(); - - Node* copyNode(bool deep, Document* pOwnerDocument) const; - -private: - XMLString _name; - XMLString _publicId; - XMLString _systemId; - - friend class Document; -}; - - -// -// inlines -// -inline const XMLString& Notation::publicId() const -{ - return _publicId; -} - - -inline const XMLString& Notation::systemId() const -{ - return _systemId; -} - - -} } // namespace Poco::XML - - -#endif // DOM_Notation_INCLUDED +// +// Notation.h +// +// Library: XML +// Package: DOM +// Module: DOM +// +// Definition of the DOM Notation class. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef DOM_Notation_INCLUDED +#define DOM_Notation_INCLUDED + + +#include "Poco/XML/XML.h" +#include "Poco/DOM/AbstractNode.h" +#include "Poco/XML/XMLString.h" + + +namespace Poco { +namespace XML { + + +class XML_API Notation: public AbstractNode + /// This interface represents a notation declared in the DTD. A notation either + /// declares, by name, the format of an unparsed entity (see section 4.7 of + /// the XML 1.0 specification <http://www.w3.org/TR/2004/REC-xml-20040204/>), + /// or is used for formal declaration of processing + /// instruction targets (see section 2.6 of the XML 1.0 specification). + /// The nodeName attribute inherited from Node is set to the declared name of + /// the notation. + /// + /// The DOM Level 1 does not support editing Notation nodes; they are therefore + /// readonly. + /// + /// A Notation node does not have any parent. +{ +public: + const XMLString& publicId() const; + /// Returns the public identifier of this notation. + /// If not specified, this is an empty string (and not null, + /// as in the DOM specification). + + const XMLString& systemId() const; + /// Returns the system identifier of this notation. + /// If not specified, this is an empty string (and not null, + /// as in the DOM specification). + + // Node + const XMLString& nodeName() const; + unsigned short nodeType() const; + +protected: + Notation(Document* pOwnerDocument, const XMLString& name, const XMLString& publicId, const XMLString& systemId); + Notation(Document* pOwnerDocument, const Notation& notation); + ~Notation(); + + Node* copyNode(bool deep, Document* pOwnerDocument) const; + +private: + XMLString _name; + XMLString _publicId; + XMLString _systemId; + + friend class Document; +}; + + +// +// inlines +// +inline const XMLString& Notation::publicId() const +{ + return _publicId; +} + + +inline const XMLString& Notation::systemId() const +{ + return _systemId; +} + + +} } // namespace Poco::XML + + +#endif // DOM_Notation_INCLUDED diff --git a/contrib/libs/poco/XML/include/Poco/DOM/ProcessingInstruction.h b/contrib/libs/poco/XML/include/Poco/DOM/ProcessingInstruction.h index ab600ca952..6d5916ee5c 100644 --- a/contrib/libs/poco/XML/include/Poco/DOM/ProcessingInstruction.h +++ b/contrib/libs/poco/XML/include/Poco/DOM/ProcessingInstruction.h @@ -1,99 +1,99 @@ -// -// ProcessingInstruction.h -// -// Library: XML -// Package: DOM -// Module: DOM -// -// Definition of the DOM ProcessingInstruction class. -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef DOM_ProcessingInstruction_INCLUDED -#define DOM_ProcessingInstruction_INCLUDED - - -#include "Poco/XML/XML.h" -#include "Poco/DOM/AbstractNode.h" -#include "Poco/XML/XMLString.h" - - -namespace Poco { -namespace XML { - - -class XML_API ProcessingInstruction: public AbstractNode - /// The ProcessingInstruction interface represents a "processing instruction", - /// used in XML as a way to keep processor-specific information in the text - /// of the document. -{ -public: - const XMLString& target() const; - /// Returns the target of this processing instruction. - /// XML defines this as being the first token following - /// the markup that begins the processing instruction. - - const XMLString& data() const; - /// Returns the content of this processing instruction. This is from the first non - /// white space character after the target to the character immediately preceding - /// the ?>. - - const XMLString& getData() const; - /// Returns the content of this processing instruction. This is from the first non - /// white space character after the target to the character immediately preceding - /// the ?>. - - void setData(const XMLString& data); - /// Sets the content of this processing instruction. - - // Node - const XMLString& nodeName() const; - const XMLString& getNodeValue() const; - void setNodeValue(const XMLString& data); - unsigned short nodeType() const; - -protected: - ProcessingInstruction(Document* pOwnerDocument, const XMLString& target, const XMLString& data); - ProcessingInstruction(Document* pOwnerDocument, const ProcessingInstruction& processingInstruction); - ~ProcessingInstruction(); - - Node* copyNode(bool deep, Document* pOwnerDocument) const; - -private: - XMLString _target; - XMLString _data; - - friend class Document; -}; - - -// -// inlines -// -inline const XMLString& ProcessingInstruction::target() const -{ - return _target; -} - - -inline const XMLString& ProcessingInstruction::data() const -{ - return _data; -} - - -inline const XMLString& ProcessingInstruction::getData() const -{ - return _data; -} - - -} } // namespace Poco::XML - - -#endif // DOM_ProcessingInstruction_INCLUDED +// +// ProcessingInstruction.h +// +// Library: XML +// Package: DOM +// Module: DOM +// +// Definition of the DOM ProcessingInstruction class. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef DOM_ProcessingInstruction_INCLUDED +#define DOM_ProcessingInstruction_INCLUDED + + +#include "Poco/XML/XML.h" +#include "Poco/DOM/AbstractNode.h" +#include "Poco/XML/XMLString.h" + + +namespace Poco { +namespace XML { + + +class XML_API ProcessingInstruction: public AbstractNode + /// The ProcessingInstruction interface represents a "processing instruction", + /// used in XML as a way to keep processor-specific information in the text + /// of the document. +{ +public: + const XMLString& target() const; + /// Returns the target of this processing instruction. + /// XML defines this as being the first token following + /// the markup that begins the processing instruction. + + const XMLString& data() const; + /// Returns the content of this processing instruction. This is from the first non + /// white space character after the target to the character immediately preceding + /// the ?>. + + const XMLString& getData() const; + /// Returns the content of this processing instruction. This is from the first non + /// white space character after the target to the character immediately preceding + /// the ?>. + + void setData(const XMLString& data); + /// Sets the content of this processing instruction. + + // Node + const XMLString& nodeName() const; + const XMLString& getNodeValue() const; + void setNodeValue(const XMLString& data); + unsigned short nodeType() const; + +protected: + ProcessingInstruction(Document* pOwnerDocument, const XMLString& target, const XMLString& data); + ProcessingInstruction(Document* pOwnerDocument, const ProcessingInstruction& processingInstruction); + ~ProcessingInstruction(); + + Node* copyNode(bool deep, Document* pOwnerDocument) const; + +private: + XMLString _target; + XMLString _data; + + friend class Document; +}; + + +// +// inlines +// +inline const XMLString& ProcessingInstruction::target() const +{ + return _target; +} + + +inline const XMLString& ProcessingInstruction::data() const +{ + return _data; +} + + +inline const XMLString& ProcessingInstruction::getData() const +{ + return _data; +} + + +} } // namespace Poco::XML + + +#endif // DOM_ProcessingInstruction_INCLUDED diff --git a/contrib/libs/poco/XML/include/Poco/DOM/Text.h b/contrib/libs/poco/XML/include/Poco/DOM/Text.h index 3a7931a8b2..5b0084909c 100644 --- a/contrib/libs/poco/XML/include/Poco/DOM/Text.h +++ b/contrib/libs/poco/XML/include/Poco/DOM/Text.h @@ -1,79 +1,79 @@ -// -// Text.h -// -// Library: XML -// Package: DOM -// Module: DOM -// -// Definition of the DOM Text class. -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef DOM_Text_INCLUDED -#define DOM_Text_INCLUDED - - -#include "Poco/XML/XML.h" -#include "Poco/DOM/CharacterData.h" -#include "Poco/XML/XMLString.h" - - -namespace Poco { -namespace XML { - - -class XML_API Text: public CharacterData - /// The Text interface inherits from CharacterData and represents the textual - /// content (termed character data in XML) of an Element or Attr. If there is - /// no markup inside an element's content, the text is contained in a single - /// object implementing the Text interface that is the only child of the element. - /// If there is markup, it is parsed into the information items (elements, comments, - /// etc.) and Text nodes that form the list of children of the element. - /// - /// When a document is first made available via the DOM, there is only one Text - /// node for each block of text. Users may create adjacent Text nodes that represent - /// the contents of a given element without any intervening markup, but should - /// be aware that there is no way to represent the separations between these - /// nodes in XML or HTML, so they will not (in general) persist between DOM - /// editing sessions. The normalize() method on Element merges any such adjacent - /// Text objects into a single node for each block of text. -{ -public: - Text* splitText(unsigned long offset); - /// Breaks this node into two nodes at the specified offset, keeping both in - /// the tree as siblings. This node then only contains all the content up to - /// the offset point. A new node of the same type, which is inserted as the - /// next sibling of this node, contains all the content at and after the offset - /// point. When the offset is equal to the length of this node, the new node - /// has no data. - - // Node - const XMLString& nodeName() const; - unsigned short nodeType() const; - - // Non-standard extensions - XMLString innerText() const; - -protected: - Text(Document* pOwnerDocument, const XMLString& data); - Text(Document* pOwnerDocument, const Text& text); - ~Text(); - - Node* copyNode(bool deep, Document* pOwnerDocument) const; - -private: - static const XMLString NODE_NAME; - - friend class Document; -}; - - -} } // namespace Poco::XML - - -#endif // DOM_Text_INCLUDED +// +// Text.h +// +// Library: XML +// Package: DOM +// Module: DOM +// +// Definition of the DOM Text class. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef DOM_Text_INCLUDED +#define DOM_Text_INCLUDED + + +#include "Poco/XML/XML.h" +#include "Poco/DOM/CharacterData.h" +#include "Poco/XML/XMLString.h" + + +namespace Poco { +namespace XML { + + +class XML_API Text: public CharacterData + /// The Text interface inherits from CharacterData and represents the textual + /// content (termed character data in XML) of an Element or Attr. If there is + /// no markup inside an element's content, the text is contained in a single + /// object implementing the Text interface that is the only child of the element. + /// If there is markup, it is parsed into the information items (elements, comments, + /// etc.) and Text nodes that form the list of children of the element. + /// + /// When a document is first made available via the DOM, there is only one Text + /// node for each block of text. Users may create adjacent Text nodes that represent + /// the contents of a given element without any intervening markup, but should + /// be aware that there is no way to represent the separations between these + /// nodes in XML or HTML, so they will not (in general) persist between DOM + /// editing sessions. The normalize() method on Element merges any such adjacent + /// Text objects into a single node for each block of text. +{ +public: + Text* splitText(unsigned long offset); + /// Breaks this node into two nodes at the specified offset, keeping both in + /// the tree as siblings. This node then only contains all the content up to + /// the offset point. A new node of the same type, which is inserted as the + /// next sibling of this node, contains all the content at and after the offset + /// point. When the offset is equal to the length of this node, the new node + /// has no data. + + // Node + const XMLString& nodeName() const; + unsigned short nodeType() const; + + // Non-standard extensions + XMLString innerText() const; + +protected: + Text(Document* pOwnerDocument, const XMLString& data); + Text(Document* pOwnerDocument, const Text& text); + ~Text(); + + Node* copyNode(bool deep, Document* pOwnerDocument) const; + +private: + static const XMLString NODE_NAME; + + friend class Document; +}; + + +} } // namespace Poco::XML + + +#endif // DOM_Text_INCLUDED diff --git a/contrib/libs/poco/XML/include/Poco/DOM/TreeWalker.h b/contrib/libs/poco/XML/include/Poco/DOM/TreeWalker.h index 884b37d3c7..79ec4a12d7 100644 --- a/contrib/libs/poco/XML/include/Poco/DOM/TreeWalker.h +++ b/contrib/libs/poco/XML/include/Poco/DOM/TreeWalker.h @@ -1,211 +1,211 @@ -// -// TreeWalker.h -// -// Library: XML -// Package: DOM -// Module: TreeWalker -// -// Definition of the DOM TreeWalker class. -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef DOM_TreeWalker_INCLUDED -#define DOM_TreeWalker_INCLUDED - - -#include "Poco/XML/XML.h" -#include "Poco/XML/XMLString.h" - - -namespace Poco { -namespace XML { - - -class Node; -class NodeFilter; - - -class XML_API TreeWalker - /// TreeWalker objects are used to navigate a document tree or subtree using - /// the view of the document defined by their whatToShow flags and filter (if - /// any). Any function which performs navigation using a TreeWalker will automatically - /// support any view defined by a TreeWalker. +// +// TreeWalker.h +// +// Library: XML +// Package: DOM +// Module: TreeWalker +// +// Definition of the DOM TreeWalker class. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef DOM_TreeWalker_INCLUDED +#define DOM_TreeWalker_INCLUDED + + +#include "Poco/XML/XML.h" +#include "Poco/XML/XMLString.h" + + +namespace Poco { +namespace XML { + + +class Node; +class NodeFilter; + + +class XML_API TreeWalker + /// TreeWalker objects are used to navigate a document tree or subtree using + /// the view of the document defined by their whatToShow flags and filter (if + /// any). Any function which performs navigation using a TreeWalker will automatically + /// support any view defined by a TreeWalker. + /// + /// Omitting nodes from the logical view of a subtree can result in a structure + /// that is substantially different from the same subtree in the complete, unfiltered + /// document. Nodes that are siblings in the TreeWalker view may be children + /// of different, widely separated nodes in the original view. For instance, + /// consider a NodeFilter that skips all nodes except for Text nodes and the + /// root node of a document. In the logical view that results, all text nodes + /// will be siblings and appear as direct children of the root node, no matter + /// how deeply nested the structure of the original document. /// - /// Omitting nodes from the logical view of a subtree can result in a structure - /// that is substantially different from the same subtree in the complete, unfiltered - /// document. Nodes that are siblings in the TreeWalker view may be children - /// of different, widely separated nodes in the original view. For instance, - /// consider a NodeFilter that skips all nodes except for Text nodes and the - /// root node of a document. In the logical view that results, all text nodes - /// will be siblings and appear as direct children of the root node, no matter - /// how deeply nested the structure of the original document. - /// - /// A TreeWalker can be directly instantiated using one of its constructors - - /// the DocumentTraversal interface is not needed and therefore not implemented. - /// Unlike most other DOM classes, TreeWalker supports value semantics. - /// - /// If the TreeWalker's current node is removed from the document, the - /// result of calling any of the movement methods is undefined. This behavior - /// does not conform to the DOM Level 2 Traversal specification. -{ -public: - TreeWalker(Node* root, unsigned long whatToShow, NodeFilter* pFilter = 0); - /// Creates a TreeWalker over the subtree rooted at the specified node. - - TreeWalker(const TreeWalker& walker); - /// Creates a TreeWalker by copying another TreeWalker. - - TreeWalker& operator = (const TreeWalker& walker); - /// Assignment operator. - - ~TreeWalker(); - /// Destroys the TreeWalker. - - Node* root() const; - /// The root node of the TreeWalker, as specified when it was created. - - unsigned long whatToShow() const; - /// This attribute determines which node types are presented via the TreeWalker. - /// The available set of constants is defined in the NodeFilter interface. Nodes - /// not accepted by whatToShow will be skipped, but their children may still - /// be considered. Note that this skip takes precedence over the filter, if - /// any. - - NodeFilter* filter() const; - /// The NodeFilter used to screen nodes. - - bool expandEntityReferences() const; - /// The value of this flag determines whether the children of entity reference - /// nodes are visible to the iterator. If false, they and their descendants - /// will be rejected. Note that this rejection takes precedence over whatToShow - /// and the filter. Also note that this is currently the only situation where - /// NodeIterators may reject a complete subtree rather than skipping individual - /// nodes. + /// A TreeWalker can be directly instantiated using one of its constructors - + /// the DocumentTraversal interface is not needed and therefore not implemented. + /// Unlike most other DOM classes, TreeWalker supports value semantics. + /// + /// If the TreeWalker's current node is removed from the document, the + /// result of calling any of the movement methods is undefined. This behavior + /// does not conform to the DOM Level 2 Traversal specification. +{ +public: + TreeWalker(Node* root, unsigned long whatToShow, NodeFilter* pFilter = 0); + /// Creates a TreeWalker over the subtree rooted at the specified node. + + TreeWalker(const TreeWalker& walker); + /// Creates a TreeWalker by copying another TreeWalker. + + TreeWalker& operator = (const TreeWalker& walker); + /// Assignment operator. + + ~TreeWalker(); + /// Destroys the TreeWalker. + + Node* root() const; + /// The root node of the TreeWalker, as specified when it was created. + + unsigned long whatToShow() const; + /// This attribute determines which node types are presented via the TreeWalker. + /// The available set of constants is defined in the NodeFilter interface. Nodes + /// not accepted by whatToShow will be skipped, but their children may still + /// be considered. Note that this skip takes precedence over the filter, if + /// any. + + NodeFilter* filter() const; + /// The NodeFilter used to screen nodes. + + bool expandEntityReferences() const; + /// The value of this flag determines whether the children of entity reference + /// nodes are visible to the iterator. If false, they and their descendants + /// will be rejected. Note that this rejection takes precedence over whatToShow + /// and the filter. Also note that this is currently the only situation where + /// NodeIterators may reject a complete subtree rather than skipping individual + /// nodes. + /// + /// To produce a view of the document that has entity references expanded and + /// does not expose the entity reference node itself, use the whatToShow flags + /// to hide the entity reference node and set expandEntityReferences to true + /// when creating the iterator. To produce a view of the document that has entity + /// reference nodes but no entity expansion, use the whatToShow flags to show + /// the entity reference node and set expandEntityReferences to false. /// - /// To produce a view of the document that has entity references expanded and - /// does not expose the entity reference node itself, use the whatToShow flags - /// to hide the entity reference node and set expandEntityReferences to true - /// when creating the iterator. To produce a view of the document that has entity - /// reference nodes but no entity expansion, use the whatToShow flags to show - /// the entity reference node and set expandEntityReferences to false. - /// - /// This implementation does not support entity reference expansion and - /// thus always returns false. - - Node* currentNode() const; - /// The node at which the TreeWalker is currently positioned. - /// Alterations to the DOM tree may cause the current node to no longer be accepted - /// by the TreeWalker's associated filter. currentNode may also be explicitly - /// set to any node, whether or not it is within the subtree specified by the - /// root node or would be accepted by the filter and whatToShow flags. Further - /// traversal occurs relative to currentNode even if it is not part of the current - /// view, by applying the filters in the requested direction; if no traversal - /// is possible, currentNode is not changed. - - Node* getCurrentNode() const; - /// See currentNode(). - - void setCurrentNode(Node* pNode); - /// Sets the current node. - - Node* parentNode(); - /// Moves to and returns the closest visible ancestor node of the current node. - /// If the search for parentNode attempts to step upward from the TreeWalker's - /// root node, or if it fails to find a visible ancestor node, this method retains - /// the current position and returns null. - - Node* firstChild(); - /// Moves the TreeWalker to the first visible child of the current node, and - /// returns the new node. If the current node has no visible children, returns - /// null, and retains the current node. - - Node* lastChild(); - /// Moves the TreeWalker to the last visible child of the current node, and - /// returns the new node. If the current node has no visible children, returns - /// null, and retains the current node. - - Node* previousSibling(); - /// Moves the TreeWalker to the previous sibling of the current node, and returns - /// the new node. If the current node has no visible previous sibling, returns - /// null, and retains the current node. - - Node* nextSibling(); - /// Moves the TreeWalker to the next sibling of the current node, and returns - /// the new node. If the current node has no visible next sibling, returns null, - /// and retains the current node. - - Node* previousNode(); - /// Moves the TreeWalker to the previous visible node in document order relative - /// to the current node, and returns the new node. If the current node has no - /// previous node, or if the search for previousNode attempts to step upward - /// from the TreeWalker's root node, returns null, and retains the current node. - - Node* nextNode(); - /// Moves the TreeWalker to the next visible node in document order relative - /// to the current node, and returns the new node. If the current node has no - /// next node, or if the search for nextNode attempts to step upward from the - /// TreeWalker's root node, returns null, and retains the current node. - -protected: - int accept(Node* pNode) const; - Node* next(Node* pNode) const; - Node* previous(Node* pNode) const; - -private: - TreeWalker(); - - Node* _pRoot; - unsigned long _whatToShow; - NodeFilter* _pFilter; - Node* _pCurrent; -}; - - -// -// inlines -// -inline Node* TreeWalker::root() const -{ - return _pRoot; -} - - -inline unsigned long TreeWalker::whatToShow() const -{ - return _whatToShow; -} - - -inline NodeFilter* TreeWalker::filter() const -{ - return _pFilter; -} - - -inline bool TreeWalker::expandEntityReferences() const -{ - return false; -} - - -inline Node* TreeWalker::currentNode() const -{ - return _pCurrent; -} - - -inline Node* TreeWalker::getCurrentNode() const -{ - return _pCurrent; -} - - -} } // namespace Poco::XML - - -#endif // DOM_TreeWalker_INCLUDED + /// This implementation does not support entity reference expansion and + /// thus always returns false. + + Node* currentNode() const; + /// The node at which the TreeWalker is currently positioned. + /// Alterations to the DOM tree may cause the current node to no longer be accepted + /// by the TreeWalker's associated filter. currentNode may also be explicitly + /// set to any node, whether or not it is within the subtree specified by the + /// root node or would be accepted by the filter and whatToShow flags. Further + /// traversal occurs relative to currentNode even if it is not part of the current + /// view, by applying the filters in the requested direction; if no traversal + /// is possible, currentNode is not changed. + + Node* getCurrentNode() const; + /// See currentNode(). + + void setCurrentNode(Node* pNode); + /// Sets the current node. + + Node* parentNode(); + /// Moves to and returns the closest visible ancestor node of the current node. + /// If the search for parentNode attempts to step upward from the TreeWalker's + /// root node, or if it fails to find a visible ancestor node, this method retains + /// the current position and returns null. + + Node* firstChild(); + /// Moves the TreeWalker to the first visible child of the current node, and + /// returns the new node. If the current node has no visible children, returns + /// null, and retains the current node. + + Node* lastChild(); + /// Moves the TreeWalker to the last visible child of the current node, and + /// returns the new node. If the current node has no visible children, returns + /// null, and retains the current node. + + Node* previousSibling(); + /// Moves the TreeWalker to the previous sibling of the current node, and returns + /// the new node. If the current node has no visible previous sibling, returns + /// null, and retains the current node. + + Node* nextSibling(); + /// Moves the TreeWalker to the next sibling of the current node, and returns + /// the new node. If the current node has no visible next sibling, returns null, + /// and retains the current node. + + Node* previousNode(); + /// Moves the TreeWalker to the previous visible node in document order relative + /// to the current node, and returns the new node. If the current node has no + /// previous node, or if the search for previousNode attempts to step upward + /// from the TreeWalker's root node, returns null, and retains the current node. + + Node* nextNode(); + /// Moves the TreeWalker to the next visible node in document order relative + /// to the current node, and returns the new node. If the current node has no + /// next node, or if the search for nextNode attempts to step upward from the + /// TreeWalker's root node, returns null, and retains the current node. + +protected: + int accept(Node* pNode) const; + Node* next(Node* pNode) const; + Node* previous(Node* pNode) const; + +private: + TreeWalker(); + + Node* _pRoot; + unsigned long _whatToShow; + NodeFilter* _pFilter; + Node* _pCurrent; +}; + + +// +// inlines +// +inline Node* TreeWalker::root() const +{ + return _pRoot; +} + + +inline unsigned long TreeWalker::whatToShow() const +{ + return _whatToShow; +} + + +inline NodeFilter* TreeWalker::filter() const +{ + return _pFilter; +} + + +inline bool TreeWalker::expandEntityReferences() const +{ + return false; +} + + +inline Node* TreeWalker::currentNode() const +{ + return _pCurrent; +} + + +inline Node* TreeWalker::getCurrentNode() const +{ + return _pCurrent; +} + + +} } // namespace Poco::XML + + +#endif // DOM_TreeWalker_INCLUDED diff --git a/contrib/libs/poco/XML/include/Poco/SAX/Attributes.h b/contrib/libs/poco/XML/include/Poco/SAX/Attributes.h index d7ba9129ed..a62d6383de 100644 --- a/contrib/libs/poco/XML/include/Poco/SAX/Attributes.h +++ b/contrib/libs/poco/XML/include/Poco/SAX/Attributes.h @@ -1,120 +1,120 @@ -// -// Attributes.h -// -// Library: XML -// Package: SAX -// Module: SAX -// -// SAX2 Attributes Interface. -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef SAX_Attributes_INCLUDED -#define SAX_Attributes_INCLUDED - - -#include "Poco/XML/XML.h" -#include "Poco/XML/XMLString.h" - - -namespace Poco { -namespace XML { - - -class XML_API Attributes - /// Interface for a list of XML attributes. - /// This interface allows access to a list of attributes in three different ways: - /// 1.by attribute index; - /// 2.by Namespace-qualified name; or - /// 3.by qualified (prefixed) name. - /// - /// The list will not contain attributes that were declared #IMPLIED but not - /// specified in the start tag. It will also not contain - /// attributes used as Namespace declarations (xmlns*) unless the - /// http://xml.org/sax/features/namespace-prefixes - /// feature is set to true (it is false by default). - /// - /// If the namespace-prefixes feature (see above) is false, access by - /// qualified name may not be available; if the - /// http://xml.org/sax/features/namespaces feature is false, access by - /// Namespace-qualified names may not be available. - /// This interface replaces the now-deprecated SAX1 AttributeList interface, - /// which does not contain Namespace support. In - /// addition to Namespace support, it adds the getIndex methods (below). - /// The order of attributes in the list is unspecified, and will vary from - /// implementation to implementation. -{ -public: - virtual int getIndex(const XMLString& name) const = 0; - /// Look up the index of an attribute by a qualified name. - - virtual int getIndex(const XMLString& namespaceURI, const XMLString& localName) const = 0; - /// Look up the index of an attribute by a namspace name. - - virtual int getLength() const = 0; - /// Return the number of attributes in the list. - /// - /// Once you know the number of attributes, you can iterate through the list. - - virtual const XMLString& getLocalName(int i) const = 0; - /// Look up a local attribute name by index. - - virtual const XMLString& getQName(int i) const = 0; - /// Look up a qualified attribute name by index. - - virtual const XMLString& getType(int i) const = 0; - /// Look up an attribute type by index. - /// - /// The attribute type is one of the strings "CDATA", "ID", "IDREF", "IDREFS", "NMTOKEN", - /// "NMTOKENS", "ENTITY", "ENTITIES", or "NOTATION" (always in upper case). - /// - /// If the parser has not read a declaration for the attribute, or if the parser does not - /// report attribute types, then it must return the value "CDATA" as stated in the XML 1.0 - /// Recommendation (clause 3.3.3, "Attribute-Value Normalization"). +// +// Attributes.h +// +// Library: XML +// Package: SAX +// Module: SAX +// +// SAX2 Attributes Interface. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef SAX_Attributes_INCLUDED +#define SAX_Attributes_INCLUDED + + +#include "Poco/XML/XML.h" +#include "Poco/XML/XMLString.h" + + +namespace Poco { +namespace XML { + + +class XML_API Attributes + /// Interface for a list of XML attributes. + /// This interface allows access to a list of attributes in three different ways: + /// 1.by attribute index; + /// 2.by Namespace-qualified name; or + /// 3.by qualified (prefixed) name. + /// + /// The list will not contain attributes that were declared #IMPLIED but not + /// specified in the start tag. It will also not contain + /// attributes used as Namespace declarations (xmlns*) unless the + /// http://xml.org/sax/features/namespace-prefixes + /// feature is set to true (it is false by default). + /// + /// If the namespace-prefixes feature (see above) is false, access by + /// qualified name may not be available; if the + /// http://xml.org/sax/features/namespaces feature is false, access by + /// Namespace-qualified names may not be available. + /// This interface replaces the now-deprecated SAX1 AttributeList interface, + /// which does not contain Namespace support. In + /// addition to Namespace support, it adds the getIndex methods (below). + /// The order of attributes in the list is unspecified, and will vary from + /// implementation to implementation. +{ +public: + virtual int getIndex(const XMLString& name) const = 0; + /// Look up the index of an attribute by a qualified name. + + virtual int getIndex(const XMLString& namespaceURI, const XMLString& localName) const = 0; + /// Look up the index of an attribute by a namspace name. + + virtual int getLength() const = 0; + /// Return the number of attributes in the list. /// - /// For an enumerated attribute that is not a notation, the parser will report the type - /// as "NMTOKEN". - - virtual const XMLString& getType(const XMLString& qname) const = 0; - /// Look up an attribute type by a qualified name. - /// - /// See getType(int) for a description of the possible types. - - virtual const XMLString& getType(const XMLString& namespaceURI, const XMLString& localName) const = 0; - /// Look up an attribute type by a namespace name. - /// - /// See getType(int) for a description of the possible types. - - virtual const XMLString& getValue(int i) const = 0; - /// Look up an attribute value by index. - /// - /// If the attribute value is a list of tokens (IDREFS, ENTITIES, or NMTOKENS), the tokens - /// will be concatenated into a single string with each token separated by a single space. - - virtual const XMLString& getValue(const XMLString& qname) const = 0; - /// Look up an attribute value by a qualified name. - /// - /// See getValue(int) for a description of the possible values. - - virtual const XMLString& getValue(const XMLString& uri, const XMLString& localName) const = 0; - /// Look up an attribute value by a namespace name. - /// - /// See getValue(int) for a description of the possible values. - - virtual const XMLString& getURI(int i) const = 0; - /// Look up a namespace URI by index. - -protected: - virtual ~Attributes(); -}; - - -} } // namespace Poco::XML - - -#endif // SAX_Attributes_INCLUDED + /// Once you know the number of attributes, you can iterate through the list. + + virtual const XMLString& getLocalName(int i) const = 0; + /// Look up a local attribute name by index. + + virtual const XMLString& getQName(int i) const = 0; + /// Look up a qualified attribute name by index. + + virtual const XMLString& getType(int i) const = 0; + /// Look up an attribute type by index. + /// + /// The attribute type is one of the strings "CDATA", "ID", "IDREF", "IDREFS", "NMTOKEN", + /// "NMTOKENS", "ENTITY", "ENTITIES", or "NOTATION" (always in upper case). + /// + /// If the parser has not read a declaration for the attribute, or if the parser does not + /// report attribute types, then it must return the value "CDATA" as stated in the XML 1.0 + /// Recommendation (clause 3.3.3, "Attribute-Value Normalization"). + /// + /// For an enumerated attribute that is not a notation, the parser will report the type + /// as "NMTOKEN". + + virtual const XMLString& getType(const XMLString& qname) const = 0; + /// Look up an attribute type by a qualified name. + /// + /// See getType(int) for a description of the possible types. + + virtual const XMLString& getType(const XMLString& namespaceURI, const XMLString& localName) const = 0; + /// Look up an attribute type by a namespace name. + /// + /// See getType(int) for a description of the possible types. + + virtual const XMLString& getValue(int i) const = 0; + /// Look up an attribute value by index. + /// + /// If the attribute value is a list of tokens (IDREFS, ENTITIES, or NMTOKENS), the tokens + /// will be concatenated into a single string with each token separated by a single space. + + virtual const XMLString& getValue(const XMLString& qname) const = 0; + /// Look up an attribute value by a qualified name. + /// + /// See getValue(int) for a description of the possible values. + + virtual const XMLString& getValue(const XMLString& uri, const XMLString& localName) const = 0; + /// Look up an attribute value by a namespace name. + /// + /// See getValue(int) for a description of the possible values. + + virtual const XMLString& getURI(int i) const = 0; + /// Look up a namespace URI by index. + +protected: + virtual ~Attributes(); +}; + + +} } // namespace Poco::XML + + +#endif // SAX_Attributes_INCLUDED diff --git a/contrib/libs/poco/XML/include/Poco/SAX/AttributesImpl.h b/contrib/libs/poco/XML/include/Poco/SAX/AttributesImpl.h index 8ce2d529f1..7281e11dbe 100644 --- a/contrib/libs/poco/XML/include/Poco/SAX/AttributesImpl.h +++ b/contrib/libs/poco/XML/include/Poco/SAX/AttributesImpl.h @@ -1,296 +1,296 @@ -// -// AttributesImpl.h -// -// Library: XML -// Package: SAX -// Module: SAX -// -// Implementation of the SAX2 Attributes Interface. -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef SAX_AttributesImpl_INCLUDED -#define SAX_AttributesImpl_INCLUDED - - -#include "Poco/XML/XML.h" -#include "Poco/SAX/Attributes.h" -#include <vector> - - -namespace Poco { -namespace XML { - - -class XML_API AttributesImpl: public Attributes - /// This class provides a default implementation of the SAX2 Attributes interface, - /// with the addition of manipulators so that the list can be modified or reused. - /// - /// There are two typical uses of this class: - /// 1. to take a persistent snapshot of an Attributes object in a startElement event; or - /// 2. to construct or modify an Attributes object in a SAX2 driver or filter. -{ -public: - struct Attribute - { - XMLString localName; - XMLString namespaceURI; - XMLString qname; - XMLString value; - XMLString type; - bool specified; - }; - typedef std::vector<Attribute> AttributeVec; - typedef AttributeVec::const_iterator iterator; - - AttributesImpl(); - /// Creates the AttributesImpl. - - AttributesImpl(const Attributes& attributes); - /// Creates the AttributesImpl by copying another one. - - AttributesImpl(const AttributesImpl& attributes); - /// Creates the AttributesImpl by copying another one. - - ~AttributesImpl(); - /// Destroys the AttributesImpl. - - AttributesImpl& operator = (const AttributesImpl& attributes); - /// Assignment operator. - - int getIndex(const XMLString& name) const; - int getIndex(const XMLString& namespaceURI, const XMLString& localName) const; - int getLength() const; - const XMLString& getLocalName(int i) const; - const XMLString& getQName(int i) const; - const XMLString& getType(int i) const; - const XMLString& getType(const XMLString& qname) const; - const XMLString& getType(const XMLString& namespaceURI, const XMLString& localName) const; - const XMLString& getValue(int i) const; - const XMLString& getValue(const XMLString& qname) const; - const XMLString& getValue(const XMLString& namespaceURI, const XMLString& localName) const; - const XMLString& getURI(int i) const; - - bool isSpecified(int i) const; - /// Returns true unless the attribute value was provided by DTD defaulting. - /// Extension from Attributes2 interface. - - bool isSpecified(const XMLString& qname) const; - /// Returns true unless the attribute value was provided by DTD defaulting. - /// Extension from Attributes2 interface. - - bool isSpecified(const XMLString& namespaceURI, const XMLString& localName) const; - /// Returns true unless the attribute value was provided by DTD defaulting. - /// Extension from Attributes2 interface. - - void setValue(int i, const XMLString& value); - /// Sets the value of an attribute. - - void setValue(const XMLString& qname, const XMLString& value); - /// Sets the value of an attribute. - - void setValue(const XMLString& namespaceURI, const XMLString& localName, const XMLString& value); - /// Sets the value of an attribute. - - void setAttributes(const Attributes& attributes); - /// Copies the attributes from another Attributes object. - - void setAttribute(int i, const XMLString& namespaceURI, const XMLString& localName, const XMLString& qname, const XMLString& type, const XMLString& value); - /// Sets an attribute. - - void addAttribute(const XMLString& namespaceURI, const XMLString& localName, const XMLString& qname, const XMLString& type, const XMLString& value); - /// Adds an attribute to the end of the list. - - void addAttribute(const XMLString& namespaceURI, const XMLString& localName, const XMLString& qname, const XMLString& type, const XMLString& value, bool specified); - /// Adds an attribute to the end of the list. - - void addAttribute(const XMLChar* namespaceURI, const XMLChar* localName, const XMLChar* qname, const XMLChar* type, const XMLChar* value, bool specified); - /// Adds an attribute to the end of the list. - - Attribute& addAttribute(); - /// Add an (empty) attribute to the end of the list. - /// For internal use only. - /// The returned Attribute element must be filled by the caller. - - void removeAttribute(int i); - /// Removes an attribute. - - void removeAttribute(const XMLString& qname); - /// Removes an attribute. - - void removeAttribute(const XMLString& namespaceURI, const XMLString& localName); - /// Removes an attribute. - - void clear(); - /// Removes all attributes. - - void reserve(std::size_t capacity); - /// Reserves capacity in the internal vector. - - void setLocalName(int i, const XMLString& localName); - /// Sets the local name of an attribute. - - void setQName(int i, const XMLString& qname); - /// Sets the qualified name of an attribute. - - void setType(int i, const XMLString& type); - /// Sets the type of an attribute. - - void setURI(int i, const XMLString& namespaceURI); - /// Sets the namespace URI of an attribute. - - iterator begin() const; - /// Iterator support. - - iterator end() const; - /// Iterator support. - -protected: - Attribute* find(const XMLString& qname) const; - Attribute* find(const XMLString& namespaceURI, const XMLString& localName) const; - -private: - AttributeVec _attributes; - Attribute _empty; -}; - - -// -// inlines -// -inline AttributesImpl::iterator AttributesImpl::begin() const -{ - return _attributes.begin(); -} - - -inline AttributesImpl::iterator AttributesImpl::end() const -{ - return _attributes.end(); -} - - -inline AttributesImpl::Attribute& AttributesImpl::addAttribute() -{ - _attributes.push_back(_empty); - return _attributes.back(); -} - - -inline int AttributesImpl::getLength() const -{ - return (int) _attributes.size(); -} - - -inline const XMLString& AttributesImpl::getLocalName(int i) const -{ - poco_assert (0 <= i && i < static_cast<int>(_attributes.size())); - return _attributes[i].localName; -} - - -inline const XMLString& AttributesImpl::getQName(int i) const -{ - poco_assert (0 <= i && i < static_cast<int>(_attributes.size())); - return _attributes[i].qname; -} - - -inline const XMLString& AttributesImpl::getType(int i) const -{ - poco_assert (0 <= i && i < static_cast<int>(_attributes.size())); - return _attributes[i].type; -} - - -inline const XMLString& AttributesImpl::getType(const XMLString& qname) const -{ - Attribute* pAttr = find(qname); - if (pAttr) - return pAttr->type; - else - return _empty.type; -} - - -inline const XMLString& AttributesImpl::getType(const XMLString& namespaceURI, const XMLString& localName) const -{ - Attribute* pAttr = find(namespaceURI, localName); - if (pAttr) - return pAttr->type; - else - return _empty.type; -} - - -inline const XMLString& AttributesImpl::getValue(int i) const -{ - poco_assert (0 <= i && i < static_cast<int>(_attributes.size())); - return _attributes[i].value; -} - - -inline const XMLString& AttributesImpl::getValue(const XMLString& qname) const -{ - Attribute* pAttr = find(qname); - if (pAttr) - return pAttr->value; - else - return _empty.value; -} - - -inline const XMLString& AttributesImpl::getValue(const XMLString& namespaceURI, const XMLString& localName) const -{ - Attribute* pAttr = find(namespaceURI, localName); - if (pAttr) - return pAttr->value; - else - return _empty.value; -} - - -inline const XMLString& AttributesImpl::getURI(int i) const -{ - poco_assert (0 <= i && i < static_cast<int>(_attributes.size())); - return _attributes[i].namespaceURI; -} - - -inline bool AttributesImpl::isSpecified(int i) const -{ - poco_assert (0 <= i && i < static_cast<int>(_attributes.size())); - return _attributes[i].specified; -} - - -inline bool AttributesImpl::isSpecified(const XMLString& qname) const -{ - Attribute* pAttr = find(qname); - if (pAttr) - return pAttr->specified; - else - return false; -} - - -inline bool AttributesImpl::isSpecified(const XMLString& namespaceURI, const XMLString& localName) const -{ - Attribute* pAttr = find(namespaceURI, localName); - if (pAttr) - return pAttr->specified; - else - return false; -} - - -} } // namespace Poco::XML - - -#endif // SAX_AttributesImpl_INCLUDED +// +// AttributesImpl.h +// +// Library: XML +// Package: SAX +// Module: SAX +// +// Implementation of the SAX2 Attributes Interface. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef SAX_AttributesImpl_INCLUDED +#define SAX_AttributesImpl_INCLUDED + + +#include "Poco/XML/XML.h" +#include "Poco/SAX/Attributes.h" +#include <vector> + + +namespace Poco { +namespace XML { + + +class XML_API AttributesImpl: public Attributes + /// This class provides a default implementation of the SAX2 Attributes interface, + /// with the addition of manipulators so that the list can be modified or reused. + /// + /// There are two typical uses of this class: + /// 1. to take a persistent snapshot of an Attributes object in a startElement event; or + /// 2. to construct or modify an Attributes object in a SAX2 driver or filter. +{ +public: + struct Attribute + { + XMLString localName; + XMLString namespaceURI; + XMLString qname; + XMLString value; + XMLString type; + bool specified; + }; + typedef std::vector<Attribute> AttributeVec; + typedef AttributeVec::const_iterator iterator; + + AttributesImpl(); + /// Creates the AttributesImpl. + + AttributesImpl(const Attributes& attributes); + /// Creates the AttributesImpl by copying another one. + + AttributesImpl(const AttributesImpl& attributes); + /// Creates the AttributesImpl by copying another one. + + ~AttributesImpl(); + /// Destroys the AttributesImpl. + + AttributesImpl& operator = (const AttributesImpl& attributes); + /// Assignment operator. + + int getIndex(const XMLString& name) const; + int getIndex(const XMLString& namespaceURI, const XMLString& localName) const; + int getLength() const; + const XMLString& getLocalName(int i) const; + const XMLString& getQName(int i) const; + const XMLString& getType(int i) const; + const XMLString& getType(const XMLString& qname) const; + const XMLString& getType(const XMLString& namespaceURI, const XMLString& localName) const; + const XMLString& getValue(int i) const; + const XMLString& getValue(const XMLString& qname) const; + const XMLString& getValue(const XMLString& namespaceURI, const XMLString& localName) const; + const XMLString& getURI(int i) const; + + bool isSpecified(int i) const; + /// Returns true unless the attribute value was provided by DTD defaulting. + /// Extension from Attributes2 interface. + + bool isSpecified(const XMLString& qname) const; + /// Returns true unless the attribute value was provided by DTD defaulting. + /// Extension from Attributes2 interface. + + bool isSpecified(const XMLString& namespaceURI, const XMLString& localName) const; + /// Returns true unless the attribute value was provided by DTD defaulting. + /// Extension from Attributes2 interface. + + void setValue(int i, const XMLString& value); + /// Sets the value of an attribute. + + void setValue(const XMLString& qname, const XMLString& value); + /// Sets the value of an attribute. + + void setValue(const XMLString& namespaceURI, const XMLString& localName, const XMLString& value); + /// Sets the value of an attribute. + + void setAttributes(const Attributes& attributes); + /// Copies the attributes from another Attributes object. + + void setAttribute(int i, const XMLString& namespaceURI, const XMLString& localName, const XMLString& qname, const XMLString& type, const XMLString& value); + /// Sets an attribute. + + void addAttribute(const XMLString& namespaceURI, const XMLString& localName, const XMLString& qname, const XMLString& type, const XMLString& value); + /// Adds an attribute to the end of the list. + + void addAttribute(const XMLString& namespaceURI, const XMLString& localName, const XMLString& qname, const XMLString& type, const XMLString& value, bool specified); + /// Adds an attribute to the end of the list. + + void addAttribute(const XMLChar* namespaceURI, const XMLChar* localName, const XMLChar* qname, const XMLChar* type, const XMLChar* value, bool specified); + /// Adds an attribute to the end of the list. + + Attribute& addAttribute(); + /// Add an (empty) attribute to the end of the list. + /// For internal use only. + /// The returned Attribute element must be filled by the caller. + + void removeAttribute(int i); + /// Removes an attribute. + + void removeAttribute(const XMLString& qname); + /// Removes an attribute. + + void removeAttribute(const XMLString& namespaceURI, const XMLString& localName); + /// Removes an attribute. + + void clear(); + /// Removes all attributes. + + void reserve(std::size_t capacity); + /// Reserves capacity in the internal vector. + + void setLocalName(int i, const XMLString& localName); + /// Sets the local name of an attribute. + + void setQName(int i, const XMLString& qname); + /// Sets the qualified name of an attribute. + + void setType(int i, const XMLString& type); + /// Sets the type of an attribute. + + void setURI(int i, const XMLString& namespaceURI); + /// Sets the namespace URI of an attribute. + + iterator begin() const; + /// Iterator support. + + iterator end() const; + /// Iterator support. + +protected: + Attribute* find(const XMLString& qname) const; + Attribute* find(const XMLString& namespaceURI, const XMLString& localName) const; + +private: + AttributeVec _attributes; + Attribute _empty; +}; + + +// +// inlines +// +inline AttributesImpl::iterator AttributesImpl::begin() const +{ + return _attributes.begin(); +} + + +inline AttributesImpl::iterator AttributesImpl::end() const +{ + return _attributes.end(); +} + + +inline AttributesImpl::Attribute& AttributesImpl::addAttribute() +{ + _attributes.push_back(_empty); + return _attributes.back(); +} + + +inline int AttributesImpl::getLength() const +{ + return (int) _attributes.size(); +} + + +inline const XMLString& AttributesImpl::getLocalName(int i) const +{ + poco_assert (0 <= i && i < static_cast<int>(_attributes.size())); + return _attributes[i].localName; +} + + +inline const XMLString& AttributesImpl::getQName(int i) const +{ + poco_assert (0 <= i && i < static_cast<int>(_attributes.size())); + return _attributes[i].qname; +} + + +inline const XMLString& AttributesImpl::getType(int i) const +{ + poco_assert (0 <= i && i < static_cast<int>(_attributes.size())); + return _attributes[i].type; +} + + +inline const XMLString& AttributesImpl::getType(const XMLString& qname) const +{ + Attribute* pAttr = find(qname); + if (pAttr) + return pAttr->type; + else + return _empty.type; +} + + +inline const XMLString& AttributesImpl::getType(const XMLString& namespaceURI, const XMLString& localName) const +{ + Attribute* pAttr = find(namespaceURI, localName); + if (pAttr) + return pAttr->type; + else + return _empty.type; +} + + +inline const XMLString& AttributesImpl::getValue(int i) const +{ + poco_assert (0 <= i && i < static_cast<int>(_attributes.size())); + return _attributes[i].value; +} + + +inline const XMLString& AttributesImpl::getValue(const XMLString& qname) const +{ + Attribute* pAttr = find(qname); + if (pAttr) + return pAttr->value; + else + return _empty.value; +} + + +inline const XMLString& AttributesImpl::getValue(const XMLString& namespaceURI, const XMLString& localName) const +{ + Attribute* pAttr = find(namespaceURI, localName); + if (pAttr) + return pAttr->value; + else + return _empty.value; +} + + +inline const XMLString& AttributesImpl::getURI(int i) const +{ + poco_assert (0 <= i && i < static_cast<int>(_attributes.size())); + return _attributes[i].namespaceURI; +} + + +inline bool AttributesImpl::isSpecified(int i) const +{ + poco_assert (0 <= i && i < static_cast<int>(_attributes.size())); + return _attributes[i].specified; +} + + +inline bool AttributesImpl::isSpecified(const XMLString& qname) const +{ + Attribute* pAttr = find(qname); + if (pAttr) + return pAttr->specified; + else + return false; +} + + +inline bool AttributesImpl::isSpecified(const XMLString& namespaceURI, const XMLString& localName) const +{ + Attribute* pAttr = find(namespaceURI, localName); + if (pAttr) + return pAttr->specified; + else + return false; +} + + +} } // namespace Poco::XML + + +#endif // SAX_AttributesImpl_INCLUDED diff --git a/contrib/libs/poco/XML/include/Poco/SAX/ContentHandler.h b/contrib/libs/poco/XML/include/Poco/SAX/ContentHandler.h index 58f2a253ad..0568fee89a 100644 --- a/contrib/libs/poco/XML/include/Poco/SAX/ContentHandler.h +++ b/contrib/libs/poco/XML/include/Poco/SAX/ContentHandler.h @@ -1,240 +1,240 @@ -// -// ContentHandler.h -// -// Library: XML -// Package: SAX -// Module: SAX -// -// SAX2 ContentHandler Interface. -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef SAX_ContentHandler_INCLUDED -#define SAX_ContentHandler_INCLUDED - - -#include "Poco/XML/XML.h" -#include "Poco/XML/XMLString.h" - - -namespace Poco { -namespace XML { - - -class Locator; -class Attributes; - - -class XML_API ContentHandler - /// Receive notification of the logical content of a document. - /// - /// This is the main interface that most SAX applications implement: if the - /// application needs to be informed of basic parsing events, it implements - /// this interface and registers an instance with the SAX parser using the setContentHandler - /// method. The parser uses the instance to report basic document-related events - /// like the start and end of elements and character data. - /// - /// The order of events in this interface is very important, and mirrors the - /// order of information in the document itself. For example, all of an element's - /// content (character data, processing instructions, and/or subelements) will - /// appear, in order, between the startElement event and the corresponding endElement - /// event. +// +// ContentHandler.h +// +// Library: XML +// Package: SAX +// Module: SAX +// +// SAX2 ContentHandler Interface. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef SAX_ContentHandler_INCLUDED +#define SAX_ContentHandler_INCLUDED + + +#include "Poco/XML/XML.h" +#include "Poco/XML/XMLString.h" + + +namespace Poco { +namespace XML { + + +class Locator; +class Attributes; + + +class XML_API ContentHandler + /// Receive notification of the logical content of a document. /// - /// This interface is similar to the now-deprecated SAX 1.0 DocumentHandler - /// interface, but it adds support for Namespaces and for reporting skipped - /// entities (in non-validating XML processors). - /// Receive notification of the logical content of a document. -{ -public: - virtual void setDocumentLocator(const Locator* loc) = 0; - /// Receive an object for locating the origin of SAX document events. - /// - /// SAX parsers are strongly encouraged (though not absolutely required) to - /// supply a locator: if it does so, it must supply the locator to the application - /// by invoking this method before invoking any of the other methods in the - /// ContentHandler interface. - /// - /// The locator allows the application to determine the end position of any - /// document-related event, even if the parser is not reporting an error. Typically, - /// the application will use this information for reporting its own errors (such - /// as character content that does not match an application's business rules). - /// The information returned by the locator is probably not sufficient for use - /// with a search engine. - /// - /// Note that the locator will return correct information only during the invocation - /// SAX event callbacks after startDocument returns and before endDocument is - /// called. The application should not attempt to use it at any other time. - - virtual void startDocument() = 0; - /// Receive notification of the beginning of a document. - /// - /// The SAX parser calls this function one time before calling all other - /// functions of this class (except SetDocumentLocator). - - virtual void endDocument() = 0; - /// Receive notification of the end of a document. - /// - /// The SAX parser will invoke this method only once, and it will be the last - /// method invoked during the parse. The parser shall not invoke this method - /// until it has either abandoned parsing (because of an unrecoverable error) - /// or reached the end of input. - - virtual void startElement(const XMLString& uri, const XMLString& localName, const XMLString& qname, const Attributes& attrList) = 0; - /// Receive notification of the beginning of an element. - /// - /// The Parser will invoke this method at the beginning of every element in - /// the XML document; there will be a corresponding endElement event for every - /// startElement event (even when the element is empty). All of the element's - /// content will be reported, in order, before the corresponding endElement - /// event. - /// - /// This event allows up to three name components for each element: - /// 1. the Namespace URI; - /// 2. the local name; and - /// 3. the qualified (prefixed) name. - /// - /// Any or all of these may be provided, depending on the values of the http://xml.org/sax/features/namespaces - /// and the http://xml.org/sax/features/namespace-prefixes properties: - /// * the Namespace URI and local name are required when the namespaces - /// property is true (the default), and are optional when the namespaces property - /// is false (if one is specified, both must be); - /// * the qualified name is required when the namespace-prefixes property - /// is true, and is optional when the namespace-prefixes property is false (the - /// default). - /// - /// Note that the attribute list provided will contain only attributes with - /// explicit values (specified or defaulted): #IMPLIED attributes will be omitted. - /// The attribute list will contain attributes used for Namespace declarations - /// (xmlns* attributes) only if the http://xml.org/sax/features/namespace-prefixes - /// property is true (it is false by default, and support for a true value is - /// optional). - /// - /// Like characters(), attribute values may have characters that need more than - /// one char value. - - virtual void endElement(const XMLString& uri, const XMLString& localName, const XMLString& qname) = 0; - /// Receive notification of the end of an element. - /// - /// The SAX parser will invoke this method at the end of every element in the - /// XML document; there will be a corresponding startElement event for every - /// endElement event (even when the element is empty). - /// - /// For information on the names, see startElement. - - virtual void characters(const XMLChar ch[], int start, int length) = 0; - /// Receive notification of character data. - /// - /// The Parser will call this method to report each chunk of character data. - /// SAX parsers may return all contiguous character data in a single chunk, - /// or they may split it into several chunks; however, all of the characters - /// in any single event must come from the same external entity so that the - /// Locator provides useful information. - /// - /// The application must not attempt to read from the array outside of the specified - /// range. - /// - /// Individual characters may consist of more than one XMLChar value. There - /// are three important cases where this happens, because characters can't be - /// represented in just sixteen bits. In one case, characters are represented - /// in a Surrogate Pair, using two special Unicode values. Such characters are - /// in the so-called "Astral Planes", with a code point above U+FFFF. A second - /// case involves composite characters, such as a base character combining with - /// one or more accent characters. And most important, if XMLChar is a plain - /// char, characters are encoded in UTF-8. - /// - /// Your code should not assume that algorithms using char-at-a-time idioms - /// will be working in character units; in some cases they will split characters. - /// This is relevant wherever XML permits arbitrary characters, such as attribute - /// values, processing instruction data, and comments as well as in data reported - /// from this method. It's also generally relevant whenever C++ code manipulates - /// internationalized text; the issue isn't unique to XML. - /// - /// Note that some parsers will report whitespace in element content using the - /// ignorableWhitespace method rather than this one (validating parsers must - /// do so). - - virtual void ignorableWhitespace(const XMLChar ch[], int start, int length) = 0; - /// Receive notification of ignorable whitespace in element content. - /// - /// Validating Parsers must use this method to report each chunk of whitespace - /// in element content (see the W3C XML 1.0 recommendation, section 2.10): non-validating - /// parsers may also use this method if they are capable of parsing and using - /// content models. - /// - /// SAX parsers may return all contiguous whitespace in a single chunk, or they - /// may split it into several chunks; however, all of the characters in any - /// single event must come from the same external entity, so that the Locator - /// provides useful information. - /// - /// The application must not attempt to read from the array outside of the specified - /// range. - - virtual void processingInstruction(const XMLString& target, const XMLString& data) = 0; - /// Receive notification of a processing instruction. - /// - /// The Parser will invoke this method once for each processing instruction - /// found: note that processing instructions may occur before or after the main - /// document element. - /// - /// A SAX parser must never report an XML declaration (XML 1.0, section 2.8) - /// or a text declaration (XML 1.0, section 4.3.1) using this method. - /// - /// Like characters(), processing instruction data may have characters that - /// need more than one char value. - - virtual void startPrefixMapping(const XMLString& prefix, const XMLString& uri) = 0; - /// Begin the scope of a prefix-URI Namespace mapping. - /// - /// The information from this event is not necessary for normal Namespace processing: - /// the SAX XML reader will automatically replace prefixes for element and attribute - /// names when the http://xml.org/sax/features/namespaces feature is true (the - /// default). - /// - /// There are cases, however, when applications need to use prefixes in character - /// data or in attribute values, where they cannot safely be expanded automatically; - /// the start/endPrefixMapping event supplies the information to the application - /// to expand prefixes in those contexts itself, if necessary. - /// - /// Note that start/endPrefixMapping events are not guaranteed to be properly - /// nested relative to each other: all startPrefixMapping events will occur - /// immediately before the corresponding startElement event, and all endPrefixMapping - /// events will occur immediately after the corresponding endElement event, - /// but their order is not otherwise guaranteed. - /// - /// There should never be start/endPrefixMapping events for the "xml" prefix, - /// since it is predeclared and immutable. - - virtual void endPrefixMapping(const XMLString& prefix) = 0; - /// End the scope of a prefix-URI mapping. - /// - /// See startPrefixMapping for details. These events will always occur immediately - /// after the corresponding endElement event, but the order of endPrefixMapping - /// events is not otherwise guaranteed. - - virtual void skippedEntity(const XMLString& name) = 0; - /// Receive notification of a skipped entity. This is not called for entity - /// references within markup constructs such as element start tags or markup - /// declarations. (The XML recommendation requires reporting skipped external - /// entities. SAX also reports internal entity expansion/non-expansion, except - /// within markup constructs.) - /// - /// The Parser will invoke this method each time the entity is skipped. Non-validating - /// processors may skip entities if they have not seen the declarations (because, - /// for example, the entity was declared in an external DTD subset). All processors - /// may skip external entities, depending on the values of the http://xml.org/sax/features/external-general-entities - /// and the http://xml.org/sax/features/external-parameter-entities properties. - -protected: - virtual ~ContentHandler(); -}; - - -} } // namespace Poco::XML - - -#endif // SAX_ContentHandler_INCLUDED + /// This is the main interface that most SAX applications implement: if the + /// application needs to be informed of basic parsing events, it implements + /// this interface and registers an instance with the SAX parser using the setContentHandler + /// method. The parser uses the instance to report basic document-related events + /// like the start and end of elements and character data. + /// + /// The order of events in this interface is very important, and mirrors the + /// order of information in the document itself. For example, all of an element's + /// content (character data, processing instructions, and/or subelements) will + /// appear, in order, between the startElement event and the corresponding endElement + /// event. + /// + /// This interface is similar to the now-deprecated SAX 1.0 DocumentHandler + /// interface, but it adds support for Namespaces and for reporting skipped + /// entities (in non-validating XML processors). + /// Receive notification of the logical content of a document. +{ +public: + virtual void setDocumentLocator(const Locator* loc) = 0; + /// Receive an object for locating the origin of SAX document events. + /// + /// SAX parsers are strongly encouraged (though not absolutely required) to + /// supply a locator: if it does so, it must supply the locator to the application + /// by invoking this method before invoking any of the other methods in the + /// ContentHandler interface. + /// + /// The locator allows the application to determine the end position of any + /// document-related event, even if the parser is not reporting an error. Typically, + /// the application will use this information for reporting its own errors (such + /// as character content that does not match an application's business rules). + /// The information returned by the locator is probably not sufficient for use + /// with a search engine. + /// + /// Note that the locator will return correct information only during the invocation + /// SAX event callbacks after startDocument returns and before endDocument is + /// called. The application should not attempt to use it at any other time. + + virtual void startDocument() = 0; + /// Receive notification of the beginning of a document. + /// + /// The SAX parser calls this function one time before calling all other + /// functions of this class (except SetDocumentLocator). + + virtual void endDocument() = 0; + /// Receive notification of the end of a document. + /// + /// The SAX parser will invoke this method only once, and it will be the last + /// method invoked during the parse. The parser shall not invoke this method + /// until it has either abandoned parsing (because of an unrecoverable error) + /// or reached the end of input. + + virtual void startElement(const XMLString& uri, const XMLString& localName, const XMLString& qname, const Attributes& attrList) = 0; + /// Receive notification of the beginning of an element. + /// + /// The Parser will invoke this method at the beginning of every element in + /// the XML document; there will be a corresponding endElement event for every + /// startElement event (even when the element is empty). All of the element's + /// content will be reported, in order, before the corresponding endElement + /// event. + /// + /// This event allows up to three name components for each element: + /// 1. the Namespace URI; + /// 2. the local name; and + /// 3. the qualified (prefixed) name. + /// + /// Any or all of these may be provided, depending on the values of the http://xml.org/sax/features/namespaces + /// and the http://xml.org/sax/features/namespace-prefixes properties: + /// * the Namespace URI and local name are required when the namespaces + /// property is true (the default), and are optional when the namespaces property + /// is false (if one is specified, both must be); + /// * the qualified name is required when the namespace-prefixes property + /// is true, and is optional when the namespace-prefixes property is false (the + /// default). + /// + /// Note that the attribute list provided will contain only attributes with + /// explicit values (specified or defaulted): #IMPLIED attributes will be omitted. + /// The attribute list will contain attributes used for Namespace declarations + /// (xmlns* attributes) only if the http://xml.org/sax/features/namespace-prefixes + /// property is true (it is false by default, and support for a true value is + /// optional). + /// + /// Like characters(), attribute values may have characters that need more than + /// one char value. + + virtual void endElement(const XMLString& uri, const XMLString& localName, const XMLString& qname) = 0; + /// Receive notification of the end of an element. + /// + /// The SAX parser will invoke this method at the end of every element in the + /// XML document; there will be a corresponding startElement event for every + /// endElement event (even when the element is empty). + /// + /// For information on the names, see startElement. + + virtual void characters(const XMLChar ch[], int start, int length) = 0; + /// Receive notification of character data. + /// + /// The Parser will call this method to report each chunk of character data. + /// SAX parsers may return all contiguous character data in a single chunk, + /// or they may split it into several chunks; however, all of the characters + /// in any single event must come from the same external entity so that the + /// Locator provides useful information. + /// + /// The application must not attempt to read from the array outside of the specified + /// range. + /// + /// Individual characters may consist of more than one XMLChar value. There + /// are three important cases where this happens, because characters can't be + /// represented in just sixteen bits. In one case, characters are represented + /// in a Surrogate Pair, using two special Unicode values. Such characters are + /// in the so-called "Astral Planes", with a code point above U+FFFF. A second + /// case involves composite characters, such as a base character combining with + /// one or more accent characters. And most important, if XMLChar is a plain + /// char, characters are encoded in UTF-8. + /// + /// Your code should not assume that algorithms using char-at-a-time idioms + /// will be working in character units; in some cases they will split characters. + /// This is relevant wherever XML permits arbitrary characters, such as attribute + /// values, processing instruction data, and comments as well as in data reported + /// from this method. It's also generally relevant whenever C++ code manipulates + /// internationalized text; the issue isn't unique to XML. + /// + /// Note that some parsers will report whitespace in element content using the + /// ignorableWhitespace method rather than this one (validating parsers must + /// do so). + + virtual void ignorableWhitespace(const XMLChar ch[], int start, int length) = 0; + /// Receive notification of ignorable whitespace in element content. + /// + /// Validating Parsers must use this method to report each chunk of whitespace + /// in element content (see the W3C XML 1.0 recommendation, section 2.10): non-validating + /// parsers may also use this method if they are capable of parsing and using + /// content models. + /// + /// SAX parsers may return all contiguous whitespace in a single chunk, or they + /// may split it into several chunks; however, all of the characters in any + /// single event must come from the same external entity, so that the Locator + /// provides useful information. + /// + /// The application must not attempt to read from the array outside of the specified + /// range. + + virtual void processingInstruction(const XMLString& target, const XMLString& data) = 0; + /// Receive notification of a processing instruction. + /// + /// The Parser will invoke this method once for each processing instruction + /// found: note that processing instructions may occur before or after the main + /// document element. + /// + /// A SAX parser must never report an XML declaration (XML 1.0, section 2.8) + /// or a text declaration (XML 1.0, section 4.3.1) using this method. + /// + /// Like characters(), processing instruction data may have characters that + /// need more than one char value. + + virtual void startPrefixMapping(const XMLString& prefix, const XMLString& uri) = 0; + /// Begin the scope of a prefix-URI Namespace mapping. + /// + /// The information from this event is not necessary for normal Namespace processing: + /// the SAX XML reader will automatically replace prefixes for element and attribute + /// names when the http://xml.org/sax/features/namespaces feature is true (the + /// default). + /// + /// There are cases, however, when applications need to use prefixes in character + /// data or in attribute values, where they cannot safely be expanded automatically; + /// the start/endPrefixMapping event supplies the information to the application + /// to expand prefixes in those contexts itself, if necessary. + /// + /// Note that start/endPrefixMapping events are not guaranteed to be properly + /// nested relative to each other: all startPrefixMapping events will occur + /// immediately before the corresponding startElement event, and all endPrefixMapping + /// events will occur immediately after the corresponding endElement event, + /// but their order is not otherwise guaranteed. + /// + /// There should never be start/endPrefixMapping events for the "xml" prefix, + /// since it is predeclared and immutable. + + virtual void endPrefixMapping(const XMLString& prefix) = 0; + /// End the scope of a prefix-URI mapping. + /// + /// See startPrefixMapping for details. These events will always occur immediately + /// after the corresponding endElement event, but the order of endPrefixMapping + /// events is not otherwise guaranteed. + + virtual void skippedEntity(const XMLString& name) = 0; + /// Receive notification of a skipped entity. This is not called for entity + /// references within markup constructs such as element start tags or markup + /// declarations. (The XML recommendation requires reporting skipped external + /// entities. SAX also reports internal entity expansion/non-expansion, except + /// within markup constructs.) + /// + /// The Parser will invoke this method each time the entity is skipped. Non-validating + /// processors may skip entities if they have not seen the declarations (because, + /// for example, the entity was declared in an external DTD subset). All processors + /// may skip external entities, depending on the values of the http://xml.org/sax/features/external-general-entities + /// and the http://xml.org/sax/features/external-parameter-entities properties. + +protected: + virtual ~ContentHandler(); +}; + + +} } // namespace Poco::XML + + +#endif // SAX_ContentHandler_INCLUDED diff --git a/contrib/libs/poco/XML/include/Poco/SAX/DTDHandler.h b/contrib/libs/poco/XML/include/Poco/SAX/DTDHandler.h index f21a299c81..aa1426fa4f 100644 --- a/contrib/libs/poco/XML/include/Poco/SAX/DTDHandler.h +++ b/contrib/libs/poco/XML/include/Poco/SAX/DTDHandler.h @@ -1,86 +1,86 @@ -// -// DTDHandler.h -// -// Library: XML -// Package: SAX -// Module: SAX -// -// SAX DTDHandler Interface. -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef SAX_DTDHandler_INCLUDED -#define SAX_DTDHandler_INCLUDED - - -#include "Poco/XML/XML.h" -#include "Poco/XML/XMLString.h" - - -namespace Poco { -namespace XML { - - -class XML_API DTDHandler - /// If a SAX application needs information about notations and unparsed entities, - /// then the application implements this interface and registers an instance with the - /// SAX parser using the parser's setDTDHandler method. The parser uses the instance - /// to report notation and unparsed entity declarations to the application. - /// - /// Note that this interface includes only those DTD events that the XML recommendation - /// requires processors to report: notation and unparsed entity declarations. - /// - /// The SAX parser may report these events in any order, regardless of the order in - /// which the notations and unparsed entities were declared; however, all DTD events - /// must be reported after the document handler's startDocument event, and before the first - /// startElement event. (If the LexicalHandler is used, these events must also be reported before the endDTD event.) +// +// DTDHandler.h +// +// Library: XML +// Package: SAX +// Module: SAX +// +// SAX DTDHandler Interface. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef SAX_DTDHandler_INCLUDED +#define SAX_DTDHandler_INCLUDED + + +#include "Poco/XML/XML.h" +#include "Poco/XML/XMLString.h" + + +namespace Poco { +namespace XML { + + +class XML_API DTDHandler + /// If a SAX application needs information about notations and unparsed entities, + /// then the application implements this interface and registers an instance with the + /// SAX parser using the parser's setDTDHandler method. The parser uses the instance + /// to report notation and unparsed entity declarations to the application. /// - /// It is up to the application to store the information for future use (perhaps in a hash table or - /// object tree). If the application encounters attributes of type "NOTATION", "ENTITY", or "ENTITIES", - /// it can use the information that it obtained through this interface to find the entity and/or notation - /// corresponding with the attribute value. -{ -public: - virtual void notationDecl(const XMLString& name, const XMLString* publicId, const XMLString* systemId) = 0; - /// Receive notification of a notation declaration event. - /// - /// It is up to the application to record the notation for later reference, - /// if necessary; notations may appear as attribute values and in unparsed - /// entity declarations, and are sometime used with processing instruction - /// target names. - /// - /// At least one of publicId and systemId must be non-null. If a system identifier - /// is present, and it is a URL, the SAX parser must resolve it fully before passing - /// it to the application through this event. - /// - /// There is no guarantee that the notation declaration will be reported before any - /// unparsed entities that use it. - /// - /// Note that publicId and systemId maybe null, therefore we pass a pointer rather than a reference. - - virtual void unparsedEntityDecl(const XMLString& name, const XMLString* publicId, const XMLString& systemId, const XMLString& notationName) = 0; - /// Receive notification of an unparsed entity declaration event. - /// - /// Note that the notation name corresponds to a notation reported by the - /// notationDecl event. It is up to the application to record the entity for - /// later reference, if necessary; unparsed entities may appear as attribute values. - /// - /// If the system identifier is a URL, the parser must resolve it fully before - /// passing it to the application. + /// Note that this interface includes only those DTD events that the XML recommendation + /// requires processors to report: notation and unparsed entity declarations. + /// + /// The SAX parser may report these events in any order, regardless of the order in + /// which the notations and unparsed entities were declared; however, all DTD events + /// must be reported after the document handler's startDocument event, and before the first + /// startElement event. (If the LexicalHandler is used, these events must also be reported before the endDTD event.) + /// + /// It is up to the application to store the information for future use (perhaps in a hash table or + /// object tree). If the application encounters attributes of type "NOTATION", "ENTITY", or "ENTITIES", + /// it can use the information that it obtained through this interface to find the entity and/or notation + /// corresponding with the attribute value. +{ +public: + virtual void notationDecl(const XMLString& name, const XMLString* publicId, const XMLString* systemId) = 0; + /// Receive notification of a notation declaration event. + /// + /// It is up to the application to record the notation for later reference, + /// if necessary; notations may appear as attribute values and in unparsed + /// entity declarations, and are sometime used with processing instruction + /// target names. + /// + /// At least one of publicId and systemId must be non-null. If a system identifier + /// is present, and it is a URL, the SAX parser must resolve it fully before passing + /// it to the application through this event. + /// + /// There is no guarantee that the notation declaration will be reported before any + /// unparsed entities that use it. /// - /// Note that publicId maybe null, therefore we pass a pointer rather than a reference. - -protected: - virtual ~DTDHandler(); -}; - - -} } // namespace Poco::XML - - -#endif // SAX_DTDHandler_INCLUDED + /// Note that publicId and systemId maybe null, therefore we pass a pointer rather than a reference. + + virtual void unparsedEntityDecl(const XMLString& name, const XMLString* publicId, const XMLString& systemId, const XMLString& notationName) = 0; + /// Receive notification of an unparsed entity declaration event. + /// + /// Note that the notation name corresponds to a notation reported by the + /// notationDecl event. It is up to the application to record the entity for + /// later reference, if necessary; unparsed entities may appear as attribute values. + /// + /// If the system identifier is a URL, the parser must resolve it fully before + /// passing it to the application. + /// + /// Note that publicId maybe null, therefore we pass a pointer rather than a reference. + +protected: + virtual ~DTDHandler(); +}; + + +} } // namespace Poco::XML + + +#endif // SAX_DTDHandler_INCLUDED diff --git a/contrib/libs/poco/XML/include/Poco/SAX/DeclHandler.h b/contrib/libs/poco/XML/include/Poco/SAX/DeclHandler.h index 578f10275d..bef995548b 100644 --- a/contrib/libs/poco/XML/include/Poco/SAX/DeclHandler.h +++ b/contrib/libs/poco/XML/include/Poco/SAX/DeclHandler.h @@ -1,91 +1,91 @@ -// -// DeclHandler.h -// -// Library: XML -// Package: SAX -// Module: SAX -// -// SAX2-ext DeclHandler Interface. -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef SAX_DeclHandler_INCLUDED -#define SAX_DeclHandler_INCLUDED - - -#include "Poco/XML/XML.h" -#include "Poco/XML/XMLString.h" - - -namespace Poco { -namespace XML { - - -class XML_API DeclHandler - /// This is an optional extension handler for SAX2 to provide information - /// about DTD declarations in an XML document. XML - /// readers are not required to support this handler, and this handler is - /// not included in the core SAX2 distribution. - /// - /// Note that data-related DTD declarations (unparsed entities and notations) - /// are already reported through the DTDHandler interface. - /// If you are using the declaration handler together with a lexical handler, - /// all of the events will occur between the startDTD and the endDTD events. - /// To set the DeclHandler for an XML reader, use the setProperty method - /// with the propertyId "http://xml.org/sax/properties/declaration-handler". - /// If the reader does not support declaration events, it will throw a - /// SAXNotRecognizedException or a SAXNotSupportedException when you attempt to - /// register the handler. -{ -public: - virtual void attributeDecl(const XMLString& eName, const XMLString& aName, const XMLString* valueDefault, const XMLString* value) = 0; - /// Report an attribute type declaration. +// +// DeclHandler.h +// +// Library: XML +// Package: SAX +// Module: SAX +// +// SAX2-ext DeclHandler Interface. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef SAX_DeclHandler_INCLUDED +#define SAX_DeclHandler_INCLUDED + + +#include "Poco/XML/XML.h" +#include "Poco/XML/XMLString.h" + + +namespace Poco { +namespace XML { + + +class XML_API DeclHandler + /// This is an optional extension handler for SAX2 to provide information + /// about DTD declarations in an XML document. XML + /// readers are not required to support this handler, and this handler is + /// not included in the core SAX2 distribution. + /// + /// Note that data-related DTD declarations (unparsed entities and notations) + /// are already reported through the DTDHandler interface. + /// If you are using the declaration handler together with a lexical handler, + /// all of the events will occur between the startDTD and the endDTD events. + /// To set the DeclHandler for an XML reader, use the setProperty method + /// with the propertyId "http://xml.org/sax/properties/declaration-handler". + /// If the reader does not support declaration events, it will throw a + /// SAXNotRecognizedException or a SAXNotSupportedException when you attempt to + /// register the handler. +{ +public: + virtual void attributeDecl(const XMLString& eName, const XMLString& aName, const XMLString* valueDefault, const XMLString* value) = 0; + /// Report an attribute type declaration. + /// + /// Only the effective (first) declaration for an attribute will be reported. + /// The type will be one of the strings "CDATA", "ID", "IDREF", "IDREFS", + /// "NMTOKEN", "NMTOKENS", "ENTITY", "ENTITIES", a parenthesized token group + /// with the separator "|" and all whitespace removed, or the word "NOTATION" + /// followed by a space followed by a parenthesized token group with all whitespace + /// removed. /// - /// Only the effective (first) declaration for an attribute will be reported. - /// The type will be one of the strings "CDATA", "ID", "IDREF", "IDREFS", - /// "NMTOKEN", "NMTOKENS", "ENTITY", "ENTITIES", a parenthesized token group - /// with the separator "|" and all whitespace removed, or the word "NOTATION" - /// followed by a space followed by a parenthesized token group with all whitespace - /// removed. - /// - /// The value will be the value as reported to applications, appropriately normalized - /// and with entity and character references expanded. - - virtual void elementDecl(const XMLString& name, const XMLString& model) = 0; - /// Report an element type declaration. - /// - /// The content model will consist of the string "EMPTY", the string "ANY", or a - /// parenthesised group, optionally followed by an occurrence indicator. The model - /// will be normalized so that all parameter entities are fully resolved and all - /// whitespace is removed,and will include the enclosing parentheses. Other - /// normalization (such as removing redundant parentheses or simplifying occurrence - /// indicators) is at the discretion of the parser. - - virtual void externalEntityDecl(const XMLString& name, const XMLString* publicId, const XMLString& systemId) = 0; - /// Report an external entity declaration. + /// The value will be the value as reported to applications, appropriately normalized + /// and with entity and character references expanded. + + virtual void elementDecl(const XMLString& name, const XMLString& model) = 0; + /// Report an element type declaration. /// - /// Only the effective (first) declaration for each entity will be reported. + /// The content model will consist of the string "EMPTY", the string "ANY", or a + /// parenthesised group, optionally followed by an occurrence indicator. The model + /// will be normalized so that all parameter entities are fully resolved and all + /// whitespace is removed,and will include the enclosing parentheses. Other + /// normalization (such as removing redundant parentheses or simplifying occurrence + /// indicators) is at the discretion of the parser. + + virtual void externalEntityDecl(const XMLString& name, const XMLString* publicId, const XMLString& systemId) = 0; + /// Report an external entity declaration. + /// + /// Only the effective (first) declaration for each entity will be reported. + /// + /// If the system identifier is a URL, the parser must resolve it fully before + /// passing it to the application. + + virtual void internalEntityDecl(const XMLString& name, const XMLString& value) = 0; + /// Report an internal entity declaration. /// - /// If the system identifier is a URL, the parser must resolve it fully before - /// passing it to the application. - - virtual void internalEntityDecl(const XMLString& name, const XMLString& value) = 0; - /// Report an internal entity declaration. - /// - /// Only the effective (first) declaration for each entity will be reported. All - /// parameter entities in the value will be expanded, but general entities will not. - -protected: - virtual ~DeclHandler(); -}; - - -} } // namespace Poco::XML - - -#endif // SAX_DeclHandler_INCLUDED + /// Only the effective (first) declaration for each entity will be reported. All + /// parameter entities in the value will be expanded, but general entities will not. + +protected: + virtual ~DeclHandler(); +}; + + +} } // namespace Poco::XML + + +#endif // SAX_DeclHandler_INCLUDED diff --git a/contrib/libs/poco/XML/include/Poco/SAX/DefaultHandler.h b/contrib/libs/poco/XML/include/Poco/SAX/DefaultHandler.h index 7df1f5479e..8f006dca25 100644 --- a/contrib/libs/poco/XML/include/Poco/SAX/DefaultHandler.h +++ b/contrib/libs/poco/XML/include/Poco/SAX/DefaultHandler.h @@ -1,83 +1,83 @@ -// -// DefaultHandler.h -// -// Library: XML -// Package: SAX -// Module: SAX -// -// SAX-2 DefaultHandler class. -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef SAX_DefaultHandler_INCLUDED -#define SAX_DefaultHandler_INCLUDED - - -#include "Poco/XML/XML.h" -#include "Poco/SAX/EntityResolver.h" -#include "Poco/SAX/DTDHandler.h" -#include "Poco/SAX/ContentHandler.h" -#include "Poco/SAX/ErrorHandler.h" - - -namespace Poco { -namespace XML { - - -class XML_API DefaultHandler: public EntityResolver, public DTDHandler, public ContentHandler, public ErrorHandler - /// Default base class for SAX2 event handlers. - /// This class is available as a convenience base class for SAX2 applications: - /// it provides default implementations for all of the - /// callbacks in the four core SAX2 handler classes: - /// * EntityResolver - /// * DTDHandler - /// * ContentHandler - /// * ErrorHandler - /// Application writers can extend this class when they need to implement only - /// part of an interface; parser writers can instantiate this - /// class to provide default handlers when the application has not supplied its own. -{ -public: - DefaultHandler(); - /// Creates the DefaultHandler. - - ~DefaultHandler(); - /// Destroys the DefaultHandler. - - // EntityResolver - InputSource* resolveEntity(const XMLString* publicId, const XMLString& systemId); - void releaseInputSource(InputSource* pSource); - - // DTDHandler - void notationDecl(const XMLString& name, const XMLString* publicId, const XMLString* systemId); - void unparsedEntityDecl(const XMLString& name, const XMLString* publicId, const XMLString& systemId, const XMLString& notationName); - - // ContentHandler - void setDocumentLocator(const Locator* loc); - void startDocument(); - void endDocument(); - void startElement(const XMLString& uri, const XMLString& localName, const XMLString& qname, const Attributes& attributes); - void endElement(const XMLString& uri, const XMLString& localName, const XMLString& qname); - void characters(const XMLChar ch[], int start, int length); - void ignorableWhitespace(const XMLChar ch[], int start, int length); - void processingInstruction(const XMLString& target, const XMLString& data); - void startPrefixMapping(const XMLString& prefix, const XMLString& uri); - void endPrefixMapping(const XMLString& prefix); - void skippedEntity(const XMLString& name); - - // ErrorHandler - void warning(const SAXException& exc); - void error(const SAXException& exc); - void fatalError(const SAXException& exc); -}; - - -} } // namespace Poco::XML - - -#endif // SAX_DefaultHandler_INCLUDED +// +// DefaultHandler.h +// +// Library: XML +// Package: SAX +// Module: SAX +// +// SAX-2 DefaultHandler class. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef SAX_DefaultHandler_INCLUDED +#define SAX_DefaultHandler_INCLUDED + + +#include "Poco/XML/XML.h" +#include "Poco/SAX/EntityResolver.h" +#include "Poco/SAX/DTDHandler.h" +#include "Poco/SAX/ContentHandler.h" +#include "Poco/SAX/ErrorHandler.h" + + +namespace Poco { +namespace XML { + + +class XML_API DefaultHandler: public EntityResolver, public DTDHandler, public ContentHandler, public ErrorHandler + /// Default base class for SAX2 event handlers. + /// This class is available as a convenience base class for SAX2 applications: + /// it provides default implementations for all of the + /// callbacks in the four core SAX2 handler classes: + /// * EntityResolver + /// * DTDHandler + /// * ContentHandler + /// * ErrorHandler + /// Application writers can extend this class when they need to implement only + /// part of an interface; parser writers can instantiate this + /// class to provide default handlers when the application has not supplied its own. +{ +public: + DefaultHandler(); + /// Creates the DefaultHandler. + + ~DefaultHandler(); + /// Destroys the DefaultHandler. + + // EntityResolver + InputSource* resolveEntity(const XMLString* publicId, const XMLString& systemId); + void releaseInputSource(InputSource* pSource); + + // DTDHandler + void notationDecl(const XMLString& name, const XMLString* publicId, const XMLString* systemId); + void unparsedEntityDecl(const XMLString& name, const XMLString* publicId, const XMLString& systemId, const XMLString& notationName); + + // ContentHandler + void setDocumentLocator(const Locator* loc); + void startDocument(); + void endDocument(); + void startElement(const XMLString& uri, const XMLString& localName, const XMLString& qname, const Attributes& attributes); + void endElement(const XMLString& uri, const XMLString& localName, const XMLString& qname); + void characters(const XMLChar ch[], int start, int length); + void ignorableWhitespace(const XMLChar ch[], int start, int length); + void processingInstruction(const XMLString& target, const XMLString& data); + void startPrefixMapping(const XMLString& prefix, const XMLString& uri); + void endPrefixMapping(const XMLString& prefix); + void skippedEntity(const XMLString& name); + + // ErrorHandler + void warning(const SAXException& exc); + void error(const SAXException& exc); + void fatalError(const SAXException& exc); +}; + + +} } // namespace Poco::XML + + +#endif // SAX_DefaultHandler_INCLUDED diff --git a/contrib/libs/poco/XML/include/Poco/SAX/EntityResolver.h b/contrib/libs/poco/XML/include/Poco/SAX/EntityResolver.h index 3387ecfca6..41e1ad6f6f 100644 --- a/contrib/libs/poco/XML/include/Poco/SAX/EntityResolver.h +++ b/contrib/libs/poco/XML/include/Poco/SAX/EntityResolver.h @@ -1,86 +1,86 @@ -// -// EntityResolver.h -// -// Library: XML -// Package: SAX -// Module: SAX -// -// SAX EntityResolver Interface. -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef SAX_EntityResolver_INCLUDED -#define SAX_EntityResolver_INCLUDED - - -#include "Poco/XML/XML.h" -#include "Poco/XML/XMLString.h" - - -namespace Poco { -namespace XML { - - -class InputSource; - - -class XML_API EntityResolver - /// If a SAX application needs to implement customized handling for external entities, - /// it must implement this interface and register an instance with the SAX driver using - /// the setEntityResolver method. +// +// EntityResolver.h +// +// Library: XML +// Package: SAX +// Module: SAX +// +// SAX EntityResolver Interface. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef SAX_EntityResolver_INCLUDED +#define SAX_EntityResolver_INCLUDED + + +#include "Poco/XML/XML.h" +#include "Poco/XML/XMLString.h" + + +namespace Poco { +namespace XML { + + +class InputSource; + + +class XML_API EntityResolver + /// If a SAX application needs to implement customized handling for external entities, + /// it must implement this interface and register an instance with the SAX driver using + /// the setEntityResolver method. + /// + /// The XML reader will then allow the application to intercept any external entities + /// (including the external DTD subset and external parameter entities, if any) before + /// including them. + /// + /// Many SAX applications will not need to implement this interface, but it will be + /// especially useful for applications that build XML documents from databases or other + /// specialised input sources, or for applications that use URI types other than URLs. /// - /// The XML reader will then allow the application to intercept any external entities - /// (including the external DTD subset and external parameter entities, if any) before - /// including them. - /// - /// Many SAX applications will not need to implement this interface, but it will be - /// especially useful for applications that build XML documents from databases or other - /// specialised input sources, or for applications that use URI types other than URLs. - /// - /// The application can also use this interface to redirect system identifiers to local - /// URIs or to look up replacements in a catalog (possibly by using the public identifier). -{ -public: - virtual InputSource* resolveEntity(const XMLString* publicId, const XMLString& systemId) = 0; - /// Allow the application to resolve external entities. - /// - /// The parser will call this method before opening any external entity except the - /// top-level document entity. Such entities include the external DTD subset and - /// external parameter entities referenced within the DTD (in either case, only - /// if the parser reads external parameter entities), and external general entities - /// referenced within the document element (if the parser reads external general entities). - /// The application may request that the parser locate the entity itself, that it use an - /// alternative URI, or that it use data provided by the application (as a character or - /// byte input stream). - /// - /// Application writers can use this method to redirect external system identifiers to - /// secure and/or local URIs, to look up public identifiers in a catalogue, or to read an - /// entity from a database or other input source (including, for example, a dialog box). - /// Neither XML nor SAX specifies a preferred policy for using public or system IDs to resolve - /// resources. However, SAX specifies how to interpret any InputSource returned by this method, - /// and that if none is returned, then the system ID will be dereferenced as a URL. - /// - /// If the system identifier is a URL, the SAX parser must resolve it fully before reporting it to - /// the application. - /// - /// Note that publicId maybe null, therefore we pass a pointer rather than a reference. - - virtual void releaseInputSource(InputSource* pSource) = 0; - /// This is a non-standard extension to SAX! - /// Called by the parser when the input source returned by ResolveEntity is - /// no longer needed. Should free any resources used by the input source. - -protected: - virtual ~EntityResolver(); -}; - - -} } // namespace Poco::XML - - -#endif // SAX_EntityResolver_INCLUDED + /// The application can also use this interface to redirect system identifiers to local + /// URIs or to look up replacements in a catalog (possibly by using the public identifier). +{ +public: + virtual InputSource* resolveEntity(const XMLString* publicId, const XMLString& systemId) = 0; + /// Allow the application to resolve external entities. + /// + /// The parser will call this method before opening any external entity except the + /// top-level document entity. Such entities include the external DTD subset and + /// external parameter entities referenced within the DTD (in either case, only + /// if the parser reads external parameter entities), and external general entities + /// referenced within the document element (if the parser reads external general entities). + /// The application may request that the parser locate the entity itself, that it use an + /// alternative URI, or that it use data provided by the application (as a character or + /// byte input stream). + /// + /// Application writers can use this method to redirect external system identifiers to + /// secure and/or local URIs, to look up public identifiers in a catalogue, or to read an + /// entity from a database or other input source (including, for example, a dialog box). + /// Neither XML nor SAX specifies a preferred policy for using public or system IDs to resolve + /// resources. However, SAX specifies how to interpret any InputSource returned by this method, + /// and that if none is returned, then the system ID will be dereferenced as a URL. + /// + /// If the system identifier is a URL, the SAX parser must resolve it fully before reporting it to + /// the application. + /// + /// Note that publicId maybe null, therefore we pass a pointer rather than a reference. + + virtual void releaseInputSource(InputSource* pSource) = 0; + /// This is a non-standard extension to SAX! + /// Called by the parser when the input source returned by ResolveEntity is + /// no longer needed. Should free any resources used by the input source. + +protected: + virtual ~EntityResolver(); +}; + + +} } // namespace Poco::XML + + +#endif // SAX_EntityResolver_INCLUDED diff --git a/contrib/libs/poco/XML/include/Poco/SAX/EntityResolverImpl.h b/contrib/libs/poco/XML/include/Poco/SAX/EntityResolverImpl.h index de088c64b6..89deb2c60c 100644 --- a/contrib/libs/poco/XML/include/Poco/SAX/EntityResolverImpl.h +++ b/contrib/libs/poco/XML/include/Poco/SAX/EntityResolverImpl.h @@ -1,78 +1,78 @@ -// -// EntityResolverImpl.h -// -// Library: XML -// Package: SAX -// Module: SAX -// -// An implementation of EntityResolver. -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef SAX_EntityResolverImpl_INCLUDED -#define SAX_EntityResolverImpl_INCLUDED - - -#include "Poco/XML/XML.h" -#include "Poco/XML/XMLString.h" -#include "Poco/SAX/EntityResolver.h" -#include "Poco/URIStreamOpener.h" - - -namespace Poco { -namespace XML { - - -class XML_API EntityResolverImpl: public EntityResolver - /// A default implementation of the EntityResolver interface. - /// - /// The system ID is first interpreted as an URI and the - /// URIStreamOpener is used to create and open an istream - /// for an InputSource. - /// - /// If the system ID is not a valid URI, it is - /// interpreted as a filesystem path and a Poco::FileInputStream - /// is opened for it. -{ -public: - EntityResolverImpl(); - /// Creates an EntityResolverImpl that uses the default - /// URIStreamOpener. - - EntityResolverImpl(const Poco::URIStreamOpener& opener); - /// Creates an EntityResolverImpl that uses the given - /// URIStreamOpener. - - ~EntityResolverImpl(); - /// Destroys the EntityResolverImpl. - - InputSource* resolveEntity(const XMLString* publicId, const XMLString& systemId); - /// Tries to use the URIStreamOpener to create and open an istream - /// for the given systemId, which is interpreted as an URI. - /// - /// If the systemId is not a valid URI, it is interpreted as - /// a local filesystem path and a Poco::FileInputStream is opened for it. - - void releaseInputSource(InputSource* pSource); - /// Deletes the InputSource's stream. - -protected: - std::istream* resolveSystemId(const XMLString& systemId); - -private: - EntityResolverImpl(const EntityResolverImpl&); - EntityResolverImpl& operator = (const EntityResolverImpl&); - - const Poco::URIStreamOpener& _opener; -}; - - -} } // namespace Poco::XML - - -#endif // SAX_EntityResolverImpl_INCLUDED +// +// EntityResolverImpl.h +// +// Library: XML +// Package: SAX +// Module: SAX +// +// An implementation of EntityResolver. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef SAX_EntityResolverImpl_INCLUDED +#define SAX_EntityResolverImpl_INCLUDED + + +#include "Poco/XML/XML.h" +#include "Poco/XML/XMLString.h" +#include "Poco/SAX/EntityResolver.h" +#include "Poco/URIStreamOpener.h" + + +namespace Poco { +namespace XML { + + +class XML_API EntityResolverImpl: public EntityResolver + /// A default implementation of the EntityResolver interface. + /// + /// The system ID is first interpreted as an URI and the + /// URIStreamOpener is used to create and open an istream + /// for an InputSource. + /// + /// If the system ID is not a valid URI, it is + /// interpreted as a filesystem path and a Poco::FileInputStream + /// is opened for it. +{ +public: + EntityResolverImpl(); + /// Creates an EntityResolverImpl that uses the default + /// URIStreamOpener. + + EntityResolverImpl(const Poco::URIStreamOpener& opener); + /// Creates an EntityResolverImpl that uses the given + /// URIStreamOpener. + + ~EntityResolverImpl(); + /// Destroys the EntityResolverImpl. + + InputSource* resolveEntity(const XMLString* publicId, const XMLString& systemId); + /// Tries to use the URIStreamOpener to create and open an istream + /// for the given systemId, which is interpreted as an URI. + /// + /// If the systemId is not a valid URI, it is interpreted as + /// a local filesystem path and a Poco::FileInputStream is opened for it. + + void releaseInputSource(InputSource* pSource); + /// Deletes the InputSource's stream. + +protected: + std::istream* resolveSystemId(const XMLString& systemId); + +private: + EntityResolverImpl(const EntityResolverImpl&); + EntityResolverImpl& operator = (const EntityResolverImpl&); + + const Poco::URIStreamOpener& _opener; +}; + + +} } // namespace Poco::XML + + +#endif // SAX_EntityResolverImpl_INCLUDED diff --git a/contrib/libs/poco/XML/include/Poco/SAX/ErrorHandler.h b/contrib/libs/poco/XML/include/Poco/SAX/ErrorHandler.h index 3097e20075..ee74712003 100644 --- a/contrib/libs/poco/XML/include/Poco/SAX/ErrorHandler.h +++ b/contrib/libs/poco/XML/include/Poco/SAX/ErrorHandler.h @@ -1,92 +1,92 @@ -// -// ErrorHandler.h -// -// Library: XML -// Package: SAX -// Module: SAX -// -// SAX ErrorHandler Interface. -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef SAX_ErrorHandler_INCLUDED -#define SAX_ErrorHandler_INCLUDED - - -#include "Poco/XML/XML.h" - - -namespace Poco { -namespace XML { - - -class SAXException; - - -class XML_API ErrorHandler - /// If a SAX application needs to implement customized error handling, it must - /// implement this interface and then register an instance with the XML reader - /// using the setErrorHandler method. The parser will then report all errors and - /// warnings through this interface. - /// - /// WARNING: If an application does not register an ErrorHandler, XML parsing errors - /// will go unreported, except that SAXParseExceptions will be thrown for fatal errors. - /// In order to detect validity errors, an ErrorHandler that does something with error() - /// calls must be registered. - /// - /// For XML processing errors, a SAX driver must use this interface in preference to - /// throwing an exception: it is up to the application to decide whether to throw an - /// exception for different types of errors and warnings. Note, however, that there is no - /// requirement that the parser continue to report additional errors after a call to - /// fatalError. In other words, a SAX driver class may throw an exception after reporting - /// any fatalError. Also parsers may throw appropriate exceptions for non-XML errors. For - /// example, XMLReader::parse() would throw an IOException for errors accessing entities or - /// the document. -{ -public: - virtual void warning(const SAXException& exc) = 0; - /// Receive notification of a warning. - /// - /// SAX parsers will use this method to report conditions that are not errors or fatal - /// errors as defined by the XML recommendation. The default behaviour is to take no action. - /// - /// The SAX parser must continue to provide normal parsing events after invoking this method: - /// it should still be possible for the application to process the document through to the end. - /// - /// Filters may use this method to report other, non-XML warnings as well. - - virtual void error(const SAXException& exc) = 0; - /// Receive notification of a recoverable error. - /// - /// This corresponds to the definition of "error" in section 1.2 of the W3C XML 1.0 - /// Recommendation. For example, a validating parser would use this callback to report - /// the violation of a validity constraint. The default behaviour is to take no action. - /// - /// The SAX parser must continue to provide normal parsing events after invoking this - /// method: it should still be possible for the application to process the document through - /// to the end. If the application cannot do so, then the parser should report a fatal error - /// even if the XML recommendation does not require it to do so. - /// - /// Filters may use this method to report other, non-XML errors as well. - - virtual void fatalError(const SAXException& exc) = 0; - /// Receive notification of a non-recoverable error. - /// The application must assume that the document is unusable after the parser has - /// invoked this method, and should continue (if at all) only for the sake of collecting - /// additional error messages: in fact, SAX parsers are free to stop reporting any other - /// events once this method has been invoked. - -protected: - virtual ~ErrorHandler(); -}; - - -} } // namespace Poco::XML - - -#endif // SAX_ErrorHandler_INCLUDED +// +// ErrorHandler.h +// +// Library: XML +// Package: SAX +// Module: SAX +// +// SAX ErrorHandler Interface. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef SAX_ErrorHandler_INCLUDED +#define SAX_ErrorHandler_INCLUDED + + +#include "Poco/XML/XML.h" + + +namespace Poco { +namespace XML { + + +class SAXException; + + +class XML_API ErrorHandler + /// If a SAX application needs to implement customized error handling, it must + /// implement this interface and then register an instance with the XML reader + /// using the setErrorHandler method. The parser will then report all errors and + /// warnings through this interface. + /// + /// WARNING: If an application does not register an ErrorHandler, XML parsing errors + /// will go unreported, except that SAXParseExceptions will be thrown for fatal errors. + /// In order to detect validity errors, an ErrorHandler that does something with error() + /// calls must be registered. + /// + /// For XML processing errors, a SAX driver must use this interface in preference to + /// throwing an exception: it is up to the application to decide whether to throw an + /// exception for different types of errors and warnings. Note, however, that there is no + /// requirement that the parser continue to report additional errors after a call to + /// fatalError. In other words, a SAX driver class may throw an exception after reporting + /// any fatalError. Also parsers may throw appropriate exceptions for non-XML errors. For + /// example, XMLReader::parse() would throw an IOException for errors accessing entities or + /// the document. +{ +public: + virtual void warning(const SAXException& exc) = 0; + /// Receive notification of a warning. + /// + /// SAX parsers will use this method to report conditions that are not errors or fatal + /// errors as defined by the XML recommendation. The default behaviour is to take no action. + /// + /// The SAX parser must continue to provide normal parsing events after invoking this method: + /// it should still be possible for the application to process the document through to the end. + /// + /// Filters may use this method to report other, non-XML warnings as well. + + virtual void error(const SAXException& exc) = 0; + /// Receive notification of a recoverable error. + /// + /// This corresponds to the definition of "error" in section 1.2 of the W3C XML 1.0 + /// Recommendation. For example, a validating parser would use this callback to report + /// the violation of a validity constraint. The default behaviour is to take no action. + /// + /// The SAX parser must continue to provide normal parsing events after invoking this + /// method: it should still be possible for the application to process the document through + /// to the end. If the application cannot do so, then the parser should report a fatal error + /// even if the XML recommendation does not require it to do so. + /// + /// Filters may use this method to report other, non-XML errors as well. + + virtual void fatalError(const SAXException& exc) = 0; + /// Receive notification of a non-recoverable error. + /// The application must assume that the document is unusable after the parser has + /// invoked this method, and should continue (if at all) only for the sake of collecting + /// additional error messages: in fact, SAX parsers are free to stop reporting any other + /// events once this method has been invoked. + +protected: + virtual ~ErrorHandler(); +}; + + +} } // namespace Poco::XML + + +#endif // SAX_ErrorHandler_INCLUDED diff --git a/contrib/libs/poco/XML/include/Poco/SAX/InputSource.h b/contrib/libs/poco/XML/include/Poco/SAX/InputSource.h index 7fcecf2589..fb970c80e5 100644 --- a/contrib/libs/poco/XML/include/Poco/SAX/InputSource.h +++ b/contrib/libs/poco/XML/include/Poco/SAX/InputSource.h @@ -1,169 +1,169 @@ -// -// InputSource.h -// -// Library: XML -// Package: SAX -// Module: SAX -// -// SAX InputSource - A single input source for an XML entity. -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef SAX_InputSource_INCLUDED -#define SAX_InputSource_INCLUDED - - -#include "Poco/XML/XML.h" -#include "Poco/XML/XMLString.h" -#include "Poco/XML/XMLStream.h" - - -namespace Poco { -namespace XML { - - -class XML_API InputSource - /// This class allows a SAX application to encapsulate information about an input - /// source in a single object, which may include a public identifier, a system - /// identifier, a byte stream (possibly with a specified encoding), and/or a character - /// stream. - /// - /// There are two places that the application can deliver an input source to the - /// parser: as the argument to the Parser.parse method, or as the return value of the - /// EntityResolver::resolveEntity() method. - /// - /// The SAX parser will use the InputSource object to determine how to read XML input. - /// If there is a character stream available, the parser will read that stream directly, - /// disregarding any text encoding declaration found in that stream. If there is no character - /// stream, but there is a byte stream, the parser will use that byte stream, using the - /// encoding specified in the InputSource or else (if no encoding is specified) autodetecting - /// the character encoding using an algorithm such as the one in the XML specification. - /// If neither a character stream nor a byte stream is available, the parser will attempt - /// to open a URI connection to the resource identified by the system identifier. - /// - /// An InputSource object belongs to the application: the SAX parser shall never modify it in - /// any way (it may modify a copy if necessary). However, standard processing of both byte and - /// character streams is to close them on as part of end-of-parse cleanup, so applications should - /// not attempt to re-use such streams after they have been handed to a parser. -{ -public: - InputSource(); - /// Zero-argument default constructor. - - InputSource(const XMLString& systemId); - /// Creates a new input source with a system identifier. - /// Applications may use setPublicId to include a public identifier as well, - /// or setEncoding to specify the character encoding, if known. +// +// InputSource.h +// +// Library: XML +// Package: SAX +// Module: SAX +// +// SAX InputSource - A single input source for an XML entity. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef SAX_InputSource_INCLUDED +#define SAX_InputSource_INCLUDED + + +#include "Poco/XML/XML.h" +#include "Poco/XML/XMLString.h" +#include "Poco/XML/XMLStream.h" + + +namespace Poco { +namespace XML { + + +class XML_API InputSource + /// This class allows a SAX application to encapsulate information about an input + /// source in a single object, which may include a public identifier, a system + /// identifier, a byte stream (possibly with a specified encoding), and/or a character + /// stream. + /// + /// There are two places that the application can deliver an input source to the + /// parser: as the argument to the Parser.parse method, or as the return value of the + /// EntityResolver::resolveEntity() method. + /// + /// The SAX parser will use the InputSource object to determine how to read XML input. + /// If there is a character stream available, the parser will read that stream directly, + /// disregarding any text encoding declaration found in that stream. If there is no character + /// stream, but there is a byte stream, the parser will use that byte stream, using the + /// encoding specified in the InputSource or else (if no encoding is specified) autodetecting + /// the character encoding using an algorithm such as the one in the XML specification. + /// If neither a character stream nor a byte stream is available, the parser will attempt + /// to open a URI connection to the resource identified by the system identifier. + /// + /// An InputSource object belongs to the application: the SAX parser shall never modify it in + /// any way (it may modify a copy if necessary). However, standard processing of both byte and + /// character streams is to close them on as part of end-of-parse cleanup, so applications should + /// not attempt to re-use such streams after they have been handed to a parser. +{ +public: + InputSource(); + /// Zero-argument default constructor. + + InputSource(const XMLString& systemId); + /// Creates a new input source with a system identifier. + /// Applications may use setPublicId to include a public identifier as well, + /// or setEncoding to specify the character encoding, if known. + /// + /// If the system identifier is a URL, it must be fully resolved (it may not + /// be a relative URL). + + InputSource(XMLByteInputStream& istr); + /// Creates a new input source with a byte stream. + /// + /// Application writers should use setSystemId() to provide a base for resolving + /// relative URIs, may use setPublicId to include a public identifier, and may use + /// setEncoding to specify the object's character encoding. + + ~InputSource(); + /// Destroys the InputSource. + + void setPublicId(const XMLString& publicId); + /// Set the public identifier for this input source. /// - /// If the system identifier is a URL, it must be fully resolved (it may not - /// be a relative URL). - - InputSource(XMLByteInputStream& istr); - /// Creates a new input source with a byte stream. + /// The public identifier is always optional: if the application writer includes one, + /// it will be provided as part of the location information. + + void setSystemId(const XMLString& systemId); + /// Set the system identifier for this input source. /// - /// Application writers should use setSystemId() to provide a base for resolving - /// relative URIs, may use setPublicId to include a public identifier, and may use - /// setEncoding to specify the object's character encoding. - - ~InputSource(); - /// Destroys the InputSource. - - void setPublicId(const XMLString& publicId); - /// Set the public identifier for this input source. - /// - /// The public identifier is always optional: if the application writer includes one, - /// it will be provided as part of the location information. - - void setSystemId(const XMLString& systemId); - /// Set the system identifier for this input source. - /// - /// The system identifier is optional if there is a byte stream or a character stream, - /// but it is still useful to provide one, since the application can use it to resolve - /// relative URIs and can include it in error messages and warnings (the parser will - /// attempt to open a connection to the URI only if there is no byte stream or character - /// stream specified). - /// - /// If the application knows the character encoding of the object pointed to by the system - /// identifier, it can register the encoding using the setEncoding method. - /// - /// If the system identifier is a URL, it must be fully resolved (it may not be a relative URL). - - const XMLString& getPublicId() const; - /// Get the public identifier for this input source. - - const XMLString& getSystemId() const; - /// Get the system identifier for this input source. - - void setByteStream(XMLByteInputStream& istr); - /// Set the byte stream for this input source. - /// The SAX parser will ignore this if there is also a character stream specified, but it - /// will use a byte stream in preference to opening a URI connection itself. - - XMLByteInputStream* getByteStream() const; - /// Get the byte stream for this input source. - - void setCharacterStream(XMLCharInputStream& istr); - /// Set the character stream for this input source. - - XMLCharInputStream* getCharacterStream() const; - /// Get the character stream for this input source. - - void setEncoding(const XMLString& encoding); - /// Set the character encoding, if known. - /// The encoding must be a string acceptable for an XML encoding declaration - /// (see section 4.3.3 of the XML 1.0 recommendation). - - const XMLString& getEncoding() const; - /// Get the character encoding for a byte stream or URI. - -private: - XMLString _publicId; - XMLString _systemId; - XMLString _encoding; - XMLByteInputStream* _bistr; - XMLCharInputStream* _cistr; -}; - - -// -// inlines -// -inline const XMLString& InputSource::getPublicId() const -{ - return _publicId; -} - - -inline const XMLString& InputSource::getSystemId() const -{ - return _systemId; -} - - -inline const XMLString& InputSource::getEncoding() const -{ - return _encoding; -} - - -inline XMLByteInputStream* InputSource::getByteStream() const -{ - return _bistr; -} - - -inline XMLCharInputStream* InputSource::getCharacterStream() const -{ - return _cistr; -} - - -} } // namespace Poco::XML - - -#endif // SAX_InputSource_INCLUDED + /// The system identifier is optional if there is a byte stream or a character stream, + /// but it is still useful to provide one, since the application can use it to resolve + /// relative URIs and can include it in error messages and warnings (the parser will + /// attempt to open a connection to the URI only if there is no byte stream or character + /// stream specified). + /// + /// If the application knows the character encoding of the object pointed to by the system + /// identifier, it can register the encoding using the setEncoding method. + /// + /// If the system identifier is a URL, it must be fully resolved (it may not be a relative URL). + + const XMLString& getPublicId() const; + /// Get the public identifier for this input source. + + const XMLString& getSystemId() const; + /// Get the system identifier for this input source. + + void setByteStream(XMLByteInputStream& istr); + /// Set the byte stream for this input source. + /// The SAX parser will ignore this if there is also a character stream specified, but it + /// will use a byte stream in preference to opening a URI connection itself. + + XMLByteInputStream* getByteStream() const; + /// Get the byte stream for this input source. + + void setCharacterStream(XMLCharInputStream& istr); + /// Set the character stream for this input source. + + XMLCharInputStream* getCharacterStream() const; + /// Get the character stream for this input source. + + void setEncoding(const XMLString& encoding); + /// Set the character encoding, if known. + /// The encoding must be a string acceptable for an XML encoding declaration + /// (see section 4.3.3 of the XML 1.0 recommendation). + + const XMLString& getEncoding() const; + /// Get the character encoding for a byte stream or URI. + +private: + XMLString _publicId; + XMLString _systemId; + XMLString _encoding; + XMLByteInputStream* _bistr; + XMLCharInputStream* _cistr; +}; + + +// +// inlines +// +inline const XMLString& InputSource::getPublicId() const +{ + return _publicId; +} + + +inline const XMLString& InputSource::getSystemId() const +{ + return _systemId; +} + + +inline const XMLString& InputSource::getEncoding() const +{ + return _encoding; +} + + +inline XMLByteInputStream* InputSource::getByteStream() const +{ + return _bistr; +} + + +inline XMLCharInputStream* InputSource::getCharacterStream() const +{ + return _cistr; +} + + +} } // namespace Poco::XML + + +#endif // SAX_InputSource_INCLUDED diff --git a/contrib/libs/poco/XML/include/Poco/SAX/LexicalHandler.h b/contrib/libs/poco/XML/include/Poco/SAX/LexicalHandler.h index 772bd5c3fb..3f232ee0dc 100644 --- a/contrib/libs/poco/XML/include/Poco/SAX/LexicalHandler.h +++ b/contrib/libs/poco/XML/include/Poco/SAX/LexicalHandler.h @@ -1,125 +1,125 @@ -// -// LexicalHandler.h -// -// Library: XML -// Package: SAX -// Module: SAX -// -// SAX2-ext LexicalHandler Interface. -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef SAX_LexicalHandler_INCLUDED -#define SAX_LexicalHandler_INCLUDED - - -#include "Poco/XML/XML.h" -#include "Poco/XML/XMLString.h" - - -namespace Poco { -namespace XML { - - -class XML_API LexicalHandler - /// This is an optional extension handler for SAX2 to provide lexical information - /// about an XML document, such as comments and CDATA section boundaries. - /// XML readers are not required to recognize this handler, and it is not part of - /// core-only SAX2 distributions. - /// - /// The events in the lexical handler apply to the entire document, not just to the - /// document element, and all lexical handler events must appear between the content - /// handler's startDocument and endDocument events. - /// - /// To set the LexicalHandler for an XML reader, use the setProperty method with the - /// property name http://xml.org/sax/properties/lexical-handler and an object implementing - /// this interface (or null) as the value. If the reader does not report lexical events, - /// it will throw a SAXNotRecognizedException when you attempt to register the handler. -{ -public: - virtual void startDTD(const XMLString& name, const XMLString& publicId, const XMLString& systemId) = 0; - /// Report the start of DTD declarations, if any. +// +// LexicalHandler.h +// +// Library: XML +// Package: SAX +// Module: SAX +// +// SAX2-ext LexicalHandler Interface. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef SAX_LexicalHandler_INCLUDED +#define SAX_LexicalHandler_INCLUDED + + +#include "Poco/XML/XML.h" +#include "Poco/XML/XMLString.h" + + +namespace Poco { +namespace XML { + + +class XML_API LexicalHandler + /// This is an optional extension handler for SAX2 to provide lexical information + /// about an XML document, such as comments and CDATA section boundaries. + /// XML readers are not required to recognize this handler, and it is not part of + /// core-only SAX2 distributions. + /// + /// The events in the lexical handler apply to the entire document, not just to the + /// document element, and all lexical handler events must appear between the content + /// handler's startDocument and endDocument events. + /// + /// To set the LexicalHandler for an XML reader, use the setProperty method with the + /// property name http://xml.org/sax/properties/lexical-handler and an object implementing + /// this interface (or null) as the value. If the reader does not report lexical events, + /// it will throw a SAXNotRecognizedException when you attempt to register the handler. +{ +public: + virtual void startDTD(const XMLString& name, const XMLString& publicId, const XMLString& systemId) = 0; + /// Report the start of DTD declarations, if any. + /// + /// This method is intended to report the beginning of the DOCTYPE declaration; + /// if the document has no DOCTYPE declaration, this method will not be invoked. + /// + /// All declarations reported through DTDHandler or DeclHandler events must appear + /// between the startDTD and endDTD events. Declarations are assumed to belong to + /// the internal DTD subset unless they appear between startEntity and endEntity + /// events. Comments and processing instructions from the DTD should also be reported + /// between the startDTD and endDTD events, in their original order of (logical) occurrence; + /// they are not required to appear in their correct locations relative to DTDHandler or + /// DeclHandler events, however. + /// + /// Note that the start/endDTD events will appear within the start/endDocument events from + /// ContentHandler and before the first startElement event. + + virtual void endDTD() = 0; + /// Report the end of DTD declarations. + /// + /// This method is intended to report the end of the DOCTYPE declaration; if the document + /// has no DOCTYPE declaration, this method will not be invoked. + + virtual void startEntity(const XMLString& name) = 0; + /// Report the beginning of some internal and external XML entities. + /// + /// The reporting of parameter entities (including the external DTD subset) is optional, + /// and SAX2 drivers that report LexicalHandler events may not implement it; you can use the + /// http://xml.org/sax/features/lexical-handler/parameter-entities feature to query or control + /// the reporting of parameter entities. + /// + /// General entities are reported with their regular names, parameter entities have '%' + /// prepended to their names, and the external DTD subset has the pseudo-entity name "[dtd]". + /// + /// When a SAX2 driver is providing these events, all other events must be properly nested + /// within start/end entity events. There is no additional requirement that events from + /// DeclHandler or DTDHandler be properly ordered. + /// + /// Note that skipped entities will be reported through the skippedEntity event, which is part of + /// the ContentHandler interface. + /// + /// Because of the streaming event model that SAX uses, some entity boundaries cannot be reported under + /// any circumstances: + /// + /// * general entities within attribute values + /// * parameter entities within declarations /// - /// This method is intended to report the beginning of the DOCTYPE declaration; - /// if the document has no DOCTYPE declaration, this method will not be invoked. + /// These will be silently expanded, with no indication of where the original entity boundaries were. + /// + /// Note also that the boundaries of character references (which are not really entities anyway) are not reported. + /// + /// All start/endEntity events must be properly nested. + + virtual void endEntity(const XMLString& name) = 0; + /// Report the end of an entity. + + virtual void startCDATA() = 0; + /// Report the start of a CDATA section. /// - /// All declarations reported through DTDHandler or DeclHandler events must appear - /// between the startDTD and endDTD events. Declarations are assumed to belong to - /// the internal DTD subset unless they appear between startEntity and endEntity - /// events. Comments and processing instructions from the DTD should also be reported - /// between the startDTD and endDTD events, in their original order of (logical) occurrence; - /// they are not required to appear in their correct locations relative to DTDHandler or - /// DeclHandler events, however. - /// - /// Note that the start/endDTD events will appear within the start/endDocument events from - /// ContentHandler and before the first startElement event. - - virtual void endDTD() = 0; - /// Report the end of DTD declarations. - /// - /// This method is intended to report the end of the DOCTYPE declaration; if the document - /// has no DOCTYPE declaration, this method will not be invoked. - - virtual void startEntity(const XMLString& name) = 0; - /// Report the beginning of some internal and external XML entities. - /// - /// The reporting of parameter entities (including the external DTD subset) is optional, - /// and SAX2 drivers that report LexicalHandler events may not implement it; you can use the - /// http://xml.org/sax/features/lexical-handler/parameter-entities feature to query or control - /// the reporting of parameter entities. - /// - /// General entities are reported with their regular names, parameter entities have '%' - /// prepended to their names, and the external DTD subset has the pseudo-entity name "[dtd]". - /// - /// When a SAX2 driver is providing these events, all other events must be properly nested - /// within start/end entity events. There is no additional requirement that events from - /// DeclHandler or DTDHandler be properly ordered. - /// - /// Note that skipped entities will be reported through the skippedEntity event, which is part of - /// the ContentHandler interface. - /// - /// Because of the streaming event model that SAX uses, some entity boundaries cannot be reported under - /// any circumstances: - /// - /// * general entities within attribute values - /// * parameter entities within declarations - /// - /// These will be silently expanded, with no indication of where the original entity boundaries were. - /// - /// Note also that the boundaries of character references (which are not really entities anyway) are not reported. - /// - /// All start/endEntity events must be properly nested. - - virtual void endEntity(const XMLString& name) = 0; - /// Report the end of an entity. - - virtual void startCDATA() = 0; - /// Report the start of a CDATA section. - /// - /// The contents of the CDATA section will be reported through the regular characters event; - /// this event is intended only to report the boundary. - - virtual void endCDATA() = 0; - /// Report the end of a CDATA section. - - virtual void comment(const XMLChar ch[], int start, int length) = 0; - /// Report an XML comment anywhere in the document. - /// - /// This callback will be used for comments inside or outside the document element, - /// including comments in the external DTD subset (if read). Comments in the DTD must - /// be properly nested inside start/endDTD and start/endEntity events (if used). - -protected: - virtual ~LexicalHandler(); -}; - - -} } // namespace Poco::XML - - -#endif // SAX_LexicalHandler_INCLUDED + /// The contents of the CDATA section will be reported through the regular characters event; + /// this event is intended only to report the boundary. + + virtual void endCDATA() = 0; + /// Report the end of a CDATA section. + + virtual void comment(const XMLChar ch[], int start, int length) = 0; + /// Report an XML comment anywhere in the document. + /// + /// This callback will be used for comments inside or outside the document element, + /// including comments in the external DTD subset (if read). Comments in the DTD must + /// be properly nested inside start/endDTD and start/endEntity events (if used). + +protected: + virtual ~LexicalHandler(); +}; + + +} } // namespace Poco::XML + + +#endif // SAX_LexicalHandler_INCLUDED diff --git a/contrib/libs/poco/XML/include/Poco/SAX/Locator.h b/contrib/libs/poco/XML/include/Poco/SAX/Locator.h index 4f2b47d481..5f9ec395bf 100644 --- a/contrib/libs/poco/XML/include/Poco/SAX/Locator.h +++ b/contrib/libs/poco/XML/include/Poco/SAX/Locator.h @@ -1,103 +1,103 @@ -// -// Locator.h -// -// Library: XML -// Package: SAX -// Module: SAX -// -// SAX Locator Interface. -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef SAX_Locator_INCLUDED -#define SAX_Locator_INCLUDED - - -#include "Poco/XML/XML.h" -#include "Poco/XML/XMLString.h" - - -namespace Poco { -namespace XML { - - -class XML_API Locator - /// Interface for associating a SAX event with a document location. - /// - /// If a SAX parser provides location information to the SAX application, it does so by - /// implementing this interface and then passing an instance to the application using the - /// content handler's setDocumentLocator method. The application can use the object to obtain - /// the location of any other SAX event in the XML source document. - /// - /// Note that the results returned by the object will be valid only during the scope of each - /// callback method: the application will receive unpredictable results if it attempts to use - /// the locator at any other time, or after parsing completes. - /// - /// SAX parsers are not required to supply a locator, but they are very strongly encouraged to - /// do so. If the parser supplies a locator, it must do so before reporting any other document - /// events. If no locator has been set by the time the application receives the startDocument event, - /// the application should assume that a locator is not available. -{ -public: - virtual XMLString getPublicId() const = 0; - /// Return the public identifier for the current document event. - /// - /// The return value is the public identifier of the document entity or of the external - /// parsed entity in which the markup triggering the event appears. - - virtual XMLString getSystemId() const = 0; - /// Return the system identifier for the current document event. - /// - /// The return value is the system identifier of the document entity or of the external - /// parsed entity in which the markup triggering the event appears. - /// - /// If the system identifier is a URL, the parser must resolve it fully before passing - /// it to the application. For example, a file name must always be provided as a - /// file:... URL, and other kinds of relative URI are also resolved against their bases. - - virtual int getLineNumber() const = 0; - /// Return the line number where the current document event ends. - /// Lines are delimited by line ends, which are defined in the XML specification. - /// - /// Warning: The return value from the method is intended only as an approximation for - /// the sake of diagnostics; it is not intended to provide sufficient information to - /// edit the character content of the original XML document. In some cases, these "line" - /// numbers match what would be displayed as columns, and in others they may not match the - /// source text due to internal entity expansion. - /// - /// The return value is an approximation of the line number in the document entity or external - /// parsed entity where the markup triggering the event appears. - /// - /// If possible, the SAX driver should provide the line position of the first character after - /// the text associated with the document event. The first line is line 1. - - virtual int getColumnNumber() const = 0; - /// Return the column number where the current document event ends. - /// This is one-based number of characters since the last line end. - /// - /// Warning: The return value from the method is intended only as an approximation - /// for the sake of diagnostics; it is not intended to provide sufficient information - /// to edit the character content of the original XML document. For example, when lines - /// contain combining character sequences, wide characters, surrogate pairs, or bi-directional - /// text, the value may not correspond to the column in a text editor's display. - /// - /// The return value is an approximation of the column number in the document entity or external - /// parsed entity where the markup triggering the event appears. - /// - /// If possible, the SAX driver should provide the line position of the first character after - /// the text associated with the document event. The first column in each line is column 1. - -protected: - virtual ~Locator(); -}; - - -} } // namespace Poco::XML - - -#endif // SAX_Locator_INCLUDED +// +// Locator.h +// +// Library: XML +// Package: SAX +// Module: SAX +// +// SAX Locator Interface. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef SAX_Locator_INCLUDED +#define SAX_Locator_INCLUDED + + +#include "Poco/XML/XML.h" +#include "Poco/XML/XMLString.h" + + +namespace Poco { +namespace XML { + + +class XML_API Locator + /// Interface for associating a SAX event with a document location. + /// + /// If a SAX parser provides location information to the SAX application, it does so by + /// implementing this interface and then passing an instance to the application using the + /// content handler's setDocumentLocator method. The application can use the object to obtain + /// the location of any other SAX event in the XML source document. + /// + /// Note that the results returned by the object will be valid only during the scope of each + /// callback method: the application will receive unpredictable results if it attempts to use + /// the locator at any other time, or after parsing completes. + /// + /// SAX parsers are not required to supply a locator, but they are very strongly encouraged to + /// do so. If the parser supplies a locator, it must do so before reporting any other document + /// events. If no locator has been set by the time the application receives the startDocument event, + /// the application should assume that a locator is not available. +{ +public: + virtual XMLString getPublicId() const = 0; + /// Return the public identifier for the current document event. + /// + /// The return value is the public identifier of the document entity or of the external + /// parsed entity in which the markup triggering the event appears. + + virtual XMLString getSystemId() const = 0; + /// Return the system identifier for the current document event. + /// + /// The return value is the system identifier of the document entity or of the external + /// parsed entity in which the markup triggering the event appears. + /// + /// If the system identifier is a URL, the parser must resolve it fully before passing + /// it to the application. For example, a file name must always be provided as a + /// file:... URL, and other kinds of relative URI are also resolved against their bases. + + virtual int getLineNumber() const = 0; + /// Return the line number where the current document event ends. + /// Lines are delimited by line ends, which are defined in the XML specification. + /// + /// Warning: The return value from the method is intended only as an approximation for + /// the sake of diagnostics; it is not intended to provide sufficient information to + /// edit the character content of the original XML document. In some cases, these "line" + /// numbers match what would be displayed as columns, and in others they may not match the + /// source text due to internal entity expansion. + /// + /// The return value is an approximation of the line number in the document entity or external + /// parsed entity where the markup triggering the event appears. + /// + /// If possible, the SAX driver should provide the line position of the first character after + /// the text associated with the document event. The first line is line 1. + + virtual int getColumnNumber() const = 0; + /// Return the column number where the current document event ends. + /// This is one-based number of characters since the last line end. + /// + /// Warning: The return value from the method is intended only as an approximation + /// for the sake of diagnostics; it is not intended to provide sufficient information + /// to edit the character content of the original XML document. For example, when lines + /// contain combining character sequences, wide characters, surrogate pairs, or bi-directional + /// text, the value may not correspond to the column in a text editor's display. + /// + /// The return value is an approximation of the column number in the document entity or external + /// parsed entity where the markup triggering the event appears. + /// + /// If possible, the SAX driver should provide the line position of the first character after + /// the text associated with the document event. The first column in each line is column 1. + +protected: + virtual ~Locator(); +}; + + +} } // namespace Poco::XML + + +#endif // SAX_Locator_INCLUDED diff --git a/contrib/libs/poco/XML/include/Poco/SAX/LocatorImpl.h b/contrib/libs/poco/XML/include/Poco/SAX/LocatorImpl.h index 2c924b3f88..0f0a584238 100644 --- a/contrib/libs/poco/XML/include/Poco/SAX/LocatorImpl.h +++ b/contrib/libs/poco/XML/include/Poco/SAX/LocatorImpl.h @@ -1,88 +1,88 @@ -// -// LocatorImpl.h -// -// Library: XML -// Package: SAX -// Module: SAX -// -// An implementation of the SAX Locator interface. -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef SAX_LocatorImpl_INCLUDED -#define SAX_LocatorImpl_INCLUDED - - -#include "Poco/XML/XML.h" -#include "Poco/SAX/Locator.h" -#include "Poco/XML/XMLString.h" - - -namespace Poco { -namespace XML { - - -class XML_API LocatorImpl: public Locator - /// Provide an optional convenience implementation of Locator. -{ -public: - LocatorImpl(); - /// Zero-argument constructor. - /// - /// This will not normally be useful, since the main purpose of this class is - /// to make a snapshot of an existing Locator. - - LocatorImpl(const Locator& loc); - /// Copy constructor. - /// - /// Create a persistent copy of the current state of a locator. When the original - /// locator changes, this copy will still keep the original values (and it can be - /// used outside the scope of DocumentHandler methods). - - ~LocatorImpl(); - /// Destroys the Locator. - - LocatorImpl& operator = (const Locator& loc); - /// Assignment operator. - - XMLString getPublicId() const; - /// Return the saved public identifier. - - XMLString getSystemId() const; - /// Return the saved system identifier. - - int getLineNumber() const; - /// Return the saved line number (1-based). - - int getColumnNumber() const; - /// Return the saved column number (1-based). - - void setPublicId(const XMLString& publicId); - /// Set the public identifier for this locator. - - void setSystemId(const XMLString& systemId); - /// Set the system identifier for this locator. - - void setLineNumber(int lineNumber); - /// Set the line number for this locator (1-based). - - void setColumnNumber(int columnNumber); - /// Set the column number for this locator (1-based). - -private: - XMLString _publicId; - XMLString _systemId; - int _lineNumber; - int _columnNumber; -}; - - -} } // namespace Poco::XML - - -#endif // SAX_LocatorImpl_INCLUDED +// +// LocatorImpl.h +// +// Library: XML +// Package: SAX +// Module: SAX +// +// An implementation of the SAX Locator interface. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef SAX_LocatorImpl_INCLUDED +#define SAX_LocatorImpl_INCLUDED + + +#include "Poco/XML/XML.h" +#include "Poco/SAX/Locator.h" +#include "Poco/XML/XMLString.h" + + +namespace Poco { +namespace XML { + + +class XML_API LocatorImpl: public Locator + /// Provide an optional convenience implementation of Locator. +{ +public: + LocatorImpl(); + /// Zero-argument constructor. + /// + /// This will not normally be useful, since the main purpose of this class is + /// to make a snapshot of an existing Locator. + + LocatorImpl(const Locator& loc); + /// Copy constructor. + /// + /// Create a persistent copy of the current state of a locator. When the original + /// locator changes, this copy will still keep the original values (and it can be + /// used outside the scope of DocumentHandler methods). + + ~LocatorImpl(); + /// Destroys the Locator. + + LocatorImpl& operator = (const Locator& loc); + /// Assignment operator. + + XMLString getPublicId() const; + /// Return the saved public identifier. + + XMLString getSystemId() const; + /// Return the saved system identifier. + + int getLineNumber() const; + /// Return the saved line number (1-based). + + int getColumnNumber() const; + /// Return the saved column number (1-based). + + void setPublicId(const XMLString& publicId); + /// Set the public identifier for this locator. + + void setSystemId(const XMLString& systemId); + /// Set the system identifier for this locator. + + void setLineNumber(int lineNumber); + /// Set the line number for this locator (1-based). + + void setColumnNumber(int columnNumber); + /// Set the column number for this locator (1-based). + +private: + XMLString _publicId; + XMLString _systemId; + int _lineNumber; + int _columnNumber; +}; + + +} } // namespace Poco::XML + + +#endif // SAX_LocatorImpl_INCLUDED diff --git a/contrib/libs/poco/XML/include/Poco/SAX/NamespaceSupport.h b/contrib/libs/poco/XML/include/Poco/SAX/NamespaceSupport.h index 7441649949..48e567b7f2 100644 --- a/contrib/libs/poco/XML/include/Poco/SAX/NamespaceSupport.h +++ b/contrib/libs/poco/XML/include/Poco/SAX/NamespaceSupport.h @@ -1,195 +1,195 @@ -// -// NamespaceSupport.h -// -// Library: XML -// Package: SAX -// Module: SAX -// -// Namespace support for SAX2. -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef SAX_NamespaceSupport_INCLUDED -#define SAX_NamespaceSupport_INCLUDED - - -#include "Poco/XML/XML.h" -#include "Poco/XML/XMLString.h" -#include <set> -#include <map> -#include <vector> - - -namespace Poco { -namespace XML { - - -class XML_API NamespaceSupport - /// Encapsulate Namespace logic for use by SAX drivers. - /// This class encapsulates the logic of Namespace processing: - /// it tracks the declarations currently in force for each context and - /// automatically processes qualified XML 1.0 names into their Namespace - /// parts; it can also be used in reverse for generating - /// XML 1.0 from Namespaces. - /// Namespace support objects are reusable, but the reset method - /// must be invoked between each session. -{ -public: - typedef std::set<XMLString> PrefixSet; - - NamespaceSupport(); - /// Creates a NamespaceSupport object. - - ~NamespaceSupport(); - /// Destroys a NamespaceSupport object. - - bool declarePrefix(const XMLString& prefix, const XMLString& namespaceURI); - /// Declare a Namespace prefix. All prefixes must be declared before they are - /// referenced. For example, a SAX driver (parser) would scan an element's attributes - /// in two passes: first for namespace declarations, then a second pass using - /// processName() to interpret prefixes against (potentially redefined) prefixes. +// +// NamespaceSupport.h +// +// Library: XML +// Package: SAX +// Module: SAX +// +// Namespace support for SAX2. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef SAX_NamespaceSupport_INCLUDED +#define SAX_NamespaceSupport_INCLUDED + + +#include "Poco/XML/XML.h" +#include "Poco/XML/XMLString.h" +#include <set> +#include <map> +#include <vector> + + +namespace Poco { +namespace XML { + + +class XML_API NamespaceSupport + /// Encapsulate Namespace logic for use by SAX drivers. + /// This class encapsulates the logic of Namespace processing: + /// it tracks the declarations currently in force for each context and + /// automatically processes qualified XML 1.0 names into their Namespace + /// parts; it can also be used in reverse for generating + /// XML 1.0 from Namespaces. + /// Namespace support objects are reusable, but the reset method + /// must be invoked between each session. +{ +public: + typedef std::set<XMLString> PrefixSet; + + NamespaceSupport(); + /// Creates a NamespaceSupport object. + + ~NamespaceSupport(); + /// Destroys a NamespaceSupport object. + + bool declarePrefix(const XMLString& prefix, const XMLString& namespaceURI); + /// Declare a Namespace prefix. All prefixes must be declared before they are + /// referenced. For example, a SAX driver (parser) would scan an element's attributes + /// in two passes: first for namespace declarations, then a second pass using + /// processName() to interpret prefixes against (potentially redefined) prefixes. + /// + /// This method declares a prefix in the current Namespace context; the prefix + /// will remain in force until this context is popped, unless it is shadowed + /// in a descendant context. + /// + /// To declare the default element Namespace, use the empty string as the prefix. + /// + /// Note that you must not declare a prefix after you've pushed and popped another + /// Namespace context, or treated the declarations phase as complete by processing + /// a prefixed name. /// - /// This method declares a prefix in the current Namespace context; the prefix - /// will remain in force until this context is popped, unless it is shadowed - /// in a descendant context. + /// Returns true if the prefix was legal, false otherwise. + + bool undeclarePrefix(const XMLString& prefix); + /// Remove the given namespace prefix. + + void getDeclaredPrefixes(PrefixSet& prefixes) const; + /// Return an enumeration of all prefixes declared in this context. + /// + /// The empty (default) prefix will be included in this enumeration; note that + /// this behaviour differs from that of getPrefix() and getPrefixes(). + + const XMLString& getPrefix(const XMLString& namespaceURI) const; + /// Return one of the prefixes mapped to a Namespace URI. + /// + /// If more than one prefix is currently mapped to the same URI, this method + /// will make an arbitrary selection; if you want all of the prefixes, use the + /// getPrefixes() method instead. + + bool isMapped(const XMLString& namespaceURI) const; + /// Returns true if the given namespaceURI has been mapped to a prefix, + /// false otherwise. + + void getPrefixes(PrefixSet& prefixes) const; + /// Return an enumeration of all prefixes whose declarations are active in the + /// current context. This includes declarations from parent contexts that have + /// not been overridden. + /// + /// Note: if there is a default prefix, it will not be returned in this enumeration; + /// check for the default prefix using the getURI with an argument of "". + + void getPrefixes(const XMLString& namespaceURI, PrefixSet& prefixes) const; + /// Return an enumeration of all prefixes for a given URI whose declarations + /// are active in the current context. This includes declarations from parent + /// contexts that have not been overridden. + /// + /// This method returns prefixes mapped to a specific Namespace URI. The xml: + /// prefix will be included. If you want only one prefix that's mapped to the + /// Namespace URI, and you don't care which one you get, use the getPrefix() method + /// instead. + /// + /// Note: the empty (default) prefix is never included in this enumeration; + /// to check for the presence of a default Namespace, use the getURI() method + /// with an argument of "". + + const XMLString& getURI(const XMLString& prefix) const; + /// Look up a prefix and get the currently-mapped Namespace URI. + /// + /// This method looks up the prefix in the current context. Use the empty string + /// ("") for the default Namespace. + + void pushContext(); + /// Start a new Namespace context. The new context will automatically inherit + /// the declarations of its parent context, but it will also keep track of which + /// declarations were made within this context. + /// + /// Event callback code should start a new context once per element. This means + /// being ready to call this in either of two places. For elements that don't + /// include namespace declarations, the ContentHandler::startElement() callback + /// is the right place. For elements with such a declaration, it'd done in the + /// first ContentHandler::startPrefixMapping() callback. A boolean flag can be + /// used to track whether a context has been started yet. When either of those + /// methods is called, it checks the flag to see if a new context needs to be + /// started. If so, it starts the context and sets the flag. After + /// ContentHandler::startElement() does that, it always clears the flag. + /// + /// Normally, SAX drivers would push a new context at the beginning of each + /// XML element. Then they perform a first pass over the attributes to process + /// all namespace declarations, making ContentHandler::startPrefixMapping() callbacks. + /// Then a second pass is made, to determine the namespace-qualified names for + /// all attributes and for the element name. Finally all the information for + /// the ContentHandler::startElement() callback is available, so it can then + /// be made. + /// + /// The Namespace support object always starts with a base context already in + /// force: in this context, only the "xml" prefix is declared. + + void popContext(); + /// Revert to the previous Namespace context. + /// + /// Normally, you should pop the context at the end of each XML element. After + /// popping the context, all Namespace prefix mappings that were previously + /// in force are restored. + /// + /// You must not attempt to declare additional Namespace prefixes after popping + /// a context, unless you push another context first. + + bool processName(const XMLString& qname, XMLString& namespaceURI, XMLString& localName, bool isAttribute) const; + /// Process a raw XML 1.0 name. + /// This method processes a raw XML 1.0 name in the current context + /// by removing the prefix and looking it up among the + /// prefixes currently declared. The result will be returned in + /// namespaceURI and localName. + /// If the raw name has a prefix that has not been declared, then the return + /// value will be false, otherwise true. /// - /// To declare the default element Namespace, use the empty string as the prefix. - /// - /// Note that you must not declare a prefix after you've pushed and popped another - /// Namespace context, or treated the declarations phase as complete by processing - /// a prefixed name. - /// - /// Returns true if the prefix was legal, false otherwise. - - bool undeclarePrefix(const XMLString& prefix); - /// Remove the given namespace prefix. - - void getDeclaredPrefixes(PrefixSet& prefixes) const; - /// Return an enumeration of all prefixes declared in this context. - /// - /// The empty (default) prefix will be included in this enumeration; note that - /// this behaviour differs from that of getPrefix() and getPrefixes(). - - const XMLString& getPrefix(const XMLString& namespaceURI) const; - /// Return one of the prefixes mapped to a Namespace URI. - /// - /// If more than one prefix is currently mapped to the same URI, this method - /// will make an arbitrary selection; if you want all of the prefixes, use the - /// getPrefixes() method instead. - - bool isMapped(const XMLString& namespaceURI) const; - /// Returns true if the given namespaceURI has been mapped to a prefix, - /// false otherwise. - - void getPrefixes(PrefixSet& prefixes) const; - /// Return an enumeration of all prefixes whose declarations are active in the - /// current context. This includes declarations from parent contexts that have - /// not been overridden. - /// - /// Note: if there is a default prefix, it will not be returned in this enumeration; - /// check for the default prefix using the getURI with an argument of "". - - void getPrefixes(const XMLString& namespaceURI, PrefixSet& prefixes) const; - /// Return an enumeration of all prefixes for a given URI whose declarations - /// are active in the current context. This includes declarations from parent - /// contexts that have not been overridden. - /// - /// This method returns prefixes mapped to a specific Namespace URI. The xml: - /// prefix will be included. If you want only one prefix that's mapped to the - /// Namespace URI, and you don't care which one you get, use the getPrefix() method - /// instead. - /// - /// Note: the empty (default) prefix is never included in this enumeration; - /// to check for the presence of a default Namespace, use the getURI() method - /// with an argument of "". - - const XMLString& getURI(const XMLString& prefix) const; - /// Look up a prefix and get the currently-mapped Namespace URI. - /// - /// This method looks up the prefix in the current context. Use the empty string - /// ("") for the default Namespace. - - void pushContext(); - /// Start a new Namespace context. The new context will automatically inherit - /// the declarations of its parent context, but it will also keep track of which - /// declarations were made within this context. - /// - /// Event callback code should start a new context once per element. This means - /// being ready to call this in either of two places. For elements that don't - /// include namespace declarations, the ContentHandler::startElement() callback - /// is the right place. For elements with such a declaration, it'd done in the - /// first ContentHandler::startPrefixMapping() callback. A boolean flag can be - /// used to track whether a context has been started yet. When either of those - /// methods is called, it checks the flag to see if a new context needs to be - /// started. If so, it starts the context and sets the flag. After - /// ContentHandler::startElement() does that, it always clears the flag. - /// - /// Normally, SAX drivers would push a new context at the beginning of each - /// XML element. Then they perform a first pass over the attributes to process - /// all namespace declarations, making ContentHandler::startPrefixMapping() callbacks. - /// Then a second pass is made, to determine the namespace-qualified names for - /// all attributes and for the element name. Finally all the information for - /// the ContentHandler::startElement() callback is available, so it can then - /// be made. - /// - /// The Namespace support object always starts with a base context already in - /// force: in this context, only the "xml" prefix is declared. - - void popContext(); - /// Revert to the previous Namespace context. - /// - /// Normally, you should pop the context at the end of each XML element. After - /// popping the context, all Namespace prefix mappings that were previously - /// in force are restored. - /// - /// You must not attempt to declare additional Namespace prefixes after popping - /// a context, unless you push another context first. - - bool processName(const XMLString& qname, XMLString& namespaceURI, XMLString& localName, bool isAttribute) const; - /// Process a raw XML 1.0 name. - /// This method processes a raw XML 1.0 name in the current context - /// by removing the prefix and looking it up among the - /// prefixes currently declared. The result will be returned in - /// namespaceURI and localName. - /// If the raw name has a prefix that has not been declared, then the return - /// value will be false, otherwise true. - /// - /// Note that attribute names are processed differently than element names: - /// an unprefixed element name will receive the - /// default Namespace (if any), while an unprefixed attribute name will not. - - void reset(); - /// Reset this Namespace support object for reuse. - /// - /// It is necessary to invoke this method before reusing the Namespace support - /// object for a new session. If namespace declaration URIs are to be supported, - /// that flag must also be set to a non-default value. - /// Reset this Namespace support object for reuse. - - static const XMLString XML_NAMESPACE; - static const XMLString XML_NAMESPACE_PREFIX; - static const XMLString XMLNS_NAMESPACE; - static const XMLString XMLNS_NAMESPACE_PREFIX; - -private: - NamespaceSupport(const NamespaceSupport&); - NamespaceSupport& operator = (const NamespaceSupport&); - - typedef std::map<XMLString, XMLString> Context; - typedef std::vector<Context> ContextVec; - - ContextVec _contexts; - - static const XMLString EMPTY_STRING; -}; - - -} } // namespace Poco::XML - - -#endif // SAX_NamespaceSupport_INCLUDED + /// Note that attribute names are processed differently than element names: + /// an unprefixed element name will receive the + /// default Namespace (if any), while an unprefixed attribute name will not. + + void reset(); + /// Reset this Namespace support object for reuse. + /// + /// It is necessary to invoke this method before reusing the Namespace support + /// object for a new session. If namespace declaration URIs are to be supported, + /// that flag must also be set to a non-default value. + /// Reset this Namespace support object for reuse. + + static const XMLString XML_NAMESPACE; + static const XMLString XML_NAMESPACE_PREFIX; + static const XMLString XMLNS_NAMESPACE; + static const XMLString XMLNS_NAMESPACE_PREFIX; + +private: + NamespaceSupport(const NamespaceSupport&); + NamespaceSupport& operator = (const NamespaceSupport&); + + typedef std::map<XMLString, XMLString> Context; + typedef std::vector<Context> ContextVec; + + ContextVec _contexts; + + static const XMLString EMPTY_STRING; +}; + + +} } // namespace Poco::XML + + +#endif // SAX_NamespaceSupport_INCLUDED diff --git a/contrib/libs/poco/XML/include/Poco/SAX/SAXException.h b/contrib/libs/poco/XML/include/Poco/SAX/SAXException.h index e1f9cae8e4..64b5b20739 100644 --- a/contrib/libs/poco/XML/include/Poco/SAX/SAXException.h +++ b/contrib/libs/poco/XML/include/Poco/SAX/SAXException.h @@ -1,176 +1,176 @@ -// -// SAXException.h -// -// Library: XML -// Package: SAX -// Module: SAX -// -// SAX exception classes. -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef SAX_SAXException_INCLUDED -#define SAX_SAXException_INCLUDED - - -#include "Poco/XML/XML.h" -#include "Poco/XML/XMLException.h" -#include "Poco/XML/XMLString.h" - - -namespace Poco { -namespace XML { - - -POCO_DECLARE_EXCEPTION(XML_API, SAXException, XMLException) - /// The base class for all SAX-related exceptions like SAXParseException, - /// SAXNotRecognizedException or SAXNotSupportedException. +// +// SAXException.h +// +// Library: XML +// Package: SAX +// Module: SAX +// +// SAX exception classes. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef SAX_SAXException_INCLUDED +#define SAX_SAXException_INCLUDED + + +#include "Poco/XML/XML.h" +#include "Poco/XML/XMLException.h" +#include "Poco/XML/XMLString.h" + + +namespace Poco { +namespace XML { + + +POCO_DECLARE_EXCEPTION(XML_API, SAXException, XMLException) + /// The base class for all SAX-related exceptions like SAXParseException, + /// SAXNotRecognizedException or SAXNotSupportedException. + /// + /// This class can contain basic error or warning information from either the XML parser + /// or the application: a parser writer or application writer can subclass it to provide + /// additional functionality. SAX handlers may throw this exception or any exception subclassed + /// from it. + /// + /// If the application needs to pass through other types of exceptions, it must wrap those exceptions + /// in a SAXException or an exception derived from a SAXException. + /// + /// If the parser or application needs to include information about a specific location in an XML + /// document, it should use the SAXParseException subclass. + + +POCO_DECLARE_EXCEPTION(XML_API, SAXNotRecognizedException, SAXException) + /// Exception class for an unrecognized identifier. + /// + /// An XMLReader will throw this exception when it finds an unrecognized feature or property + /// identifier; SAX applications and extensions may use this class for other, similar purposes. + + +POCO_DECLARE_EXCEPTION(XML_API, SAXNotSupportedException, SAXException) + /// Exception class for an unsupported operation. + /// + /// An XMLReader will throw this exception when it recognizes a feature or property identifier, + /// but cannot perform the requested operation (setting a state or value). Other SAX2 applications + /// and extensions may use this class for similar purposes. + + +class Locator; + + +class XML_API SAXParseException: public SAXException + /// Encapsulate an XML parse error or warning. /// - /// This class can contain basic error or warning information from either the XML parser - /// or the application: a parser writer or application writer can subclass it to provide - /// additional functionality. SAX handlers may throw this exception or any exception subclassed - /// from it. - /// - /// If the application needs to pass through other types of exceptions, it must wrap those exceptions - /// in a SAXException or an exception derived from a SAXException. - /// - /// If the parser or application needs to include information about a specific location in an XML - /// document, it should use the SAXParseException subclass. - - -POCO_DECLARE_EXCEPTION(XML_API, SAXNotRecognizedException, SAXException) - /// Exception class for an unrecognized identifier. - /// - /// An XMLReader will throw this exception when it finds an unrecognized feature or property - /// identifier; SAX applications and extensions may use this class for other, similar purposes. - - -POCO_DECLARE_EXCEPTION(XML_API, SAXNotSupportedException, SAXException) - /// Exception class for an unsupported operation. - /// - /// An XMLReader will throw this exception when it recognizes a feature or property identifier, - /// but cannot perform the requested operation (setting a state or value). Other SAX2 applications - /// and extensions may use this class for similar purposes. - - -class Locator; - - -class XML_API SAXParseException: public SAXException - /// Encapsulate an XML parse error or warning. - /// - /// This exception may include information for locating the error in the original XML document, - /// as if it came from a Locator object. Note that although the application will receive a - /// SAXParseException as the argument to the handlers in the ErrorHandler interface, the application - /// is not actually required to throw the exception; instead, it can simply read the information in it - /// and take a different action. - /// - /// Since this exception is a subclass of SAXException, it inherits the ability to wrap another exception. -{ -public: - SAXParseException(const std::string& msg, const Locator& loc); - /// Create a new SAXParseException from a message and a Locator. - - SAXParseException(const std::string& msg, const Locator& loc, const Poco::Exception& exc); - /// Wrap an existing exception in a SAXParseException. - - SAXParseException(const std::string& msg, const XMLString& publicId, const XMLString& systemId, int lineNumber, int columnNumber); - /// Create a new SAXParseException with an embedded exception. - /// - /// This constructor is most useful for parser writers. - /// All parameters except the message are as if they were provided by a Locator. - /// For example, if the system identifier is a URL (including relative filename), - /// the caller must resolve it fully before creating the exception. - - SAXParseException(const std::string& msg, const XMLString& publicId, const XMLString& systemId, int lineNumber, int columnNumber, const Poco::Exception& exc); - /// Create a new SAXParseException. - /// - /// This constructor is most useful for parser writers. - /// All parameters except the message are as if they were provided by a Locator. - /// For example, if the system identifier is a URL (including relative filename), - /// the caller must resolve it fully before creating the exception. - - SAXParseException(const SAXParseException& exc); - /// Creates a new SAXParseException from another one. - - ~SAXParseException() noexcept; - /// Destroy the exception. - - SAXParseException& operator = (const SAXParseException& exc); - /// Assignment operator. - + /// This exception may include information for locating the error in the original XML document, + /// as if it came from a Locator object. Note that although the application will receive a + /// SAXParseException as the argument to the handlers in the ErrorHandler interface, the application + /// is not actually required to throw the exception; instead, it can simply read the information in it + /// and take a different action. + /// + /// Since this exception is a subclass of SAXException, it inherits the ability to wrap another exception. +{ +public: + SAXParseException(const std::string& msg, const Locator& loc); + /// Create a new SAXParseException from a message and a Locator. + + SAXParseException(const std::string& msg, const Locator& loc, const Poco::Exception& exc); + /// Wrap an existing exception in a SAXParseException. + + SAXParseException(const std::string& msg, const XMLString& publicId, const XMLString& systemId, int lineNumber, int columnNumber); + /// Create a new SAXParseException with an embedded exception. + /// + /// This constructor is most useful for parser writers. + /// All parameters except the message are as if they were provided by a Locator. + /// For example, if the system identifier is a URL (including relative filename), + /// the caller must resolve it fully before creating the exception. + + SAXParseException(const std::string& msg, const XMLString& publicId, const XMLString& systemId, int lineNumber, int columnNumber, const Poco::Exception& exc); + /// Create a new SAXParseException. + /// + /// This constructor is most useful for parser writers. + /// All parameters except the message are as if they were provided by a Locator. + /// For example, if the system identifier is a URL (including relative filename), + /// the caller must resolve it fully before creating the exception. + + SAXParseException(const SAXParseException& exc); + /// Creates a new SAXParseException from another one. + + ~SAXParseException() noexcept; + /// Destroy the exception. + + SAXParseException& operator = (const SAXParseException& exc); + /// Assignment operator. + const char* name() const noexcept; - /// Returns a static string describing the exception. - + /// Returns a static string describing the exception. + const char* className() const noexcept; - /// Returns the name of the exception class. - - Poco::Exception* clone() const; - /// Creates an exact copy of the exception. - - void rethrow() const; - /// (Re)Throws the exception. - - const XMLString& getPublicId() const; - /// Get the public identifier of the entity where the exception occurred. - - const XMLString& getSystemId() const; - /// Get the system identifier of the entity where the exception occurred. - - int getLineNumber() const; - /// The line number of the end of the text where the exception occurred. - /// The first line is line 1. - - int getColumnNumber() const; - /// The column number of the end of the text where the exception occurred. - /// The first column in a line is position 1. - -protected: - static std::string buildMessage(const std::string& msg, const XMLString& publicId, const XMLString& systemId, int lineNumber, int columnNumber); - -private: - SAXParseException(); - - XMLString _publicId; - XMLString _systemId; - int _lineNumber; - int _columnNumber; -}; - - -// -// inlines -// -inline const XMLString& SAXParseException::getPublicId() const -{ - return _publicId; -} - - -inline const XMLString& SAXParseException::getSystemId() const -{ - return _systemId; -} - - -inline int SAXParseException::getLineNumber() const -{ - return _lineNumber; -} - - -inline int SAXParseException::getColumnNumber() const -{ - return _columnNumber; -} - - -} } // namespace Poco::XML - - -#endif // SAX_SAXException_INCLUDED + /// Returns the name of the exception class. + + Poco::Exception* clone() const; + /// Creates an exact copy of the exception. + + void rethrow() const; + /// (Re)Throws the exception. + + const XMLString& getPublicId() const; + /// Get the public identifier of the entity where the exception occurred. + + const XMLString& getSystemId() const; + /// Get the system identifier of the entity where the exception occurred. + + int getLineNumber() const; + /// The line number of the end of the text where the exception occurred. + /// The first line is line 1. + + int getColumnNumber() const; + /// The column number of the end of the text where the exception occurred. + /// The first column in a line is position 1. + +protected: + static std::string buildMessage(const std::string& msg, const XMLString& publicId, const XMLString& systemId, int lineNumber, int columnNumber); + +private: + SAXParseException(); + + XMLString _publicId; + XMLString _systemId; + int _lineNumber; + int _columnNumber; +}; + + +// +// inlines +// +inline const XMLString& SAXParseException::getPublicId() const +{ + return _publicId; +} + + +inline const XMLString& SAXParseException::getSystemId() const +{ + return _systemId; +} + + +inline int SAXParseException::getLineNumber() const +{ + return _lineNumber; +} + + +inline int SAXParseException::getColumnNumber() const +{ + return _columnNumber; +} + + +} } // namespace Poco::XML + + +#endif // SAX_SAXException_INCLUDED diff --git a/contrib/libs/poco/XML/include/Poco/SAX/SAXParser.h b/contrib/libs/poco/XML/include/Poco/SAX/SAXParser.h index 587e61c597..8cdfd6fa65 100644 --- a/contrib/libs/poco/XML/include/Poco/SAX/SAXParser.h +++ b/contrib/libs/poco/XML/include/Poco/SAX/SAXParser.h @@ -1,103 +1,103 @@ -// -// SAXParser.h -// -// Library: XML -// Package: SAX -// Module: SAX -// -// Implementation of the XMLReader interface. -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef SAX_SAXParser_INCLUDED -#define SAX_SAXParser_INCLUDED - - -#include "Poco/XML/XML.h" -#include "Poco/SAX/XMLReader.h" -#include "Poco/XML/ParserEngine.h" - - -namespace Poco { -namespace XML { - - -class XML_API SAXParser: public XMLReader - /// This class provides a SAX2 (Simple API for XML) interface to expat, - /// the XML parser toolkit. - /// The following SAX2 features and properties are supported: - /// * http://xml.org/sax/features/external-general-entities - /// * http://xml.org/sax/features/external-parameter-entities - /// * http://xml.org/sax/features/namespaces - /// * http://xml.org/sax/features/namespace-prefixes - /// * http://xml.org/sax/properties/lexical-handler - /// * http://xml.org/sax/properties/declaration-handler - /// - /// The following proprietary extensions are supported: - /// * http://www.appinf.com/features/enable-partial-reads -- - /// see ParserEngine::setEnablePartialReads() -{ -public: - SAXParser(); - /// Creates an SAXParser. - - SAXParser(const XMLString& encoding); - /// Creates an SAXParser with the given encoding. - - ~SAXParser(); - /// Destroys the SAXParser. - - void setEncoding(const XMLString& encoding); - /// Sets the encoding used by the parser if no - /// encoding is specified in the XML document. - - const XMLString& getEncoding() const; - /// Returns the name of the encoding used by - /// the parser if no encoding is specified in - /// the XML document. - - void addEncoding(const XMLString& name, Poco::TextEncoding* pEncoding); - /// Adds an encoding to the parser. Does not take ownership of the pointer! - - /// XMLReader - void setEntityResolver(EntityResolver* pResolver); - EntityResolver* getEntityResolver() const; - void setDTDHandler(DTDHandler* pDTDHandler); - DTDHandler* getDTDHandler() const; - void setContentHandler(ContentHandler* pContentHandler); - ContentHandler* getContentHandler() const; - void setErrorHandler(ErrorHandler* pErrorHandler); - ErrorHandler* getErrorHandler() const; - void setFeature(const XMLString& featureId, bool state); - bool getFeature(const XMLString& featureId) const; - void setProperty(const XMLString& propertyId, const XMLString& value); - void setProperty(const XMLString& propertyId, void* value); - void* getProperty(const XMLString& propertyId) const; - void parse(InputSource* pSource); - void parse(const XMLString& systemId); - void parseMemoryNP(const char* xml, std::size_t size); - - /// Extensions - void parseString(const std::string& xml); - - static const XMLString FEATURE_PARTIAL_READS; - -protected: - void setupParse(); - -private: - ParserEngine _engine; - bool _namespaces; - bool _namespacePrefixes; -}; - - -} } // namespace Poco::XML - - -#endif // SAX_SAXParser_INCLUDED +// +// SAXParser.h +// +// Library: XML +// Package: SAX +// Module: SAX +// +// Implementation of the XMLReader interface. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef SAX_SAXParser_INCLUDED +#define SAX_SAXParser_INCLUDED + + +#include "Poco/XML/XML.h" +#include "Poco/SAX/XMLReader.h" +#include "Poco/XML/ParserEngine.h" + + +namespace Poco { +namespace XML { + + +class XML_API SAXParser: public XMLReader + /// This class provides a SAX2 (Simple API for XML) interface to expat, + /// the XML parser toolkit. + /// The following SAX2 features and properties are supported: + /// * http://xml.org/sax/features/external-general-entities + /// * http://xml.org/sax/features/external-parameter-entities + /// * http://xml.org/sax/features/namespaces + /// * http://xml.org/sax/features/namespace-prefixes + /// * http://xml.org/sax/properties/lexical-handler + /// * http://xml.org/sax/properties/declaration-handler + /// + /// The following proprietary extensions are supported: + /// * http://www.appinf.com/features/enable-partial-reads -- + /// see ParserEngine::setEnablePartialReads() +{ +public: + SAXParser(); + /// Creates an SAXParser. + + SAXParser(const XMLString& encoding); + /// Creates an SAXParser with the given encoding. + + ~SAXParser(); + /// Destroys the SAXParser. + + void setEncoding(const XMLString& encoding); + /// Sets the encoding used by the parser if no + /// encoding is specified in the XML document. + + const XMLString& getEncoding() const; + /// Returns the name of the encoding used by + /// the parser if no encoding is specified in + /// the XML document. + + void addEncoding(const XMLString& name, Poco::TextEncoding* pEncoding); + /// Adds an encoding to the parser. Does not take ownership of the pointer! + + /// XMLReader + void setEntityResolver(EntityResolver* pResolver); + EntityResolver* getEntityResolver() const; + void setDTDHandler(DTDHandler* pDTDHandler); + DTDHandler* getDTDHandler() const; + void setContentHandler(ContentHandler* pContentHandler); + ContentHandler* getContentHandler() const; + void setErrorHandler(ErrorHandler* pErrorHandler); + ErrorHandler* getErrorHandler() const; + void setFeature(const XMLString& featureId, bool state); + bool getFeature(const XMLString& featureId) const; + void setProperty(const XMLString& propertyId, const XMLString& value); + void setProperty(const XMLString& propertyId, void* value); + void* getProperty(const XMLString& propertyId) const; + void parse(InputSource* pSource); + void parse(const XMLString& systemId); + void parseMemoryNP(const char* xml, std::size_t size); + + /// Extensions + void parseString(const std::string& xml); + + static const XMLString FEATURE_PARTIAL_READS; + +protected: + void setupParse(); + +private: + ParserEngine _engine; + bool _namespaces; + bool _namespacePrefixes; +}; + + +} } // namespace Poco::XML + + +#endif // SAX_SAXParser_INCLUDED diff --git a/contrib/libs/poco/XML/include/Poco/SAX/WhitespaceFilter.h b/contrib/libs/poco/XML/include/Poco/SAX/WhitespaceFilter.h index f4f08bc0f3..001b74397d 100644 --- a/contrib/libs/poco/XML/include/Poco/SAX/WhitespaceFilter.h +++ b/contrib/libs/poco/XML/include/Poco/SAX/WhitespaceFilter.h @@ -1,81 +1,81 @@ -// -// WhitespaceFilter.h -// -// Library: XML -// Package: SAX -// Module: WhitespaceFilter -// -// Definition of the WhitespaceFilter class. -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef SAX_WhitespaceFilter_INCLUDED -#define SAX_WhitespaceFilter_INCLUDED - - -#include "Poco/XML/XML.h" -#include "Poco/SAX/XMLFilterImpl.h" -#include "Poco/SAX/LexicalHandler.h" - - -namespace Poco { -namespace XML { - - -class XML_API WhitespaceFilter: public XMLFilterImpl, public LexicalHandler - /// This implementation of the SAX2 XMLFilter interface - /// filters all whitespace-only character data element - /// content. -{ -public: - WhitespaceFilter(); - /// Creates the WhitespaceFilter, with no parent. - - WhitespaceFilter(XMLReader* pReader); - /// Creates the WhitespaceFilter with the specified parent. - - ~WhitespaceFilter(); - /// Destroys the WhitespaceFilter. - - // XMLReader - void setProperty(const XMLString& propertyId, const XMLString& value); - void setProperty(const XMLString& propertyId, void* value); - void* getProperty(const XMLString& propertyId) const; - - // ContentHandler - void startDocument(); - void endDocument(); - void startElement(const XMLString& uri, const XMLString& localName, const XMLString& qname, const Attributes& attrList); - void endElement(const XMLString& uri, const XMLString& localName, const XMLString& qname); - void characters(const XMLChar ch[], int start, int length); - void ignorableWhitespace(const XMLChar ch[], int start, int length); - void processingInstruction(const XMLString& target, const XMLString& data); - - // LexicalHandler - void startDTD(const XMLString& name, const XMLString& publicId, const XMLString& systemId); - void endDTD(); - void startEntity(const XMLString& name); - void endEntity(const XMLString& name); - void startCDATA(); - void endCDATA(); - void comment(const XMLChar ch[], int start, int length); - -protected: - void setupParse(); - -private: - LexicalHandler* _pLexicalHandler; - XMLString _data; - bool _filter; -}; - - -} } // namespace Poco::XML - - -#endif // SAX_WhitespaceFilter_INCLUDED +// +// WhitespaceFilter.h +// +// Library: XML +// Package: SAX +// Module: WhitespaceFilter +// +// Definition of the WhitespaceFilter class. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef SAX_WhitespaceFilter_INCLUDED +#define SAX_WhitespaceFilter_INCLUDED + + +#include "Poco/XML/XML.h" +#include "Poco/SAX/XMLFilterImpl.h" +#include "Poco/SAX/LexicalHandler.h" + + +namespace Poco { +namespace XML { + + +class XML_API WhitespaceFilter: public XMLFilterImpl, public LexicalHandler + /// This implementation of the SAX2 XMLFilter interface + /// filters all whitespace-only character data element + /// content. +{ +public: + WhitespaceFilter(); + /// Creates the WhitespaceFilter, with no parent. + + WhitespaceFilter(XMLReader* pReader); + /// Creates the WhitespaceFilter with the specified parent. + + ~WhitespaceFilter(); + /// Destroys the WhitespaceFilter. + + // XMLReader + void setProperty(const XMLString& propertyId, const XMLString& value); + void setProperty(const XMLString& propertyId, void* value); + void* getProperty(const XMLString& propertyId) const; + + // ContentHandler + void startDocument(); + void endDocument(); + void startElement(const XMLString& uri, const XMLString& localName, const XMLString& qname, const Attributes& attrList); + void endElement(const XMLString& uri, const XMLString& localName, const XMLString& qname); + void characters(const XMLChar ch[], int start, int length); + void ignorableWhitespace(const XMLChar ch[], int start, int length); + void processingInstruction(const XMLString& target, const XMLString& data); + + // LexicalHandler + void startDTD(const XMLString& name, const XMLString& publicId, const XMLString& systemId); + void endDTD(); + void startEntity(const XMLString& name); + void endEntity(const XMLString& name); + void startCDATA(); + void endCDATA(); + void comment(const XMLChar ch[], int start, int length); + +protected: + void setupParse(); + +private: + LexicalHandler* _pLexicalHandler; + XMLString _data; + bool _filter; +}; + + +} } // namespace Poco::XML + + +#endif // SAX_WhitespaceFilter_INCLUDED diff --git a/contrib/libs/poco/XML/include/Poco/SAX/XMLFilter.h b/contrib/libs/poco/XML/include/Poco/SAX/XMLFilter.h index 0bc2e965e9..65ae70f913 100644 --- a/contrib/libs/poco/XML/include/Poco/SAX/XMLFilter.h +++ b/contrib/libs/poco/XML/include/Poco/SAX/XMLFilter.h @@ -1,61 +1,61 @@ -// -// XMLFilter.h -// -// Library: XML -// Package: SAX -// Module: SAXFilters -// -// SAX2 XMLFilter Interface. -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef SAX_XMLFilter_INCLUDED -#define SAX_XMLFilter_INCLUDED - - -#include "Poco/XML/XML.h" -#include "Poco/SAX/XMLReader.h" - - -namespace Poco { -namespace XML { - - -class XML_API XMLFilter: public XMLReader - /// Interface for an XML filter. - /// - /// An XML filter is like an XML reader, except that it obtains its events from another XML reader - /// rather than a primary source like an XML document or database. Filters can modify a stream of - /// events as they pass on to the final application. +// +// XMLFilter.h +// +// Library: XML +// Package: SAX +// Module: SAXFilters +// +// SAX2 XMLFilter Interface. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef SAX_XMLFilter_INCLUDED +#define SAX_XMLFilter_INCLUDED + + +#include "Poco/XML/XML.h" +#include "Poco/SAX/XMLReader.h" + + +namespace Poco { +namespace XML { + + +class XML_API XMLFilter: public XMLReader + /// Interface for an XML filter. /// - /// The XMLFilterImpl helper class provides a convenient base for creating SAX2 filters, by passing on - /// all EntityResolver, DTDHandler, ContentHandler and ErrorHandler events automatically. -{ -public: - virtual XMLReader* getParent() const = 0; - /// Set the parent reader. - /// - /// This method allows the application to link the filter to a parent reader (which may be another - /// filter). The argument may not be null. - - virtual void setParent(XMLReader* pParent) = 0; - /// Get the parent reader. - /// - /// This method allows the application to query the parent reader (which may be another filter). - /// It is generally a bad idea to perform any operations on the parent reader directly: they should - /// all pass through this filter. - -protected: - virtual ~XMLFilter(); -}; - - -} } // namespace Poco::XML - - -#endif // SAX_XMLFilter_INCLUDED + /// An XML filter is like an XML reader, except that it obtains its events from another XML reader + /// rather than a primary source like an XML document or database. Filters can modify a stream of + /// events as they pass on to the final application. + /// + /// The XMLFilterImpl helper class provides a convenient base for creating SAX2 filters, by passing on + /// all EntityResolver, DTDHandler, ContentHandler and ErrorHandler events automatically. +{ +public: + virtual XMLReader* getParent() const = 0; + /// Set the parent reader. + /// + /// This method allows the application to link the filter to a parent reader (which may be another + /// filter). The argument may not be null. + + virtual void setParent(XMLReader* pParent) = 0; + /// Get the parent reader. + /// + /// This method allows the application to query the parent reader (which may be another filter). + /// It is generally a bad idea to perform any operations on the parent reader directly: they should + /// all pass through this filter. + +protected: + virtual ~XMLFilter(); +}; + + +} } // namespace Poco::XML + + +#endif // SAX_XMLFilter_INCLUDED diff --git a/contrib/libs/poco/XML/include/Poco/SAX/XMLFilterImpl.h b/contrib/libs/poco/XML/include/Poco/SAX/XMLFilterImpl.h index 33c049c7b2..d8449df8ce 100644 --- a/contrib/libs/poco/XML/include/Poco/SAX/XMLFilterImpl.h +++ b/contrib/libs/poco/XML/include/Poco/SAX/XMLFilterImpl.h @@ -1,132 +1,132 @@ -// -// XMLFilterImpl.h -// -// Library: XML -// Package: SAX -// Module: SAXFilters -// -// SAX2 XMLFilterImpl class. -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef SAX_XMLFilterImpl_INCLUDED -#define SAX_XMLFilterImpl_INCLUDED - - -#include "Poco/XML/XML.h" -#include "Poco/SAX/XMLFilter.h" -#include "Poco/SAX/EntityResolver.h" -#include "Poco/SAX/DTDHandler.h" -#include "Poco/SAX/ContentHandler.h" -#include "Poco/SAX/ErrorHandler.h" - - -namespace Poco { -namespace XML { - - -class XML_API XMLFilterImpl: public XMLFilter, public EntityResolver, public DTDHandler, public ContentHandler, public ErrorHandler - /// Base class for deriving an XML filter. - /// - /// This class is designed to sit between an XMLReader and the client application's event - /// handlers. By default, it does nothing but pass requests up to the reader and events on to - /// the handlers unmodified, but subclasses can override specific methods to modify the event - /// stream or the configuration requests as they pass through. -{ -public: - XMLFilterImpl(); - /// Construct an empty XML filter, with no parent. - /// - /// This filter will have no parent: you must assign a parent before you start a parse or do any - /// configuration with setFeature or setProperty, unless you use this as a pure event consumer rather - /// than as an XMLReader. - - XMLFilterImpl(XMLReader* pParent); - /// Construct an XML filter with the specified parent. - - ~XMLFilterImpl(); - /// Destroys the XMLFilterImpl. - - // XMLFilter - XMLReader* getParent() const; - void setParent(XMLReader* pParent); - - // XMLReader - void setEntityResolver(EntityResolver* pResolver); - EntityResolver* getEntityResolver() const; - void setDTDHandler(DTDHandler* pDTDHandler); - DTDHandler* getDTDHandler() const; - void setContentHandler(ContentHandler* pContentHandler); - ContentHandler* getContentHandler() const; - void setErrorHandler(ErrorHandler* pErrorHandler); - ErrorHandler* getErrorHandler() const; - void setFeature(const XMLString& featureId, bool state); - bool getFeature(const XMLString& featureId) const; - void setProperty(const XMLString& propertyId, const XMLString& value); - void setProperty(const XMLString& propertyId, void* value); - void* getProperty(const XMLString& propertyId) const; - void parse(InputSource* pSource); - void parse(const XMLString& systemId); - void parseMemoryNP(const char* xml, std::size_t size); - - // EntityResolver - InputSource* resolveEntity(const XMLString* publicId, const XMLString& systemId); - void releaseInputSource(InputSource* pSource); - - // DTDHandler - void notationDecl(const XMLString& name, const XMLString* publicId, const XMLString* systemId); - void unparsedEntityDecl(const XMLString& name, const XMLString* publicId, const XMLString& systemId, const XMLString& notationName); - - // ContentHandler - void setDocumentLocator(const Locator* loc); - void startDocument(); - void endDocument(); - void startElement(const XMLString& uri, const XMLString& localName, const XMLString& qname, const Attributes& attrList); - void endElement(const XMLString& uri, const XMLString& localName, const XMLString& qname); - void characters(const XMLChar ch[], int start, int length); - void ignorableWhitespace(const XMLChar ch[], int start, int length); - void processingInstruction(const XMLString& target, const XMLString& data); - void startPrefixMapping(const XMLString& prefix, const XMLString& uri); - void endPrefixMapping(const XMLString& prefix); - void skippedEntity(const XMLString& prefix); - void warning(const SAXException& e); - void error(const SAXException& e); - void fatalError(const SAXException& e); - -protected: - XMLReader* parent() const; - /// Return a pointer to the parent reader. - /// Subclasses can use this method instead of - /// getParent() for better performance - this method - /// is non-virtual and implemented as inline. - - virtual void setupParse(); - /// Setup the event handlers in the parent reader. - -private: - XMLReader* _pParent; - EntityResolver* _pEntityResolver; - DTDHandler* _pDTDHandler; - ContentHandler* _pContentHandler; - ErrorHandler* _pErrorHandler; -}; - - -// -// inlines -// -inline XMLReader* XMLFilterImpl::parent() const -{ - return _pParent; -} - - -} } // namespace Poco::XML - - -#endif // SAX_XMLFilterImpl_INCLUDED +// +// XMLFilterImpl.h +// +// Library: XML +// Package: SAX +// Module: SAXFilters +// +// SAX2 XMLFilterImpl class. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef SAX_XMLFilterImpl_INCLUDED +#define SAX_XMLFilterImpl_INCLUDED + + +#include "Poco/XML/XML.h" +#include "Poco/SAX/XMLFilter.h" +#include "Poco/SAX/EntityResolver.h" +#include "Poco/SAX/DTDHandler.h" +#include "Poco/SAX/ContentHandler.h" +#include "Poco/SAX/ErrorHandler.h" + + +namespace Poco { +namespace XML { + + +class XML_API XMLFilterImpl: public XMLFilter, public EntityResolver, public DTDHandler, public ContentHandler, public ErrorHandler + /// Base class for deriving an XML filter. + /// + /// This class is designed to sit between an XMLReader and the client application's event + /// handlers. By default, it does nothing but pass requests up to the reader and events on to + /// the handlers unmodified, but subclasses can override specific methods to modify the event + /// stream or the configuration requests as they pass through. +{ +public: + XMLFilterImpl(); + /// Construct an empty XML filter, with no parent. + /// + /// This filter will have no parent: you must assign a parent before you start a parse or do any + /// configuration with setFeature or setProperty, unless you use this as a pure event consumer rather + /// than as an XMLReader. + + XMLFilterImpl(XMLReader* pParent); + /// Construct an XML filter with the specified parent. + + ~XMLFilterImpl(); + /// Destroys the XMLFilterImpl. + + // XMLFilter + XMLReader* getParent() const; + void setParent(XMLReader* pParent); + + // XMLReader + void setEntityResolver(EntityResolver* pResolver); + EntityResolver* getEntityResolver() const; + void setDTDHandler(DTDHandler* pDTDHandler); + DTDHandler* getDTDHandler() const; + void setContentHandler(ContentHandler* pContentHandler); + ContentHandler* getContentHandler() const; + void setErrorHandler(ErrorHandler* pErrorHandler); + ErrorHandler* getErrorHandler() const; + void setFeature(const XMLString& featureId, bool state); + bool getFeature(const XMLString& featureId) const; + void setProperty(const XMLString& propertyId, const XMLString& value); + void setProperty(const XMLString& propertyId, void* value); + void* getProperty(const XMLString& propertyId) const; + void parse(InputSource* pSource); + void parse(const XMLString& systemId); + void parseMemoryNP(const char* xml, std::size_t size); + + // EntityResolver + InputSource* resolveEntity(const XMLString* publicId, const XMLString& systemId); + void releaseInputSource(InputSource* pSource); + + // DTDHandler + void notationDecl(const XMLString& name, const XMLString* publicId, const XMLString* systemId); + void unparsedEntityDecl(const XMLString& name, const XMLString* publicId, const XMLString& systemId, const XMLString& notationName); + + // ContentHandler + void setDocumentLocator(const Locator* loc); + void startDocument(); + void endDocument(); + void startElement(const XMLString& uri, const XMLString& localName, const XMLString& qname, const Attributes& attrList); + void endElement(const XMLString& uri, const XMLString& localName, const XMLString& qname); + void characters(const XMLChar ch[], int start, int length); + void ignorableWhitespace(const XMLChar ch[], int start, int length); + void processingInstruction(const XMLString& target, const XMLString& data); + void startPrefixMapping(const XMLString& prefix, const XMLString& uri); + void endPrefixMapping(const XMLString& prefix); + void skippedEntity(const XMLString& prefix); + void warning(const SAXException& e); + void error(const SAXException& e); + void fatalError(const SAXException& e); + +protected: + XMLReader* parent() const; + /// Return a pointer to the parent reader. + /// Subclasses can use this method instead of + /// getParent() for better performance - this method + /// is non-virtual and implemented as inline. + + virtual void setupParse(); + /// Setup the event handlers in the parent reader. + +private: + XMLReader* _pParent; + EntityResolver* _pEntityResolver; + DTDHandler* _pDTDHandler; + ContentHandler* _pContentHandler; + ErrorHandler* _pErrorHandler; +}; + + +// +// inlines +// +inline XMLReader* XMLFilterImpl::parent() const +{ + return _pParent; +} + + +} } // namespace Poco::XML + + +#endif // SAX_XMLFilterImpl_INCLUDED diff --git a/contrib/libs/poco/XML/include/Poco/SAX/XMLReader.h b/contrib/libs/poco/XML/include/Poco/SAX/XMLReader.h index 0b1d360323..ad077c61e4 100644 --- a/contrib/libs/poco/XML/include/Poco/SAX/XMLReader.h +++ b/contrib/libs/poco/XML/include/Poco/SAX/XMLReader.h @@ -1,205 +1,205 @@ -// -// XMLReader.h -// -// Library: XML -// Package: SAX -// Module: SAX -// -// SAX2 XMLReader Interface. -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef SAX_XMLReader_INCLUDED -#define SAX_XMLReader_INCLUDED - - -#include "Poco/XML/XML.h" -#include "Poco/XML/XMLString.h" - - -namespace Poco { -namespace XML { - - -class EntityResolver; -class DTDHandler; -class ContentHandler; -class ErrorHandler; -class InputSource; -class LexicalHandler; -class NamespaceHandler; - - -class XML_API XMLReader - /// Interface for reading an XML document using callbacks. - /// XMLReader is the interface that an XML parser's SAX2 driver must - /// implement. This interface allows an application to set and - /// query features and properties in the parser, to register event handlers - /// for document processing, and to initiate a document parse. - /// All SAX interfaces are assumed to be synchronous: the parse methods must not - /// return until parsing is complete, and readers - /// must wait for an event-handler callback to return before reporting the next event. -{ -public: - virtual void setEntityResolver(EntityResolver* pResolver) = 0; - /// Allow an application to register an entity resolver. - /// - /// If the application does not register an entity resolver, the - /// XMLReader will perform its own default resolution. +// +// XMLReader.h +// +// Library: XML +// Package: SAX +// Module: SAX +// +// SAX2 XMLReader Interface. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef SAX_XMLReader_INCLUDED +#define SAX_XMLReader_INCLUDED + + +#include "Poco/XML/XML.h" +#include "Poco/XML/XMLString.h" + + +namespace Poco { +namespace XML { + + +class EntityResolver; +class DTDHandler; +class ContentHandler; +class ErrorHandler; +class InputSource; +class LexicalHandler; +class NamespaceHandler; + + +class XML_API XMLReader + /// Interface for reading an XML document using callbacks. + /// XMLReader is the interface that an XML parser's SAX2 driver must + /// implement. This interface allows an application to set and + /// query features and properties in the parser, to register event handlers + /// for document processing, and to initiate a document parse. + /// All SAX interfaces are assumed to be synchronous: the parse methods must not + /// return until parsing is complete, and readers + /// must wait for an event-handler callback to return before reporting the next event. +{ +public: + virtual void setEntityResolver(EntityResolver* pResolver) = 0; + /// Allow an application to register an entity resolver. /// - /// Applications may register a new or different resolver in the middle of a - /// parse, and the SAX parser must begin using the new resolver immediately. - - virtual EntityResolver* getEntityResolver() const = 0; - /// Return the current entity resolver. - - virtual void setDTDHandler(DTDHandler* pDTDHandler) = 0; - /// Allow an application to register a DTD event handler. - /// - /// If the application does not register a DTD handler, all DTD events reported by - /// the SAX parser will be silently ignored. + /// If the application does not register an entity resolver, the + /// XMLReader will perform its own default resolution. + /// + /// Applications may register a new or different resolver in the middle of a + /// parse, and the SAX parser must begin using the new resolver immediately. + + virtual EntityResolver* getEntityResolver() const = 0; + /// Return the current entity resolver. + + virtual void setDTDHandler(DTDHandler* pDTDHandler) = 0; + /// Allow an application to register a DTD event handler. /// - /// Applications may register a new or different handler in the middle of a parse, - /// and the SAX parser must begin using the new handler immediately. - - virtual DTDHandler* getDTDHandler() const = 0; - /// Return the current DTD handler. - - virtual void setContentHandler(ContentHandler* pContentHandler) = 0; - /// Allow an application to register a content event handler. + /// If the application does not register a DTD handler, all DTD events reported by + /// the SAX parser will be silently ignored. + /// + /// Applications may register a new or different handler in the middle of a parse, + /// and the SAX parser must begin using the new handler immediately. + + virtual DTDHandler* getDTDHandler() const = 0; + /// Return the current DTD handler. + + virtual void setContentHandler(ContentHandler* pContentHandler) = 0; + /// Allow an application to register a content event handler. + /// + /// If the application does not register a content handler, all content events + /// reported by the SAX parser will be silently ignored. + /// + /// Applications may register a new or different handler in the middle of a parse, + /// and the SAX parser must begin using the new handler immediately. + + virtual ContentHandler* getContentHandler() const = 0; + /// Return the current content handler. + + virtual void setErrorHandler(ErrorHandler* pErrorHandler) = 0; + /// Allow an application to register an error event handler. /// - /// If the application does not register a content handler, all content events - /// reported by the SAX parser will be silently ignored. + /// If the application does not register an error handler, all error events reported by + /// the SAX parser will be silently ignored; however, normal processing may not continue. + /// It is highly recommended that all SAX applications implement an error handler to avoid + /// unexpected bugs. + /// + /// Applications may register a new or different handler in the middle of a parse, and the + /// SAX parser must begin using the new handler immediately. + + virtual ErrorHandler* getErrorHandler() const = 0; + /// Return the current error handler. + + virtual void setFeature(const XMLString& featureId, bool state) = 0; + /// Set the state of a feature. /// - /// Applications may register a new or different handler in the middle of a parse, - /// and the SAX parser must begin using the new handler immediately. - - virtual ContentHandler* getContentHandler() const = 0; - /// Return the current content handler. - - virtual void setErrorHandler(ErrorHandler* pErrorHandler) = 0; - /// Allow an application to register an error event handler. - /// - /// If the application does not register an error handler, all error events reported by - /// the SAX parser will be silently ignored; however, normal processing may not continue. - /// It is highly recommended that all SAX applications implement an error handler to avoid - /// unexpected bugs. + /// The feature name is any fully-qualified URI. It is possible for an XMLReader to + /// expose a feature value but to be unable to change the current value. Some feature + /// values may be immutable or mutable only in specific contexts, such as before, during, + /// or after a parse. + /// + /// All XMLReaders are required to support setting http://xml.org/sax/features/namespaces + /// to true and http://xml.org/sax/features/namespace-prefixes to false. + + virtual bool getFeature(const XMLString& featureId) const = 0; + /// Look up the value of a feature. /// - /// Applications may register a new or different handler in the middle of a parse, and the - /// SAX parser must begin using the new handler immediately. - - virtual ErrorHandler* getErrorHandler() const = 0; - /// Return the current error handler. - - virtual void setFeature(const XMLString& featureId, bool state) = 0; - /// Set the state of a feature. - /// - /// The feature name is any fully-qualified URI. It is possible for an XMLReader to - /// expose a feature value but to be unable to change the current value. Some feature - /// values may be immutable or mutable only in specific contexts, such as before, during, - /// or after a parse. + /// The feature name is any fully-qualified URI. It is possible for an XMLReader + /// to recognize a feature name but temporarily be unable to return its value. + /// Some feature values may be available only in specific contexts, such as before, + /// during, or after a parse. Also, some feature values may not be programmatically + /// accessible. (In the case of an adapter for SAX1 Parser, there is no + /// implementation-independent way to expose whether the underlying parser is performing + /// validation, expanding external entities, and so forth.) + /// + /// All XMLReaders are required to recognize the + /// http://xml.org/sax/features/namespaces and the + /// http://xml.org/sax/features/namespace-prefixes feature names. + /// Implementors are free (and encouraged) to invent their own features, + /// using names built on their own URIs. + + virtual void setProperty(const XMLString& propertyId, const XMLString& value) = 0; + /// Set the value of a property. + /// + /// The property name is any fully-qualified URI. It is possible for an XMLReader + /// to recognize a property name but to be unable to change the current value. + /// Some property values may be immutable or mutable only in specific contexts, + /// such as before, during, or after a parse. + /// + /// XMLReaders are not required to recognize setting any specific property names, though a + /// core set is defined by SAX2. + /// + /// This method is also the standard mechanism for setting extended handlers. + + virtual void setProperty(const XMLString& propertyId, void* value) = 0; + /// Set the value of a property. + /// See also setProperty(const XMLString&, const XMLString&). + + virtual void* getProperty(const XMLString& propertyId) const = 0; + /// Look up the value of a property. + /// String values are returned as XMLChar* + /// The property name is any fully-qualified URI. It is possible for an XMLReader to + /// recognize a property name but temporarily be unable to return its value. Some property + /// values may be available only in specific contexts, such as before, during, or after a parse. /// - /// All XMLReaders are required to support setting http://xml.org/sax/features/namespaces - /// to true and http://xml.org/sax/features/namespace-prefixes to false. - - virtual bool getFeature(const XMLString& featureId) const = 0; - /// Look up the value of a feature. - /// - /// The feature name is any fully-qualified URI. It is possible for an XMLReader - /// to recognize a feature name but temporarily be unable to return its value. - /// Some feature values may be available only in specific contexts, such as before, - /// during, or after a parse. Also, some feature values may not be programmatically - /// accessible. (In the case of an adapter for SAX1 Parser, there is no - /// implementation-independent way to expose whether the underlying parser is performing - /// validation, expanding external entities, and so forth.) + /// XMLReaders are not required to recognize any specific property names, though an initial + /// core set is documented for SAX2. + /// + /// Implementors are free (and encouraged) to invent their own properties, using names + /// built on their own URIs. + + virtual void parse(InputSource* pSource) = 0; + /// Parse an XML document. + /// + /// The application can use this method to instruct the XML reader to begin parsing an + /// XML document from any valid input source (a character stream, a byte stream, or a URI). + /// + /// Applications may not invoke this method while a parse is in progress (they should create + /// a new XMLReader instead for each nested XML document). Once a parse is complete, an + /// application may reuse the same XMLReader object, possibly with a different input source. + /// Configuration of the XMLReader object (such as handler bindings and values established for + /// feature flags and properties) is unchanged by completion of a parse, unless the definition of that + /// aspect of the configuration explicitly specifies other behavior. (For example, feature flags or + /// properties exposing characteristics of the document being parsed.) + /// + /// During the parse, the XMLReader will provide information about the XML document through the registered + /// event handlers. /// - /// All XMLReaders are required to recognize the - /// http://xml.org/sax/features/namespaces and the - /// http://xml.org/sax/features/namespace-prefixes feature names. - /// Implementors are free (and encouraged) to invent their own features, - /// using names built on their own URIs. - - virtual void setProperty(const XMLString& propertyId, const XMLString& value) = 0; - /// Set the value of a property. - /// - /// The property name is any fully-qualified URI. It is possible for an XMLReader - /// to recognize a property name but to be unable to change the current value. - /// Some property values may be immutable or mutable only in specific contexts, - /// such as before, during, or after a parse. - /// - /// XMLReaders are not required to recognize setting any specific property names, though a - /// core set is defined by SAX2. - /// - /// This method is also the standard mechanism for setting extended handlers. - - virtual void setProperty(const XMLString& propertyId, void* value) = 0; - /// Set the value of a property. - /// See also setProperty(const XMLString&, const XMLString&). - - virtual void* getProperty(const XMLString& propertyId) const = 0; - /// Look up the value of a property. - /// String values are returned as XMLChar* - /// The property name is any fully-qualified URI. It is possible for an XMLReader to - /// recognize a property name but temporarily be unable to return its value. Some property - /// values may be available only in specific contexts, such as before, during, or after a parse. - /// - /// XMLReaders are not required to recognize any specific property names, though an initial - /// core set is documented for SAX2. - /// - /// Implementors are free (and encouraged) to invent their own properties, using names - /// built on their own URIs. - - virtual void parse(InputSource* pSource) = 0; - /// Parse an XML document. - /// - /// The application can use this method to instruct the XML reader to begin parsing an - /// XML document from any valid input source (a character stream, a byte stream, or a URI). - /// - /// Applications may not invoke this method while a parse is in progress (they should create - /// a new XMLReader instead for each nested XML document). Once a parse is complete, an - /// application may reuse the same XMLReader object, possibly with a different input source. - /// Configuration of the XMLReader object (such as handler bindings and values established for - /// feature flags and properties) is unchanged by completion of a parse, unless the definition of that - /// aspect of the configuration explicitly specifies other behavior. (For example, feature flags or - /// properties exposing characteristics of the document being parsed.) - /// - /// During the parse, the XMLReader will provide information about the XML document through the registered - /// event handlers. - /// - /// This method is synchronous: it will not return until parsing has ended. If a client application - /// wants to terminate parsing early, it should throw an exception. - - virtual void parse(const XMLString& systemId) = 0; - /// Parse an XML document from a system identifier. - /// See also parse(InputSource*). - - virtual void parseMemoryNP(const char* xml, std::size_t size) = 0; - /// Parse an XML document from memory. - /// See also parse(InputSource*). - - // SAX Features - static const XMLString FEATURE_VALIDATION; - static const XMLString FEATURE_NAMESPACES; - static const XMLString FEATURE_NAMESPACE_PREFIXES; - static const XMLString FEATURE_EXTERNAL_GENERAL_ENTITIES; - static const XMLString FEATURE_EXTERNAL_PARAMETER_ENTITIES; - static const XMLString FEATURE_STRING_INTERNING; - - // SAX Properties - static const XMLString PROPERTY_DECLARATION_HANDLER; - static const XMLString PROPERTY_LEXICAL_HANDLER; - -protected: - virtual ~XMLReader(); -}; - - -} } // namespace Poco::XML - - -#endif // SAX_XMLReader_INCLUDED + /// This method is synchronous: it will not return until parsing has ended. If a client application + /// wants to terminate parsing early, it should throw an exception. + + virtual void parse(const XMLString& systemId) = 0; + /// Parse an XML document from a system identifier. + /// See also parse(InputSource*). + + virtual void parseMemoryNP(const char* xml, std::size_t size) = 0; + /// Parse an XML document from memory. + /// See also parse(InputSource*). + + // SAX Features + static const XMLString FEATURE_VALIDATION; + static const XMLString FEATURE_NAMESPACES; + static const XMLString FEATURE_NAMESPACE_PREFIXES; + static const XMLString FEATURE_EXTERNAL_GENERAL_ENTITIES; + static const XMLString FEATURE_EXTERNAL_PARAMETER_ENTITIES; + static const XMLString FEATURE_STRING_INTERNING; + + // SAX Properties + static const XMLString PROPERTY_DECLARATION_HANDLER; + static const XMLString PROPERTY_LEXICAL_HANDLER; + +protected: + virtual ~XMLReader(); +}; + + +} } // namespace Poco::XML + + +#endif // SAX_XMLReader_INCLUDED diff --git a/contrib/libs/poco/XML/include/Poco/XML/Content.h b/contrib/libs/poco/XML/include/Poco/XML/Content.h index 8b2b312344..52ff589376 100644 --- a/contrib/libs/poco/XML/include/Poco/XML/Content.h +++ b/contrib/libs/poco/XML/include/Poco/XML/Content.h @@ -1,63 +1,63 @@ -// -// Content.h -// -// Library: XML -// Package: XML -// Module: Content -// -// Definition of the Content enum. -// -// Copyright (c) 2015, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// Based on libstudxml (http://www.codesynthesis.com/projects/libstudxml/). -// Copyright (c) 2009-2013 Code Synthesis Tools CC. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef XML_Content_INCLUDED -#define XML_Content_INCLUDED - - -namespace Poco { -namespace XML { - - -struct Content - /// XML content model. C++11 enum class emulated for C++98. - /// - /// element characters whitespaces notes - /// Empty no no ignored - /// Simple no yes preserved content accumulated - /// Complex yes no ignored - /// Mixed yes yes preserved -{ - enum value - { - Empty, - Simple, - Complex, - Mixed - }; - - Content(value v) - : _v(v) - { - } - - operator value() const - { - return _v; - } - -private: - value _v; -}; - - -} } // namespace Poco::XML - - -#endif // XML_Content_INCLUDED +// +// Content.h +// +// Library: XML +// Package: XML +// Module: Content +// +// Definition of the Content enum. +// +// Copyright (c) 2015, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Based on libstudxml (http://www.codesynthesis.com/projects/libstudxml/). +// Copyright (c) 2009-2013 Code Synthesis Tools CC. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef XML_Content_INCLUDED +#define XML_Content_INCLUDED + + +namespace Poco { +namespace XML { + + +struct Content + /// XML content model. C++11 enum class emulated for C++98. + /// + /// element characters whitespaces notes + /// Empty no no ignored + /// Simple no yes preserved content accumulated + /// Complex yes no ignored + /// Mixed yes yes preserved +{ + enum value + { + Empty, + Simple, + Complex, + Mixed + }; + + Content(value v) + : _v(v) + { + } + + operator value() const + { + return _v; + } + +private: + value _v; +}; + + +} } // namespace Poco::XML + + +#endif // XML_Content_INCLUDED diff --git a/contrib/libs/poco/XML/include/Poco/XML/Name.h b/contrib/libs/poco/XML/include/Poco/XML/Name.h index d21219b14a..0a7ac1ca5c 100644 --- a/contrib/libs/poco/XML/include/Poco/XML/Name.h +++ b/contrib/libs/poco/XML/include/Poco/XML/Name.h @@ -1,138 +1,138 @@ -// -// Name.h -// -// Library: XML -// Package: XML -// Module: Name -// -// Definition of the Name class. -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef XML_Name_INCLUDED -#define XML_Name_INCLUDED - - -#include "Poco/XML/XML.h" -#include "Poco/XML/XMLString.h" - - -namespace Poco { -namespace XML { - - -class XML_API Name - /// An XML element or attribute name, consisting of a - /// qualified name, a namespace URI and a local name. -{ -public: - Name(); - /// Creates an empty Name. - - Name(const XMLString& qname); - /// Creates a Name from a qualified name only. - - Name(const XMLString& qname, const XMLString& namespaceURI); - /// Creates a Name from a qualified name and a namespace URI. - /// The local name is extracted from the qualified name. - - Name(const XMLString& qname, const XMLString& namespaceURI, const XMLString& localName); - /// Creates a Name from a qualified name, a namespace URI and a local name. - - Name(const Name& name); - /// Copy constructor. - - ~Name(); - /// Destroys the name. - - Name& operator = (const Name& name); - /// Assignment operator. - - void swap(Name& name); - /// Swaps the name with another one. - - void assign(const XMLString& qname); - /// Assigns a new value to the name. - - void assign(const XMLString& qname, const XMLString& namespaceURI); - /// Assigns new values to the name. - /// The local name is extracted from the qualified name. - - void assign(const XMLString& qname, const XMLString& namespaceURI, const XMLString& localName); - /// Assigns new values to the name. - - bool equals(const Name& name) const; - /// Returns true if both names are equal. - - bool equals(const XMLString& qname, const XMLString& namespaceURI, const XMLString& localName) const; - /// Returns true if all the name's components are equal to the given ones. - - bool equalsWeakly(const XMLString& qname, const XMLString& namespaceURI, const XMLString& localName) const; - /// Returns true if either the qnames are identical or the namespaceURIs and the localNames are identical. - - const XMLString& qname() const; - /// Returns the qualified name. - - const XMLString& namespaceURI() const; - /// Returns the namespace URI. - - const XMLString& localName() const; - /// Returns the local name. - - XMLString prefix() const; - /// Returns the namespace prefix. - - static void split(const XMLString& qname, XMLString& prefix, XMLString& localName); - /// Splits the given qualified name into its prefix and localName parts. - - static XMLString localName(const XMLString& qname); - /// Returns the local name part of the given qualified name. - - static XMLString prefix(const XMLString& qname); - /// Returns the prefix part of the given qualified name. - - static const XMLString EMPTY_NAME; - -private: - XMLString _qname; - XMLString _namespaceURI; - XMLString _localName; -}; - - -// -// inlines -// -inline const XMLString& Name::qname() const -{ - return _qname; -} - - -inline const XMLString& Name::namespaceURI() const -{ - return _namespaceURI; -} - - -inline const XMLString& Name::localName() const -{ - return _localName; -} - - -inline void swap(Name& n1, Name& n2) -{ - n1.swap(n2); -} - - -} } // namespace Poco::XML - - -#endif // XML_Name_INCLUDED +// +// Name.h +// +// Library: XML +// Package: XML +// Module: Name +// +// Definition of the Name class. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef XML_Name_INCLUDED +#define XML_Name_INCLUDED + + +#include "Poco/XML/XML.h" +#include "Poco/XML/XMLString.h" + + +namespace Poco { +namespace XML { + + +class XML_API Name + /// An XML element or attribute name, consisting of a + /// qualified name, a namespace URI and a local name. +{ +public: + Name(); + /// Creates an empty Name. + + Name(const XMLString& qname); + /// Creates a Name from a qualified name only. + + Name(const XMLString& qname, const XMLString& namespaceURI); + /// Creates a Name from a qualified name and a namespace URI. + /// The local name is extracted from the qualified name. + + Name(const XMLString& qname, const XMLString& namespaceURI, const XMLString& localName); + /// Creates a Name from a qualified name, a namespace URI and a local name. + + Name(const Name& name); + /// Copy constructor. + + ~Name(); + /// Destroys the name. + + Name& operator = (const Name& name); + /// Assignment operator. + + void swap(Name& name); + /// Swaps the name with another one. + + void assign(const XMLString& qname); + /// Assigns a new value to the name. + + void assign(const XMLString& qname, const XMLString& namespaceURI); + /// Assigns new values to the name. + /// The local name is extracted from the qualified name. + + void assign(const XMLString& qname, const XMLString& namespaceURI, const XMLString& localName); + /// Assigns new values to the name. + + bool equals(const Name& name) const; + /// Returns true if both names are equal. + + bool equals(const XMLString& qname, const XMLString& namespaceURI, const XMLString& localName) const; + /// Returns true if all the name's components are equal to the given ones. + + bool equalsWeakly(const XMLString& qname, const XMLString& namespaceURI, const XMLString& localName) const; + /// Returns true if either the qnames are identical or the namespaceURIs and the localNames are identical. + + const XMLString& qname() const; + /// Returns the qualified name. + + const XMLString& namespaceURI() const; + /// Returns the namespace URI. + + const XMLString& localName() const; + /// Returns the local name. + + XMLString prefix() const; + /// Returns the namespace prefix. + + static void split(const XMLString& qname, XMLString& prefix, XMLString& localName); + /// Splits the given qualified name into its prefix and localName parts. + + static XMLString localName(const XMLString& qname); + /// Returns the local name part of the given qualified name. + + static XMLString prefix(const XMLString& qname); + /// Returns the prefix part of the given qualified name. + + static const XMLString EMPTY_NAME; + +private: + XMLString _qname; + XMLString _namespaceURI; + XMLString _localName; +}; + + +// +// inlines +// +inline const XMLString& Name::qname() const +{ + return _qname; +} + + +inline const XMLString& Name::namespaceURI() const +{ + return _namespaceURI; +} + + +inline const XMLString& Name::localName() const +{ + return _localName; +} + + +inline void swap(Name& n1, Name& n2) +{ + n1.swap(n2); +} + + +} } // namespace Poco::XML + + +#endif // XML_Name_INCLUDED diff --git a/contrib/libs/poco/XML/include/Poco/XML/NamePool.h b/contrib/libs/poco/XML/include/Poco/XML/NamePool.h index 9ffadf1af9..a0c34a9ac6 100644 --- a/contrib/libs/poco/XML/include/Poco/XML/NamePool.h +++ b/contrib/libs/poco/XML/include/Poco/XML/NamePool.h @@ -1,83 +1,83 @@ -// -// NamePool.h -// -// Library: XML -// Package: XML -// Module: NamePool -// -// Definition of the NamePool class. -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef XML_NamePool_INCLUDED -#define XML_NamePool_INCLUDED - - -#include "Poco/XML/XML.h" -#include "Poco/XML/XMLString.h" -#include "Poco/XML/Name.h" - - -#ifndef POCO_XML_NAMEPOOL_DEFAULT_SIZE -#define POCO_XML_NAMEPOOL_DEFAULT_SIZE 509 -#endif - - -namespace Poco { -namespace XML { - - -class NamePoolItem; - - -class XML_API NamePool - /// A hashtable that stores XML names consisting of an URI, a - /// local name and a qualified name. -{ -public: - NamePool(unsigned long size = POCO_XML_NAMEPOOL_DEFAULT_SIZE); - /// Creates a name pool with room for up to size strings. - /// - /// The given size should be a suitable prime number, - /// e.g. 251, 509, 1021 or 4093. - - const Name& insert(const XMLString& qname, const XMLString& namespaceURI, const XMLString& localName); - /// Returns a const reference to an Name for the given names. - /// Creates the Name if it does not already exist. - /// Throws a PoolOverflowException if the name pool is full. - - const Name& insert(const Name& name); - /// Returns a const reference to an Name for the given name. - /// Creates the Name if it does not already exist. - /// Throws a PoolOverflowException if the name pool is full. - - void duplicate(); - /// Increments the reference count. - - void release(); - /// Decrements the reference count and deletes the object if the reference count reaches zero. - -protected: - unsigned long hash(const XMLString& qname, const XMLString& namespaceURI, const XMLString& localName); - ~NamePool(); - -private: - NamePool(const NamePool&); - NamePool& operator = (const NamePool&); - - NamePoolItem* _pItems; - unsigned long _size; - unsigned long _salt; - int _rc; -}; - - -} } // namespace Poco::XML - - -#endif // XML_NamePool_INCLUDED +// +// NamePool.h +// +// Library: XML +// Package: XML +// Module: NamePool +// +// Definition of the NamePool class. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef XML_NamePool_INCLUDED +#define XML_NamePool_INCLUDED + + +#include "Poco/XML/XML.h" +#include "Poco/XML/XMLString.h" +#include "Poco/XML/Name.h" + + +#ifndef POCO_XML_NAMEPOOL_DEFAULT_SIZE +#define POCO_XML_NAMEPOOL_DEFAULT_SIZE 509 +#endif + + +namespace Poco { +namespace XML { + + +class NamePoolItem; + + +class XML_API NamePool + /// A hashtable that stores XML names consisting of an URI, a + /// local name and a qualified name. +{ +public: + NamePool(unsigned long size = POCO_XML_NAMEPOOL_DEFAULT_SIZE); + /// Creates a name pool with room for up to size strings. + /// + /// The given size should be a suitable prime number, + /// e.g. 251, 509, 1021 or 4093. + + const Name& insert(const XMLString& qname, const XMLString& namespaceURI, const XMLString& localName); + /// Returns a const reference to an Name for the given names. + /// Creates the Name if it does not already exist. + /// Throws a PoolOverflowException if the name pool is full. + + const Name& insert(const Name& name); + /// Returns a const reference to an Name for the given name. + /// Creates the Name if it does not already exist. + /// Throws a PoolOverflowException if the name pool is full. + + void duplicate(); + /// Increments the reference count. + + void release(); + /// Decrements the reference count and deletes the object if the reference count reaches zero. + +protected: + unsigned long hash(const XMLString& qname, const XMLString& namespaceURI, const XMLString& localName); + ~NamePool(); + +private: + NamePool(const NamePool&); + NamePool& operator = (const NamePool&); + + NamePoolItem* _pItems; + unsigned long _size; + unsigned long _salt; + int _rc; +}; + + +} } // namespace Poco::XML + + +#endif // XML_NamePool_INCLUDED diff --git a/contrib/libs/poco/XML/include/Poco/XML/NamespaceStrategy.h b/contrib/libs/poco/XML/include/Poco/XML/NamespaceStrategy.h index 1f27e3c23b..4937c5a5c8 100644 --- a/contrib/libs/poco/XML/include/Poco/XML/NamespaceStrategy.h +++ b/contrib/libs/poco/XML/include/Poco/XML/NamespaceStrategy.h @@ -1,115 +1,115 @@ -// -// NamespaceStrategy.h -// -// Library: XML -// Package: XML -// Module: NamespaceStrategy -// -// Definition of the NamespaceStrategy class. -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef XML_NamespaceStrategy_INCLUDED -#define XML_NamespaceStrategy_INCLUDED - - -#include "Poco/XML/XML.h" -#include "Poco/XML/XMLString.h" -#include "Poco/SAX/NamespaceSupport.h" -#include "Poco/SAX/AttributesImpl.h" - - -namespace Poco { -namespace XML { - - -class ContentHandler; - - -class XML_API NamespaceStrategy - /// This class is used by ParserEngine to handle the - /// startElement, endElement, startPrefixMapping and - /// endPrefixMapping events. -{ -public: - virtual ~NamespaceStrategy(); - - virtual void startElement(const XMLChar* name, const XMLChar** atts, int specifiedCount, ContentHandler* pContentHandler) = 0; - /// Translate the arguments as delivered by Expat and - /// call the startElement() method of the ContentHandler. - - virtual void endElement(const XMLChar* name, ContentHandler* pContentHandler) = 0; - /// Translate the arguments as delivered by Expat and - /// call the endElement() method of the ContentHandler. - -protected: - static void splitName(const XMLChar* qname, XMLString& uri, XMLString& localName); - static void splitName(const XMLChar* qname, XMLString& uri, XMLString& localName, XMLString& prefix); - - static const XMLString NOTHING; -}; - - -class XML_API NoNamespacesStrategy: public NamespaceStrategy - /// The NamespaceStrategy implementation used if no namespaces - /// processing is requested. -{ -public: - NoNamespacesStrategy(); - ~NoNamespacesStrategy(); - - void startElement(const XMLChar* name, const XMLChar** atts, int specifiedCount, ContentHandler* pContentHandler); - void endElement(const XMLChar* name, ContentHandler* pContentHandler); - -private: - XMLString _name; - AttributesImpl _attrs; -}; - - -class XML_API NoNamespacePrefixesStrategy: public NamespaceStrategy - /// The NamespaceStrategy implementation used if namespaces - /// processing is requested, but prefixes are not reported. -{ -public: - NoNamespacePrefixesStrategy(); - ~NoNamespacePrefixesStrategy(); - - void startElement(const XMLChar* name, const XMLChar** atts, int specifiedCount, ContentHandler* pContentHandler); - void endElement(const XMLChar* name, ContentHandler* pContentHandler); - -private: - XMLString _uri; - XMLString _local; - AttributesImpl _attrs; -}; - - -class XML_API NamespacePrefixesStrategy: public NamespaceStrategy - /// The NamespaceStrategy implementation used if namespaces - /// processing is requested and prefixes are reported. -{ -public: - NamespacePrefixesStrategy(); - ~NamespacePrefixesStrategy(); - - void startElement(const XMLChar* name, const XMLChar** atts, int specifiedCount, ContentHandler* pContentHandler); - void endElement(const XMLChar* name, ContentHandler* pContentHandler); - -private: - XMLString _uri; - XMLString _local; - XMLString _qname; - AttributesImpl _attrs; -}; - - -} } // namespace Poco::XML - - -#endif // XML_NamespaceStrategy_INCLUDED +// +// NamespaceStrategy.h +// +// Library: XML +// Package: XML +// Module: NamespaceStrategy +// +// Definition of the NamespaceStrategy class. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef XML_NamespaceStrategy_INCLUDED +#define XML_NamespaceStrategy_INCLUDED + + +#include "Poco/XML/XML.h" +#include "Poco/XML/XMLString.h" +#include "Poco/SAX/NamespaceSupport.h" +#include "Poco/SAX/AttributesImpl.h" + + +namespace Poco { +namespace XML { + + +class ContentHandler; + + +class XML_API NamespaceStrategy + /// This class is used by ParserEngine to handle the + /// startElement, endElement, startPrefixMapping and + /// endPrefixMapping events. +{ +public: + virtual ~NamespaceStrategy(); + + virtual void startElement(const XMLChar* name, const XMLChar** atts, int specifiedCount, ContentHandler* pContentHandler) = 0; + /// Translate the arguments as delivered by Expat and + /// call the startElement() method of the ContentHandler. + + virtual void endElement(const XMLChar* name, ContentHandler* pContentHandler) = 0; + /// Translate the arguments as delivered by Expat and + /// call the endElement() method of the ContentHandler. + +protected: + static void splitName(const XMLChar* qname, XMLString& uri, XMLString& localName); + static void splitName(const XMLChar* qname, XMLString& uri, XMLString& localName, XMLString& prefix); + + static const XMLString NOTHING; +}; + + +class XML_API NoNamespacesStrategy: public NamespaceStrategy + /// The NamespaceStrategy implementation used if no namespaces + /// processing is requested. +{ +public: + NoNamespacesStrategy(); + ~NoNamespacesStrategy(); + + void startElement(const XMLChar* name, const XMLChar** atts, int specifiedCount, ContentHandler* pContentHandler); + void endElement(const XMLChar* name, ContentHandler* pContentHandler); + +private: + XMLString _name; + AttributesImpl _attrs; +}; + + +class XML_API NoNamespacePrefixesStrategy: public NamespaceStrategy + /// The NamespaceStrategy implementation used if namespaces + /// processing is requested, but prefixes are not reported. +{ +public: + NoNamespacePrefixesStrategy(); + ~NoNamespacePrefixesStrategy(); + + void startElement(const XMLChar* name, const XMLChar** atts, int specifiedCount, ContentHandler* pContentHandler); + void endElement(const XMLChar* name, ContentHandler* pContentHandler); + +private: + XMLString _uri; + XMLString _local; + AttributesImpl _attrs; +}; + + +class XML_API NamespacePrefixesStrategy: public NamespaceStrategy + /// The NamespaceStrategy implementation used if namespaces + /// processing is requested and prefixes are reported. +{ +public: + NamespacePrefixesStrategy(); + ~NamespacePrefixesStrategy(); + + void startElement(const XMLChar* name, const XMLChar** atts, int specifiedCount, ContentHandler* pContentHandler); + void endElement(const XMLChar* name, ContentHandler* pContentHandler); + +private: + XMLString _uri; + XMLString _local; + XMLString _qname; + AttributesImpl _attrs; +}; + + +} } // namespace Poco::XML + + +#endif // XML_NamespaceStrategy_INCLUDED diff --git a/contrib/libs/poco/XML/include/Poco/XML/ParserEngine.h b/contrib/libs/poco/XML/include/Poco/XML/ParserEngine.h index 772f5ea291..5d569dced0 100644 --- a/contrib/libs/poco/XML/include/Poco/XML/ParserEngine.h +++ b/contrib/libs/poco/XML/include/Poco/XML/ParserEngine.h @@ -1,358 +1,358 @@ -// -// ParserEngine.h -// -// Library: XML -// Package: XML -// Module: ParserEngine -// -// Definition of the ParseEngine class. -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 - - -#ifndef XML_ParserEngine_INCLUDED -#define XML_ParserEngine_INCLUDED - - -#include "Poco/XML/XML.h" -#if defined(POCO_UNBUNDLED) -#include <expat.h> -#else -#error #include "Poco/XML/expat.h" -#endif -#include "Poco/XML/XMLString.h" -#include "Poco/XML/XMLStream.h" -#include "Poco/SAX/Locator.h" -#include "Poco/TextEncoding.h" -#include <map> -#include <vector> - - -namespace Poco { -namespace XML { - - -class InputSource; -class EntityResolver; -class DTDHandler; -class DeclHandler; -class ContentHandler; -class LexicalHandler; -class ErrorHandler; -class NamespaceStrategy; -class ContextLocator; - - -class XML_API ParserEngine: public Locator - /// This class provides an object-oriented, stream-based, - /// low-level interface to the XML Parser Toolkit (expat). - /// It is strongly recommended, that you use the - /// SAX parser classes (which are based on this - /// class) instead of this class, since they provide - /// a standardized, higher-level interface to the parser. -{ -public: - ParserEngine(); - /// Creates the parser engine. - - ParserEngine(const XMLString& encoding); - /// Creates the parser engine and passes the encoding - /// to the underlying parser. - - ~ParserEngine(); - /// Destroys the parser. - - void setEncoding(const XMLString& encoding); - /// Sets the encoding used by expat. The encoding must be - /// set before parsing begins, otherwise it will be ignored. - - const XMLString& getEncoding() const; - /// Returns the encoding used by expat. - - void addEncoding(const XMLString& name, Poco::TextEncoding* pEncoding); - /// Adds an encoding to the parser. - - void setNamespaceStrategy(NamespaceStrategy* pStrategy); - /// Sets the NamespaceStrategy used by the parser. - /// The parser takes ownership of the strategy object - /// and deletes it when it's no longer needed. - /// The default is NoNamespacesStrategy. - - NamespaceStrategy* getNamespaceStrategy() const; - /// Returns the NamespaceStrategy currently in use. - - void setExpandInternalEntities(bool flag = true); - /// Enables/disables expansion of internal entities (enabled by - /// default). If entity expansion is disabled, internal entities - /// are reported via the default handler. - /// Must be set before parsing begins, otherwise it will be - /// ignored. - - bool getExpandInternalEntities() const; - /// Returns true if internal entities will be expanded automatically, - /// which is the default. - - void setExternalGeneralEntities(bool flag = true); - /// Enable or disable processing of external general entities. - - bool getExternalGeneralEntities() const; - /// Returns true if external general entities will be processed; false otherwise. - - void setExternalParameterEntities(bool flag = true); - /// Enable or disable processing of external parameter entities. - - bool getExternalParameterEntities() const; - /// Returns true if external parameter entities will be processed; false otherwise. - - void setEntityResolver(EntityResolver* pResolver); - /// Allow an application to register an entity resolver. - - EntityResolver* getEntityResolver() const; - /// Return the current entity resolver. - - void setDTDHandler(DTDHandler* pDTDHandler); - /// Allow an application to register a DTD event handler. - - DTDHandler* getDTDHandler() const; - /// Return the current DTD handler. - - void setDeclHandler(DeclHandler* pDeclHandler); - /// Allow an application to register a DTD declarations event handler. - - DeclHandler* getDeclHandler() const; - /// Return the current DTD declarations handler. - - void setContentHandler(ContentHandler* pContentHandler); - /// Allow an application to register a content event handler. - - ContentHandler* getContentHandler() const; - /// Return the current content handler. - - void setLexicalHandler(LexicalHandler* pLexicalHandler); - /// Allow an application to register a lexical event handler. - - LexicalHandler* getLexicalHandler() const; - /// Return the current lexical handler. - - void setErrorHandler(ErrorHandler* pErrorHandler); - /// Allow an application to register an error event handler. - - ErrorHandler* getErrorHandler() const; - /// Return the current error handler. - - void setEnablePartialReads(bool flag = true); - /// Enable or disable partial reads from the input source. - /// - /// This is useful for parsing XML from a socket stream for - /// a protocol like XMPP, where basically single elements - /// are read one at a time from the input source's stream, and - /// following elements depend upon responses sent back to - /// the peer. - /// - /// Normally, the parser always reads blocks of PARSE_BUFFER_SIZE - /// at a time, and blocks until a complete block has been read (or - /// the end of the stream has been reached). - /// This allows for efficient parsing of "complete" XML documents, - /// but fails in a case such as XMPP, where only XML fragments - /// are sent at a time. - - bool getEnablePartialReads() const; - /// Returns true if partial reads are enabled (see - /// setEnablePartialReads()), false otherwise. - - void parse(InputSource* pInputSource); - /// Parse an XML document from the given InputSource. - - void parse(const char* pBuffer, std::size_t size); - /// Parses an XML document from the given buffer. - - // Locator - XMLString getPublicId() const; - /// Return the public identifier for the current document event. - - XMLString getSystemId() const; - /// Return the system identifier for the current document event. - - int getLineNumber() const; - /// Return the line number where the current document event ends. - - int getColumnNumber() const; - /// Return the column number where the current document event ends. - -protected: - void init(); - /// initializes expat - - void parseByteInputStream(XMLByteInputStream& istr); - /// Parses an entity from the given stream. - - void parseCharInputStream(XMLCharInputStream& istr); - /// Parses an entity from the given stream. - - std::streamsize readBytes(XMLByteInputStream& istr, char* pBuffer, std::streamsize bufferSize); - /// Reads at most bufferSize bytes from the given stream into the given buffer. - - std::streamsize readChars(XMLCharInputStream& istr, XMLChar* pBuffer, std::streamsize bufferSize); - /// Reads at most bufferSize chars from the given stream into the given buffer. - - void handleError(int errorNo); - /// Throws an XMLException with a message corresponding - /// to the given Expat error code. - - void parseExternal(XML_Parser extParser, InputSource* pInputSource); - /// Parse an XML document from the given InputSource. - - void parseExternalByteInputStream(XML_Parser extParser, XMLByteInputStream& istr); - /// Parses an external entity from the given stream, with a separate parser. - - void parseExternalCharInputStream(XML_Parser extParser, XMLCharInputStream& istr); - /// Parses an external entity from the given stream, with a separate parser. - - void pushContext(XML_Parser parser, InputSource* pInputSource); - /// Pushes a new entry to the context stack. - - void popContext(); - /// Pops the top-most entry from the context stack. - - void resetContext(); - /// Resets and clears the context stack. - - const Locator& locator() const; - /// Returns a locator denoting the current parse location. - - // expat handler procedures - static void handleStartElement(void* userData, const XML_Char* name, const XML_Char** atts); - static void handleEndElement(void* userData, const XML_Char* name); - static void handleCharacterData(void* userData, const XML_Char* s, int len); - static void handleProcessingInstruction(void* userData, const XML_Char* target, const XML_Char* data); - static void handleDefault(void* userData, const XML_Char* s, int len); - static void handleUnparsedEntityDecl(void* userData, const XML_Char* entityName, const XML_Char* base, const XML_Char* systemId, const XML_Char* publicId, const XML_Char* notationName); - static void handleNotationDecl(void* userData, const XML_Char* notationName, const XML_Char* base, const XML_Char* systemId, const XML_Char* publicId); - static int handleExternalEntityRef(XML_Parser parser, const XML_Char* openEntityNames, const XML_Char* base, const XML_Char* systemId, const XML_Char* publicId); - static int handleUnknownEncoding(void* encodingHandlerData, const XML_Char* name, XML_Encoding* info); - static void handleComment(void* userData, const XML_Char* data); - static void handleStartCdataSection(void* userData); - static void handleEndCdataSection(void* userData); - static void handleStartNamespaceDecl(void* userData, const XML_Char* prefix, const XML_Char* uri); - static void handleEndNamespaceDecl(void* userData, const XML_Char* prefix); - static void handleStartDoctypeDecl(void* userData, const XML_Char* doctypeName, const XML_Char *systemId, const XML_Char* publicId, int hasInternalSubset); - static void handleEndDoctypeDecl(void* userData); - static void handleEntityDecl(void *userData, const XML_Char *entityName, int isParamEntity, const XML_Char *value, int valueLength, - const XML_Char *base, const XML_Char *systemId, const XML_Char *publicId, const XML_Char *notationName); - static void handleExternalParsedEntityDecl(void* userData, const XML_Char* entityName, const XML_Char* base, const XML_Char* systemId, const XML_Char* publicId); - static void handleInternalParsedEntityDecl(void* userData, const XML_Char* entityName, const XML_Char* replacementText, int replacementTextLength); - static void handleSkippedEntity(void* userData, const XML_Char* entityName, int isParameterEntity); - - // encoding support - static int convert(void *data, const char *s); - -private: - typedef std::map<XMLString, Poco::TextEncoding*> EncodingMap; - typedef std::vector<ContextLocator*> ContextStack; - - XML_Parser _parser; - char* _pBuffer; - bool _encodingSpecified; - XMLString _encoding; - bool _expandInternalEntities; - bool _externalGeneralEntities; - bool _externalParameterEntities; - bool _enablePartialReads; - NamespaceStrategy* _pNamespaceStrategy; - EncodingMap _encodings; - ContextStack _context; - - EntityResolver* _pEntityResolver; - DTDHandler* _pDTDHandler; - DeclHandler* _pDeclHandler; - ContentHandler* _pContentHandler; - LexicalHandler* _pLexicalHandler; - ErrorHandler* _pErrorHandler; - - static const int PARSE_BUFFER_SIZE; - static const XMLString EMPTY_STRING; -}; - - -// -// inlines -// -inline const XMLString& ParserEngine::getEncoding() const -{ - return _encoding; -} - - -inline NamespaceStrategy* ParserEngine::getNamespaceStrategy() const -{ - return _pNamespaceStrategy; -} - - -inline bool ParserEngine::getExpandInternalEntities() const -{ - return _expandInternalEntities; -} - - -inline bool ParserEngine::getExternalGeneralEntities() const -{ - return _externalGeneralEntities; -} - - -inline bool ParserEngine::getExternalParameterEntities() const -{ - return _externalParameterEntities; -} - - -inline EntityResolver* ParserEngine::getEntityResolver() const -{ - return _pEntityResolver; -} - - -inline DTDHandler* ParserEngine::getDTDHandler() const -{ - return _pDTDHandler; -} - - -inline DeclHandler* ParserEngine::getDeclHandler() const -{ - return _pDeclHandler; -} - - -inline ContentHandler* ParserEngine::getContentHandler() const -{ - return _pContentHandler; -} - - -inline LexicalHandler* ParserEngine::getLexicalHandler() const -{ - return _pLexicalHandler; -} - - -inline ErrorHandler* ParserEngine::getErrorHandler() const -{ - return _pErrorHandler; -} - - -inline bool ParserEngine::getEnablePartialReads() const -{ - return _enablePartialReads; -} - - -} } // namespace Poco::XML - - -#endif // XML_ParserEngine_INCLUDED +// +// ParserEngine.h +// +// Library: XML +// Package: XML +// Module: ParserEngine +// +// Definition of the ParseEngine class. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 + + +#ifndef XML_ParserEngine_INCLUDED +#define XML_ParserEngine_INCLUDED + + +#include "Poco/XML/XML.h" +#if defined(POCO_UNBUNDLED) +#include <expat.h> +#else +#error #include "Poco/XML/expat.h" +#endif +#include "Poco/XML/XMLString.h" +#include "Poco/XML/XMLStream.h" +#include "Poco/SAX/Locator.h" +#include "Poco/TextEncoding.h" +#include <map> +#include <vector> + + +namespace Poco { +namespace XML { + + +class InputSource; +class EntityResolver; +class DTDHandler; +class DeclHandler; +class ContentHandler; +class LexicalHandler; +class ErrorHandler; +class NamespaceStrategy; +class ContextLocator; + + +class XML_API ParserEngine: public Locator + /// This class provides an object-oriented, stream-based, + /// low-level interface to the XML Parser Toolkit (expat). + /// It is strongly recommended, that you use the + /// SAX parser classes (which are based on this + /// class) instead of this class, since they provide + /// a standardized, higher-level interface to the parser. +{ +public: + ParserEngine(); + /// Creates the parser engine. + + ParserEngine(const XMLString& encoding); + /// Creates the parser engine and passes the encoding + /// to the underlying parser. + + ~ParserEngine(); + /// Destroys the parser. + + void setEncoding(const XMLString& encoding); + /// Sets the encoding used by expat. The encoding must be + /// set before parsing begins, otherwise it will be ignored. + + const XMLString& getEncoding() const; + /// Returns the encoding used by expat. + + void addEncoding(const XMLString& name, Poco::TextEncoding* pEncoding); + /// Adds an encoding to the parser. + + void setNamespaceStrategy(NamespaceStrategy* pStrategy); + /// Sets the NamespaceStrategy used by the parser. + /// The parser takes ownership of the strategy object + /// and deletes it when it's no longer needed. + /// The default is NoNamespacesStrategy. + + NamespaceStrategy* getNamespaceStrategy() const; + /// Returns the NamespaceStrategy currently in use. + + void setExpandInternalEntities(bool flag = true); + /// Enables/disables expansion of internal entities (enabled by + /// default). If entity expansion is disabled, internal entities + /// are reported via the default handler. + /// Must be set before parsing begins, otherwise it will be + /// ignored. + + bool getExpandInternalEntities() const; + /// Returns true if internal entities will be expanded automatically, + /// which is the default. + + void setExternalGeneralEntities(bool flag = true); + /// Enable or disable processing of external general entities. + + bool getExternalGeneralEntities() const; + /// Returns true if external general entities will be processed; false otherwise. + + void setExternalParameterEntities(bool flag = true); + /// Enable or disable processing of external parameter entities. + + bool getExternalParameterEntities() const; + /// Returns true if external parameter entities will be processed; false otherwise. + + void setEntityResolver(EntityResolver* pResolver); + /// Allow an application to register an entity resolver. + + EntityResolver* getEntityResolver() const; + /// Return the current entity resolver. + + void setDTDHandler(DTDHandler* pDTDHandler); + /// Allow an application to register a DTD event handler. + + DTDHandler* getDTDHandler() const; + /// Return the current DTD handler. + + void setDeclHandler(DeclHandler* pDeclHandler); + /// Allow an application to register a DTD declarations event handler. + + DeclHandler* getDeclHandler() const; + /// Return the current DTD declarations handler. + + void setContentHandler(ContentHandler* pContentHandler); + /// Allow an application to register a content event handler. + + ContentHandler* getContentHandler() const; + /// Return the current content handler. + + void setLexicalHandler(LexicalHandler* pLexicalHandler); + /// Allow an application to register a lexical event handler. + + LexicalHandler* getLexicalHandler() const; + /// Return the current lexical handler. + + void setErrorHandler(ErrorHandler* pErrorHandler); + /// Allow an application to register an error event handler. + + ErrorHandler* getErrorHandler() const; + /// Return the current error handler. + + void setEnablePartialReads(bool flag = true); + /// Enable or disable partial reads from the input source. + /// + /// This is useful for parsing XML from a socket stream for + /// a protocol like XMPP, where basically single elements + /// are read one at a time from the input source's stream, and + /// following elements depend upon responses sent back to + /// the peer. + /// + /// Normally, the parser always reads blocks of PARSE_BUFFER_SIZE + /// at a time, and blocks until a complete block has been read (or + /// the end of the stream has been reached). + /// This allows for efficient parsing of "complete" XML documents, + /// but fails in a case such as XMPP, where only XML fragments + /// are sent at a time. + + bool getEnablePartialReads() const; + /// Returns true if partial reads are enabled (see + /// setEnablePartialReads()), false otherwise. + + void parse(InputSource* pInputSource); + /// Parse an XML document from the given InputSource. + + void parse(const char* pBuffer, std::size_t size); + /// Parses an XML document from the given buffer. + + // Locator + XMLString getPublicId() const; + /// Return the public identifier for the current document event. + + XMLString getSystemId() const; + /// Return the system identifier for the current document event. + + int getLineNumber() const; + /// Return the line number where the current document event ends. + + int getColumnNumber() const; + /// Return the column number where the current document event ends. + +protected: + void init(); + /// initializes expat + + void parseByteInputStream(XMLByteInputStream& istr); + /// Parses an entity from the given stream. + + void parseCharInputStream(XMLCharInputStream& istr); + /// Parses an entity from the given stream. + + std::streamsize readBytes(XMLByteInputStream& istr, char* pBuffer, std::streamsize bufferSize); + /// Reads at most bufferSize bytes from the given stream into the given buffer. + + std::streamsize readChars(XMLCharInputStream& istr, XMLChar* pBuffer, std::streamsize bufferSize); + /// Reads at most bufferSize chars from the given stream into the given buffer. + + void handleError(int errorNo); + /// Throws an XMLException with a message corresponding + /// to the given Expat error code. + + void parseExternal(XML_Parser extParser, InputSource* pInputSource); + /// Parse an XML document from the given InputSource. + + void parseExternalByteInputStream(XML_Parser extParser, XMLByteInputStream& istr); + /// Parses an external entity from the given stream, with a separate parser. + + void parseExternalCharInputStream(XML_Parser extParser, XMLCharInputStream& istr); + /// Parses an external entity from the given stream, with a separate parser. + + void pushContext(XML_Parser parser, InputSource* pInputSource); + /// Pushes a new entry to the context stack. + + void popContext(); + /// Pops the top-most entry from the context stack. + + void resetContext(); + /// Resets and clears the context stack. + + const Locator& locator() const; + /// Returns a locator denoting the current parse location. + + // expat handler procedures + static void handleStartElement(void* userData, const XML_Char* name, const XML_Char** atts); + static void handleEndElement(void* userData, const XML_Char* name); + static void handleCharacterData(void* userData, const XML_Char* s, int len); + static void handleProcessingInstruction(void* userData, const XML_Char* target, const XML_Char* data); + static void handleDefault(void* userData, const XML_Char* s, int len); + static void handleUnparsedEntityDecl(void* userData, const XML_Char* entityName, const XML_Char* base, const XML_Char* systemId, const XML_Char* publicId, const XML_Char* notationName); + static void handleNotationDecl(void* userData, const XML_Char* notationName, const XML_Char* base, const XML_Char* systemId, const XML_Char* publicId); + static int handleExternalEntityRef(XML_Parser parser, const XML_Char* openEntityNames, const XML_Char* base, const XML_Char* systemId, const XML_Char* publicId); + static int handleUnknownEncoding(void* encodingHandlerData, const XML_Char* name, XML_Encoding* info); + static void handleComment(void* userData, const XML_Char* data); + static void handleStartCdataSection(void* userData); + static void handleEndCdataSection(void* userData); + static void handleStartNamespaceDecl(void* userData, const XML_Char* prefix, const XML_Char* uri); + static void handleEndNamespaceDecl(void* userData, const XML_Char* prefix); + static void handleStartDoctypeDecl(void* userData, const XML_Char* doctypeName, const XML_Char *systemId, const XML_Char* publicId, int hasInternalSubset); + static void handleEndDoctypeDecl(void* userData); + static void handleEntityDecl(void *userData, const XML_Char *entityName, int isParamEntity, const XML_Char *value, int valueLength, + const XML_Char *base, const XML_Char *systemId, const XML_Char *publicId, const XML_Char *notationName); + static void handleExternalParsedEntityDecl(void* userData, const XML_Char* entityName, const XML_Char* base, const XML_Char* systemId, const XML_Char* publicId); + static void handleInternalParsedEntityDecl(void* userData, const XML_Char* entityName, const XML_Char* replacementText, int replacementTextLength); + static void handleSkippedEntity(void* userData, const XML_Char* entityName, int isParameterEntity); + + // encoding support + static int convert(void *data, const char *s); + +private: + typedef std::map<XMLString, Poco::TextEncoding*> EncodingMap; + typedef std::vector<ContextLocator*> ContextStack; + + XML_Parser _parser; + char* _pBuffer; + bool _encodingSpecified; + XMLString _encoding; + bool _expandInternalEntities; + bool _externalGeneralEntities; + bool _externalParameterEntities; + bool _enablePartialReads; + NamespaceStrategy* _pNamespaceStrategy; + EncodingMap _encodings; + ContextStack _context; + + EntityResolver* _pEntityResolver; + DTDHandler* _pDTDHandler; + DeclHandler* _pDeclHandler; + ContentHandler* _pContentHandler; + LexicalHandler* _pLexicalHandler; + ErrorHandler* _pErrorHandler; + + static const int PARSE_BUFFER_SIZE; + static const XMLString EMPTY_STRING; +}; + + +// +// inlines +// +inline const XMLString& ParserEngine::getEncoding() const +{ + return _encoding; +} + + +inline NamespaceStrategy* ParserEngine::getNamespaceStrategy() const +{ + return _pNamespaceStrategy; +} + + +inline bool ParserEngine::getExpandInternalEntities() const +{ + return _expandInternalEntities; +} + + +inline bool ParserEngine::getExternalGeneralEntities() const +{ + return _externalGeneralEntities; +} + + +inline bool ParserEngine::getExternalParameterEntities() const +{ + return _externalParameterEntities; +} + + +inline EntityResolver* ParserEngine::getEntityResolver() const +{ + return _pEntityResolver; +} + + +inline DTDHandler* ParserEngine::getDTDHandler() const +{ + return _pDTDHandler; +} + + +inline DeclHandler* ParserEngine::getDeclHandler() const +{ + return _pDeclHandler; +} + + +inline ContentHandler* ParserEngine::getContentHandler() const +{ + return _pContentHandler; +} + + +inline LexicalHandler* ParserEngine::getLexicalHandler() const +{ + return _pLexicalHandler; +} + + +inline ErrorHandler* ParserEngine::getErrorHandler() const +{ + return _pErrorHandler; +} + + +inline bool ParserEngine::getEnablePartialReads() const +{ + return _enablePartialReads; +} + + +} } // namespace Poco::XML + + +#endif // XML_ParserEngine_INCLUDED diff --git a/contrib/libs/poco/XML/include/Poco/XML/QName.h b/contrib/libs/poco/XML/include/Poco/XML/QName.h index 6a6a246e16..5dc4fe8d14 100644 --- a/contrib/libs/poco/XML/include/Poco/XML/QName.h +++ b/contrib/libs/poco/XML/include/Poco/XML/QName.h @@ -1,135 +1,135 @@ -// -// QName.h -// -// Library: XML -// Package: XML -// Module: QName -// -// Definition of the QName class. -// -// Copyright (c) 2015, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// Based on libstudxml (http://www.codesynthesis.com/projects/libstudxml/). -// Copyright (c) 2009-2013 Code Synthesis Tools CC. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef XML_QName_INCLUDED -#define XML_QName_INCLUDED - - -#include "Poco/XML/XML.h" -#include <string> -#include <iosfwd> - - -namespace Poco { -namespace XML { - - -class XML_API QName - /// This class represents a qualified XML name in the stream parser. - /// - /// Note that the optional prefix is just a "syntactic sugar". In - /// particular, it is ignored by the comparison operators and the - /// std::ostream insertion operator. -{ -public: - QName(); - QName(const std::string& name); - QName(const std::string& ns, const std::string& name); - QName(const std::string& ns, const std::string& name, const std::string& prefix); - - const std::string& namespaceURI() const; - /// Returns the namespace URI part of the name. - - const std::string& localName() const; - /// Returns the local part of the name. - - const std::string& prefix() const; - /// Returns the namespace prefix of the name. - - std::string& namespaceURI(); - /// Returns the namespace URI part of the name. - - std::string& localName(); - /// Returns the local part of the name. - - std::string& prefix(); - /// Returns the namespace prefix of the name. - - std::string toString() const; - /// Returns a printable representation in the [<namespace>#]<name> form. - -public: - friend bool operator < (const QName& x, const QName& y) - { - return x._ns < y._ns || (x._ns == y._ns && x._name < y._name); - } - - friend bool operator == (const QName& x, const QName& y) - { - return x._ns == y._ns && x._name == y._name; - } - - friend bool operator != (const QName& x, const QName& y) - { - return !(x == y); - } - -private: - std::string _ns; - std::string _name; - std::string _prefix; -}; - - -// -// inlines -// -inline const std::string& QName::namespaceURI() const -{ - return _ns; -} - - -inline const std::string& QName::localName() const -{ - return _name; -} - - -inline const std::string& QName::prefix() const -{ - return _prefix; -} - - -inline std::string& QName::namespaceURI() -{ - return _ns; -} - - -inline std::string& QName::localName() -{ - return _name; -} - - -inline std::string& QName::prefix() -{ - return _prefix; -} - - -XML_API std::ostream& operator << (std::ostream&, const QName&); - - -} } // namespace Poco::XML - - -#endif // XML_QName_INCLUDED +// +// QName.h +// +// Library: XML +// Package: XML +// Module: QName +// +// Definition of the QName class. +// +// Copyright (c) 2015, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Based on libstudxml (http://www.codesynthesis.com/projects/libstudxml/). +// Copyright (c) 2009-2013 Code Synthesis Tools CC. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef XML_QName_INCLUDED +#define XML_QName_INCLUDED + + +#include "Poco/XML/XML.h" +#include <string> +#include <iosfwd> + + +namespace Poco { +namespace XML { + + +class XML_API QName + /// This class represents a qualified XML name in the stream parser. + /// + /// Note that the optional prefix is just a "syntactic sugar". In + /// particular, it is ignored by the comparison operators and the + /// std::ostream insertion operator. +{ +public: + QName(); + QName(const std::string& name); + QName(const std::string& ns, const std::string& name); + QName(const std::string& ns, const std::string& name, const std::string& prefix); + + const std::string& namespaceURI() const; + /// Returns the namespace URI part of the name. + + const std::string& localName() const; + /// Returns the local part of the name. + + const std::string& prefix() const; + /// Returns the namespace prefix of the name. + + std::string& namespaceURI(); + /// Returns the namespace URI part of the name. + + std::string& localName(); + /// Returns the local part of the name. + + std::string& prefix(); + /// Returns the namespace prefix of the name. + + std::string toString() const; + /// Returns a printable representation in the [<namespace>#]<name> form. + +public: + friend bool operator < (const QName& x, const QName& y) + { + return x._ns < y._ns || (x._ns == y._ns && x._name < y._name); + } + + friend bool operator == (const QName& x, const QName& y) + { + return x._ns == y._ns && x._name == y._name; + } + + friend bool operator != (const QName& x, const QName& y) + { + return !(x == y); + } + +private: + std::string _ns; + std::string _name; + std::string _prefix; +}; + + +// +// inlines +// +inline const std::string& QName::namespaceURI() const +{ + return _ns; +} + + +inline const std::string& QName::localName() const +{ + return _name; +} + + +inline const std::string& QName::prefix() const +{ + return _prefix; +} + + +inline std::string& QName::namespaceURI() +{ + return _ns; +} + + +inline std::string& QName::localName() +{ + return _name; +} + + +inline std::string& QName::prefix() +{ + return _prefix; +} + + +XML_API std::ostream& operator << (std::ostream&, const QName&); + + +} } // namespace Poco::XML + + +#endif // XML_QName_INCLUDED diff --git a/contrib/libs/poco/XML/include/Poco/XML/ValueTraits.h b/contrib/libs/poco/XML/include/Poco/XML/ValueTraits.h index 46631c9398..d8fa26cd13 100644 --- a/contrib/libs/poco/XML/include/Poco/XML/ValueTraits.h +++ b/contrib/libs/poco/XML/include/Poco/XML/ValueTraits.h @@ -1,104 +1,104 @@ -// -// ValueTraits.h -// -// Library: XML -// Package: XML -// Module: ValueTraits -// -// Definition of the ValueTraits templates. -// -// Copyright (c) 2015, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// Based on libstudxml (http://www.codesynthesis.com/projects/libstudxml/). -// Copyright (c) 2009-2013 Code Synthesis Tools CC. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef XML_ValueTraits_INCLUDED -#define XML_ValueTraits_INCLUDED - - -#include "XMLStreamParserException.h" -#include <string> -#include <cstddef> -#include <iostream> -#include <sstream> - - -namespace Poco { -namespace XML { - - -class XMLStreamParser; -class XMLStreamSerializer; - - -template <typename T> -struct DefaultValueTraits -{ - static T - parse(std::string, const XMLStreamParser&); - - static std::string - serialize(const T&, const XMLStreamSerializer&); -}; - - -template <> -struct XML_API DefaultValueTraits<bool> -{ - static bool - parse(std::string, const XMLStreamParser&); - - static std::string serialize(bool v, const XMLStreamSerializer&) - { - return v ? "true" : "false"; - } -}; - - -template <> -struct XML_API DefaultValueTraits<std::string> -{ - static std::string parse(std::string s, const XMLStreamParser&) - { - return s; - } - - static std::string serialize(const std::string& v, const XMLStreamSerializer&) - { - return v; - } -}; - - -template <typename T> -struct ValueTraits: DefaultValueTraits<T> -{ -}; - - -template <typename T, std::size_t N> -struct ValueTraits<T[N]> : DefaultValueTraits<const T*> -{ -}; - - -template <typename T> -T DefaultValueTraits<T>::parse(std::string s, const XMLStreamParser& p) -{ - T r; - std::istringstream is(s); - if (!(is >> r && is.eof())) - throw XMLStreamParserException(p, "invalid value '" + s + "'"); - return r; -} - - -} } // namespace Poco::XML - - -#endif // XML_ValueTraits_INCLUDED +// +// ValueTraits.h +// +// Library: XML +// Package: XML +// Module: ValueTraits +// +// Definition of the ValueTraits templates. +// +// Copyright (c) 2015, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Based on libstudxml (http://www.codesynthesis.com/projects/libstudxml/). +// Copyright (c) 2009-2013 Code Synthesis Tools CC. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef XML_ValueTraits_INCLUDED +#define XML_ValueTraits_INCLUDED + + +#include "XMLStreamParserException.h" +#include <string> +#include <cstddef> +#include <iostream> +#include <sstream> + + +namespace Poco { +namespace XML { + + +class XMLStreamParser; +class XMLStreamSerializer; + + +template <typename T> +struct DefaultValueTraits +{ + static T + parse(std::string, const XMLStreamParser&); + + static std::string + serialize(const T&, const XMLStreamSerializer&); +}; + + +template <> +struct XML_API DefaultValueTraits<bool> +{ + static bool + parse(std::string, const XMLStreamParser&); + + static std::string serialize(bool v, const XMLStreamSerializer&) + { + return v ? "true" : "false"; + } +}; + + +template <> +struct XML_API DefaultValueTraits<std::string> +{ + static std::string parse(std::string s, const XMLStreamParser&) + { + return s; + } + + static std::string serialize(const std::string& v, const XMLStreamSerializer&) + { + return v; + } +}; + + +template <typename T> +struct ValueTraits: DefaultValueTraits<T> +{ +}; + + +template <typename T, std::size_t N> +struct ValueTraits<T[N]> : DefaultValueTraits<const T*> +{ +}; + + +template <typename T> +T DefaultValueTraits<T>::parse(std::string s, const XMLStreamParser& p) +{ + T r; + std::istringstream is(s); + if (!(is >> r && is.eof())) + throw XMLStreamParserException(p, "invalid value '" + s + "'"); + return r; +} + + +} } // namespace Poco::XML + + +#endif // XML_ValueTraits_INCLUDED diff --git a/contrib/libs/poco/XML/include/Poco/XML/XML.h b/contrib/libs/poco/XML/include/Poco/XML/XML.h index 19a21a3b47..59cb1a2f97 100644 --- a/contrib/libs/poco/XML/include/Poco/XML/XML.h +++ b/contrib/libs/poco/XML/include/Poco/XML/XML.h @@ -1,62 +1,62 @@ -// -// XML.h -// -// Library: XML -// Package: XML -// Module: XML -// -// Basic definitions for the Poco XML library. -// This file must be the first file included by every other XML -// header file. -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef XML_XML_INCLUDED -#define XML_XML_INCLUDED - - -#include "Poco/Foundation.h" - - -// -// The following block is the standard way of creating macros which make exporting -// from a DLL simpler. All files within this DLL are compiled with the XML_EXPORTS -// symbol defined on the command line. this symbol should not be defined on any project -// that uses this DLL. This way any other project whose source files include this file see -// XML_API functions as being imported from a DLL, whereas this DLL sees symbols -// defined with this macro as being exported. -// -#if defined(_WIN32) && defined(POCO_DLL) - #if defined(XML_EXPORTS) - #define XML_API __declspec(dllexport) - #else - #define XML_API __declspec(dllimport) - #endif -#endif - - -#if !defined(XML_API) - #if !defined(POCO_NO_GCC_API_ATTRIBUTE) && defined (__GNUC__) && (__GNUC__ >= 4) - #define XML_API __attribute__ ((visibility ("default"))) - #else - #define XML_API - #endif -#endif - - -// -// Automatically link XML library. -// -#if defined(_MSC_VER) - #if !defined(POCO_NO_AUTOMATIC_LIBS) && !defined(XML_EXPORTS) - #pragma comment(lib, "PocoXML" POCO_LIB_SUFFIX) - #endif -#endif - - -#endif // XML_XML_INCLUDED +// +// XML.h +// +// Library: XML +// Package: XML +// Module: XML +// +// Basic definitions for the Poco XML library. +// This file must be the first file included by every other XML +// header file. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef XML_XML_INCLUDED +#define XML_XML_INCLUDED + + +#include "Poco/Foundation.h" + + +// +// The following block is the standard way of creating macros which make exporting +// from a DLL simpler. All files within this DLL are compiled with the XML_EXPORTS +// symbol defined on the command line. this symbol should not be defined on any project +// that uses this DLL. This way any other project whose source files include this file see +// XML_API functions as being imported from a DLL, whereas this DLL sees symbols +// defined with this macro as being exported. +// +#if defined(_WIN32) && defined(POCO_DLL) + #if defined(XML_EXPORTS) + #define XML_API __declspec(dllexport) + #else + #define XML_API __declspec(dllimport) + #endif +#endif + + +#if !defined(XML_API) + #if !defined(POCO_NO_GCC_API_ATTRIBUTE) && defined (__GNUC__) && (__GNUC__ >= 4) + #define XML_API __attribute__ ((visibility ("default"))) + #else + #define XML_API + #endif +#endif + + +// +// Automatically link XML library. +// +#if defined(_MSC_VER) + #if !defined(POCO_NO_AUTOMATIC_LIBS) && !defined(XML_EXPORTS) + #pragma comment(lib, "PocoXML" POCO_LIB_SUFFIX) + #endif +#endif + + +#endif // XML_XML_INCLUDED diff --git a/contrib/libs/poco/XML/include/Poco/XML/XMLException.h b/contrib/libs/poco/XML/include/Poco/XML/XMLException.h index 9805badf06..d8e255388b 100644 --- a/contrib/libs/poco/XML/include/Poco/XML/XMLException.h +++ b/contrib/libs/poco/XML/include/Poco/XML/XMLException.h @@ -1,37 +1,37 @@ -// -// XMLException.h -// -// Library: XML -// Package: XML -// Module: XMLException -// -// Definition of the XMLException class. -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef XML_XMLException_INCLUDED -#define XML_XMLException_INCLUDED - - -#include "Poco/XML/XML.h" -#include "Poco/Exception.h" - - -namespace Poco { -namespace XML { - - -POCO_DECLARE_EXCEPTION(XML_API, XMLException, Poco::RuntimeException) - /// The base class for all XML-related exceptions like SAXException - /// and DOMException. - - -} } // namespace Poco::XML - - -#endif // XML_XMLException_INCLUDED +// +// XMLException.h +// +// Library: XML +// Package: XML +// Module: XMLException +// +// Definition of the XMLException class. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef XML_XMLException_INCLUDED +#define XML_XMLException_INCLUDED + + +#include "Poco/XML/XML.h" +#include "Poco/Exception.h" + + +namespace Poco { +namespace XML { + + +POCO_DECLARE_EXCEPTION(XML_API, XMLException, Poco::RuntimeException) + /// The base class for all XML-related exceptions like SAXException + /// and DOMException. + + +} } // namespace Poco::XML + + +#endif // XML_XMLException_INCLUDED diff --git a/contrib/libs/poco/XML/include/Poco/XML/XMLStream.h b/contrib/libs/poco/XML/include/Poco/XML/XMLStream.h index e75705a255..316af26054 100644 --- a/contrib/libs/poco/XML/include/Poco/XML/XMLStream.h +++ b/contrib/libs/poco/XML/include/Poco/XML/XMLStream.h @@ -1,71 +1,71 @@ -// -// XMLStream.h -// -// Library: XML -// Package: XML -// Module: XMLStream -// -// Definition of the XMLByteInputStream and XMLCharInputStream classes. -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef XML_XMLStream_INCLUDED -#define XML_XMLStream_INCLUDED - - -#include "Poco/XML/XML.h" -#include <istream> -#include <ostream> - - -namespace Poco { -namespace XML { - - -// The byte input stream is always a narrow stream. -typedef std::istream XMLByteInputStream; -typedef std::ostream XMLByteOutputStream; - - -// -// The XML parser uses the stream classes provided by the C++ -// standard library (based on the basic_stream<> template). -// In Unicode mode, a wide stream is used. -// To turn on Unicode mode, #define XML_UNICODE and -// XML_UNICODE_WCHAR_T when compiling the library. -// -// XML_UNICODE XML_UNICODE_WCHAR_T XMLCharInputStream XMLCharOutputStream -// ------------------------------------------------------------------------- -// N N std::istream std::ostream -// N Y std::wistream std::wostream -// Y Y std::wistream std::wostream -// Y N <not supported> -// -#if defined(XML_UNICODE_WCHAR_T) - - // Unicode - use wide streams - typedef std::wistream XMLCharInputStream; - typedef std::wostream XMLCharOutputStream; - -#elif defined(XML_UNICODE) - - // not supported - leave XMLString undefined - -#else - - // Characters are UTF-8 encoded - typedef std::istream XMLCharInputStream; - typedef std::ostream XMLCharOutputStream; - -#endif - - -} } // namespace Poco::XML - - -#endif // XML_XMLStream_INCLUDED +// +// XMLStream.h +// +// Library: XML +// Package: XML +// Module: XMLStream +// +// Definition of the XMLByteInputStream and XMLCharInputStream classes. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef XML_XMLStream_INCLUDED +#define XML_XMLStream_INCLUDED + + +#include "Poco/XML/XML.h" +#include <istream> +#include <ostream> + + +namespace Poco { +namespace XML { + + +// The byte input stream is always a narrow stream. +typedef std::istream XMLByteInputStream; +typedef std::ostream XMLByteOutputStream; + + +// +// The XML parser uses the stream classes provided by the C++ +// standard library (based on the basic_stream<> template). +// In Unicode mode, a wide stream is used. +// To turn on Unicode mode, #define XML_UNICODE and +// XML_UNICODE_WCHAR_T when compiling the library. +// +// XML_UNICODE XML_UNICODE_WCHAR_T XMLCharInputStream XMLCharOutputStream +// ------------------------------------------------------------------------- +// N N std::istream std::ostream +// N Y std::wistream std::wostream +// Y Y std::wistream std::wostream +// Y N <not supported> +// +#if defined(XML_UNICODE_WCHAR_T) + + // Unicode - use wide streams + typedef std::wistream XMLCharInputStream; + typedef std::wostream XMLCharOutputStream; + +#elif defined(XML_UNICODE) + + // not supported - leave XMLString undefined + +#else + + // Characters are UTF-8 encoded + typedef std::istream XMLCharInputStream; + typedef std::ostream XMLCharOutputStream; + +#endif + + +} } // namespace Poco::XML + + +#endif // XML_XMLStream_INCLUDED diff --git a/contrib/libs/poco/XML/include/Poco/XML/XMLStreamParser.h b/contrib/libs/poco/XML/include/Poco/XML/XMLStreamParser.h index 26ac78d369..f594a961a5 100644 --- a/contrib/libs/poco/XML/include/Poco/XML/XMLStreamParser.h +++ b/contrib/libs/poco/XML/include/Poco/XML/XMLStreamParser.h @@ -1,634 +1,634 @@ -// -// XMLStreamParser.h -// -// Library: XML -// Package: XML -// Module: XMLStreamParser -// -// Definition of the XMLStreamParser class. -// -// Copyright (c) 2015, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// Based on libstudxml (http://www.codesynthesis.com/projects/libstudxml/). -// Copyright (c) 2009-2013 Code Synthesis Tools CC. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef XML_XMLStreamParser_INCLUDED -#define XML_XMLStreamParser_INCLUDED - - -// We only support UTF-8 expat. -#ifdef XML_UNICODE -#error UTF-16 expat (XML_UNICODE defined) is not supported -#endif - - -#include "Poco/XML/QName.h" -#include "Poco/XML/ValueTraits.h" -#include "Poco/XML/Content.h" -#if defined(POCO_UNBUNDLED) -#include <expat.h> -#else -#error #include "Poco/XML/expat.h" -#endif -#include <map> -#include <vector> -#include <string> -#include <iosfwd> -#include <cstddef> - - -namespace Poco { -namespace XML { - - -class XML_API XMLStreamParser - /// The streaming XML pull parser and streaming XML serializer. The parser - /// is a conforming, non-validating XML 1.0 implementation (see Implementation Notes - /// for details). The application character encoding (that is, the encoding used - /// in the application's memory) for both parser and serializer is UTF-8. - /// The output encoding of the serializer is UTF-8 as well. The parser supports - /// UTF-8, UTF-16, ISO-8859-1, and US-ASCII input encodings. - /// - /// Attribute map: - /// - /// Attribute map lookup. If attribute is not found, then the version - /// without the default value throws an appropriate parsing exception - /// while the version with the default value returns that value. - /// - /// Note also that there is no attribute(ns, name) version since it - /// would conflict with attribute(name, dv) (qualified attributes - /// are not very common). - /// - /// Attribute map is valid throughout at the "element level" until - /// end_element and not just during EV_START_ELEMENT. As a special case, - /// the map is still valid after peek() that returned end_element until - /// this end_element event is retrieved with next(). - /// - /// Using parser: - /// - /// XMLStreamParser p(ifs, argv[1]); - /// for (XMLStreamParser::EventType e: p) - /// { - /// switch (e) - /// { - /// case XMLStreamParser::EV_START_ELEMENT: - /// cerr << p.line () << ':' << p.column () << ": start " << p.name () << endl; - /// break; - /// case XMLStreamParser::EV_END_ELEMENT: - /// cerr << p.line () << ':' << p.column () << ": end " << p.name () << endl; - /// break; - /// case XMLStreamParser::EV_START_ATTRIBUTE: - /// ... - /// case XMLStreamParser::EV_END_ATTRIBUTE: - /// ... - /// case XMLStreamParser::EV_CHARACTERS: - /// ... - /// } - /// } -{ -public: - enum EventType - /// Parsing events. - { - EV_START_ELEMENT, - EV_END_ELEMENT, - EV_START_ATTRIBUTE, - EV_END_ATTRIBUTE, - EV_CHARACTERS, - EV_START_NAMESPACE_DECL, - EV_END_NAMESPACE_DECL, - EV_EOF - }; - - typedef unsigned short FeatureType; - /// If both receive_attributes_event and RECEIVE_ATTRIBUTE_MAP are - /// specified, then RECEIVE_ATTRIBUTES_EVENT is assumed. - - static const FeatureType RECEIVE_ELEMENTS = 0x0001; - static const FeatureType RECEIVE_CHARACTERS = 0x0002; - static const FeatureType RECEIVE_ATTRIBUTE_MAP = 0x0004; - static const FeatureType RECEIVE_ATTRIBUTES_EVENT = 0x0008; - static const FeatureType RECEIVE_NAMESPACE_DECLS = 0x0010; - static const FeatureType RECEIVE_DEFAULT = RECEIVE_ELEMENTS | RECEIVE_CHARACTERS | RECEIVE_ATTRIBUTE_MAP; - - struct XML_API AttributeValueType - { - std::string value; - mutable bool handled; - }; - - typedef std::map<QName, AttributeValueType> AttributeMapType; - - struct XML_API Iterator - // C++11 range-based for support. Generally, the iterator interface - // doesn't make much sense for the XMLStreamParser so for now we have an - // implementation that is just enough to the range-based for. - { - typedef EventType value_type; - - Iterator(XMLStreamParser* p = 0, EventType e = EV_EOF): - _parser(p), - _e(e) - { - } - - value_type operator * () const - { - return _e; - } - - Iterator& operator ++ () - { - _e = _parser->next(); - return *this; - } - - bool operator == (Iterator y) const - /// Comparison only makes sense when comparing to end (eof). - { - return _e == EV_EOF && y._e == EV_EOF; - } - - bool operator != (Iterator y) const - /// Comparison only makes sense when comparing to end (eof). - { - return !(*this == y); - } - - private: - XMLStreamParser* _parser; - EventType _e; - }; - - Iterator begin() - { - return Iterator(this, next()); - } - - Iterator end() - { - return Iterator(this, EV_EOF); - } - - XMLStreamParser(std::istream&, const std::string& inputName, FeatureType = RECEIVE_DEFAULT); - /// The parser constructor takes three arguments: the stream to parse, - /// input name that is used in diagnostics to identify the document being - /// parsed, and the list of events we want the parser to report. - /// - /// Parse std::istream. Input name is used in diagnostics to identify - /// the document being parsed. - /// - /// If stream exceptions are enabled then std::ios_base::failure - /// exception is used to report io errors (badbit and failbit). - /// Otherwise, those are reported as the parsing exception. - - XMLStreamParser(const void* data, std::size_t size, const std::string& inputName, FeatureType = RECEIVE_DEFAULT); - /// Parse memory buffer that contains the whole document. Input name - /// is used in diagnostics to identify the document being parsed. - - ~XMLStreamParser(); - /// Destroys the XMLStreamParser. - - EventType next(); - /// Call the next() function when we are ready to handle the next piece of XML. - - void nextExpect(EventType); - /// Get the next event and make sure that it's what's expected. If it - /// is not, then throw an appropriate parsing exception. - - void nextExpect(EventType, const std::string& name); - void nextExpect(EventType, const QName& qname); - void nextExpect(EventType, const std::string& ns, const std::string& name); - - EventType peek(); - EventType event(); - /// Return the event that was last returned by the call to next() or peek(). - - const std::string& inputName() const; - const QName& getQName() const; - const std::string& namespaceURI() const; - const std::string& localName() const; - const std::string& prefix() const; - std::string& value(); - const std::string& value() const; - template <typename T> T value() const; - Poco::UInt64 line() const; - Poco::UInt64 column() const; - const std::string& attribute(const std::string& name) const; - template <typename T> - T attribute(const std::string& name) const; - std::string attribute(const std::string& name, const std::string& deflt) const; - template <typename T> - T attribute(const std::string& name, const T& deflt) const; - const std::string& attribute(const QName& qname) const; - template <typename T> - T attribute(const QName& qname) const; - std::string attribute(const QName& qname, const std::string& deflt) const; - template <typename T> - T attribute(const QName& qname, const T& deflt) const; - bool attributePresent(const std::string& name) const; - bool attributePresent(const QName& qname) const; - const AttributeMapType& attributeMap() const; - - void content(Content); - Content content() const; - - void nextExpect(EventType, const std::string& name, Content); - void nextExpect(EventType, const QName& qname, Content); - void nextExpect(EventType, const std::string& ns, const std::string& name, Content); - - // Helpers for parsing elements with simple content. The first two - // functions assume that EV_START_ELEMENT has already been parsed. The - // rest parse the complete element, from start to end. - // - // Note also that as with attribute(), there is no (namespace,name) - // overload since it would conflicts with (namespace,deflt). - std::string element(); - - template <typename T> - T element(); - std::string element(const std::string& name); - std::string element(const QName& qname); - template <typename T> - T element(const std::string& name); - template <typename T> - T element(const QName& qname); - std::string element(const std::string& name, const std::string& deflt); - std::string element(const QName& qname, const std::string& deflt); - template <typename T> - T element(const std::string& name, const T& deflt); - template <typename T> - T element(const QName& qname, const T& deflt); - -private: - XMLStreamParser(const XMLStreamParser&); - XMLStreamParser& operator = (const XMLStreamParser&); - - static void XMLCALL handleStartElement(void*, const XML_Char*, const XML_Char**); - static void XMLCALL handleEndElement(void*, const XML_Char*); - static void XMLCALL handleCharacters(void*, const XML_Char*, int); - static void XMLCALL handleStartNamespaceDecl(void*, const XML_Char*, const XML_Char*); - static void XMLCALL handleEndNamespaceDecl(void*, const XML_Char*); - - void init(); - EventType nextImpl(bool peek); - EventType nextBody(); - void handleError(); - - // If _size is 0, then data is std::istream. Otherwise, it is a buffer. - union - { - std::istream* is; - const void* buf; - } - _data; - - std::size_t _size; - const std::string _inputName; - FeatureType _feature; - XML_Parser _parser; - std::size_t _depth; - bool _accumulateContent; // Whether we are accumulating character content. - enum { state_next, state_peek } _parserState; - EventType _currentEvent; - EventType _queue; - QName _qname; - std::string _value; - const QName* _qualifiedName; - std::string* _pvalue; - Poco::UInt64 _line; - Poco::UInt64 _column; - - struct AttributeType - { - QName qname; - std::string value; - }; - - typedef std::vector<AttributeType> attributes; - attributes _attributes; - attributes::size_type _currentAttributeIndex; // Index of the current attribute. - - typedef std::vector<QName> NamespaceDecls; - NamespaceDecls _startNamespace; - NamespaceDecls::size_type _startNamespaceIndex;// Index of the current decl. - NamespaceDecls _endNamespace; - NamespaceDecls::size_type _endNamespaceIndex;// Index of the current decl. - - struct ElementEntry - { - ElementEntry(std::size_t d, Content c = Content::Mixed): - depth(d), - content(c), - attributesUnhandled(0) - { - } - - std::size_t depth; - Content content; - AttributeMapType attributeMap; - mutable AttributeMapType::size_type attributesUnhandled; - }; - - typedef std::vector<ElementEntry> ElementState; - std::vector<ElementEntry> _elementState; - - const AttributeMapType _emptyAttrMap; - - const ElementEntry* getElement() const; - const ElementEntry* getElementImpl() const; - void popElement(); -}; - - -XML_API std::ostream& operator << (std::ostream&, XMLStreamParser::EventType); - - -// -// inlines -// -inline XMLStreamParser::EventType XMLStreamParser::event() - // Return the even that was last returned by the call to next() or peek(). -{ - return _currentEvent; -} - - -inline const std::string& XMLStreamParser::inputName() const -{ - return _inputName; -} - - -inline const QName& XMLStreamParser::getQName() const -{ - return *_qualifiedName; -} - - -inline const std::string& XMLStreamParser::namespaceURI() const -{ - return _qualifiedName->namespaceURI(); -} - - -inline const std::string& XMLStreamParser::localName() const -{ - return _qualifiedName->localName(); -} - - -inline const std::string& XMLStreamParser::prefix() const -{ - return _qualifiedName->prefix(); -} - - -inline std::string& XMLStreamParser::value() -{ - return *_pvalue; -} - - -inline const std::string& XMLStreamParser::value() const -{ - return *_pvalue; -} - - -inline Poco::UInt64 XMLStreamParser::line() const -{ - return _line; -} - - -inline Poco::UInt64 XMLStreamParser::column() const -{ - return _column; -} - - -inline XMLStreamParser::EventType XMLStreamParser::peek() -{ - if (_parserState == state_peek) - return _currentEvent; - else - { - EventType e(nextImpl(true)); - _parserState = state_peek; // Set it after the call to nextImpl(). - return e; - } -} - - -template <typename T> -inline T XMLStreamParser::value() const -{ - return ValueTraits < T > ::parse(value(), *this); -} - - -inline const std::string& XMLStreamParser::attribute(const std::string& n) const -{ - return attribute(QName(n)); -} - - -template <typename T> -inline T XMLStreamParser::attribute(const std::string& n) const -{ - return attribute < T > (QName(n)); -} - - -inline std::string XMLStreamParser::attribute(const std::string& n, const std::string& dv) const -{ - return attribute(QName(n), dv); -} - - -template <typename T> -inline T XMLStreamParser::attribute(const std::string& n, const T& dv) const -{ - return attribute < T > (QName(n), dv); -} - - -template <typename T> -inline T XMLStreamParser::attribute(const QName& qn) const -{ - return ValueTraits < T > ::parse(attribute(qn), *this); -} - - -inline bool XMLStreamParser::attributePresent(const std::string& n) const -{ - return attributePresent(QName(n)); -} - - -inline const XMLStreamParser::AttributeMapType& XMLStreamParser::attributeMap() const -{ - if (const ElementEntry* e = getElement()) - { - e->attributesUnhandled = 0; // Assume all handled. - return e->attributeMap; - } - - return _emptyAttrMap; -} - - -inline void XMLStreamParser::nextExpect(EventType e, const QName& qn) -{ - nextExpect(e, qn.namespaceURI(), qn.localName()); -} - - -inline void XMLStreamParser::nextExpect(EventType e, const std::string& n) -{ - nextExpect(e, std::string(), n); -} - - -inline void XMLStreamParser::nextExpect(EventType e, const QName& qn, Content c) -{ - nextExpect(e, qn); - poco_assert(e == EV_START_ELEMENT); - content(c); -} - - -inline void XMLStreamParser::nextExpect(EventType e, const std::string& n, Content c) -{ - nextExpect(e, std::string(), n); - poco_assert(e == EV_START_ELEMENT); - content(c); -} - - -inline void XMLStreamParser::nextExpect(EventType e, const std::string& ns, const std::string& n, Content c) -{ - nextExpect(e, ns, n); - poco_assert(e == EV_START_ELEMENT); - content(c); -} - - -template <typename T> -inline T XMLStreamParser::element() -{ - return ValueTraits < T > ::parse(element(), *this); -} - - -inline std::string XMLStreamParser::element(const std::string& n) -{ - nextExpect(EV_START_ELEMENT, n); - return element(); -} - - -inline std::string XMLStreamParser::element(const QName& qn) -{ - nextExpect(EV_START_ELEMENT, qn); - return element(); -} - - -template <typename T> -inline T XMLStreamParser::element(const std::string& n) -{ - return ValueTraits < T > ::parse(element(n), *this); -} - - -template <typename T> -inline T XMLStreamParser::element(const QName& qn) -{ - return ValueTraits < T > ::parse(element(qn), *this); -} - - -inline std::string XMLStreamParser::element(const std::string& n, const std::string& dv) -{ - return element(QName(n), dv); -} - - -template <typename T> -inline T XMLStreamParser::element(const std::string& n, const T& dv) -{ - return element < T > (QName(n), dv); -} - - -inline void XMLStreamParser::content(Content c) -{ - poco_assert(_parserState == state_next); - - if (!_elementState.empty() && _elementState.back().depth == _depth) - _elementState.back().content = c; - else - _elementState.push_back(ElementEntry(_depth, c)); -} - - -inline Content XMLStreamParser::content() const -{ - poco_assert(_parserState == state_next); - - return !_elementState.empty() && _elementState.back().depth == _depth ? _elementState.back().content : Content(Content::Mixed); -} - - -inline const XMLStreamParser::ElementEntry* XMLStreamParser::getElement() const -{ - return _elementState.empty() ? 0 : getElementImpl(); -} - - -template <typename T> -T XMLStreamParser::attribute(const QName& qn, const T& dv) const -{ - if (const ElementEntry* e = getElement()) - { - AttributeMapType::const_iterator i(e->attributeMap.find(qn)); - - if (i != e->attributeMap.end()) - { - if (!i->second.handled) - { - i->second.handled = true; - e->attributesUnhandled--; - } - return ValueTraits < T > ::parse(i->second.value, *this); - } - } - - return dv; -} - - -template <typename T> -T XMLStreamParser::element(const QName& qn, const T& dv) -{ - if (peek() == EV_START_ELEMENT && getQName() == qn) - { - next(); - return element<T>(); - } - - return dv; -} - - -} } // namespace Poco::XML - - -#endif // XML_XMLStreamParser_INCLUDED +// +// XMLStreamParser.h +// +// Library: XML +// Package: XML +// Module: XMLStreamParser +// +// Definition of the XMLStreamParser class. +// +// Copyright (c) 2015, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Based on libstudxml (http://www.codesynthesis.com/projects/libstudxml/). +// Copyright (c) 2009-2013 Code Synthesis Tools CC. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef XML_XMLStreamParser_INCLUDED +#define XML_XMLStreamParser_INCLUDED + + +// We only support UTF-8 expat. +#ifdef XML_UNICODE +#error UTF-16 expat (XML_UNICODE defined) is not supported +#endif + + +#include "Poco/XML/QName.h" +#include "Poco/XML/ValueTraits.h" +#include "Poco/XML/Content.h" +#if defined(POCO_UNBUNDLED) +#include <expat.h> +#else +#error #include "Poco/XML/expat.h" +#endif +#include <map> +#include <vector> +#include <string> +#include <iosfwd> +#include <cstddef> + + +namespace Poco { +namespace XML { + + +class XML_API XMLStreamParser + /// The streaming XML pull parser and streaming XML serializer. The parser + /// is a conforming, non-validating XML 1.0 implementation (see Implementation Notes + /// for details). The application character encoding (that is, the encoding used + /// in the application's memory) for both parser and serializer is UTF-8. + /// The output encoding of the serializer is UTF-8 as well. The parser supports + /// UTF-8, UTF-16, ISO-8859-1, and US-ASCII input encodings. + /// + /// Attribute map: + /// + /// Attribute map lookup. If attribute is not found, then the version + /// without the default value throws an appropriate parsing exception + /// while the version with the default value returns that value. + /// + /// Note also that there is no attribute(ns, name) version since it + /// would conflict with attribute(name, dv) (qualified attributes + /// are not very common). + /// + /// Attribute map is valid throughout at the "element level" until + /// end_element and not just during EV_START_ELEMENT. As a special case, + /// the map is still valid after peek() that returned end_element until + /// this end_element event is retrieved with next(). + /// + /// Using parser: + /// + /// XMLStreamParser p(ifs, argv[1]); + /// for (XMLStreamParser::EventType e: p) + /// { + /// switch (e) + /// { + /// case XMLStreamParser::EV_START_ELEMENT: + /// cerr << p.line () << ':' << p.column () << ": start " << p.name () << endl; + /// break; + /// case XMLStreamParser::EV_END_ELEMENT: + /// cerr << p.line () << ':' << p.column () << ": end " << p.name () << endl; + /// break; + /// case XMLStreamParser::EV_START_ATTRIBUTE: + /// ... + /// case XMLStreamParser::EV_END_ATTRIBUTE: + /// ... + /// case XMLStreamParser::EV_CHARACTERS: + /// ... + /// } + /// } +{ +public: + enum EventType + /// Parsing events. + { + EV_START_ELEMENT, + EV_END_ELEMENT, + EV_START_ATTRIBUTE, + EV_END_ATTRIBUTE, + EV_CHARACTERS, + EV_START_NAMESPACE_DECL, + EV_END_NAMESPACE_DECL, + EV_EOF + }; + + typedef unsigned short FeatureType; + /// If both receive_attributes_event and RECEIVE_ATTRIBUTE_MAP are + /// specified, then RECEIVE_ATTRIBUTES_EVENT is assumed. + + static const FeatureType RECEIVE_ELEMENTS = 0x0001; + static const FeatureType RECEIVE_CHARACTERS = 0x0002; + static const FeatureType RECEIVE_ATTRIBUTE_MAP = 0x0004; + static const FeatureType RECEIVE_ATTRIBUTES_EVENT = 0x0008; + static const FeatureType RECEIVE_NAMESPACE_DECLS = 0x0010; + static const FeatureType RECEIVE_DEFAULT = RECEIVE_ELEMENTS | RECEIVE_CHARACTERS | RECEIVE_ATTRIBUTE_MAP; + + struct XML_API AttributeValueType + { + std::string value; + mutable bool handled; + }; + + typedef std::map<QName, AttributeValueType> AttributeMapType; + + struct XML_API Iterator + // C++11 range-based for support. Generally, the iterator interface + // doesn't make much sense for the XMLStreamParser so for now we have an + // implementation that is just enough to the range-based for. + { + typedef EventType value_type; + + Iterator(XMLStreamParser* p = 0, EventType e = EV_EOF): + _parser(p), + _e(e) + { + } + + value_type operator * () const + { + return _e; + } + + Iterator& operator ++ () + { + _e = _parser->next(); + return *this; + } + + bool operator == (Iterator y) const + /// Comparison only makes sense when comparing to end (eof). + { + return _e == EV_EOF && y._e == EV_EOF; + } + + bool operator != (Iterator y) const + /// Comparison only makes sense when comparing to end (eof). + { + return !(*this == y); + } + + private: + XMLStreamParser* _parser; + EventType _e; + }; + + Iterator begin() + { + return Iterator(this, next()); + } + + Iterator end() + { + return Iterator(this, EV_EOF); + } + + XMLStreamParser(std::istream&, const std::string& inputName, FeatureType = RECEIVE_DEFAULT); + /// The parser constructor takes three arguments: the stream to parse, + /// input name that is used in diagnostics to identify the document being + /// parsed, and the list of events we want the parser to report. + /// + /// Parse std::istream. Input name is used in diagnostics to identify + /// the document being parsed. + /// + /// If stream exceptions are enabled then std::ios_base::failure + /// exception is used to report io errors (badbit and failbit). + /// Otherwise, those are reported as the parsing exception. + + XMLStreamParser(const void* data, std::size_t size, const std::string& inputName, FeatureType = RECEIVE_DEFAULT); + /// Parse memory buffer that contains the whole document. Input name + /// is used in diagnostics to identify the document being parsed. + + ~XMLStreamParser(); + /// Destroys the XMLStreamParser. + + EventType next(); + /// Call the next() function when we are ready to handle the next piece of XML. + + void nextExpect(EventType); + /// Get the next event and make sure that it's what's expected. If it + /// is not, then throw an appropriate parsing exception. + + void nextExpect(EventType, const std::string& name); + void nextExpect(EventType, const QName& qname); + void nextExpect(EventType, const std::string& ns, const std::string& name); + + EventType peek(); + EventType event(); + /// Return the event that was last returned by the call to next() or peek(). + + const std::string& inputName() const; + const QName& getQName() const; + const std::string& namespaceURI() const; + const std::string& localName() const; + const std::string& prefix() const; + std::string& value(); + const std::string& value() const; + template <typename T> T value() const; + Poco::UInt64 line() const; + Poco::UInt64 column() const; + const std::string& attribute(const std::string& name) const; + template <typename T> + T attribute(const std::string& name) const; + std::string attribute(const std::string& name, const std::string& deflt) const; + template <typename T> + T attribute(const std::string& name, const T& deflt) const; + const std::string& attribute(const QName& qname) const; + template <typename T> + T attribute(const QName& qname) const; + std::string attribute(const QName& qname, const std::string& deflt) const; + template <typename T> + T attribute(const QName& qname, const T& deflt) const; + bool attributePresent(const std::string& name) const; + bool attributePresent(const QName& qname) const; + const AttributeMapType& attributeMap() const; + + void content(Content); + Content content() const; + + void nextExpect(EventType, const std::string& name, Content); + void nextExpect(EventType, const QName& qname, Content); + void nextExpect(EventType, const std::string& ns, const std::string& name, Content); + + // Helpers for parsing elements with simple content. The first two + // functions assume that EV_START_ELEMENT has already been parsed. The + // rest parse the complete element, from start to end. + // + // Note also that as with attribute(), there is no (namespace,name) + // overload since it would conflicts with (namespace,deflt). + std::string element(); + + template <typename T> + T element(); + std::string element(const std::string& name); + std::string element(const QName& qname); + template <typename T> + T element(const std::string& name); + template <typename T> + T element(const QName& qname); + std::string element(const std::string& name, const std::string& deflt); + std::string element(const QName& qname, const std::string& deflt); + template <typename T> + T element(const std::string& name, const T& deflt); + template <typename T> + T element(const QName& qname, const T& deflt); + +private: + XMLStreamParser(const XMLStreamParser&); + XMLStreamParser& operator = (const XMLStreamParser&); + + static void XMLCALL handleStartElement(void*, const XML_Char*, const XML_Char**); + static void XMLCALL handleEndElement(void*, const XML_Char*); + static void XMLCALL handleCharacters(void*, const XML_Char*, int); + static void XMLCALL handleStartNamespaceDecl(void*, const XML_Char*, const XML_Char*); + static void XMLCALL handleEndNamespaceDecl(void*, const XML_Char*); + + void init(); + EventType nextImpl(bool peek); + EventType nextBody(); + void handleError(); + + // If _size is 0, then data is std::istream. Otherwise, it is a buffer. + union + { + std::istream* is; + const void* buf; + } + _data; + + std::size_t _size; + const std::string _inputName; + FeatureType _feature; + XML_Parser _parser; + std::size_t _depth; + bool _accumulateContent; // Whether we are accumulating character content. + enum { state_next, state_peek } _parserState; + EventType _currentEvent; + EventType _queue; + QName _qname; + std::string _value; + const QName* _qualifiedName; + std::string* _pvalue; + Poco::UInt64 _line; + Poco::UInt64 _column; + + struct AttributeType + { + QName qname; + std::string value; + }; + + typedef std::vector<AttributeType> attributes; + attributes _attributes; + attributes::size_type _currentAttributeIndex; // Index of the current attribute. + + typedef std::vector<QName> NamespaceDecls; + NamespaceDecls _startNamespace; + NamespaceDecls::size_type _startNamespaceIndex;// Index of the current decl. + NamespaceDecls _endNamespace; + NamespaceDecls::size_type _endNamespaceIndex;// Index of the current decl. + + struct ElementEntry + { + ElementEntry(std::size_t d, Content c = Content::Mixed): + depth(d), + content(c), + attributesUnhandled(0) + { + } + + std::size_t depth; + Content content; + AttributeMapType attributeMap; + mutable AttributeMapType::size_type attributesUnhandled; + }; + + typedef std::vector<ElementEntry> ElementState; + std::vector<ElementEntry> _elementState; + + const AttributeMapType _emptyAttrMap; + + const ElementEntry* getElement() const; + const ElementEntry* getElementImpl() const; + void popElement(); +}; + + +XML_API std::ostream& operator << (std::ostream&, XMLStreamParser::EventType); + + +// +// inlines +// +inline XMLStreamParser::EventType XMLStreamParser::event() + // Return the even that was last returned by the call to next() or peek(). +{ + return _currentEvent; +} + + +inline const std::string& XMLStreamParser::inputName() const +{ + return _inputName; +} + + +inline const QName& XMLStreamParser::getQName() const +{ + return *_qualifiedName; +} + + +inline const std::string& XMLStreamParser::namespaceURI() const +{ + return _qualifiedName->namespaceURI(); +} + + +inline const std::string& XMLStreamParser::localName() const +{ + return _qualifiedName->localName(); +} + + +inline const std::string& XMLStreamParser::prefix() const +{ + return _qualifiedName->prefix(); +} + + +inline std::string& XMLStreamParser::value() +{ + return *_pvalue; +} + + +inline const std::string& XMLStreamParser::value() const +{ + return *_pvalue; +} + + +inline Poco::UInt64 XMLStreamParser::line() const +{ + return _line; +} + + +inline Poco::UInt64 XMLStreamParser::column() const +{ + return _column; +} + + +inline XMLStreamParser::EventType XMLStreamParser::peek() +{ + if (_parserState == state_peek) + return _currentEvent; + else + { + EventType e(nextImpl(true)); + _parserState = state_peek; // Set it after the call to nextImpl(). + return e; + } +} + + +template <typename T> +inline T XMLStreamParser::value() const +{ + return ValueTraits < T > ::parse(value(), *this); +} + + +inline const std::string& XMLStreamParser::attribute(const std::string& n) const +{ + return attribute(QName(n)); +} + + +template <typename T> +inline T XMLStreamParser::attribute(const std::string& n) const +{ + return attribute < T > (QName(n)); +} + + +inline std::string XMLStreamParser::attribute(const std::string& n, const std::string& dv) const +{ + return attribute(QName(n), dv); +} + + +template <typename T> +inline T XMLStreamParser::attribute(const std::string& n, const T& dv) const +{ + return attribute < T > (QName(n), dv); +} + + +template <typename T> +inline T XMLStreamParser::attribute(const QName& qn) const +{ + return ValueTraits < T > ::parse(attribute(qn), *this); +} + + +inline bool XMLStreamParser::attributePresent(const std::string& n) const +{ + return attributePresent(QName(n)); +} + + +inline const XMLStreamParser::AttributeMapType& XMLStreamParser::attributeMap() const +{ + if (const ElementEntry* e = getElement()) + { + e->attributesUnhandled = 0; // Assume all handled. + return e->attributeMap; + } + + return _emptyAttrMap; +} + + +inline void XMLStreamParser::nextExpect(EventType e, const QName& qn) +{ + nextExpect(e, qn.namespaceURI(), qn.localName()); +} + + +inline void XMLStreamParser::nextExpect(EventType e, const std::string& n) +{ + nextExpect(e, std::string(), n); +} + + +inline void XMLStreamParser::nextExpect(EventType e, const QName& qn, Content c) +{ + nextExpect(e, qn); + poco_assert(e == EV_START_ELEMENT); + content(c); +} + + +inline void XMLStreamParser::nextExpect(EventType e, const std::string& n, Content c) +{ + nextExpect(e, std::string(), n); + poco_assert(e == EV_START_ELEMENT); + content(c); +} + + +inline void XMLStreamParser::nextExpect(EventType e, const std::string& ns, const std::string& n, Content c) +{ + nextExpect(e, ns, n); + poco_assert(e == EV_START_ELEMENT); + content(c); +} + + +template <typename T> +inline T XMLStreamParser::element() +{ + return ValueTraits < T > ::parse(element(), *this); +} + + +inline std::string XMLStreamParser::element(const std::string& n) +{ + nextExpect(EV_START_ELEMENT, n); + return element(); +} + + +inline std::string XMLStreamParser::element(const QName& qn) +{ + nextExpect(EV_START_ELEMENT, qn); + return element(); +} + + +template <typename T> +inline T XMLStreamParser::element(const std::string& n) +{ + return ValueTraits < T > ::parse(element(n), *this); +} + + +template <typename T> +inline T XMLStreamParser::element(const QName& qn) +{ + return ValueTraits < T > ::parse(element(qn), *this); +} + + +inline std::string XMLStreamParser::element(const std::string& n, const std::string& dv) +{ + return element(QName(n), dv); +} + + +template <typename T> +inline T XMLStreamParser::element(const std::string& n, const T& dv) +{ + return element < T > (QName(n), dv); +} + + +inline void XMLStreamParser::content(Content c) +{ + poco_assert(_parserState == state_next); + + if (!_elementState.empty() && _elementState.back().depth == _depth) + _elementState.back().content = c; + else + _elementState.push_back(ElementEntry(_depth, c)); +} + + +inline Content XMLStreamParser::content() const +{ + poco_assert(_parserState == state_next); + + return !_elementState.empty() && _elementState.back().depth == _depth ? _elementState.back().content : Content(Content::Mixed); +} + + +inline const XMLStreamParser::ElementEntry* XMLStreamParser::getElement() const +{ + return _elementState.empty() ? 0 : getElementImpl(); +} + + +template <typename T> +T XMLStreamParser::attribute(const QName& qn, const T& dv) const +{ + if (const ElementEntry* e = getElement()) + { + AttributeMapType::const_iterator i(e->attributeMap.find(qn)); + + if (i != e->attributeMap.end()) + { + if (!i->second.handled) + { + i->second.handled = true; + e->attributesUnhandled--; + } + return ValueTraits < T > ::parse(i->second.value, *this); + } + } + + return dv; +} + + +template <typename T> +T XMLStreamParser::element(const QName& qn, const T& dv) +{ + if (peek() == EV_START_ELEMENT && getQName() == qn) + { + next(); + return element<T>(); + } + + return dv; +} + + +} } // namespace Poco::XML + + +#endif // XML_XMLStreamParser_INCLUDED diff --git a/contrib/libs/poco/XML/include/Poco/XML/XMLStreamParserException.h b/contrib/libs/poco/XML/include/Poco/XML/XMLStreamParserException.h index 88e4ff3304..edeca1f44d 100644 --- a/contrib/libs/poco/XML/include/Poco/XML/XMLStreamParserException.h +++ b/contrib/libs/poco/XML/include/Poco/XML/XMLStreamParserException.h @@ -1,58 +1,58 @@ -// -// XMLStreamParserException.h -// -// Library: XML -// Package: XML -// Module: XMLStreamParserException -// -// Definition of the XMLStreamParserException class. -// -// Copyright (c) 2015, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef XML_XMLStreamParserException_INCLUDED -#define XML_XMLStreamParserException_INCLUDED - - -#include "Poco/XML/XMLException.h" - - -namespace Poco { -namespace XML { - - -class XMLStreamParser; - - -class XML_API XMLStreamParserException: public Poco::XML::XMLException -{ -public: - XMLStreamParserException(const std::string& name, Poco::UInt64 line, Poco::UInt64 column, const std::string& description); - XMLStreamParserException(const XMLStreamParser&, const std::string& description); - virtual ~XMLStreamParserException() noexcept; - +// +// XMLStreamParserException.h +// +// Library: XML +// Package: XML +// Module: XMLStreamParserException +// +// Definition of the XMLStreamParserException class. +// +// Copyright (c) 2015, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef XML_XMLStreamParserException_INCLUDED +#define XML_XMLStreamParserException_INCLUDED + + +#include "Poco/XML/XMLException.h" + + +namespace Poco { +namespace XML { + + +class XMLStreamParser; + + +class XML_API XMLStreamParserException: public Poco::XML::XMLException +{ +public: + XMLStreamParserException(const std::string& name, Poco::UInt64 line, Poco::UInt64 column, const std::string& description); + XMLStreamParserException(const XMLStreamParser&, const std::string& description); + virtual ~XMLStreamParserException() noexcept; + const char* name() const noexcept; - Poco::UInt64 line() const; - Poco::UInt64 column() const; - const std::string& description() const; + Poco::UInt64 line() const; + Poco::UInt64 column() const; + const std::string& description() const; virtual const char* what() const noexcept; - -private: - void init(); - - std::string _name; - Poco::UInt64 _line; - Poco::UInt64 _column; - std::string _description; - std::string _what; -}; - - -} } // namespace Poco::XML - - -#endif // XML_XMLStreamParserException_INCLUDED + +private: + void init(); + + std::string _name; + Poco::UInt64 _line; + Poco::UInt64 _column; + std::string _description; + std::string _what; +}; + + +} } // namespace Poco::XML + + +#endif // XML_XMLStreamParserException_INCLUDED diff --git a/contrib/libs/poco/XML/include/Poco/XML/XMLString.h b/contrib/libs/poco/XML/include/Poco/XML/XMLString.h index 4f6d24b418..123d9f4547 100644 --- a/contrib/libs/poco/XML/include/Poco/XML/XMLString.h +++ b/contrib/libs/poco/XML/include/Poco/XML/XMLString.h @@ -1,87 +1,87 @@ -// -// XMLString.h -// -// Library: XML -// Package: XML -// Module: XMLString -// -// Definition of the XMLString class. -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef XML_XMLString_INCLUDED -#define XML_XMLString_INCLUDED - - -#include "Poco/XML/XML.h" - - -namespace Poco { -namespace XML { - - -// -// The XML parser uses the string classes provided by the C++ -// standard library (based on the basic_string<> template). -// In Unicode mode, a std::wstring is used, otherwise -// a std::string is used. -// To turn on Unicode mode, #define XML_UNICODE and -// XML_UNICODE_WCHAR_T when compiling the library. -// -// XML_UNICODE XML_UNICODE_WCHAR_T XMLChar XMLString -// -------------------------------------------------------------- -// N N char std::string -// N Y wchar_t std::wstring -// Y Y wchar_t std::wstring -// Y N <not supported> -// -#if defined(XML_UNICODE_WCHAR_T) - - // Unicode - use wchar_t - typedef wchar_t XMLChar; - typedef std::wstring XMLString; - - std::string fromXMLString(const XMLString& str); - /// Converts an XMLString into an UTF-8 encoded - /// string. - - XMLString toXMLString(const std::string& str); - /// Converts an UTF-8 encoded string into an - /// XMLString - - #define XML_LIT(lit) L##lit - -#elif defined(XML_UNICODE) - - // not supported - leave XMLString undefined - -#else - - // Characters are UTF-8 encoded - typedef char XMLChar; - typedef std::string XMLString; - - inline const std::string& fromXMLString(const XMLString& str) - { - return str; - } - - inline const XMLString& toXMLString(const std::string& str) - { - return str; - } - - #define XML_LIT(lit) lit - -#endif - - -} } // namespace Poco::XML - - -#endif // XML_XMLString_INCLUDED +// +// XMLString.h +// +// Library: XML +// Package: XML +// Module: XMLString +// +// Definition of the XMLString class. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef XML_XMLString_INCLUDED +#define XML_XMLString_INCLUDED + + +#include "Poco/XML/XML.h" + + +namespace Poco { +namespace XML { + + +// +// The XML parser uses the string classes provided by the C++ +// standard library (based on the basic_string<> template). +// In Unicode mode, a std::wstring is used, otherwise +// a std::string is used. +// To turn on Unicode mode, #define XML_UNICODE and +// XML_UNICODE_WCHAR_T when compiling the library. +// +// XML_UNICODE XML_UNICODE_WCHAR_T XMLChar XMLString +// -------------------------------------------------------------- +// N N char std::string +// N Y wchar_t std::wstring +// Y Y wchar_t std::wstring +// Y N <not supported> +// +#if defined(XML_UNICODE_WCHAR_T) + + // Unicode - use wchar_t + typedef wchar_t XMLChar; + typedef std::wstring XMLString; + + std::string fromXMLString(const XMLString& str); + /// Converts an XMLString into an UTF-8 encoded + /// string. + + XMLString toXMLString(const std::string& str); + /// Converts an UTF-8 encoded string into an + /// XMLString + + #define XML_LIT(lit) L##lit + +#elif defined(XML_UNICODE) + + // not supported - leave XMLString undefined + +#else + + // Characters are UTF-8 encoded + typedef char XMLChar; + typedef std::string XMLString; + + inline const std::string& fromXMLString(const XMLString& str) + { + return str; + } + + inline const XMLString& toXMLString(const std::string& str) + { + return str; + } + + #define XML_LIT(lit) lit + +#endif + + +} } // namespace Poco::XML + + +#endif // XML_XMLString_INCLUDED diff --git a/contrib/libs/poco/XML/include/Poco/XML/XMLWriter.h b/contrib/libs/poco/XML/include/Poco/XML/XMLWriter.h index b87fd30c47..d0936c0fdc 100644 --- a/contrib/libs/poco/XML/include/Poco/XML/XMLWriter.h +++ b/contrib/libs/poco/XML/include/Poco/XML/XMLWriter.h @@ -1,375 +1,375 @@ -// -// XMLWriter.h -// -// Library: XML -// Package: XML -// Module: XMLWriter -// -// Definition of the XMLWriter class. -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef XML_XMLWriter_INCLUDED -#define XML_XMLWriter_INCLUDED - - -#include "Poco/XML/XML.h" -#include "Poco/SAX/ContentHandler.h" -#include "Poco/SAX/LexicalHandler.h" -#include "Poco/SAX/DTDHandler.h" -#include "Poco/SAX/NamespaceSupport.h" -#include "Poco/XML/XMLString.h" -#include "Poco/XML/XMLStream.h" -#include "Poco/XML/Name.h" -#include "Poco/TextEncoding.h" -#include "Poco/StreamConverter.h" -#include <vector> -#include <map> - - -namespace Poco { -namespace XML { - - -class Locator; - - -class XML_API XMLWriter: public ContentHandler, public LexicalHandler, public DTDHandler - /// This class serializes SAX2 ContentHandler, LexicalHandler and - /// DTDHandler events back into a stream. +// +// XMLWriter.h +// +// Library: XML +// Package: XML +// Module: XMLWriter +// +// Definition of the XMLWriter class. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef XML_XMLWriter_INCLUDED +#define XML_XMLWriter_INCLUDED + + +#include "Poco/XML/XML.h" +#include "Poco/SAX/ContentHandler.h" +#include "Poco/SAX/LexicalHandler.h" +#include "Poco/SAX/DTDHandler.h" +#include "Poco/SAX/NamespaceSupport.h" +#include "Poco/XML/XMLString.h" +#include "Poco/XML/XMLStream.h" +#include "Poco/XML/Name.h" +#include "Poco/TextEncoding.h" +#include "Poco/StreamConverter.h" +#include <vector> +#include <map> + + +namespace Poco { +namespace XML { + + +class Locator; + + +class XML_API XMLWriter: public ContentHandler, public LexicalHandler, public DTDHandler + /// This class serializes SAX2 ContentHandler, LexicalHandler and + /// DTDHandler events back into a stream. + /// + /// Various consistency checks are performed on the written data + /// (i.e. there must be exactly one root element and every startElement() + /// must have a matching endElement()). /// - /// Various consistency checks are performed on the written data - /// (i.e. there must be exactly one root element and every startElement() - /// must have a matching endElement()). - /// - /// The XMLWriter supports optional pretty-printing of the serialized XML. - /// Note, however, that pretty-printing XML data alters the - /// information set of the document being written, since in - /// XML all whitespace is potentially relevant to an application. - /// - /// The writer contains extensive support for XML Namespaces, so that a client - /// application does not have to keep track of prefixes and supply xmlns attributes. - /// - /// If the client does not provide namespace prefixes (either by specifying them - /// as part of the qualified name given to startElement(), or by calling - /// startPrefixMapping()), the XMLWriter automatically generates namespace - /// prefixes in the form ns1, ns2, etc. -{ -public: - enum Options - { - CANONICAL = 0x00, - /// Do not write an XML declaration (default). - - CANONICAL_XML = 0x01, - /// Enables basic support for Canonical XML: - /// - do not write an XML declaration - /// - do not use special empty element syntax - /// - set the New Line character to NEWLINE_LF - /// - write namespace declarations and attributes - /// in canonical order - /// - use default namespace as much as possible - - WRITE_XML_DECLARATION = 0x02, - /// Write an XML declaration. - - PRETTY_PRINT = 0x04, - /// Pretty-print XML markup. - - PRETTY_PRINT_ATTRIBUTES = 0x08 - /// Write each attribute on a separate line. - /// PRETTY_PRINT must be specified as well. - }; - - XMLWriter(XMLByteOutputStream& str, int options); - /// Creates the XMLWriter and sets the specified options. - /// - /// The resulting stream will be UTF-8 encoded. - - XMLWriter(XMLByteOutputStream& str, int options, const std::string& encodingName, Poco::TextEncoding& textEncoding); - /// Creates the XMLWriter and sets the specified options. - /// - /// The encoding is reflected in the XML declaration. - /// The caller is responsible for that the given encodingName matches with - /// the given textEncoding. - - XMLWriter(XMLByteOutputStream& str, int options, const std::string& encodingName, Poco::TextEncoding* pTextEncoding); - /// Creates the XMLWriter and sets the specified options. - /// - /// The encoding is reflected in the XML declaration. - /// The caller is responsible for that the given encodingName matches with - /// the given textEncoding. - /// If pTextEncoding is null, the given encodingName is ignored and the - /// default UTF-8 encoding is used. - - ~XMLWriter(); - /// Destroys the XMLWriter. - - void setNewLine(const std::string& newLineCharacters); - /// Sets the line ending for the resulting XML file. - /// - /// Possible values are: - /// * NEWLINE_DEFAULT (whatever is appropriate for the current platform) - /// * NEWLINE_CRLF (Windows), - /// * NEWLINE_LF (Unix), - /// * NEWLINE_CR (Macintosh) - - const std::string& getNewLine() const; - /// Returns the line ending currently in use. - - void setIndent(const std::string& indent); - /// Sets the string used for one indentation step. - /// - /// The default is a single TAB character. - /// The given string should only contain TAB or SPACE - /// characters (e.g., a single TAB character, or - /// two to four SPACE characters). - - const std::string& getIndent() const; - /// Returns the string used for one indentation step. - - // ContentHandler - void setDocumentLocator(const Locator* loc); - /// Currently unused. - - void startDocument(); - /// Writes a generic XML declaration to the stream. - /// If a document type has been set (see SetDocumentType), - /// a DOCTYPE declaration is also written. - - void endDocument(); - /// Checks that all elements are closed and prints a final newline. - - void startFragment(); - /// Use this instead of StartDocument() if you want to write - /// a fragment rather than a document (no XML declaration and - /// more than one "root" element allowed). - - void endFragment(); - /// Checks that all elements are closed and prints a final newline. - - void startElement(const XMLString& namespaceURI, const XMLString& localName, const XMLString& qname, const Attributes& attributes); - /// Writes an XML start element tag. - /// - /// Namespaces are handled as follows. - /// 1. If a qname, but no namespaceURI and localName are given, the qname is taken as element name. - /// 2. If a namespaceURI and a localName, but no qname is given, and the given namespaceURI has been - /// declared earlier, the namespace prefix for the given namespaceURI together with the localName - /// is taken as element name. If the namespace has not been declared, a prefix in the form - /// "ns1", "ns2", etc. is generated and the namespace is declared with the generated prefix. - /// 3. If all three are given, and the namespace given in namespaceURI has not been declared, it is declared now. - /// Otherwise, see 2. - - void startElement(const XMLString& namespaceURI, const XMLString& localName, const XMLString& qname); - /// Writes an XML start element tag with no attributes. - /// See the other startElement() method for more information. - - void endElement(const XMLString& namespaceURI, const XMLString& localName, const XMLString& qname); - /// Writes an XML end element tag. - /// - /// Throws an exception if the name of doesn't match the - /// one of the most recent startElement(). - - void emptyElement(const XMLString& namespaceURI, const XMLString& localName, const XMLString& qname); - /// Writes an empty XML element tag (<elem/>). - - void emptyElement(const XMLString& namespaceURI, const XMLString& localName, const XMLString& qname, const Attributes& attributes); - /// Writes an empty XML element tag with the given attributes (<elem attr1="value1"... />). - - void characters(const XMLChar ch[], int start, int length); - /// Writes XML character data. Quotes, ampersand's, less-than and - /// greater-than signs are escaped, unless a CDATA section - /// has been opened by calling startCDATA(). - /// - /// The characters must be encoded in UTF-8 (if XMLChar is char) or - /// UTF-16 (if XMLChar is wchar_t). - - void characters(const XMLString& str); - /// Writes XML character data. Quotes, ampersand's, less-than and - /// greater-than signs are escaped, unless a CDATA section - /// has been opened by calling startCDATA(). - /// - /// The characters must be encoded in UTF-8 (if XMLChar is char) or - /// UTF-16 (if XMLChar is wchar_t). - - void rawCharacters(const XMLString& str); - /// Writes the characters in the given string as they are. - /// The caller is responsible for escaping characters as - /// necessary to produce valid XML. - /// - /// The characters must be encoded in UTF-8 (if XMLChar is char) or - /// UTF-16 (if XMLChar is wchar_t). - - void ignorableWhitespace(const XMLChar ch[], int start, int length); - /// Writes whitespace characters by simply passing them to - /// characters(). - - void processingInstruction(const XMLString& target, const XMLString& data); - /// Writes a processing instruction. - - void startPrefixMapping(const XMLString& prefix, const XMLString& namespaceURI); - /// Begin the scope of a prefix-URI Namespace mapping. - /// A namespace declaration is written with the next element. - - void endPrefixMapping(const XMLString& prefix); - /// End the scope of a prefix-URI mapping. - - void skippedEntity(const XMLString& name); - /// Does nothing. - - void dataElement(const XMLString& namespaceURI, const XMLString& localName, const XMLString& qname, const XMLString& data, - const XMLString& attr1 = XMLString(), const XMLString& value1 = XMLString(), - const XMLString& attr2 = XMLString(), const XMLString& value2 = XMLString(), - const XMLString& attr3 = XMLString(), const XMLString& value3 = XMLString()); - /// Writes a data element in the form <name attr1="value1"...>data</name>. - - // LexicalHandler - void startCDATA(); - /// Writes the <![CDATA[ string that begins a CDATA section. - /// Use characters() to write the actual character data. - - void endCDATA(); - /// Writes the ]]> string that ends a CDATA section. - - void comment(const XMLChar ch[], int start, int length); - /// Writes a comment. - - void startDTD(const XMLString& name, const XMLString& publicId, const XMLString& systemId); - /// Writes a DTD declaration. - - void endDTD(); - /// Writes the closing characters of a DTD declaration. - - void startEntity(const XMLString& name); - /// Does nothing. - - void endEntity(const XMLString& name); - /// Does nothing. - - // DTDHandler - void notationDecl(const XMLString& name, const XMLString* publicId, const XMLString* systemId); - void unparsedEntityDecl(const XMLString& name, const XMLString* publicId, const XMLString& systemId, const XMLString& notationName); - - static const std::string NEWLINE_DEFAULT; - static const std::string NEWLINE_CR; - static const std::string NEWLINE_CRLF; - static const std::string NEWLINE_LF; - - // Namespace support. - XMLString uniquePrefix(); - /// Creates and returns a unique namespace prefix that - /// can be used with startPrefixMapping(). - - bool isNamespaceMapped(const XMLString& namespc) const; - /// Returns true if the given namespace has been mapped - /// to a prefix in the current element or its ancestors. - - // Misc. - int depth() const; - /// Return the number of nested XML elements. - /// - /// Will be -1 if no document or fragment has been started, - /// 0 if the document or fragment has been started, - /// 1 if the document element has been written and - /// > 1 for every element nested within the document element. - -protected: - typedef std::map<XMLString, XMLString> AttributeMap; - typedef std::map<XMLString, std::pair<XMLString, XMLString> > CanonicalAttributeMap; - - void writeStartElement(const XMLString& namespaceURI, const XMLString& localName, const XMLString& qname, const Attributes& attributes); - void writeCanonicalStartElement(const XMLString& namespaceURI, const XMLString& localName, const XMLString& qname, const Attributes& attributes); - void writeEndElement(const XMLString& namespaceURI, const XMLString& localName, const XMLString& qname); - void writeMarkup(const std::string& str) const; - void writeXML(const XMLString& str) const; - void writeXML(XMLChar ch) const; - void writeNewLine() const; - void writeIndent() const; - void writeIndent(int indent) const; - void writeName(const XMLString& prefix, const XMLString& localName); - void writeXMLDeclaration(); - void closeStartTag(); - void declareNamespaces(const XMLString& namespaceURI, const XMLString& localName, const XMLString& qname, const Attributes& attributes); - void declareAttributeNamespaces(const Attributes& attributes); - void addNamespaceAttributes(AttributeMap& attributeMap); - void addNamespaceAttributes(CanonicalAttributeMap& attributeMap); - void addAttributes(AttributeMap& attributeMap, const Attributes& attributes, const XMLString& elementNamespaceURI); - void addAttributes(CanonicalAttributeMap& attributeMap, const Attributes& attributes, const XMLString& elementNamespaceURI); - void writeAttributes(const AttributeMap& attributeMap); - void writeAttributes(const CanonicalAttributeMap& attributeMap); - void prettyPrint() const; - static std::string nameToString(const XMLString& localName, const XMLString& qname); - -private: - struct Namespace - { - Namespace(const XMLString& thePrefix, const XMLString& theNamespaceURI): - prefix(thePrefix), - namespaceURI(theNamespaceURI) - { - } - - XMLString prefix; - XMLString namespaceURI; - }; - typedef std::vector<Name> ElementStack; - - Poco::OutputStreamConverter* _pTextConverter; - Poco::TextEncoding* _pInEncoding; - Poco::TextEncoding* _pOutEncoding; - int _options; - std::string _encoding; - std::string _newLine; - int _depth; - int _elementCount; - bool _inFragment; - bool _inCDATA; - bool _inDTD; - bool _inInternalDTD; - bool _contentWritten; - bool _unclosedStartTag; - ElementStack _elementStack; - NamespaceSupport _namespaces; - int _prefix; - bool _nsContextPushed; - std::string _indent; - - static const std::string MARKUP_QUOTENC; - static const std::string MARKUP_AMPENC; - static const std::string MARKUP_LTENC; - static const std::string MARKUP_GTENC; - static const std::string MARKUP_TABENC; - static const std::string MARKUP_CRENC; - static const std::string MARKUP_LFENC; - static const std::string MARKUP_LT; - static const std::string MARKUP_GT; - static const std::string MARKUP_SLASHGT; - static const std::string MARKUP_LTSLASH; - static const std::string MARKUP_COLON; - static const std::string MARKUP_EQQUOT; - static const std::string MARKUP_QUOT; - static const std::string MARKUP_SPACE; - static const std::string MARKUP_TAB; - static const std::string MARKUP_BEGIN_CDATA; - static const std::string MARKUP_END_CDATA; -}; - - -// -// inlines -// -inline int XMLWriter::depth() const -{ - return _depth; -} - - -} } // namespace Poco::XML - - -#endif // XML_XMLWriter_INCLUDED + /// The XMLWriter supports optional pretty-printing of the serialized XML. + /// Note, however, that pretty-printing XML data alters the + /// information set of the document being written, since in + /// XML all whitespace is potentially relevant to an application. + /// + /// The writer contains extensive support for XML Namespaces, so that a client + /// application does not have to keep track of prefixes and supply xmlns attributes. + /// + /// If the client does not provide namespace prefixes (either by specifying them + /// as part of the qualified name given to startElement(), or by calling + /// startPrefixMapping()), the XMLWriter automatically generates namespace + /// prefixes in the form ns1, ns2, etc. +{ +public: + enum Options + { + CANONICAL = 0x00, + /// Do not write an XML declaration (default). + + CANONICAL_XML = 0x01, + /// Enables basic support for Canonical XML: + /// - do not write an XML declaration + /// - do not use special empty element syntax + /// - set the New Line character to NEWLINE_LF + /// - write namespace declarations and attributes + /// in canonical order + /// - use default namespace as much as possible + + WRITE_XML_DECLARATION = 0x02, + /// Write an XML declaration. + + PRETTY_PRINT = 0x04, + /// Pretty-print XML markup. + + PRETTY_PRINT_ATTRIBUTES = 0x08 + /// Write each attribute on a separate line. + /// PRETTY_PRINT must be specified as well. + }; + + XMLWriter(XMLByteOutputStream& str, int options); + /// Creates the XMLWriter and sets the specified options. + /// + /// The resulting stream will be UTF-8 encoded. + + XMLWriter(XMLByteOutputStream& str, int options, const std::string& encodingName, Poco::TextEncoding& textEncoding); + /// Creates the XMLWriter and sets the specified options. + /// + /// The encoding is reflected in the XML declaration. + /// The caller is responsible for that the given encodingName matches with + /// the given textEncoding. + + XMLWriter(XMLByteOutputStream& str, int options, const std::string& encodingName, Poco::TextEncoding* pTextEncoding); + /// Creates the XMLWriter and sets the specified options. + /// + /// The encoding is reflected in the XML declaration. + /// The caller is responsible for that the given encodingName matches with + /// the given textEncoding. + /// If pTextEncoding is null, the given encodingName is ignored and the + /// default UTF-8 encoding is used. + + ~XMLWriter(); + /// Destroys the XMLWriter. + + void setNewLine(const std::string& newLineCharacters); + /// Sets the line ending for the resulting XML file. + /// + /// Possible values are: + /// * NEWLINE_DEFAULT (whatever is appropriate for the current platform) + /// * NEWLINE_CRLF (Windows), + /// * NEWLINE_LF (Unix), + /// * NEWLINE_CR (Macintosh) + + const std::string& getNewLine() const; + /// Returns the line ending currently in use. + + void setIndent(const std::string& indent); + /// Sets the string used for one indentation step. + /// + /// The default is a single TAB character. + /// The given string should only contain TAB or SPACE + /// characters (e.g., a single TAB character, or + /// two to four SPACE characters). + + const std::string& getIndent() const; + /// Returns the string used for one indentation step. + + // ContentHandler + void setDocumentLocator(const Locator* loc); + /// Currently unused. + + void startDocument(); + /// Writes a generic XML declaration to the stream. + /// If a document type has been set (see SetDocumentType), + /// a DOCTYPE declaration is also written. + + void endDocument(); + /// Checks that all elements are closed and prints a final newline. + + void startFragment(); + /// Use this instead of StartDocument() if you want to write + /// a fragment rather than a document (no XML declaration and + /// more than one "root" element allowed). + + void endFragment(); + /// Checks that all elements are closed and prints a final newline. + + void startElement(const XMLString& namespaceURI, const XMLString& localName, const XMLString& qname, const Attributes& attributes); + /// Writes an XML start element tag. + /// + /// Namespaces are handled as follows. + /// 1. If a qname, but no namespaceURI and localName are given, the qname is taken as element name. + /// 2. If a namespaceURI and a localName, but no qname is given, and the given namespaceURI has been + /// declared earlier, the namespace prefix for the given namespaceURI together with the localName + /// is taken as element name. If the namespace has not been declared, a prefix in the form + /// "ns1", "ns2", etc. is generated and the namespace is declared with the generated prefix. + /// 3. If all three are given, and the namespace given in namespaceURI has not been declared, it is declared now. + /// Otherwise, see 2. + + void startElement(const XMLString& namespaceURI, const XMLString& localName, const XMLString& qname); + /// Writes an XML start element tag with no attributes. + /// See the other startElement() method for more information. + + void endElement(const XMLString& namespaceURI, const XMLString& localName, const XMLString& qname); + /// Writes an XML end element tag. + /// + /// Throws an exception if the name of doesn't match the + /// one of the most recent startElement(). + + void emptyElement(const XMLString& namespaceURI, const XMLString& localName, const XMLString& qname); + /// Writes an empty XML element tag (<elem/>). + + void emptyElement(const XMLString& namespaceURI, const XMLString& localName, const XMLString& qname, const Attributes& attributes); + /// Writes an empty XML element tag with the given attributes (<elem attr1="value1"... />). + + void characters(const XMLChar ch[], int start, int length); + /// Writes XML character data. Quotes, ampersand's, less-than and + /// greater-than signs are escaped, unless a CDATA section + /// has been opened by calling startCDATA(). + /// + /// The characters must be encoded in UTF-8 (if XMLChar is char) or + /// UTF-16 (if XMLChar is wchar_t). + + void characters(const XMLString& str); + /// Writes XML character data. Quotes, ampersand's, less-than and + /// greater-than signs are escaped, unless a CDATA section + /// has been opened by calling startCDATA(). + /// + /// The characters must be encoded in UTF-8 (if XMLChar is char) or + /// UTF-16 (if XMLChar is wchar_t). + + void rawCharacters(const XMLString& str); + /// Writes the characters in the given string as they are. + /// The caller is responsible for escaping characters as + /// necessary to produce valid XML. + /// + /// The characters must be encoded in UTF-8 (if XMLChar is char) or + /// UTF-16 (if XMLChar is wchar_t). + + void ignorableWhitespace(const XMLChar ch[], int start, int length); + /// Writes whitespace characters by simply passing them to + /// characters(). + + void processingInstruction(const XMLString& target, const XMLString& data); + /// Writes a processing instruction. + + void startPrefixMapping(const XMLString& prefix, const XMLString& namespaceURI); + /// Begin the scope of a prefix-URI Namespace mapping. + /// A namespace declaration is written with the next element. + + void endPrefixMapping(const XMLString& prefix); + /// End the scope of a prefix-URI mapping. + + void skippedEntity(const XMLString& name); + /// Does nothing. + + void dataElement(const XMLString& namespaceURI, const XMLString& localName, const XMLString& qname, const XMLString& data, + const XMLString& attr1 = XMLString(), const XMLString& value1 = XMLString(), + const XMLString& attr2 = XMLString(), const XMLString& value2 = XMLString(), + const XMLString& attr3 = XMLString(), const XMLString& value3 = XMLString()); + /// Writes a data element in the form <name attr1="value1"...>data</name>. + + // LexicalHandler + void startCDATA(); + /// Writes the <![CDATA[ string that begins a CDATA section. + /// Use characters() to write the actual character data. + + void endCDATA(); + /// Writes the ]]> string that ends a CDATA section. + + void comment(const XMLChar ch[], int start, int length); + /// Writes a comment. + + void startDTD(const XMLString& name, const XMLString& publicId, const XMLString& systemId); + /// Writes a DTD declaration. + + void endDTD(); + /// Writes the closing characters of a DTD declaration. + + void startEntity(const XMLString& name); + /// Does nothing. + + void endEntity(const XMLString& name); + /// Does nothing. + + // DTDHandler + void notationDecl(const XMLString& name, const XMLString* publicId, const XMLString* systemId); + void unparsedEntityDecl(const XMLString& name, const XMLString* publicId, const XMLString& systemId, const XMLString& notationName); + + static const std::string NEWLINE_DEFAULT; + static const std::string NEWLINE_CR; + static const std::string NEWLINE_CRLF; + static const std::string NEWLINE_LF; + + // Namespace support. + XMLString uniquePrefix(); + /// Creates and returns a unique namespace prefix that + /// can be used with startPrefixMapping(). + + bool isNamespaceMapped(const XMLString& namespc) const; + /// Returns true if the given namespace has been mapped + /// to a prefix in the current element or its ancestors. + + // Misc. + int depth() const; + /// Return the number of nested XML elements. + /// + /// Will be -1 if no document or fragment has been started, + /// 0 if the document or fragment has been started, + /// 1 if the document element has been written and + /// > 1 for every element nested within the document element. + +protected: + typedef std::map<XMLString, XMLString> AttributeMap; + typedef std::map<XMLString, std::pair<XMLString, XMLString> > CanonicalAttributeMap; + + void writeStartElement(const XMLString& namespaceURI, const XMLString& localName, const XMLString& qname, const Attributes& attributes); + void writeCanonicalStartElement(const XMLString& namespaceURI, const XMLString& localName, const XMLString& qname, const Attributes& attributes); + void writeEndElement(const XMLString& namespaceURI, const XMLString& localName, const XMLString& qname); + void writeMarkup(const std::string& str) const; + void writeXML(const XMLString& str) const; + void writeXML(XMLChar ch) const; + void writeNewLine() const; + void writeIndent() const; + void writeIndent(int indent) const; + void writeName(const XMLString& prefix, const XMLString& localName); + void writeXMLDeclaration(); + void closeStartTag(); + void declareNamespaces(const XMLString& namespaceURI, const XMLString& localName, const XMLString& qname, const Attributes& attributes); + void declareAttributeNamespaces(const Attributes& attributes); + void addNamespaceAttributes(AttributeMap& attributeMap); + void addNamespaceAttributes(CanonicalAttributeMap& attributeMap); + void addAttributes(AttributeMap& attributeMap, const Attributes& attributes, const XMLString& elementNamespaceURI); + void addAttributes(CanonicalAttributeMap& attributeMap, const Attributes& attributes, const XMLString& elementNamespaceURI); + void writeAttributes(const AttributeMap& attributeMap); + void writeAttributes(const CanonicalAttributeMap& attributeMap); + void prettyPrint() const; + static std::string nameToString(const XMLString& localName, const XMLString& qname); + +private: + struct Namespace + { + Namespace(const XMLString& thePrefix, const XMLString& theNamespaceURI): + prefix(thePrefix), + namespaceURI(theNamespaceURI) + { + } + + XMLString prefix; + XMLString namespaceURI; + }; + typedef std::vector<Name> ElementStack; + + Poco::OutputStreamConverter* _pTextConverter; + Poco::TextEncoding* _pInEncoding; + Poco::TextEncoding* _pOutEncoding; + int _options; + std::string _encoding; + std::string _newLine; + int _depth; + int _elementCount; + bool _inFragment; + bool _inCDATA; + bool _inDTD; + bool _inInternalDTD; + bool _contentWritten; + bool _unclosedStartTag; + ElementStack _elementStack; + NamespaceSupport _namespaces; + int _prefix; + bool _nsContextPushed; + std::string _indent; + + static const std::string MARKUP_QUOTENC; + static const std::string MARKUP_AMPENC; + static const std::string MARKUP_LTENC; + static const std::string MARKUP_GTENC; + static const std::string MARKUP_TABENC; + static const std::string MARKUP_CRENC; + static const std::string MARKUP_LFENC; + static const std::string MARKUP_LT; + static const std::string MARKUP_GT; + static const std::string MARKUP_SLASHGT; + static const std::string MARKUP_LTSLASH; + static const std::string MARKUP_COLON; + static const std::string MARKUP_EQQUOT; + static const std::string MARKUP_QUOT; + static const std::string MARKUP_SPACE; + static const std::string MARKUP_TAB; + static const std::string MARKUP_BEGIN_CDATA; + static const std::string MARKUP_END_CDATA; +}; + + +// +// inlines +// +inline int XMLWriter::depth() const +{ + return _depth; +} + + +} } // namespace Poco::XML + + +#endif // XML_XMLWriter_INCLUDED |