mirror of
https://github.com/pocoproject/poco.git
synced 2025-02-20 14:24:35 +01:00
set eol-style to native
This commit is contained in:
parent
84fedbdb60
commit
201a0be588
62
XML/Makefile
62
XML/Makefile
@ -1,31 +1,31 @@
|
||||
#
|
||||
# Makefile
|
||||
#
|
||||
# $Id: //poco/1.2/XML/Makefile#1 $
|
||||
#
|
||||
# Makefile for Poco XML
|
||||
#
|
||||
|
||||
include $(POCO_BASE)/build/rules/global
|
||||
|
||||
COMMONFLAGS += -DXML_NS -DXML_DTD -DHAVE_EXPAT_CONFIG_H
|
||||
|
||||
objects = AbstractContainerNode AbstractNode Attr AttrMap Attributes \
|
||||
AttributesImpl CDATASection CharacterData ChildNodesList Comment \
|
||||
ContentHandler DOMBuilder DOMException DOMImplementation DOMObject \
|
||||
DOMParser DOMSerializer DOMWriter DTDHandler DTDMap DeclHandler \
|
||||
DefaultHandler Document DocumentEvent DocumentFragment DocumentType \
|
||||
Element ElementsByTagNameList Entity EntityReference EntityResolver \
|
||||
EntityResolverImpl ErrorHandler Event EventDispatcher EventException \
|
||||
EventListener EventTarget InputSource LexicalHandler Locator LocatorImpl \
|
||||
MutationEvent Name NamePool NamedNodeMap NamespaceStrategy \
|
||||
NamespaceSupport Node NodeFilter NodeIterator NodeList Notation \
|
||||
ParserEngine ProcessingInstruction SAXException SAXParser Text \
|
||||
TreeWalker WhitespaceFilter XMLException XMLFilter XMLFilterImpl XMLReader \
|
||||
XMLString XMLWriter xmlparse xmlrole xmltok
|
||||
|
||||
target = PocoXML
|
||||
target_version = $(LIBVERSION)
|
||||
target_libs = PocoFoundation
|
||||
|
||||
include $(POCO_BASE)/build/rules/lib
|
||||
#
|
||||
# Makefile
|
||||
#
|
||||
# $Id: //poco/1.2/XML/Makefile#1 $
|
||||
#
|
||||
# Makefile for Poco XML
|
||||
#
|
||||
|
||||
include $(POCO_BASE)/build/rules/global
|
||||
|
||||
COMMONFLAGS += -DXML_NS -DXML_DTD -DHAVE_EXPAT_CONFIG_H
|
||||
|
||||
objects = AbstractContainerNode AbstractNode Attr AttrMap Attributes \
|
||||
AttributesImpl CDATASection CharacterData ChildNodesList Comment \
|
||||
ContentHandler DOMBuilder DOMException DOMImplementation DOMObject \
|
||||
DOMParser DOMSerializer DOMWriter DTDHandler DTDMap DeclHandler \
|
||||
DefaultHandler Document DocumentEvent DocumentFragment DocumentType \
|
||||
Element ElementsByTagNameList Entity EntityReference EntityResolver \
|
||||
EntityResolverImpl ErrorHandler Event EventDispatcher EventException \
|
||||
EventListener EventTarget InputSource LexicalHandler Locator LocatorImpl \
|
||||
MutationEvent Name NamePool NamedNodeMap NamespaceStrategy \
|
||||
NamespaceSupport Node NodeFilter NodeIterator NodeList Notation \
|
||||
ParserEngine ProcessingInstruction SAXException SAXParser Text \
|
||||
TreeWalker WhitespaceFilter XMLException XMLFilter XMLFilterImpl XMLReader \
|
||||
XMLString XMLWriter xmlparse xmlrole xmltok
|
||||
|
||||
target = PocoXML
|
||||
target_version = $(LIBVERSION)
|
||||
target_libs = PocoFoundation
|
||||
|
||||
include $(POCO_BASE)/build/rules/lib
|
||||
|
152
XML/XML.vmsbuild
152
XML/XML.vmsbuild
@ -1,76 +1,76 @@
|
||||
#
|
||||
# XML.vmsbuild
|
||||
#
|
||||
# $Id: //poco/1.2/XML/XML.vmsbuild#1 $
|
||||
#
|
||||
DEF=HAVE_EXPAT_CONFIG_H,XML_NS,XML_DTD
|
||||
LIB=PocoXML
|
||||
AbstractContainerNode
|
||||
AbstractNode
|
||||
Attr
|
||||
AttrMap
|
||||
Attributes
|
||||
AttributesImpl
|
||||
CDATASection
|
||||
CharacterData
|
||||
ChildNodesList
|
||||
Comment
|
||||
ContentHandler
|
||||
DOMBuilder
|
||||
DOMException
|
||||
DOMImplementation
|
||||
DOMObject
|
||||
DOMParser
|
||||
DOMSerializer
|
||||
DOMWriter
|
||||
DTDHandler
|
||||
DTDMap
|
||||
DeclHandler
|
||||
DefaultHandler
|
||||
Document
|
||||
DocumentEvent
|
||||
DocumentFragment
|
||||
DocumentType
|
||||
Element
|
||||
ElementsByTagNameList
|
||||
Entity
|
||||
EntityReference
|
||||
EntityResolver
|
||||
EntityResolverImpl
|
||||
ErrorHandler
|
||||
Event
|
||||
EventDispatcher
|
||||
EventException
|
||||
EventListener
|
||||
EventTarget
|
||||
InputSource
|
||||
LexicalHandler
|
||||
Locator
|
||||
LocatorImpl
|
||||
MutationEvent
|
||||
Name
|
||||
NamePool
|
||||
NamedNodeMap
|
||||
NamespaceStrategy
|
||||
NamespaceSupport
|
||||
Node
|
||||
NodeFilter
|
||||
NodeIterator
|
||||
NodeList
|
||||
Notation
|
||||
ParserEngine
|
||||
ProcessingInstruction
|
||||
SAXException
|
||||
SAXParser
|
||||
Text
|
||||
TreeWalker
|
||||
WhitespaceFilter
|
||||
XMLException
|
||||
XMLFilter
|
||||
XMLFilterImpl
|
||||
XMLReader
|
||||
XMLString
|
||||
XMLWriter
|
||||
xmlparse
|
||||
xmlrole
|
||||
xmltok
|
||||
#
|
||||
# XML.vmsbuild
|
||||
#
|
||||
# $Id: //poco/1.2/XML/XML.vmsbuild#1 $
|
||||
#
|
||||
DEF=HAVE_EXPAT_CONFIG_H,XML_NS,XML_DTD
|
||||
LIB=PocoXML
|
||||
AbstractContainerNode
|
||||
AbstractNode
|
||||
Attr
|
||||
AttrMap
|
||||
Attributes
|
||||
AttributesImpl
|
||||
CDATASection
|
||||
CharacterData
|
||||
ChildNodesList
|
||||
Comment
|
||||
ContentHandler
|
||||
DOMBuilder
|
||||
DOMException
|
||||
DOMImplementation
|
||||
DOMObject
|
||||
DOMParser
|
||||
DOMSerializer
|
||||
DOMWriter
|
||||
DTDHandler
|
||||
DTDMap
|
||||
DeclHandler
|
||||
DefaultHandler
|
||||
Document
|
||||
DocumentEvent
|
||||
DocumentFragment
|
||||
DocumentType
|
||||
Element
|
||||
ElementsByTagNameList
|
||||
Entity
|
||||
EntityReference
|
||||
EntityResolver
|
||||
EntityResolverImpl
|
||||
ErrorHandler
|
||||
Event
|
||||
EventDispatcher
|
||||
EventException
|
||||
EventListener
|
||||
EventTarget
|
||||
InputSource
|
||||
LexicalHandler
|
||||
Locator
|
||||
LocatorImpl
|
||||
MutationEvent
|
||||
Name
|
||||
NamePool
|
||||
NamedNodeMap
|
||||
NamespaceStrategy
|
||||
NamespaceSupport
|
||||
Node
|
||||
NodeFilter
|
||||
NodeIterator
|
||||
NodeList
|
||||
Notation
|
||||
ParserEngine
|
||||
ProcessingInstruction
|
||||
SAXException
|
||||
SAXParser
|
||||
Text
|
||||
TreeWalker
|
||||
WhitespaceFilter
|
||||
XMLException
|
||||
XMLFilter
|
||||
XMLFilterImpl
|
||||
XMLReader
|
||||
XMLString
|
||||
XMLWriter
|
||||
xmlparse
|
||||
xmlrole
|
||||
xmltok
|
||||
|
@ -1,30 +1,30 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 8.00
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "XML", "XML_vs71.vcproj", "{9E211743-85FE-4977-82F3-4F04B40C912D}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestSuite", "testsuite\TestSuite_vs71.vcproj", "{C9ACF028-17A1-44C2-8C09-DFD3BD9E7D45}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{9E211743-85FE-4977-82F3-4F04B40C912D} = {9E211743-85FE-4977-82F3-4F04B40C912D}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfiguration) = preSolution
|
||||
debug_shared = debug_shared
|
||||
release_shared = release_shared
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfiguration) = postSolution
|
||||
{9E211743-85FE-4977-82F3-4F04B40C912D}.debug_shared.ActiveCfg = debug_shared|Win32
|
||||
{9E211743-85FE-4977-82F3-4F04B40C912D}.debug_shared.Build.0 = debug_shared|Win32
|
||||
{9E211743-85FE-4977-82F3-4F04B40C912D}.release_shared.ActiveCfg = release_shared|Win32
|
||||
{9E211743-85FE-4977-82F3-4F04B40C912D}.release_shared.Build.0 = release_shared|Win32
|
||||
{C9ACF028-17A1-44C2-8C09-DFD3BD9E7D45}.debug_shared.ActiveCfg = debug_shared|Win32
|
||||
{C9ACF028-17A1-44C2-8C09-DFD3BD9E7D45}.debug_shared.Build.0 = debug_shared|Win32
|
||||
{C9ACF028-17A1-44C2-8C09-DFD3BD9E7D45}.release_shared.ActiveCfg = release_shared|Win32
|
||||
{C9ACF028-17A1-44C2-8C09-DFD3BD9E7D45}.release_shared.Build.0 = release_shared|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityAddIns) = postSolution
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
Microsoft Visual Studio Solution File, Format Version 8.00
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "XML", "XML_vs71.vcproj", "{9E211743-85FE-4977-82F3-4F04B40C912D}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestSuite", "testsuite\TestSuite_vs71.vcproj", "{C9ACF028-17A1-44C2-8C09-DFD3BD9E7D45}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{9E211743-85FE-4977-82F3-4F04B40C912D} = {9E211743-85FE-4977-82F3-4F04B40C912D}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfiguration) = preSolution
|
||||
debug_shared = debug_shared
|
||||
release_shared = release_shared
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfiguration) = postSolution
|
||||
{9E211743-85FE-4977-82F3-4F04B40C912D}.debug_shared.ActiveCfg = debug_shared|Win32
|
||||
{9E211743-85FE-4977-82F3-4F04B40C912D}.debug_shared.Build.0 = debug_shared|Win32
|
||||
{9E211743-85FE-4977-82F3-4F04B40C912D}.release_shared.ActiveCfg = release_shared|Win32
|
||||
{9E211743-85FE-4977-82F3-4F04B40C912D}.release_shared.Build.0 = release_shared|Win32
|
||||
{C9ACF028-17A1-44C2-8C09-DFD3BD9E7D45}.debug_shared.ActiveCfg = debug_shared|Win32
|
||||
{C9ACF028-17A1-44C2-8C09-DFD3BD9E7D45}.debug_shared.Build.0 = debug_shared|Win32
|
||||
{C9ACF028-17A1-44C2-8C09-DFD3BD9E7D45}.release_shared.ActiveCfg = release_shared|Win32
|
||||
{C9ACF028-17A1-44C2-8C09-DFD3BD9E7D45}.release_shared.Build.0 = release_shared|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityAddIns) = postSolution
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
1354
XML/XML_vs71.vcproj
1354
XML/XML_vs71.vcproj
File diff suppressed because it is too large
Load Diff
@ -1,28 +1,28 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 9.00
|
||||
# Visual Studio 2005
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "XML", "XML_vs80.vcproj", "{9E211743-85FE-4977-82F3-4F04B40C912D}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestSuite", "testsuite\TestSuite_vs80.vcproj", "{C9ACF028-17A1-44C2-8C09-DFD3BD9E7D45}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{9E211743-85FE-4977-82F3-4F04B40C912D} = {9E211743-85FE-4977-82F3-4F04B40C912D}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
debug_shared|Win32 = debug_shared|Win32
|
||||
release_shared|Win32 = release_shared|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{9E211743-85FE-4977-82F3-4F04B40C912D}.debug_shared|Win32.ActiveCfg = debug_shared|Win32
|
||||
{9E211743-85FE-4977-82F3-4F04B40C912D}.debug_shared|Win32.Build.0 = debug_shared|Win32
|
||||
{9E211743-85FE-4977-82F3-4F04B40C912D}.release_shared|Win32.ActiveCfg = release_shared|Win32
|
||||
{9E211743-85FE-4977-82F3-4F04B40C912D}.release_shared|Win32.Build.0 = release_shared|Win32
|
||||
{C9ACF028-17A1-44C2-8C09-DFD3BD9E7D45}.debug_shared|Win32.ActiveCfg = debug_shared|Win32
|
||||
{C9ACF028-17A1-44C2-8C09-DFD3BD9E7D45}.debug_shared|Win32.Build.0 = debug_shared|Win32
|
||||
{C9ACF028-17A1-44C2-8C09-DFD3BD9E7D45}.release_shared|Win32.ActiveCfg = release_shared|Win32
|
||||
{C9ACF028-17A1-44C2-8C09-DFD3BD9E7D45}.release_shared|Win32.Build.0 = release_shared|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
Microsoft Visual Studio Solution File, Format Version 9.00
|
||||
# Visual Studio 2005
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "XML", "XML_vs80.vcproj", "{9E211743-85FE-4977-82F3-4F04B40C912D}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestSuite", "testsuite\TestSuite_vs80.vcproj", "{C9ACF028-17A1-44C2-8C09-DFD3BD9E7D45}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{9E211743-85FE-4977-82F3-4F04B40C912D} = {9E211743-85FE-4977-82F3-4F04B40C912D}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
debug_shared|Win32 = debug_shared|Win32
|
||||
release_shared|Win32 = release_shared|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{9E211743-85FE-4977-82F3-4F04B40C912D}.debug_shared|Win32.ActiveCfg = debug_shared|Win32
|
||||
{9E211743-85FE-4977-82F3-4F04B40C912D}.debug_shared|Win32.Build.0 = debug_shared|Win32
|
||||
{9E211743-85FE-4977-82F3-4F04B40C912D}.release_shared|Win32.ActiveCfg = release_shared|Win32
|
||||
{9E211743-85FE-4977-82F3-4F04B40C912D}.release_shared|Win32.Build.0 = release_shared|Win32
|
||||
{C9ACF028-17A1-44C2-8C09-DFD3BD9E7D45}.debug_shared|Win32.ActiveCfg = debug_shared|Win32
|
||||
{C9ACF028-17A1-44C2-8C09-DFD3BD9E7D45}.debug_shared|Win32.Build.0 = debug_shared|Win32
|
||||
{C9ACF028-17A1-44C2-8C09-DFD3BD9E7D45}.release_shared|Win32.ActiveCfg = release_shared|Win32
|
||||
{C9ACF028-17A1-44C2-8C09-DFD3BD9E7D45}.release_shared|Win32.Build.0 = release_shared|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
1802
XML/XML_vs80.vcproj
1802
XML/XML_vs80.vcproj
File diff suppressed because it is too large
Load Diff
@ -1,86 +1,86 @@
|
||||
//
|
||||
// AbstractContainerNode.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/DOM/AbstractContainerNode.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOM
|
||||
//
|
||||
// Definition of the AbstractContainerNode class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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;
|
||||
|
||||
protected:
|
||||
AbstractContainerNode(Document* pOwnerDocument);
|
||||
AbstractContainerNode(Document* pOwnerDocument, const AbstractContainerNode& node);
|
||||
~AbstractContainerNode();
|
||||
|
||||
void dispatchNodeRemovedFromDocument();
|
||||
void dispatchNodeInsertedIntoDocument();
|
||||
|
||||
private:
|
||||
AbstractNode* _pFirstChild;
|
||||
|
||||
friend class AbstractNode;
|
||||
};
|
||||
|
||||
|
||||
} } // namespace Poco::XML
|
||||
|
||||
|
||||
#endif // DOM_AbstractContainerNode_INCLUDED
|
||||
//
|
||||
// AbstractContainerNode.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/DOM/AbstractContainerNode.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOM
|
||||
//
|
||||
// Definition of the AbstractContainerNode class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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;
|
||||
|
||||
protected:
|
||||
AbstractContainerNode(Document* pOwnerDocument);
|
||||
AbstractContainerNode(Document* pOwnerDocument, const AbstractContainerNode& node);
|
||||
~AbstractContainerNode();
|
||||
|
||||
void dispatchNodeRemovedFromDocument();
|
||||
void dispatchNodeInsertedIntoDocument();
|
||||
|
||||
private:
|
||||
AbstractNode* _pFirstChild;
|
||||
|
||||
friend class AbstractNode;
|
||||
};
|
||||
|
||||
|
||||
} } // namespace Poco::XML
|
||||
|
||||
|
||||
#endif // DOM_AbstractContainerNode_INCLUDED
|
||||
|
@ -1,144 +1,144 @@
|
||||
//
|
||||
// AbstractNode.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/DOM/AbstractNode.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOM
|
||||
//
|
||||
// Definition of the AbstractNode class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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;
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
|
||||
} } // namespace Poco::XML
|
||||
|
||||
|
||||
#endif // DOM_AbstractNode_INCLUDED
|
||||
//
|
||||
// AbstractNode.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/DOM/AbstractNode.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOM
|
||||
//
|
||||
// Definition of the AbstractNode class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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;
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
|
||||
} } // namespace Poco::XML
|
||||
|
||||
|
||||
#endif // DOM_AbstractNode_INCLUDED
|
||||
|
@ -1,202 +1,202 @@
|
||||
//
|
||||
// Attr.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/DOM/Attr.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOM
|
||||
//
|
||||
// Definition of the DOM Attr class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/DOM/Attr.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOM
|
||||
//
|
||||
// Definition of the DOM Attr class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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
|
||||
|
@ -1,87 +1,87 @@
|
||||
//
|
||||
// AttrMap.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/DOM/AttrMap.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOM
|
||||
//
|
||||
// Definition of the AttrMap class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/DOM/AttrMap.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOM
|
||||
//
|
||||
// Definition of the AttrMap class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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
|
||||
|
@ -1,57 +1,57 @@
|
||||
//
|
||||
// AutoPtr.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/DOM/AutoPtr.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOM
|
||||
//
|
||||
// Import Poco::AutoPtr into the XML namespace.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/DOM/AutoPtr.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOM
|
||||
//
|
||||
// Import Poco::AutoPtr into the XML namespace.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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
|
||||
|
@ -1,106 +1,106 @@
|
||||
//
|
||||
// CDATASection.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/DOM/CDATASection.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOM
|
||||
//
|
||||
// Definition of the DOM CDATASection class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/DOM/CDATASection.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOM
|
||||
//
|
||||
// Definition of the DOM CDATASection class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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
|
||||
|
@ -1,145 +1,145 @@
|
||||
//
|
||||
// CharacterData.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/DOM/CharacterData.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOM
|
||||
//
|
||||
// Definition of the DOM CharacterData class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/DOM/CharacterData.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOM
|
||||
//
|
||||
// Definition of the DOM CharacterData class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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
|
||||
|
@ -1,77 +1,77 @@
|
||||
//
|
||||
// ChildNodesList.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/DOM/ChildNodesList.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOM
|
||||
//
|
||||
// Definition of the ChildNodesList class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/DOM/ChildNodesList.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOM
|
||||
//
|
||||
// Definition of the ChildNodesList class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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
|
||||
|
@ -1,80 +1,80 @@
|
||||
//
|
||||
// Comment.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/DOM/Comment.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOM
|
||||
//
|
||||
// Definition of the DOM Comment class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/DOM/Comment.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOM
|
||||
//
|
||||
// Definition of the DOM Comment class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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
|
||||
|
@ -1,131 +1,131 @@
|
||||
//
|
||||
// DOMBuilder.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/DOM/DOMBuilder.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOMBuilder
|
||||
//
|
||||
// Definition of the DOMBuilder class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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.
|
||||
|
||||
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
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/DOM/DOMBuilder.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOMBuilder
|
||||
//
|
||||
// Definition of the DOMBuilder class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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.
|
||||
|
||||
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
|
||||
|
@ -1,134 +1,134 @@
|
||||
//
|
||||
// DOMException.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/DOM/DOMException.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOM
|
||||
//
|
||||
// Definition of the DOM DOMException class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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() throw();
|
||||
/// Destroys the DOMException.
|
||||
|
||||
DOMException& operator = (const DOMException& exc);
|
||||
|
||||
const char* name() const throw();
|
||||
/// Returns a static string describing the exception.
|
||||
|
||||
const char* className() const throw();
|
||||
/// 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
|
||||
//
|
||||
// DOMException.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/DOM/DOMException.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOM
|
||||
//
|
||||
// Definition of the DOM DOMException class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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() throw();
|
||||
/// Destroys the DOMException.
|
||||
|
||||
DOMException& operator = (const DOMException& exc);
|
||||
|
||||
const char* name() const throw();
|
||||
/// Returns a static string describing the exception.
|
||||
|
||||
const char* className() const throw();
|
||||
/// 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
|
||||
|
@ -1,104 +1,104 @@
|
||||
//
|
||||
// DOMImplementation.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/DOM/DOMImplementation.h#2 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOM
|
||||
//
|
||||
// Definition of the DOM DOMImplementation class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/DOM/DOMImplementation.h#2 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOM
|
||||
//
|
||||
// Definition of the DOM DOMImplementation class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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
|
||||
|
@ -1,125 +1,125 @@
|
||||
//
|
||||
// DOMObject.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/DOM/DOMObject.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOM
|
||||
//
|
||||
// Definition of the DOMObject class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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 explicitely
|
||||
/// 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
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/DOM/DOMObject.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOM
|
||||
//
|
||||
// Definition of the DOMObject class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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 explicitely
|
||||
/// 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
|
||||
|
@ -1,126 +1,126 @@
|
||||
//
|
||||
// DOMParser.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/DOM/DOMParser.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOMParser
|
||||
//
|
||||
// Definition of the DOMParser class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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:
|
||||
DOMParser(NamePool* pNamePool = 0);
|
||||
/// Creates a new DOMParser.
|
||||
/// If a NamePool is given, it becomes the Document's NamePool.
|
||||
|
||||
~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.
|
||||
|
||||
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_WHITESPACE;
|
||||
|
||||
private:
|
||||
SAXParser _saxParser;
|
||||
NamePool* _pNamePool;
|
||||
bool _whitespace;
|
||||
};
|
||||
|
||||
|
||||
} } // namespace Poco::XML
|
||||
|
||||
|
||||
#endif // DOM_DOMParser_INCLUDED
|
||||
//
|
||||
// DOMParser.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/DOM/DOMParser.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOMParser
|
||||
//
|
||||
// Definition of the DOMParser class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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:
|
||||
DOMParser(NamePool* pNamePool = 0);
|
||||
/// Creates a new DOMParser.
|
||||
/// If a NamePool is given, it becomes the Document's NamePool.
|
||||
|
||||
~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.
|
||||
|
||||
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_WHITESPACE;
|
||||
|
||||
private:
|
||||
SAXParser _saxParser;
|
||||
NamePool* _pNamePool;
|
||||
bool _whitespace;
|
||||
};
|
||||
|
||||
|
||||
} } // namespace Poco::XML
|
||||
|
||||
|
||||
#endif // DOM_DOMParser_INCLUDED
|
||||
|
@ -1,140 +1,140 @@
|
||||
//
|
||||
// DOMSerializer.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/DOM/DOMSerializer.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOMSerializer
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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 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
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/DOM/DOMSerializer.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOMSerializer
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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 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
|
||||
|
@ -1,131 +1,131 @@
|
||||
//
|
||||
// DOMWriter.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/DOM/DOMWriter.h#2 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOMWriter
|
||||
//
|
||||
// Definition of class DOMWriter.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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 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 (std::ofstream).
|
||||
|
||||
private:
|
||||
std::string _encodingName;
|
||||
Poco::TextEncoding* _pTextEncoding;
|
||||
int _options;
|
||||
std::string _newLine;
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// 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;
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::XML
|
||||
|
||||
|
||||
#endif // DOM_DOMWriter_INCLUDED
|
||||
//
|
||||
// DOMWriter.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/DOM/DOMWriter.h#2 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOMWriter
|
||||
//
|
||||
// Definition of class DOMWriter.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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 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 (std::ofstream).
|
||||
|
||||
private:
|
||||
std::string _encodingName;
|
||||
Poco::TextEncoding* _pTextEncoding;
|
||||
int _options;
|
||||
std::string _newLine;
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// 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;
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::XML
|
||||
|
||||
|
||||
#endif // DOM_DOMWriter_INCLUDED
|
||||
|
@ -1,89 +1,89 @@
|
||||
//
|
||||
// DTDMap.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/DOM/DTDMap.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOM
|
||||
//
|
||||
// Definition of the DTDMap class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/DOM/DTDMap.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOM
|
||||
//
|
||||
// Definition of the DTDMap class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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
|
||||
|
@ -1,299 +1,299 @@
|
||||
//
|
||||
// Document.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/DOM/Document.h#2 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOM
|
||||
//
|
||||
// Definition of the DOM Document class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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/XML/XMLString.h"
|
||||
#include "Poco/XML/NamePool.h"
|
||||
#include "Poco/AutoReleasePool.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace XML {
|
||||
|
||||
|
||||
class NamePool;
|
||||
class DocumentType;
|
||||
class DOMImplementation;
|
||||
class Element;
|
||||
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;
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
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 suspeded.
|
||||
|
||||
bool events() const;
|
||||
/// Returns true if events are not suspeded.
|
||||
|
||||
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
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/DOM/Document.h#2 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOM
|
||||
//
|
||||
// Definition of the DOM Document class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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/XML/XMLString.h"
|
||||
#include "Poco/XML/NamePool.h"
|
||||
#include "Poco/AutoReleasePool.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace XML {
|
||||
|
||||
|
||||
class NamePool;
|
||||
class DocumentType;
|
||||
class DOMImplementation;
|
||||
class Element;
|
||||
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;
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
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 suspeded.
|
||||
|
||||
bool events() const;
|
||||
/// Returns true if events are not suspeded.
|
||||
|
||||
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
|
||||
|
@ -1,87 +1,87 @@
|
||||
//
|
||||
// DocumentEvent.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/DOM/DocumentEvent.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOM
|
||||
//
|
||||
// Definition of the DOM DocumentEvent interface.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/DOM/DocumentEvent.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOM
|
||||
//
|
||||
// Definition of the DOM DocumentEvent interface.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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
|
||||
|
@ -1,106 +1,106 @@
|
||||
//
|
||||
// DocumentFragment.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/DOM/DocumentFragment.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOM
|
||||
//
|
||||
// Definition of the DOM DocumentFragment class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/DOM/DocumentFragment.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOM
|
||||
//
|
||||
// Definition of the DOM DocumentFragment class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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
|
||||
|
@ -1,147 +1,147 @@
|
||||
//
|
||||
// DocumentType.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/DOM/DocumentType.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOM
|
||||
//
|
||||
// Definition of the DOM DocumentType class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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.
|
||||
///
|
||||
/// 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
|
||||
//
|
||||
// DocumentType.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/DOM/DocumentType.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOM
|
||||
//
|
||||
// Definition of the DOM DocumentType class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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.
|
||||
///
|
||||
/// 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
|
||||
|
@ -1,236 +1,236 @@
|
||||
//
|
||||
// Element.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/DOM/Element.h#2 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOM
|
||||
//
|
||||
// Definition of the DOM Element class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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.
|
||||
///
|
||||
/// 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* 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.
|
||||
///
|
||||
/// 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;
|
||||
|
||||
// Non-standard extensions
|
||||
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
|
||||
//
|
||||
// Element.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/DOM/Element.h#2 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOM
|
||||
//
|
||||
// Definition of the DOM Element class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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.
|
||||
///
|
||||
/// 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* 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.
|
||||
///
|
||||
/// 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;
|
||||
|
||||
// Non-standard extensions
|
||||
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
|
||||
|
@ -1,106 +1,106 @@
|
||||
//
|
||||
// ElementsByTagNameList.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/DOM/ElementsByTagNameList.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOM
|
||||
//
|
||||
// Definition of the ElementsByTagNameList and ElementsByTagNameListNS classes.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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 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 Element;
|
||||
friend class Document;
|
||||
};
|
||||
|
||||
|
||||
} } // namespace Poco::XML
|
||||
|
||||
|
||||
#endif // DOM_ElementsByTagNameList_INCLUDED
|
||||
//
|
||||
// ElementsByTagNameList.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/DOM/ElementsByTagNameList.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOM
|
||||
//
|
||||
// Definition of the ElementsByTagNameList and ElementsByTagNameListNS classes.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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 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 Element;
|
||||
friend class Document;
|
||||
};
|
||||
|
||||
|
||||
} } // namespace Poco::XML
|
||||
|
||||
|
||||
#endif // DOM_ElementsByTagNameList_INCLUDED
|
||||
|
@ -1,148 +1,148 @@
|
||||
//
|
||||
// Entity.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/DOM/Entity.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOM
|
||||
//
|
||||
// Definition of the DOM Entity class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/DOM/Entity.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOM
|
||||
//
|
||||
// Definition of the DOM Entity class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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
|
||||
|
@ -1,95 +1,95 @@
|
||||
//
|
||||
// EntityReference.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/DOM/EntityReference.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOM
|
||||
//
|
||||
// Definition of the DOM EntityReference class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/DOM/EntityReference.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOM
|
||||
//
|
||||
// Definition of the DOM EntityReference class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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
|
||||
|
@ -1,231 +1,231 @@
|
||||
//
|
||||
// Event.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/DOM/Event.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOMEvents
|
||||
//
|
||||
// Definition of the DOM Event class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/DOM/Event.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOMEvents
|
||||
//
|
||||
// Definition of the DOM Event class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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
|
||||
|
@ -1,119 +1,119 @@
|
||||
//
|
||||
// EventDispatcher.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/DOM/EventDispatcher.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOMEvents
|
||||
//
|
||||
// Definition of the EventDispatcher class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/DOM/EventDispatcher.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOMEvents
|
||||
//
|
||||
// Definition of the EventDispatcher class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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
|
||||
|
@ -1,103 +1,103 @@
|
||||
//
|
||||
// EventException.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/DOM/EventException.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOMEvents
|
||||
//
|
||||
// Definition of the DOM EventException class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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() throw();
|
||||
/// Destroys the EventException.
|
||||
|
||||
EventException& operator = (const EventException& exc);
|
||||
|
||||
const char* name() const throw();
|
||||
/// Returns a static string describing the exception.
|
||||
|
||||
const char* className() const throw();
|
||||
/// 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
|
||||
//
|
||||
// EventException.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/DOM/EventException.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOMEvents
|
||||
//
|
||||
// Definition of the DOM EventException class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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() throw();
|
||||
/// Destroys the EventException.
|
||||
|
||||
EventException& operator = (const EventException& exc);
|
||||
|
||||
const char* name() const throw();
|
||||
/// Returns a static string describing the exception.
|
||||
|
||||
const char* className() const throw();
|
||||
/// 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
|
||||
|
@ -1,79 +1,79 @@
|
||||
//
|
||||
// EventListener.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/DOM/EventListener.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOMEvents
|
||||
//
|
||||
// Definition of the DOM EventListener interface.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/DOM/EventListener.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOMEvents
|
||||
//
|
||||
// Definition of the DOM EventListener interface.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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
|
||||
|
@ -1,98 +1,98 @@
|
||||
//
|
||||
// EventTarget.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/DOM/EventTarget.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOMEvents
|
||||
//
|
||||
// Definition of the DOM EventTarget interface.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/DOM/EventTarget.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOMEvents
|
||||
//
|
||||
// Definition of the DOM EventTarget interface.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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
|
||||
|
@ -1,165 +1,165 @@
|
||||
//
|
||||
// MutationEvent.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/DOM/MutationEvent.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOMEvents
|
||||
//
|
||||
// Definition of the DOM MutationEvent class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/DOM/MutationEvent.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOMEvents
|
||||
//
|
||||
// Definition of the DOM MutationEvent class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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
|
||||
|
@ -1,115 +1,115 @@
|
||||
//
|
||||
// NamedNodeMap.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/DOM/NamedNodeMap.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOM
|
||||
//
|
||||
// Definition of the DOM NamedNodeMap interface.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/DOM/NamedNodeMap.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOM
|
||||
//
|
||||
// Definition of the DOM NamedNodeMap interface.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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
|
||||
|
@ -1,255 +1,255 @@
|
||||
//
|
||||
// Node.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/DOM/Node.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOM
|
||||
//
|
||||
// Definition of the DOM Node interface.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#ifndef DOM_Node_INCLUDED
|
||||
#define DOM_Node_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/XML/XML.h"
|
||||
#include "Poco/DOM/EventTarget.h"
|
||||
#include "Poco/XML/XMLString.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.
|
||||
///
|
||||
/// 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.
|
||||
///
|
||||
/// 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.
|
||||
///
|
||||
/// 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
|
||||
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.
|
||||
|
||||
protected:
|
||||
virtual ~Node();
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// inlines
|
||||
//
|
||||
inline const XMLString& Node::nodeValue() const
|
||||
{
|
||||
return getNodeValue();
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::XML
|
||||
|
||||
|
||||
#endif // DOM_Node_INCLUDED
|
||||
//
|
||||
// Node.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/DOM/Node.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOM
|
||||
//
|
||||
// Definition of the DOM Node interface.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#ifndef DOM_Node_INCLUDED
|
||||
#define DOM_Node_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/XML/XML.h"
|
||||
#include "Poco/DOM/EventTarget.h"
|
||||
#include "Poco/XML/XMLString.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.
|
||||
///
|
||||
/// 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.
|
||||
///
|
||||
/// 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.
|
||||
///
|
||||
/// 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
|
||||
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.
|
||||
|
||||
protected:
|
||||
virtual ~Node();
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// inlines
|
||||
//
|
||||
inline const XMLString& Node::nodeValue() const
|
||||
{
|
||||
return getNodeValue();
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::XML
|
||||
|
||||
|
||||
#endif // DOM_Node_INCLUDED
|
||||
|
@ -1,168 +1,168 @@
|
||||
//
|
||||
// NodeFilter.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/DOM/NodeFilter.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: NodeFilter
|
||||
//
|
||||
// Definition of the DOM NodeFilter interface.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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.)
|
||||
///
|
||||
/// Returns FILTER_ACCEPT, FILTER_REJECT or FILTER_SKIP.
|
||||
|
||||
protected:
|
||||
virtual ~NodeFilter();
|
||||
};
|
||||
|
||||
|
||||
} } // namespace Poco::XML
|
||||
|
||||
|
||||
#endif // DOM_NodeFilter_INCLUDED
|
||||
//
|
||||
// NodeFilter.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/DOM/NodeFilter.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: NodeFilter
|
||||
//
|
||||
// Definition of the DOM NodeFilter interface.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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.)
|
||||
///
|
||||
/// Returns FILTER_ACCEPT, FILTER_REJECT or FILTER_SKIP.
|
||||
|
||||
protected:
|
||||
virtual ~NodeFilter();
|
||||
};
|
||||
|
||||
|
||||
} } // namespace Poco::XML
|
||||
|
||||
|
||||
#endif // DOM_NodeFilter_INCLUDED
|
||||
|
@ -1,189 +1,189 @@
|
||||
//
|
||||
// NodeIterator.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/DOM/NodeIterator.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: NodeIterator
|
||||
//
|
||||
// Definition of the DOM NodeIterator class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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.
|
||||
///
|
||||
/// 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
|
||||
//
|
||||
// NodeIterator.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/DOM/NodeIterator.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: NodeIterator
|
||||
//
|
||||
// Definition of the DOM NodeIterator class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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.
|
||||
///
|
||||
/// 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
|
||||
|
@ -1,83 +1,83 @@
|
||||
//
|
||||
// NodeList.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/DOM/NodeList.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOM
|
||||
//
|
||||
// Definition of the DOM NodeList interface.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/DOM/NodeList.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOM
|
||||
//
|
||||
// Definition of the DOM NodeList interface.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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
|
||||
|
@ -1,115 +1,115 @@
|
||||
//
|
||||
// Notation.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/DOM/Notation.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOM
|
||||
//
|
||||
// Definition of the DOM Notation class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/DOM/Notation.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOM
|
||||
//
|
||||
// Definition of the DOM Notation class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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
|
||||
|
@ -1,121 +1,121 @@
|
||||
//
|
||||
// ProcessingInstruction.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/DOM/ProcessingInstruction.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOM
|
||||
//
|
||||
// Definition of the DOM ProcessingInstruction class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/DOM/ProcessingInstruction.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOM
|
||||
//
|
||||
// Definition of the DOM ProcessingInstruction class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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
|
||||
|
@ -1,101 +1,101 @@
|
||||
//
|
||||
// Text.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/DOM/Text.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOM
|
||||
//
|
||||
// Definition of the DOM Text class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/DOM/Text.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOM
|
||||
//
|
||||
// Definition of the DOM Text class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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
|
||||
|
@ -1,233 +1,233 @@
|
||||
//
|
||||
// TreeWalker.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/DOM/TreeWalker.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: TreeWalker
|
||||
//
|
||||
// Definition of the DOM TreeWalker class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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.
|
||||
///
|
||||
/// 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 NodeIterator.
|
||||
|
||||
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.
|
||||
///
|
||||
/// 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
|
||||
//
|
||||
// TreeWalker.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/DOM/TreeWalker.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: TreeWalker
|
||||
//
|
||||
// Definition of the DOM TreeWalker class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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.
|
||||
///
|
||||
/// 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 NodeIterator.
|
||||
|
||||
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.
|
||||
///
|
||||
/// 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
|
||||
|
@ -1,142 +1,142 @@
|
||||
//
|
||||
// Attributes.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/SAX/Attributes.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: SAX
|
||||
// Module: SAX
|
||||
//
|
||||
// SAX2 Attributes Interface.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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 XMLString getLocalName(int i) const = 0;
|
||||
/// Look up a local attribute name by index.
|
||||
|
||||
virtual XMLString getQName(int i) const = 0;
|
||||
/// Look up a qualified attribute name by index.
|
||||
|
||||
virtual 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 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 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 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 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 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 XMLString getURI(int i) const = 0;
|
||||
/// Look up a namespace URI by index.
|
||||
|
||||
protected:
|
||||
virtual ~Attributes();
|
||||
};
|
||||
|
||||
|
||||
} } // namespace Poco::XML
|
||||
|
||||
|
||||
#endif // SAX_Attributes_INCLUDED
|
||||
//
|
||||
// Attributes.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/SAX/Attributes.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: SAX
|
||||
// Module: SAX
|
||||
//
|
||||
// SAX2 Attributes Interface.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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 XMLString getLocalName(int i) const = 0;
|
||||
/// Look up a local attribute name by index.
|
||||
|
||||
virtual XMLString getQName(int i) const = 0;
|
||||
/// Look up a qualified attribute name by index.
|
||||
|
||||
virtual 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 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 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 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 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 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 XMLString getURI(int i) const = 0;
|
||||
/// Look up a namespace URI by index.
|
||||
|
||||
protected:
|
||||
virtual ~Attributes();
|
||||
};
|
||||
|
||||
|
||||
} } // namespace Poco::XML
|
||||
|
||||
|
||||
#endif // SAX_Attributes_INCLUDED
|
||||
|
@ -1,194 +1,194 @@
|
||||
//
|
||||
// AttributesImpl.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/SAX/AttributesImpl.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: SAX
|
||||
// Module: SAX
|
||||
//
|
||||
// Implementation of the SAX2 Attributes Interface.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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:
|
||||
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;
|
||||
XMLString getLocalName(int i) const;
|
||||
XMLString getQName(int i) const;
|
||||
XMLString getType(int i) const;
|
||||
XMLString getType(const XMLString& qname) const;
|
||||
XMLString getType(const XMLString& namespaceURI, const XMLString& localName) const;
|
||||
XMLString getValue(int i) const;
|
||||
XMLString getValue(const XMLString& qname) const;
|
||||
XMLString getValue(const XMLString& namespaceURI, const XMLString& localName) 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.
|
||||
|
||||
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 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.
|
||||
|
||||
struct Attribute
|
||||
{
|
||||
XMLString localName;
|
||||
XMLString namespaceURI;
|
||||
XMLString qname;
|
||||
XMLString value;
|
||||
XMLString type;
|
||||
bool specified;
|
||||
};
|
||||
typedef std::vector<Attribute> AttributeVec;
|
||||
typedef AttributeVec::const_iterator iterator;
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// inlines
|
||||
//
|
||||
inline AttributesImpl::iterator AttributesImpl::begin() const
|
||||
{
|
||||
return _attributes.begin();
|
||||
}
|
||||
|
||||
|
||||
inline AttributesImpl::iterator AttributesImpl::end() const
|
||||
{
|
||||
return _attributes.end();
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::XML
|
||||
|
||||
|
||||
#endif // SAX_AttributesImpl_INCLUDED
|
||||
//
|
||||
// AttributesImpl.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/SAX/AttributesImpl.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: SAX
|
||||
// Module: SAX
|
||||
//
|
||||
// Implementation of the SAX2 Attributes Interface.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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:
|
||||
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;
|
||||
XMLString getLocalName(int i) const;
|
||||
XMLString getQName(int i) const;
|
||||
XMLString getType(int i) const;
|
||||
XMLString getType(const XMLString& qname) const;
|
||||
XMLString getType(const XMLString& namespaceURI, const XMLString& localName) const;
|
||||
XMLString getValue(int i) const;
|
||||
XMLString getValue(const XMLString& qname) const;
|
||||
XMLString getValue(const XMLString& namespaceURI, const XMLString& localName) 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.
|
||||
|
||||
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 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.
|
||||
|
||||
struct Attribute
|
||||
{
|
||||
XMLString localName;
|
||||
XMLString namespaceURI;
|
||||
XMLString qname;
|
||||
XMLString value;
|
||||
XMLString type;
|
||||
bool specified;
|
||||
};
|
||||
typedef std::vector<Attribute> AttributeVec;
|
||||
typedef AttributeVec::const_iterator iterator;
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// inlines
|
||||
//
|
||||
inline AttributesImpl::iterator AttributesImpl::begin() const
|
||||
{
|
||||
return _attributes.begin();
|
||||
}
|
||||
|
||||
|
||||
inline AttributesImpl::iterator AttributesImpl::end() const
|
||||
{
|
||||
return _attributes.end();
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::XML
|
||||
|
||||
|
||||
#endif // SAX_AttributesImpl_INCLUDED
|
||||
|
@ -1,261 +1,261 @@
|
||||
//
|
||||
// ContentHandler.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/SAX/ContentHandler.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: SAX
|
||||
// Module: SAX
|
||||
//
|
||||
// SAX2 ContentHandler Interface.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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.
|
||||
///
|
||||
/// 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 Java char value. There
|
||||
/// are two 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.
|
||||
///
|
||||
/// 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 Java 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
|
||||
//
|
||||
// ContentHandler.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/SAX/ContentHandler.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: SAX
|
||||
// Module: SAX
|
||||
//
|
||||
// SAX2 ContentHandler Interface.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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.
|
||||
///
|
||||
/// 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 Java char value. There
|
||||
/// are two 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.
|
||||
///
|
||||
/// 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 Java 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
|
||||
|
@ -1,108 +1,108 @@
|
||||
//
|
||||
// DTDHandler.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/SAX/DTDHandler.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: SAX
|
||||
// Module: SAX
|
||||
//
|
||||
// SAX DTDHandler Interface.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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.)
|
||||
///
|
||||
/// 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 publicId maybe null, therefore we pass a pointer rather than a reference.
|
||||
|
||||
protected:
|
||||
virtual ~DTDHandler();
|
||||
};
|
||||
|
||||
|
||||
} } // namespace Poco::XML
|
||||
|
||||
|
||||
#endif // SAX_DTDHandler_INCLUDED
|
||||
//
|
||||
// DTDHandler.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/SAX/DTDHandler.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: SAX
|
||||
// Module: SAX
|
||||
//
|
||||
// SAX DTDHandler Interface.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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.)
|
||||
///
|
||||
/// 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 publicId maybe null, therefore we pass a pointer rather than a reference.
|
||||
|
||||
protected:
|
||||
virtual ~DTDHandler();
|
||||
};
|
||||
|
||||
|
||||
} } // namespace Poco::XML
|
||||
|
||||
|
||||
#endif // SAX_DTDHandler_INCLUDED
|
||||
|
@ -1,113 +1,113 @@
|
||||
//
|
||||
// DeclHandler.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/SAX/DeclHandler.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: SAX
|
||||
// Module: SAX
|
||||
//
|
||||
// SAX2-ext DeclHandler Interface.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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.
|
||||
///
|
||||
/// 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.
|
||||
///
|
||||
/// 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.
|
||||
///
|
||||
/// 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
|
||||
//
|
||||
// DeclHandler.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/SAX/DeclHandler.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: SAX
|
||||
// Module: SAX
|
||||
//
|
||||
// SAX2-ext DeclHandler Interface.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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.
|
||||
///
|
||||
/// 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.
|
||||
///
|
||||
/// 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.
|
||||
///
|
||||
/// 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
|
||||
|
@ -1,105 +1,105 @@
|
||||
//
|
||||
// DefaultHandler.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/SAX/DefaultHandler.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: SAX
|
||||
// Module: SAX
|
||||
//
|
||||
// SAX-2 DefaultHandler class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/SAX/DefaultHandler.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: SAX
|
||||
// Module: SAX
|
||||
//
|
||||
// SAX-2 DefaultHandler class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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
|
||||
|
@ -1,108 +1,108 @@
|
||||
//
|
||||
// EntityResolver.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/SAX/EntityResolver.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: SAX
|
||||
// Module: SAX
|
||||
//
|
||||
// SAX EntityResolver Interface.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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 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
|
||||
//
|
||||
// EntityResolver.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/SAX/EntityResolver.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: SAX
|
||||
// Module: SAX
|
||||
//
|
||||
// SAX EntityResolver Interface.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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 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
|
||||
|
@ -1,100 +1,100 @@
|
||||
//
|
||||
// EntityResolverImpl.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/SAX/EntityResolverImpl.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: SAX
|
||||
// Module: SAX
|
||||
//
|
||||
// An implementation of EntityResolver.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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 ifstream
|
||||
/// 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 an ifstream 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
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/SAX/EntityResolverImpl.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: SAX
|
||||
// Module: SAX
|
||||
//
|
||||
// An implementation of EntityResolver.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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 ifstream
|
||||
/// 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 an ifstream 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
|
||||
|
@ -1,114 +1,114 @@
|
||||
//
|
||||
// ErrorHandler.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/SAX/ErrorHandler.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: SAX
|
||||
// Module: SAX
|
||||
//
|
||||
// SAX ErrorHandler Interface.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/SAX/ErrorHandler.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: SAX
|
||||
// Module: SAX
|
||||
//
|
||||
// SAX ErrorHandler Interface.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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
|
||||
|
@ -1,191 +1,191 @@
|
||||
//
|
||||
// InputSource.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/SAX/InputSource.h#1 $
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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.
|
||||
///
|
||||
/// 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
|
||||
//
|
||||
// InputSource.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/SAX/InputSource.h#1 $
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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.
|
||||
///
|
||||
/// 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
|
||||
|
@ -1,147 +1,147 @@
|
||||
//
|
||||
// LexicalHandler.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/SAX/LexicalHandler.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: SAX
|
||||
// Module: SAX
|
||||
//
|
||||
// SAX2-ext LexicalHandler Interface.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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
|
||||
///
|
||||
/// 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
|
||||
//
|
||||
// LexicalHandler.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/SAX/LexicalHandler.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: SAX
|
||||
// Module: SAX
|
||||
//
|
||||
// SAX2-ext LexicalHandler Interface.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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
|
||||
///
|
||||
/// 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
|
||||
|
@ -1,125 +1,125 @@
|
||||
//
|
||||
// Locator.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/SAX/Locator.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: SAX
|
||||
// Module: SAX
|
||||
//
|
||||
// SAX Locator Interface.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/SAX/Locator.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: SAX
|
||||
// Module: SAX
|
||||
//
|
||||
// SAX Locator Interface.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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
|
||||
|
@ -1,110 +1,110 @@
|
||||
//
|
||||
// LocatorImpl.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/SAX/LocatorImpl.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: SAX
|
||||
// Module: SAX
|
||||
//
|
||||
// An implementation of the SAX Locator interface.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/SAX/LocatorImpl.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: SAX
|
||||
// Module: SAX
|
||||
//
|
||||
// An implementation of the SAX Locator interface.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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
|
||||
|
@ -1,217 +1,217 @@
|
||||
//
|
||||
// NamespaceSupport.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/SAX/NamespaceSupport.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: SAX
|
||||
// Module: SAX
|
||||
//
|
||||
// Namespace support for SAX2.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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.
|
||||
///
|
||||
/// 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(java.lang.String) 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 received the
|
||||
/// default Namespace (if any), while an unprefixed element 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
|
||||
//
|
||||
// NamespaceSupport.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/SAX/NamespaceSupport.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: SAX
|
||||
// Module: SAX
|
||||
//
|
||||
// Namespace support for SAX2.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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.
|
||||
///
|
||||
/// 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(java.lang.String) 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 received the
|
||||
/// default Namespace (if any), while an unprefixed element 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
|
||||
|
@ -1,198 +1,198 @@
|
||||
//
|
||||
// SAXException.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/SAX/SAXException.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: SAX
|
||||
// Module: SAX
|
||||
//
|
||||
// SAX exception classes.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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 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() throw();
|
||||
/// Destroy the exception.
|
||||
|
||||
SAXParseException& operator = (const SAXParseException& exc);
|
||||
/// Assignment operator.
|
||||
|
||||
const char* name() const throw();
|
||||
/// Returns a static string describing the exception.
|
||||
|
||||
const char* className() const throw();
|
||||
/// 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
|
||||
//
|
||||
// SAXException.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/SAX/SAXException.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: SAX
|
||||
// Module: SAX
|
||||
//
|
||||
// SAX exception classes.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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 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() throw();
|
||||
/// Destroy the exception.
|
||||
|
||||
SAXParseException& operator = (const SAXParseException& exc);
|
||||
/// Assignment operator.
|
||||
|
||||
const char* name() const throw();
|
||||
/// Returns a static string describing the exception.
|
||||
|
||||
const char* className() const throw();
|
||||
/// 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
|
||||
|
@ -1,118 +1,118 @@
|
||||
//
|
||||
// SAXParser.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/SAX/SAXParser.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: SAX
|
||||
// Module: SAX
|
||||
//
|
||||
// Implementation of the XMLReader interface.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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
|
||||
{
|
||||
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.
|
||||
|
||||
/// 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);
|
||||
|
||||
/// Extensions
|
||||
void parseString(const std::string& xml);
|
||||
|
||||
protected:
|
||||
void setupParse();
|
||||
|
||||
private:
|
||||
ParserEngine _engine;
|
||||
bool _namespaces;
|
||||
bool _namespacePrefixes;
|
||||
};
|
||||
|
||||
|
||||
} } // namespace Poco::XML
|
||||
|
||||
|
||||
#endif // SAX_SAXParser_INCLUDED
|
||||
//
|
||||
// SAXParser.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/SAX/SAXParser.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: SAX
|
||||
// Module: SAX
|
||||
//
|
||||
// Implementation of the XMLReader interface.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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
|
||||
{
|
||||
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.
|
||||
|
||||
/// 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);
|
||||
|
||||
/// Extensions
|
||||
void parseString(const std::string& xml);
|
||||
|
||||
protected:
|
||||
void setupParse();
|
||||
|
||||
private:
|
||||
ParserEngine _engine;
|
||||
bool _namespaces;
|
||||
bool _namespacePrefixes;
|
||||
};
|
||||
|
||||
|
||||
} } // namespace Poco::XML
|
||||
|
||||
|
||||
#endif // SAX_SAXParser_INCLUDED
|
||||
|
@ -1,103 +1,103 @@
|
||||
//
|
||||
// WhitespaceFilter.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/SAX/WhitespaceFilter.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: SAX
|
||||
// Module: WhitespaceFilter
|
||||
//
|
||||
// Definition of the WhitespaceFilter class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/SAX/WhitespaceFilter.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: SAX
|
||||
// Module: WhitespaceFilter
|
||||
//
|
||||
// Definition of the WhitespaceFilter class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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
|
||||
|
@ -1,83 +1,83 @@
|
||||
//
|
||||
// XMLFilter.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/SAX/XMLFilter.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: SAX
|
||||
// Module: SAXFilters
|
||||
//
|
||||
// SAX2 XMLFilter Interface.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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.
|
||||
///
|
||||
/// 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
|
||||
//
|
||||
// XMLFilter.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/SAX/XMLFilter.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: SAX
|
||||
// Module: SAXFilters
|
||||
//
|
||||
// SAX2 XMLFilter Interface.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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.
|
||||
///
|
||||
/// 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
|
||||
|
@ -1,153 +1,153 @@
|
||||
//
|
||||
// XMLFilterImpl.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/SAX/XMLFilterImpl.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: SAX
|
||||
// Module: SAXFilters
|
||||
//
|
||||
// SAX2 XMLFilterImpl class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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);
|
||||
|
||||
// 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
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/SAX/XMLFilterImpl.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: SAX
|
||||
// Module: SAXFilters
|
||||
//
|
||||
// SAX2 XMLFilterImpl class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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);
|
||||
|
||||
// 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
|
||||
|
@ -1,223 +1,223 @@
|
||||
//
|
||||
// XMLReader.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/SAX/XMLReader.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: SAX
|
||||
// Module: SAX
|
||||
//
|
||||
// SAX2 XMLReader Interface.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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.
|
||||
///
|
||||
/// 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.
|
||||
///
|
||||
/// 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 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.
|
||||
///
|
||||
/// 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.
|
||||
///
|
||||
/// 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.
|
||||
///
|
||||
/// 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*).
|
||||
|
||||
// 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
|
||||
//
|
||||
// XMLReader.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/SAX/XMLReader.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: SAX
|
||||
// Module: SAX
|
||||
//
|
||||
// SAX2 XMLReader Interface.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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.
|
||||
///
|
||||
/// 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.
|
||||
///
|
||||
/// 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 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.
|
||||
///
|
||||
/// 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.
|
||||
///
|
||||
/// 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.
|
||||
///
|
||||
/// 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*).
|
||||
|
||||
// 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
|
||||
|
@ -1,160 +1,160 @@
|
||||
//
|
||||
// Name.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/XML/Name.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: XML
|
||||
// Module: Name
|
||||
//
|
||||
// Definition of the Name class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/XML/Name.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: XML
|
||||
// Module: Name
|
||||
//
|
||||
// Definition of the Name class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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
|
||||
|
@ -1,96 +1,96 @@
|
||||
//
|
||||
// NamePool.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/XML/NamePool.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: XML
|
||||
// Module: NamePool
|
||||
//
|
||||
// Definition of the NamePool class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#ifndef XML_NamePool_INCLUDED
|
||||
#define XML_NamePool_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/XML/XML.h"
|
||||
#include "Poco/XML/XMLString.h"
|
||||
#include "Poco/XML/Name.h"
|
||||
|
||||
|
||||
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 = 251);
|
||||
/// Creates a name pool with room for up to size strings.
|
||||
|
||||
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;
|
||||
int _rc;
|
||||
};
|
||||
|
||||
|
||||
} } // namespace Poco::XML
|
||||
|
||||
|
||||
#endif // XML_NamePool_INCLUDED
|
||||
//
|
||||
// NamePool.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/XML/NamePool.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: XML
|
||||
// Module: NamePool
|
||||
//
|
||||
// Definition of the NamePool class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#ifndef XML_NamePool_INCLUDED
|
||||
#define XML_NamePool_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/XML/XML.h"
|
||||
#include "Poco/XML/XMLString.h"
|
||||
#include "Poco/XML/Name.h"
|
||||
|
||||
|
||||
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 = 251);
|
||||
/// Creates a name pool with room for up to size strings.
|
||||
|
||||
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;
|
||||
int _rc;
|
||||
};
|
||||
|
||||
|
||||
} } // namespace Poco::XML
|
||||
|
||||
|
||||
#endif // XML_NamePool_INCLUDED
|
||||
|
@ -1,123 +1,123 @@
|
||||
//
|
||||
// NamespaceStrategy.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/XML/NamespaceStrategy.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: XML
|
||||
// Module: NamespaceStrategy
|
||||
//
|
||||
// Definition of the NamespaceStrategy class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#ifndef XML_NamespaceStrategy_INCLUDED
|
||||
#define XML_NamespaceStrategy_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/XML/XML.h"
|
||||
#include "Poco/XML/XMLString.h"
|
||||
#include "Poco/SAX/NamespaceSupport.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;
|
||||
static const XMLString CDATA;
|
||||
static const XMLString COLON;
|
||||
};
|
||||
|
||||
|
||||
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);
|
||||
};
|
||||
|
||||
|
||||
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);
|
||||
};
|
||||
|
||||
|
||||
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);
|
||||
};
|
||||
|
||||
|
||||
} } // namespace Poco::XML
|
||||
|
||||
|
||||
#endif // XML_NamespaceStrategy_INCLUDED
|
||||
//
|
||||
// NamespaceStrategy.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/XML/NamespaceStrategy.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: XML
|
||||
// Module: NamespaceStrategy
|
||||
//
|
||||
// Definition of the NamespaceStrategy class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#ifndef XML_NamespaceStrategy_INCLUDED
|
||||
#define XML_NamespaceStrategy_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/XML/XML.h"
|
||||
#include "Poco/XML/XMLString.h"
|
||||
#include "Poco/SAX/NamespaceSupport.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;
|
||||
static const XMLString CDATA;
|
||||
static const XMLString COLON;
|
||||
};
|
||||
|
||||
|
||||
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);
|
||||
};
|
||||
|
||||
|
||||
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);
|
||||
};
|
||||
|
||||
|
||||
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);
|
||||
};
|
||||
|
||||
|
||||
} } // namespace Poco::XML
|
||||
|
||||
|
||||
#endif // XML_NamespaceStrategy_INCLUDED
|
||||
|
@ -1,340 +1,340 @@
|
||||
//
|
||||
// ParserEngine.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/XML/ParserEngine.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: XML
|
||||
// Module: ParserEngine
|
||||
//
|
||||
// Definition of the ParseEngine class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
|
||||
#ifndef XML_ParserEngine_INCLUDED
|
||||
#define XML_ParserEngine_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/XML/XML.h"
|
||||
#include "Poco/XML/expat.h"
|
||||
#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 parse(InputSource* pInputSource);
|
||||
/// Parse an XML document from the given InputSource.
|
||||
|
||||
// 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.
|
||||
|
||||
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;
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::XML
|
||||
|
||||
|
||||
#endif // XML_ParserEngine_INCLUDED
|
||||
//
|
||||
// ParserEngine.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/XML/ParserEngine.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: XML
|
||||
// Module: ParserEngine
|
||||
//
|
||||
// Definition of the ParseEngine class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
|
||||
#ifndef XML_ParserEngine_INCLUDED
|
||||
#define XML_ParserEngine_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/XML/XML.h"
|
||||
#include "Poco/XML/expat.h"
|
||||
#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 parse(InputSource* pInputSource);
|
||||
/// Parse an XML document from the given InputSource.
|
||||
|
||||
// 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.
|
||||
|
||||
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;
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::XML
|
||||
|
||||
|
||||
#endif // XML_ParserEngine_INCLUDED
|
||||
|
@ -1,70 +1,70 @@
|
||||
//
|
||||
// XML.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/XML/XML.h#1 $
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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, wheras 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)
|
||||
#define XML_API
|
||||
#endif
|
||||
|
||||
|
||||
#endif // XML_XML_INCLUDED
|
||||
//
|
||||
// XML.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/XML/XML.h#1 $
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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, wheras 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)
|
||||
#define XML_API
|
||||
#endif
|
||||
|
||||
|
||||
#endif // XML_XML_INCLUDED
|
||||
|
@ -1,59 +1,59 @@
|
||||
//
|
||||
// XMLException.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/XML/XMLException.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: XML
|
||||
// Module: XMLException
|
||||
//
|
||||
// Definition of the XMLException class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/XML/XMLException.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: XML
|
||||
// Module: XMLException
|
||||
//
|
||||
// Definition of the XMLException class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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
|
||||
|
@ -1,93 +1,93 @@
|
||||
//
|
||||
// XMLStream.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/XML/XMLStream.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: XML
|
||||
// Module: XMLStream
|
||||
//
|
||||
// Definition of the XMLByteInputStream and XMLCharInputStream classes.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/XML/XMLStream.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: XML
|
||||
// Module: XMLStream
|
||||
//
|
||||
// Definition of the XMLByteInputStream and XMLCharInputStream classes.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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
|
||||
|
@ -1,105 +1,105 @@
|
||||
//
|
||||
// XMLString.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/XML/XMLString.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: XML
|
||||
// Module: XMLString
|
||||
//
|
||||
// Definition of the XMLString class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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
|
||||
|
||||
#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;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
} } // namespace Poco::XML
|
||||
|
||||
|
||||
#endif // XML_XMLString_INCLUDED
|
||||
//
|
||||
// XMLString.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/XML/XMLString.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: XML
|
||||
// Module: XMLString
|
||||
//
|
||||
// Definition of the XMLString class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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
|
||||
|
||||
#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;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
} } // namespace Poco::XML
|
||||
|
||||
|
||||
#endif // XML_XMLString_INCLUDED
|
||||
|
@ -1,331 +1,331 @@
|
||||
//
|
||||
// XMLWriter.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/XML/XMLWriter.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: XML
|
||||
// Module: XMLWriter
|
||||
//
|
||||
// Definition of the XMLWriter class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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()).
|
||||
///
|
||||
/// 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
|
||||
WRITE_XML_DECLARATION = 0x01, /// write an XML declaration
|
||||
PRETTY_PRINT = 0x02 /// pretty-print XML markup
|
||||
};
|
||||
|
||||
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.
|
||||
|
||||
// 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;
|
||||
|
||||
protected:
|
||||
typedef std::map<XMLString, XMLString> AttributeMap;
|
||||
|
||||
void writeStartElement(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 writeName(const XMLString& prefix, const XMLString& localName);
|
||||
void writeXMLDeclaration();
|
||||
void closeStartTag();
|
||||
void declareAttributeNamespaces(const Attributes& attributes);
|
||||
void addNamespaceAttributes(AttributeMap& attributeMap);
|
||||
void addAttributes(AttributeMap& attributeMap, const Attributes& attributes, const XMLString& elementNamespaceURI);
|
||||
void writeAttributes(const AttributeMap& attributeMap);
|
||||
void prettyPrint() const;
|
||||
XMLString newPrefix();
|
||||
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;
|
||||
|
||||
static const std::string MARKUP_QUOTENC;
|
||||
static const std::string MARKUP_APOSENC;
|
||||
static const std::string MARKUP_AMPENC;
|
||||
static const std::string MARKUP_LTENC;
|
||||
static const std::string MARKUP_GTENC;
|
||||
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;
|
||||
};
|
||||
|
||||
|
||||
} } // namespace Poco::XML
|
||||
|
||||
|
||||
#endif // XML_XMLWriter_INCLUDED
|
||||
//
|
||||
// XMLWriter.h
|
||||
//
|
||||
// $Id: //poco/1.2/XML/include/Poco/XML/XMLWriter.h#1 $
|
||||
//
|
||||
// Library: XML
|
||||
// Package: XML
|
||||
// Module: XMLWriter
|
||||
//
|
||||
// Definition of the XMLWriter class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#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()).
|
||||
///
|
||||
/// 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
|
||||
WRITE_XML_DECLARATION = 0x01, /// write an XML declaration
|
||||
PRETTY_PRINT = 0x02 /// pretty-print XML markup
|
||||
};
|
||||
|
||||
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.
|
||||
|
||||
// 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;
|
||||
|
||||
protected:
|
||||
typedef std::map<XMLString, XMLString> AttributeMap;
|
||||
|
||||
void writeStartElement(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 writeName(const XMLString& prefix, const XMLString& localName);
|
||||
void writeXMLDeclaration();
|
||||
void closeStartTag();
|
||||
void declareAttributeNamespaces(const Attributes& attributes);
|
||||
void addNamespaceAttributes(AttributeMap& attributeMap);
|
||||
void addAttributes(AttributeMap& attributeMap, const Attributes& attributes, const XMLString& elementNamespaceURI);
|
||||
void writeAttributes(const AttributeMap& attributeMap);
|
||||
void prettyPrint() const;
|
||||
XMLString newPrefix();
|
||||
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;
|
||||
|
||||
static const std::string MARKUP_QUOTENC;
|
||||
static const std::string MARKUP_APOSENC;
|
||||
static const std::string MARKUP_AMPENC;
|
||||
static const std::string MARKUP_LTENC;
|
||||
static const std::string MARKUP_GTENC;
|
||||
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;
|
||||
};
|
||||
|
||||
|
||||
} } // namespace Poco::XML
|
||||
|
||||
|
||||
#endif // XML_XMLWriter_INCLUDED
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,114 +1,114 @@
|
||||
/* Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd
|
||||
See the file COPYING for copying permission.
|
||||
*/
|
||||
|
||||
#ifndef Expat_External_INCLUDED
|
||||
#define Expat_External_INCLUDED 1
|
||||
|
||||
/* External API definitions */
|
||||
|
||||
#if defined(_MSC_EXTENSIONS) && !defined(__BEOS__) && !defined(__CYGWIN__)
|
||||
#define XML_USE_MSC_EXTENSIONS 1
|
||||
#endif
|
||||
|
||||
/* Expat tries very hard to make the API boundary very specifically
|
||||
defined. There are two macros defined to control this boundary;
|
||||
each of these can be defined before including this header to
|
||||
achieve some different behavior, but doing so it not recommended or
|
||||
tested frequently.
|
||||
|
||||
XMLCALL - The calling convention to use for all calls across the
|
||||
"library boundary." This will default to cdecl, and
|
||||
try really hard to tell the compiler that's what we
|
||||
want.
|
||||
|
||||
XMLIMPORT - Whatever magic is needed to note that a function is
|
||||
to be imported from a dynamically loaded library
|
||||
(.dll, .so, or .sl, depending on your platform).
|
||||
|
||||
The XMLCALL macro was added in Expat 1.95.7. The only one which is
|
||||
expected to be directly useful in client code is XMLCALL.
|
||||
|
||||
Note that on at least some Unix versions, the Expat library must be
|
||||
compiled with the cdecl calling convention as the default since
|
||||
system headers may assume the cdecl convention.
|
||||
*/
|
||||
#ifndef XMLCALL
|
||||
#if defined(XML_USE_MSC_EXTENSIONS)
|
||||
#define XMLCALL __cdecl
|
||||
#elif defined(__GNUC__) && defined(__i386)
|
||||
#define XMLCALL __attribute__((cdecl))
|
||||
#else
|
||||
/* For any platform which uses this definition and supports more than
|
||||
one calling convention, we need to extend this definition to
|
||||
declare the convention used on that platform, if it's possible to
|
||||
do so.
|
||||
|
||||
If this is the case for your platform, please file a bug report
|
||||
with information on how to identify your platform via the C
|
||||
pre-processor and how to specify the same calling convention as the
|
||||
platform's malloc() implementation.
|
||||
*/
|
||||
#define XMLCALL
|
||||
#endif
|
||||
#endif /* not defined XMLCALL */
|
||||
|
||||
|
||||
#if !defined(XML_STATIC) && !defined(XMLIMPORT)
|
||||
#ifndef XML_BUILDING_EXPAT
|
||||
/* using Expat from an application */
|
||||
|
||||
#ifdef XML_USE_MSC_EXTENSIONS
|
||||
#define XMLIMPORT __declspec(dllimport)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif /* not defined XML_STATIC */
|
||||
|
||||
/* If we didn't define it above, define it away: */
|
||||
#ifndef XMLIMPORT
|
||||
#define XMLIMPORT
|
||||
#endif
|
||||
|
||||
|
||||
#define XMLPARSEAPI(type) XMLIMPORT type XMLCALL
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef XML_UNICODE_WCHAR_T
|
||||
#define XML_UNICODE
|
||||
#endif
|
||||
|
||||
#ifdef XML_UNICODE /* Information is UTF-16 encoded. */
|
||||
#ifdef XML_UNICODE_WCHAR_T
|
||||
typedef wchar_t XML_Char;
|
||||
typedef wchar_t XML_LChar;
|
||||
#else
|
||||
typedef unsigned short XML_Char;
|
||||
typedef char XML_LChar;
|
||||
#endif /* XML_UNICODE_WCHAR_T */
|
||||
#else /* Information is UTF-8 encoded. */
|
||||
typedef char XML_Char;
|
||||
typedef char XML_LChar;
|
||||
#endif /* XML_UNICODE */
|
||||
|
||||
#ifdef XML_LARGE_SIZE /* Use large integers for file/stream positions. */
|
||||
#if defined(XML_USE_MSC_EXTENSIONS) && _MSC_VER < 1400
|
||||
typedef __int64 XML_Index;
|
||||
typedef unsigned __int64 XML_Size;
|
||||
#else
|
||||
typedef long long XML_Index;
|
||||
typedef unsigned long long XML_Size;
|
||||
#endif
|
||||
#else
|
||||
typedef long XML_Index;
|
||||
typedef unsigned long XML_Size;
|
||||
#endif /* XML_LARGE_SIZE */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* not Expat_External_INCLUDED */
|
||||
/* Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd
|
||||
See the file COPYING for copying permission.
|
||||
*/
|
||||
|
||||
#ifndef Expat_External_INCLUDED
|
||||
#define Expat_External_INCLUDED 1
|
||||
|
||||
/* External API definitions */
|
||||
|
||||
#if defined(_MSC_EXTENSIONS) && !defined(__BEOS__) && !defined(__CYGWIN__)
|
||||
#define XML_USE_MSC_EXTENSIONS 1
|
||||
#endif
|
||||
|
||||
/* Expat tries very hard to make the API boundary very specifically
|
||||
defined. There are two macros defined to control this boundary;
|
||||
each of these can be defined before including this header to
|
||||
achieve some different behavior, but doing so it not recommended or
|
||||
tested frequently.
|
||||
|
||||
XMLCALL - The calling convention to use for all calls across the
|
||||
"library boundary." This will default to cdecl, and
|
||||
try really hard to tell the compiler that's what we
|
||||
want.
|
||||
|
||||
XMLIMPORT - Whatever magic is needed to note that a function is
|
||||
to be imported from a dynamically loaded library
|
||||
(.dll, .so, or .sl, depending on your platform).
|
||||
|
||||
The XMLCALL macro was added in Expat 1.95.7. The only one which is
|
||||
expected to be directly useful in client code is XMLCALL.
|
||||
|
||||
Note that on at least some Unix versions, the Expat library must be
|
||||
compiled with the cdecl calling convention as the default since
|
||||
system headers may assume the cdecl convention.
|
||||
*/
|
||||
#ifndef XMLCALL
|
||||
#if defined(XML_USE_MSC_EXTENSIONS)
|
||||
#define XMLCALL __cdecl
|
||||
#elif defined(__GNUC__) && defined(__i386)
|
||||
#define XMLCALL __attribute__((cdecl))
|
||||
#else
|
||||
/* For any platform which uses this definition and supports more than
|
||||
one calling convention, we need to extend this definition to
|
||||
declare the convention used on that platform, if it's possible to
|
||||
do so.
|
||||
|
||||
If this is the case for your platform, please file a bug report
|
||||
with information on how to identify your platform via the C
|
||||
pre-processor and how to specify the same calling convention as the
|
||||
platform's malloc() implementation.
|
||||
*/
|
||||
#define XMLCALL
|
||||
#endif
|
||||
#endif /* not defined XMLCALL */
|
||||
|
||||
|
||||
#if !defined(XML_STATIC) && !defined(XMLIMPORT)
|
||||
#ifndef XML_BUILDING_EXPAT
|
||||
/* using Expat from an application */
|
||||
|
||||
#ifdef XML_USE_MSC_EXTENSIONS
|
||||
#define XMLIMPORT __declspec(dllimport)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif /* not defined XML_STATIC */
|
||||
|
||||
/* If we didn't define it above, define it away: */
|
||||
#ifndef XMLIMPORT
|
||||
#define XMLIMPORT
|
||||
#endif
|
||||
|
||||
|
||||
#define XMLPARSEAPI(type) XMLIMPORT type XMLCALL
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef XML_UNICODE_WCHAR_T
|
||||
#define XML_UNICODE
|
||||
#endif
|
||||
|
||||
#ifdef XML_UNICODE /* Information is UTF-16 encoded. */
|
||||
#ifdef XML_UNICODE_WCHAR_T
|
||||
typedef wchar_t XML_Char;
|
||||
typedef wchar_t XML_LChar;
|
||||
#else
|
||||
typedef unsigned short XML_Char;
|
||||
typedef char XML_LChar;
|
||||
#endif /* XML_UNICODE_WCHAR_T */
|
||||
#else /* Information is UTF-8 encoded. */
|
||||
typedef char XML_Char;
|
||||
typedef char XML_LChar;
|
||||
#endif /* XML_UNICODE */
|
||||
|
||||
#ifdef XML_LARGE_SIZE /* Use large integers for file/stream positions. */
|
||||
#if defined(XML_USE_MSC_EXTENSIONS) && _MSC_VER < 1400
|
||||
typedef __int64 XML_Index;
|
||||
typedef unsigned __int64 XML_Size;
|
||||
#else
|
||||
typedef long long XML_Index;
|
||||
typedef unsigned long long XML_Size;
|
||||
#endif
|
||||
#else
|
||||
typedef long XML_Index;
|
||||
typedef unsigned long XML_Size;
|
||||
#endif /* XML_LARGE_SIZE */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* not Expat_External_INCLUDED */
|
||||
|
@ -1,8 +1,8 @@
|
||||
#
|
||||
# sample.vmsbuild
|
||||
#
|
||||
# $Id: //poco/1.2/XML/samples/DOMParser/DOMParser.vmsbuild#1 $
|
||||
#
|
||||
EXE=DOMParser
|
||||
DOMParser
|
||||
<SourceFilesHere>
|
||||
#
|
||||
# sample.vmsbuild
|
||||
#
|
||||
# $Id: //poco/1.2/XML/samples/DOMParser/DOMParser.vmsbuild#1 $
|
||||
#
|
||||
EXE=DOMParser
|
||||
DOMParser
|
||||
<SourceFilesHere>
|
||||
|
@ -1,149 +1,149 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="DOMParser"
|
||||
ProjectGUID="{383DAD0B-41DF-4130-B3E3-C9A6B19E9F3A}"
|
||||
Keyword="Win32Proj">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="debug_shared|Win32"
|
||||
OutputDirectory="obj\debug_shared"
|
||||
IntermediateDirectory="obj\debug_shared"
|
||||
ConfigurationType="1"
|
||||
UseOfMFC="2"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=".\include;..\..\..\Foundation\include;..\..\..\XML\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500"
|
||||
MinimalRebuild="TRUE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
BufferSecurityCheck="TRUE"
|
||||
TreatWChar_tAsBuiltInType="TRUE"
|
||||
ForceConformanceInForLoopScope="TRUE"
|
||||
RuntimeTypeInfo="TRUE"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="4"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="PocoFoundationd.lib PocoXMLd.lib"
|
||||
OutputFile="bin/DOMParserd.exe"
|
||||
LinkIncremental="2"
|
||||
AdditionalLibraryDirectories="..\..\..\lib"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile="bin/DOMParserd.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="release_shared|Win32"
|
||||
OutputDirectory="obj\release_shared"
|
||||
IntermediateDirectory="obj\release_shared"
|
||||
ConfigurationType="1"
|
||||
UseOfMFC="2"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="4"
|
||||
InlineFunctionExpansion="1"
|
||||
EnableIntrinsicFunctions="TRUE"
|
||||
FavorSizeOrSpeed="1"
|
||||
OmitFramePointers="TRUE"
|
||||
OptimizeForWindowsApplication="TRUE"
|
||||
AdditionalIncludeDirectories=".\include;..\..\..\Foundation\include;..\..\..\XML\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500"
|
||||
StringPooling="TRUE"
|
||||
RuntimeLibrary="2"
|
||||
BufferSecurityCheck="FALSE"
|
||||
TreatWChar_tAsBuiltInType="TRUE"
|
||||
ForceConformanceInForLoopScope="TRUE"
|
||||
RuntimeTypeInfo="TRUE"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="3"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="PocoFoundation.lib PocoXML.lib"
|
||||
OutputFile="bin/DOMParser.exe"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories="..\..\..\lib"
|
||||
GenerateDebugInformation="FALSE"
|
||||
ProgramDatabaseFile=""
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="">
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="">
|
||||
<File
|
||||
RelativePath=".\src\DOMParser.cpp">
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="DOMParser"
|
||||
ProjectGUID="{383DAD0B-41DF-4130-B3E3-C9A6B19E9F3A}"
|
||||
Keyword="Win32Proj">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="debug_shared|Win32"
|
||||
OutputDirectory="obj\debug_shared"
|
||||
IntermediateDirectory="obj\debug_shared"
|
||||
ConfigurationType="1"
|
||||
UseOfMFC="2"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=".\include;..\..\..\Foundation\include;..\..\..\XML\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500"
|
||||
MinimalRebuild="TRUE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
BufferSecurityCheck="TRUE"
|
||||
TreatWChar_tAsBuiltInType="TRUE"
|
||||
ForceConformanceInForLoopScope="TRUE"
|
||||
RuntimeTypeInfo="TRUE"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="4"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="PocoFoundationd.lib PocoXMLd.lib"
|
||||
OutputFile="bin/DOMParserd.exe"
|
||||
LinkIncremental="2"
|
||||
AdditionalLibraryDirectories="..\..\..\lib"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile="bin/DOMParserd.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="release_shared|Win32"
|
||||
OutputDirectory="obj\release_shared"
|
||||
IntermediateDirectory="obj\release_shared"
|
||||
ConfigurationType="1"
|
||||
UseOfMFC="2"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="4"
|
||||
InlineFunctionExpansion="1"
|
||||
EnableIntrinsicFunctions="TRUE"
|
||||
FavorSizeOrSpeed="1"
|
||||
OmitFramePointers="TRUE"
|
||||
OptimizeForWindowsApplication="TRUE"
|
||||
AdditionalIncludeDirectories=".\include;..\..\..\Foundation\include;..\..\..\XML\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500"
|
||||
StringPooling="TRUE"
|
||||
RuntimeLibrary="2"
|
||||
BufferSecurityCheck="FALSE"
|
||||
TreatWChar_tAsBuiltInType="TRUE"
|
||||
ForceConformanceInForLoopScope="TRUE"
|
||||
RuntimeTypeInfo="TRUE"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="3"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="PocoFoundation.lib PocoXML.lib"
|
||||
OutputFile="bin/DOMParser.exe"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories="..\..\..\lib"
|
||||
GenerateDebugInformation="FALSE"
|
||||
ProgramDatabaseFile=""
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="">
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="">
|
||||
<File
|
||||
RelativePath=".\src\DOMParser.cpp">
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
|
@ -1,213 +1,213 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="DOMParser"
|
||||
ProjectGUID="{383DAD0B-41DF-4130-B3E3-C9A6B19E9F3A}"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="debug_shared|Win32"
|
||||
OutputDirectory="obj\debug_shared"
|
||||
IntermediateDirectory="obj\debug_shared"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
UseOfMFC="2"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=".\include;..\..\..\Foundation\include;..\..\..\XML\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
BufferSecurityCheck="true"
|
||||
TreatWChar_tAsBuiltInType="true"
|
||||
ForceConformanceInForLoopScope="true"
|
||||
RuntimeTypeInfo="true"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="PocoFoundationd.lib PocoXMLd.lib"
|
||||
OutputFile="bin/DOMParserd.exe"
|
||||
LinkIncremental="2"
|
||||
AdditionalLibraryDirectories="..\..\..\lib"
|
||||
GenerateDebugInformation="true"
|
||||
ProgramDatabaseFile="bin/DOMParserd.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="release_shared|Win32"
|
||||
OutputDirectory="obj\release_shared"
|
||||
IntermediateDirectory="obj\release_shared"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
UseOfMFC="2"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="4"
|
||||
InlineFunctionExpansion="1"
|
||||
EnableIntrinsicFunctions="true"
|
||||
FavorSizeOrSpeed="1"
|
||||
OmitFramePointers="true"
|
||||
AdditionalIncludeDirectories=".\include;..\..\..\Foundation\include;..\..\..\XML\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500"
|
||||
StringPooling="true"
|
||||
RuntimeLibrary="2"
|
||||
BufferSecurityCheck="false"
|
||||
TreatWChar_tAsBuiltInType="true"
|
||||
ForceConformanceInForLoopScope="true"
|
||||
RuntimeTypeInfo="true"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="PocoFoundation.lib PocoXML.lib"
|
||||
OutputFile="bin/DOMParser.exe"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories="..\..\..\lib"
|
||||
GenerateDebugInformation="false"
|
||||
ProgramDatabaseFile=""
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\src\DOMParser.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="DOMParser"
|
||||
ProjectGUID="{383DAD0B-41DF-4130-B3E3-C9A6B19E9F3A}"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="debug_shared|Win32"
|
||||
OutputDirectory="obj\debug_shared"
|
||||
IntermediateDirectory="obj\debug_shared"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
UseOfMFC="2"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=".\include;..\..\..\Foundation\include;..\..\..\XML\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
BufferSecurityCheck="true"
|
||||
TreatWChar_tAsBuiltInType="true"
|
||||
ForceConformanceInForLoopScope="true"
|
||||
RuntimeTypeInfo="true"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="PocoFoundationd.lib PocoXMLd.lib"
|
||||
OutputFile="bin/DOMParserd.exe"
|
||||
LinkIncremental="2"
|
||||
AdditionalLibraryDirectories="..\..\..\lib"
|
||||
GenerateDebugInformation="true"
|
||||
ProgramDatabaseFile="bin/DOMParserd.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="release_shared|Win32"
|
||||
OutputDirectory="obj\release_shared"
|
||||
IntermediateDirectory="obj\release_shared"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
UseOfMFC="2"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="4"
|
||||
InlineFunctionExpansion="1"
|
||||
EnableIntrinsicFunctions="true"
|
||||
FavorSizeOrSpeed="1"
|
||||
OmitFramePointers="true"
|
||||
AdditionalIncludeDirectories=".\include;..\..\..\Foundation\include;..\..\..\XML\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500"
|
||||
StringPooling="true"
|
||||
RuntimeLibrary="2"
|
||||
BufferSecurityCheck="false"
|
||||
TreatWChar_tAsBuiltInType="true"
|
||||
ForceConformanceInForLoopScope="true"
|
||||
RuntimeTypeInfo="true"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="PocoFoundation.lib PocoXML.lib"
|
||||
OutputFile="bin/DOMParser.exe"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories="..\..\..\lib"
|
||||
GenerateDebugInformation="false"
|
||||
ProgramDatabaseFile=""
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\src\DOMParser.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
|
@ -1,17 +1,17 @@
|
||||
#
|
||||
# Makefile
|
||||
#
|
||||
# $Id: //poco/1.2/XML/samples/DOMParser/Makefile#1 $
|
||||
#
|
||||
# Makefile for Poco DOMParser
|
||||
#
|
||||
|
||||
include $(POCO_BASE)/build/rules/global
|
||||
|
||||
objects = DOMParser
|
||||
|
||||
target = DOMParser
|
||||
target_version = 1
|
||||
target_libs = PocoXML PocoFoundation
|
||||
|
||||
include $(POCO_BASE)/build/rules/exec
|
||||
#
|
||||
# Makefile
|
||||
#
|
||||
# $Id: //poco/1.2/XML/samples/DOMParser/Makefile#1 $
|
||||
#
|
||||
# Makefile for Poco DOMParser
|
||||
#
|
||||
|
||||
include $(POCO_BASE)/build/rules/global
|
||||
|
||||
objects = DOMParser
|
||||
|
||||
target = DOMParser
|
||||
target_version = 1
|
||||
target_libs = PocoXML PocoFoundation
|
||||
|
||||
include $(POCO_BASE)/build/rules/exec
|
||||
|
@ -1,81 +1,81 @@
|
||||
//
|
||||
// DOMParser.cpp
|
||||
//
|
||||
// $Id: //poco/1.2/XML/samples/DOMParser/src/DOMParser.cpp#1 $
|
||||
//
|
||||
// This sample demonstrates the DOMParser, AutoPtr and
|
||||
// NodeIterator classes.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#include "Poco/DOM/DOMParser.h"
|
||||
#include "Poco/DOM/Document.h"
|
||||
#include "Poco/DOM/NodeIterator.h"
|
||||
#include "Poco/DOM/NodeFilter.h"
|
||||
#include "Poco/DOM/AutoPtr.h"
|
||||
#include "Poco/SAX/InputSource.h"
|
||||
#include "Poco/Exception.h"
|
||||
#include <iostream>
|
||||
|
||||
|
||||
using Poco::XML::DOMParser;
|
||||
using Poco::XML::InputSource;
|
||||
using Poco::XML::Document;
|
||||
using Poco::XML::NodeIterator;
|
||||
using Poco::XML::NodeFilter;
|
||||
using Poco::XML::Node;
|
||||
using Poco::XML::AutoPtr;
|
||||
using Poco::Exception;
|
||||
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
// Parse an XML document from standard input
|
||||
// and use a NodeIterator to print out all nodes.
|
||||
|
||||
InputSource src(std::cin);
|
||||
try
|
||||
{
|
||||
DOMParser parser;
|
||||
AutoPtr<Document> pDoc = parser.parse(&src);
|
||||
|
||||
NodeIterator it(pDoc, NodeFilter::SHOW_ALL);
|
||||
Node* pNode = it.nextNode();
|
||||
while (pNode)
|
||||
{
|
||||
std::cout << pNode->nodeName() << ":" << pNode->nodeValue() << std::endl;
|
||||
pNode = it.nextNode();
|
||||
}
|
||||
}
|
||||
catch (Exception& exc)
|
||||
{
|
||||
std::cerr << exc.displayText() << std::endl;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
//
|
||||
// DOMParser.cpp
|
||||
//
|
||||
// $Id: //poco/1.2/XML/samples/DOMParser/src/DOMParser.cpp#1 $
|
||||
//
|
||||
// This sample demonstrates the DOMParser, AutoPtr and
|
||||
// NodeIterator classes.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#include "Poco/DOM/DOMParser.h"
|
||||
#include "Poco/DOM/Document.h"
|
||||
#include "Poco/DOM/NodeIterator.h"
|
||||
#include "Poco/DOM/NodeFilter.h"
|
||||
#include "Poco/DOM/AutoPtr.h"
|
||||
#include "Poco/SAX/InputSource.h"
|
||||
#include "Poco/Exception.h"
|
||||
#include <iostream>
|
||||
|
||||
|
||||
using Poco::XML::DOMParser;
|
||||
using Poco::XML::InputSource;
|
||||
using Poco::XML::Document;
|
||||
using Poco::XML::NodeIterator;
|
||||
using Poco::XML::NodeFilter;
|
||||
using Poco::XML::Node;
|
||||
using Poco::XML::AutoPtr;
|
||||
using Poco::Exception;
|
||||
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
// Parse an XML document from standard input
|
||||
// and use a NodeIterator to print out all nodes.
|
||||
|
||||
InputSource src(std::cin);
|
||||
try
|
||||
{
|
||||
DOMParser parser;
|
||||
AutoPtr<Document> pDoc = parser.parse(&src);
|
||||
|
||||
NodeIterator it(pDoc, NodeFilter::SHOW_ALL);
|
||||
Node* pNode = it.nextNode();
|
||||
while (pNode)
|
||||
{
|
||||
std::cout << pNode->nodeName() << ":" << pNode->nodeValue() << std::endl;
|
||||
pNode = it.nextNode();
|
||||
}
|
||||
}
|
||||
catch (Exception& exc)
|
||||
{
|
||||
std::cerr << exc.displayText() << std::endl;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
#
|
||||
# sample.vmsbuild
|
||||
#
|
||||
# $Id: //poco/1.2/XML/samples/DOMWriter/DOMWriter.vmsbuild#1 $
|
||||
#
|
||||
EXE=DOMWriter
|
||||
DOMWriter
|
||||
<SourceFilesHere>
|
||||
#
|
||||
# sample.vmsbuild
|
||||
#
|
||||
# $Id: //poco/1.2/XML/samples/DOMWriter/DOMWriter.vmsbuild#1 $
|
||||
#
|
||||
EXE=DOMWriter
|
||||
DOMWriter
|
||||
<SourceFilesHere>
|
||||
|
@ -1,149 +1,149 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="DOMWriter"
|
||||
ProjectGUID="{68F63799-6BCA-4058-89AC-DAC545C6AB0F}"
|
||||
Keyword="Win32Proj">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="debug_shared|Win32"
|
||||
OutputDirectory="obj\debug_shared"
|
||||
IntermediateDirectory="obj\debug_shared"
|
||||
ConfigurationType="1"
|
||||
UseOfMFC="2"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=".\include;..\..\..\Foundation\include;..\..\..\XML\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500"
|
||||
MinimalRebuild="TRUE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
BufferSecurityCheck="TRUE"
|
||||
TreatWChar_tAsBuiltInType="TRUE"
|
||||
ForceConformanceInForLoopScope="TRUE"
|
||||
RuntimeTypeInfo="TRUE"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="4"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="PocoFoundationd.lib PocoXMLd.lib"
|
||||
OutputFile="bin/DOMWriterd.exe"
|
||||
LinkIncremental="2"
|
||||
AdditionalLibraryDirectories="..\..\..\lib"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile="bin/DOMWriterd.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="release_shared|Win32"
|
||||
OutputDirectory="obj\release_shared"
|
||||
IntermediateDirectory="obj\release_shared"
|
||||
ConfigurationType="1"
|
||||
UseOfMFC="2"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="4"
|
||||
InlineFunctionExpansion="1"
|
||||
EnableIntrinsicFunctions="TRUE"
|
||||
FavorSizeOrSpeed="1"
|
||||
OmitFramePointers="TRUE"
|
||||
OptimizeForWindowsApplication="TRUE"
|
||||
AdditionalIncludeDirectories=".\include;..\..\..\Foundation\include;..\..\..\XML\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500"
|
||||
StringPooling="TRUE"
|
||||
RuntimeLibrary="2"
|
||||
BufferSecurityCheck="FALSE"
|
||||
TreatWChar_tAsBuiltInType="TRUE"
|
||||
ForceConformanceInForLoopScope="TRUE"
|
||||
RuntimeTypeInfo="TRUE"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="3"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="PocoFoundation.lib PocoXML.lib"
|
||||
OutputFile="bin/DOMWriter.exe"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories="..\..\..\lib"
|
||||
GenerateDebugInformation="FALSE"
|
||||
ProgramDatabaseFile=""
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="">
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="">
|
||||
<File
|
||||
RelativePath=".\src\DOMWriter.cpp">
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="DOMWriter"
|
||||
ProjectGUID="{68F63799-6BCA-4058-89AC-DAC545C6AB0F}"
|
||||
Keyword="Win32Proj">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="debug_shared|Win32"
|
||||
OutputDirectory="obj\debug_shared"
|
||||
IntermediateDirectory="obj\debug_shared"
|
||||
ConfigurationType="1"
|
||||
UseOfMFC="2"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=".\include;..\..\..\Foundation\include;..\..\..\XML\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500"
|
||||
MinimalRebuild="TRUE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
BufferSecurityCheck="TRUE"
|
||||
TreatWChar_tAsBuiltInType="TRUE"
|
||||
ForceConformanceInForLoopScope="TRUE"
|
||||
RuntimeTypeInfo="TRUE"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="4"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="PocoFoundationd.lib PocoXMLd.lib"
|
||||
OutputFile="bin/DOMWriterd.exe"
|
||||
LinkIncremental="2"
|
||||
AdditionalLibraryDirectories="..\..\..\lib"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile="bin/DOMWriterd.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="release_shared|Win32"
|
||||
OutputDirectory="obj\release_shared"
|
||||
IntermediateDirectory="obj\release_shared"
|
||||
ConfigurationType="1"
|
||||
UseOfMFC="2"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="4"
|
||||
InlineFunctionExpansion="1"
|
||||
EnableIntrinsicFunctions="TRUE"
|
||||
FavorSizeOrSpeed="1"
|
||||
OmitFramePointers="TRUE"
|
||||
OptimizeForWindowsApplication="TRUE"
|
||||
AdditionalIncludeDirectories=".\include;..\..\..\Foundation\include;..\..\..\XML\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500"
|
||||
StringPooling="TRUE"
|
||||
RuntimeLibrary="2"
|
||||
BufferSecurityCheck="FALSE"
|
||||
TreatWChar_tAsBuiltInType="TRUE"
|
||||
ForceConformanceInForLoopScope="TRUE"
|
||||
RuntimeTypeInfo="TRUE"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="3"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="PocoFoundation.lib PocoXML.lib"
|
||||
OutputFile="bin/DOMWriter.exe"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories="..\..\..\lib"
|
||||
GenerateDebugInformation="FALSE"
|
||||
ProgramDatabaseFile=""
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="">
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="">
|
||||
<File
|
||||
RelativePath=".\src\DOMWriter.cpp">
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
|
@ -1,213 +1,213 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="DOMWriter"
|
||||
ProjectGUID="{68F63799-6BCA-4058-89AC-DAC545C6AB0F}"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="debug_shared|Win32"
|
||||
OutputDirectory="obj\debug_shared"
|
||||
IntermediateDirectory="obj\debug_shared"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
UseOfMFC="2"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=".\include;..\..\..\Foundation\include;..\..\..\XML\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
BufferSecurityCheck="true"
|
||||
TreatWChar_tAsBuiltInType="true"
|
||||
ForceConformanceInForLoopScope="true"
|
||||
RuntimeTypeInfo="true"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="PocoFoundationd.lib PocoXMLd.lib"
|
||||
OutputFile="bin/DOMWriterd.exe"
|
||||
LinkIncremental="2"
|
||||
AdditionalLibraryDirectories="..\..\..\lib"
|
||||
GenerateDebugInformation="true"
|
||||
ProgramDatabaseFile="bin/DOMWriterd.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="release_shared|Win32"
|
||||
OutputDirectory="obj\release_shared"
|
||||
IntermediateDirectory="obj\release_shared"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
UseOfMFC="2"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="4"
|
||||
InlineFunctionExpansion="1"
|
||||
EnableIntrinsicFunctions="true"
|
||||
FavorSizeOrSpeed="1"
|
||||
OmitFramePointers="true"
|
||||
AdditionalIncludeDirectories=".\include;..\..\..\Foundation\include;..\..\..\XML\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500"
|
||||
StringPooling="true"
|
||||
RuntimeLibrary="2"
|
||||
BufferSecurityCheck="false"
|
||||
TreatWChar_tAsBuiltInType="true"
|
||||
ForceConformanceInForLoopScope="true"
|
||||
RuntimeTypeInfo="true"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="PocoFoundation.lib PocoXML.lib"
|
||||
OutputFile="bin/DOMWriter.exe"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories="..\..\..\lib"
|
||||
GenerateDebugInformation="false"
|
||||
ProgramDatabaseFile=""
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\src\DOMWriter.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="DOMWriter"
|
||||
ProjectGUID="{68F63799-6BCA-4058-89AC-DAC545C6AB0F}"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="debug_shared|Win32"
|
||||
OutputDirectory="obj\debug_shared"
|
||||
IntermediateDirectory="obj\debug_shared"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
UseOfMFC="2"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=".\include;..\..\..\Foundation\include;..\..\..\XML\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
BufferSecurityCheck="true"
|
||||
TreatWChar_tAsBuiltInType="true"
|
||||
ForceConformanceInForLoopScope="true"
|
||||
RuntimeTypeInfo="true"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="PocoFoundationd.lib PocoXMLd.lib"
|
||||
OutputFile="bin/DOMWriterd.exe"
|
||||
LinkIncremental="2"
|
||||
AdditionalLibraryDirectories="..\..\..\lib"
|
||||
GenerateDebugInformation="true"
|
||||
ProgramDatabaseFile="bin/DOMWriterd.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="release_shared|Win32"
|
||||
OutputDirectory="obj\release_shared"
|
||||
IntermediateDirectory="obj\release_shared"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
UseOfMFC="2"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="4"
|
||||
InlineFunctionExpansion="1"
|
||||
EnableIntrinsicFunctions="true"
|
||||
FavorSizeOrSpeed="1"
|
||||
OmitFramePointers="true"
|
||||
AdditionalIncludeDirectories=".\include;..\..\..\Foundation\include;..\..\..\XML\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500"
|
||||
StringPooling="true"
|
||||
RuntimeLibrary="2"
|
||||
BufferSecurityCheck="false"
|
||||
TreatWChar_tAsBuiltInType="true"
|
||||
ForceConformanceInForLoopScope="true"
|
||||
RuntimeTypeInfo="true"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="PocoFoundation.lib PocoXML.lib"
|
||||
OutputFile="bin/DOMWriter.exe"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories="..\..\..\lib"
|
||||
GenerateDebugInformation="false"
|
||||
ProgramDatabaseFile=""
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\src\DOMWriter.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
|
@ -1,17 +1,17 @@
|
||||
#
|
||||
# Makefile
|
||||
#
|
||||
# $Id: //poco/1.2/XML/samples/DOMWriter/Makefile#1 $
|
||||
#
|
||||
# Makefile for Poco DOMWriter
|
||||
#
|
||||
|
||||
include $(POCO_BASE)/build/rules/global
|
||||
|
||||
objects = DOMWriter
|
||||
|
||||
target = DOMWriter
|
||||
target_version = 1
|
||||
target_libs = PocoXML PocoFoundation
|
||||
|
||||
include $(POCO_BASE)/build/rules/exec
|
||||
#
|
||||
# Makefile
|
||||
#
|
||||
# $Id: //poco/1.2/XML/samples/DOMWriter/Makefile#1 $
|
||||
#
|
||||
# Makefile for Poco DOMWriter
|
||||
#
|
||||
|
||||
include $(POCO_BASE)/build/rules/global
|
||||
|
||||
objects = DOMWriter
|
||||
|
||||
target = DOMWriter
|
||||
target_version = 1
|
||||
target_libs = PocoXML PocoFoundation
|
||||
|
||||
include $(POCO_BASE)/build/rules/exec
|
||||
|
@ -1,78 +1,78 @@
|
||||
//
|
||||
// DOMWriter.cpp
|
||||
//
|
||||
// $Id: //poco/1.2/XML/samples/DOMWriter/src/DOMWriter.cpp#1 $
|
||||
//
|
||||
// This sample demonstrates the DOMWriter class and how to
|
||||
// build DOM documents in memory.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#include "Poco/DOM/Document.h"
|
||||
#include "Poco/DOM/Element.h"
|
||||
#include "Poco/DOM/Text.h"
|
||||
#include "Poco/DOM/AutoPtr.h"
|
||||
#include "Poco/DOM/DOMWriter.h"
|
||||
#include "Poco/XML/XMLWriter.h"
|
||||
#include <iostream>
|
||||
|
||||
|
||||
using Poco::XML::Document;
|
||||
using Poco::XML::Element;
|
||||
using Poco::XML::Text;
|
||||
using Poco::XML::AutoPtr;
|
||||
using Poco::XML::DOMWriter;
|
||||
using Poco::XML::XMLWriter;
|
||||
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
// build a DOM document and write it to standard output.
|
||||
|
||||
AutoPtr<Document> pDoc = new Document;
|
||||
|
||||
AutoPtr<Element> pRoot = pDoc->createElement("root");
|
||||
pDoc->appendChild(pRoot);
|
||||
|
||||
AutoPtr<Element> pChild1 = pDoc->createElement("child1");
|
||||
AutoPtr<Text> pText1 = pDoc->createTextNode("text1");
|
||||
pChild1->appendChild(pText1);
|
||||
pRoot->appendChild(pChild1);
|
||||
|
||||
AutoPtr<Element> pChild2 = pDoc->createElement("child2");
|
||||
AutoPtr<Text> pText2 = pDoc->createTextNode("text2");
|
||||
pChild2->appendChild(pText2);
|
||||
pRoot->appendChild(pChild2);
|
||||
|
||||
DOMWriter writer;
|
||||
writer.setNewLine("\n");
|
||||
writer.setOptions(XMLWriter::PRETTY_PRINT);
|
||||
writer.writeNode(std::cout, pDoc);
|
||||
|
||||
return 0;
|
||||
}
|
||||
//
|
||||
// DOMWriter.cpp
|
||||
//
|
||||
// $Id: //poco/1.2/XML/samples/DOMWriter/src/DOMWriter.cpp#1 $
|
||||
//
|
||||
// This sample demonstrates the DOMWriter class and how to
|
||||
// build DOM documents in memory.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#include "Poco/DOM/Document.h"
|
||||
#include "Poco/DOM/Element.h"
|
||||
#include "Poco/DOM/Text.h"
|
||||
#include "Poco/DOM/AutoPtr.h"
|
||||
#include "Poco/DOM/DOMWriter.h"
|
||||
#include "Poco/XML/XMLWriter.h"
|
||||
#include <iostream>
|
||||
|
||||
|
||||
using Poco::XML::Document;
|
||||
using Poco::XML::Element;
|
||||
using Poco::XML::Text;
|
||||
using Poco::XML::AutoPtr;
|
||||
using Poco::XML::DOMWriter;
|
||||
using Poco::XML::XMLWriter;
|
||||
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
// build a DOM document and write it to standard output.
|
||||
|
||||
AutoPtr<Document> pDoc = new Document;
|
||||
|
||||
AutoPtr<Element> pRoot = pDoc->createElement("root");
|
||||
pDoc->appendChild(pRoot);
|
||||
|
||||
AutoPtr<Element> pChild1 = pDoc->createElement("child1");
|
||||
AutoPtr<Text> pText1 = pDoc->createTextNode("text1");
|
||||
pChild1->appendChild(pText1);
|
||||
pRoot->appendChild(pChild1);
|
||||
|
||||
AutoPtr<Element> pChild2 = pDoc->createElement("child2");
|
||||
AutoPtr<Text> pText2 = pDoc->createTextNode("text2");
|
||||
pChild2->appendChild(pText2);
|
||||
pRoot->appendChild(pChild2);
|
||||
|
||||
DOMWriter writer;
|
||||
writer.setNewLine("\n");
|
||||
writer.setOptions(XMLWriter::PRETTY_PRINT);
|
||||
writer.writeNode(std::cout, pDoc);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,15 +1,15 @@
|
||||
#
|
||||
# Makefile
|
||||
#
|
||||
# $Id: //poco/1.2/XML/samples/Makefile#1 $
|
||||
#
|
||||
# Makefile for Poco XML Samples
|
||||
#
|
||||
|
||||
.PHONY: projects
|
||||
clean all: projects
|
||||
projects:
|
||||
$(MAKE) -C DOMParser $(MAKECMDGOALS)
|
||||
$(MAKE) -C DOMWriter $(MAKECMDGOALS)
|
||||
$(MAKE) -C PrettyPrint $(MAKECMDGOALS)
|
||||
$(MAKE) -C SAXParser $(MAKECMDGOALS)
|
||||
#
|
||||
# Makefile
|
||||
#
|
||||
# $Id: //poco/1.2/XML/samples/Makefile#1 $
|
||||
#
|
||||
# Makefile for Poco XML Samples
|
||||
#
|
||||
|
||||
.PHONY: projects
|
||||
clean all: projects
|
||||
projects:
|
||||
$(MAKE) -C DOMParser $(MAKECMDGOALS)
|
||||
$(MAKE) -C DOMWriter $(MAKECMDGOALS)
|
||||
$(MAKE) -C PrettyPrint $(MAKECMDGOALS)
|
||||
$(MAKE) -C SAXParser $(MAKECMDGOALS)
|
||||
|
@ -1,17 +1,17 @@
|
||||
#
|
||||
# Makefile
|
||||
#
|
||||
# $Id: //poco/1.2/XML/samples/PrettyPrint/Makefile#1 $
|
||||
#
|
||||
# Makefile for Poco PrettyPrint
|
||||
#
|
||||
|
||||
include $(POCO_BASE)/build/rules/global
|
||||
|
||||
objects = PrettyPrint
|
||||
|
||||
target = PrettyPrint
|
||||
target_version = 1
|
||||
target_libs = PocoXML PocoFoundation
|
||||
|
||||
include $(POCO_BASE)/build/rules/exec
|
||||
#
|
||||
# Makefile
|
||||
#
|
||||
# $Id: //poco/1.2/XML/samples/PrettyPrint/Makefile#1 $
|
||||
#
|
||||
# Makefile for Poco PrettyPrint
|
||||
#
|
||||
|
||||
include $(POCO_BASE)/build/rules/global
|
||||
|
||||
objects = PrettyPrint
|
||||
|
||||
target = PrettyPrint
|
||||
target_version = 1
|
||||
target_libs = PocoXML PocoFoundation
|
||||
|
||||
include $(POCO_BASE)/build/rules/exec
|
||||
|
@ -1,8 +1,8 @@
|
||||
#
|
||||
# sample.vmsbuild
|
||||
#
|
||||
# $Id: //poco/1.2/XML/samples/PrettyPrint/PrettyPrint.vmsbuild#1 $
|
||||
#
|
||||
EXE=PrettyPrint
|
||||
PrettyPrint
|
||||
<SourceFilesHere>
|
||||
#
|
||||
# sample.vmsbuild
|
||||
#
|
||||
# $Id: //poco/1.2/XML/samples/PrettyPrint/PrettyPrint.vmsbuild#1 $
|
||||
#
|
||||
EXE=PrettyPrint
|
||||
PrettyPrint
|
||||
<SourceFilesHere>
|
||||
|
@ -1,149 +1,149 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="PrettyPrint"
|
||||
ProjectGUID="{5A6FC255-BE1D-4E09-A680-A67FF16E832F}"
|
||||
Keyword="Win32Proj">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="debug_shared|Win32"
|
||||
OutputDirectory="obj\debug_shared"
|
||||
IntermediateDirectory="obj\debug_shared"
|
||||
ConfigurationType="1"
|
||||
UseOfMFC="2"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=".\include;..\..\..\Foundation\include;..\..\..\XML\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500"
|
||||
MinimalRebuild="TRUE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
BufferSecurityCheck="TRUE"
|
||||
TreatWChar_tAsBuiltInType="TRUE"
|
||||
ForceConformanceInForLoopScope="TRUE"
|
||||
RuntimeTypeInfo="TRUE"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="4"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="PocoFoundationd.lib PocoXMLd.lib"
|
||||
OutputFile="bin/PrettyPrintd.exe"
|
||||
LinkIncremental="2"
|
||||
AdditionalLibraryDirectories="..\..\..\lib"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile="bin/PrettyPrintd.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="release_shared|Win32"
|
||||
OutputDirectory="obj\release_shared"
|
||||
IntermediateDirectory="obj\release_shared"
|
||||
ConfigurationType="1"
|
||||
UseOfMFC="2"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="4"
|
||||
InlineFunctionExpansion="1"
|
||||
EnableIntrinsicFunctions="TRUE"
|
||||
FavorSizeOrSpeed="1"
|
||||
OmitFramePointers="TRUE"
|
||||
OptimizeForWindowsApplication="TRUE"
|
||||
AdditionalIncludeDirectories=".\include;..\..\..\Foundation\include;..\..\..\XML\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500"
|
||||
StringPooling="TRUE"
|
||||
RuntimeLibrary="2"
|
||||
BufferSecurityCheck="FALSE"
|
||||
TreatWChar_tAsBuiltInType="TRUE"
|
||||
ForceConformanceInForLoopScope="TRUE"
|
||||
RuntimeTypeInfo="TRUE"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="3"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="PocoFoundation.lib PocoXML.lib"
|
||||
OutputFile="bin/PrettyPrint.exe"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories="..\..\..\lib"
|
||||
GenerateDebugInformation="FALSE"
|
||||
ProgramDatabaseFile=""
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="">
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="">
|
||||
<File
|
||||
RelativePath=".\src\PrettyPrint.cpp">
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="PrettyPrint"
|
||||
ProjectGUID="{5A6FC255-BE1D-4E09-A680-A67FF16E832F}"
|
||||
Keyword="Win32Proj">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="debug_shared|Win32"
|
||||
OutputDirectory="obj\debug_shared"
|
||||
IntermediateDirectory="obj\debug_shared"
|
||||
ConfigurationType="1"
|
||||
UseOfMFC="2"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=".\include;..\..\..\Foundation\include;..\..\..\XML\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500"
|
||||
MinimalRebuild="TRUE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
BufferSecurityCheck="TRUE"
|
||||
TreatWChar_tAsBuiltInType="TRUE"
|
||||
ForceConformanceInForLoopScope="TRUE"
|
||||
RuntimeTypeInfo="TRUE"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="4"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="PocoFoundationd.lib PocoXMLd.lib"
|
||||
OutputFile="bin/PrettyPrintd.exe"
|
||||
LinkIncremental="2"
|
||||
AdditionalLibraryDirectories="..\..\..\lib"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile="bin/PrettyPrintd.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="release_shared|Win32"
|
||||
OutputDirectory="obj\release_shared"
|
||||
IntermediateDirectory="obj\release_shared"
|
||||
ConfigurationType="1"
|
||||
UseOfMFC="2"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="4"
|
||||
InlineFunctionExpansion="1"
|
||||
EnableIntrinsicFunctions="TRUE"
|
||||
FavorSizeOrSpeed="1"
|
||||
OmitFramePointers="TRUE"
|
||||
OptimizeForWindowsApplication="TRUE"
|
||||
AdditionalIncludeDirectories=".\include;..\..\..\Foundation\include;..\..\..\XML\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500"
|
||||
StringPooling="TRUE"
|
||||
RuntimeLibrary="2"
|
||||
BufferSecurityCheck="FALSE"
|
||||
TreatWChar_tAsBuiltInType="TRUE"
|
||||
ForceConformanceInForLoopScope="TRUE"
|
||||
RuntimeTypeInfo="TRUE"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="3"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="PocoFoundation.lib PocoXML.lib"
|
||||
OutputFile="bin/PrettyPrint.exe"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories="..\..\..\lib"
|
||||
GenerateDebugInformation="FALSE"
|
||||
ProgramDatabaseFile=""
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="">
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="">
|
||||
<File
|
||||
RelativePath=".\src\PrettyPrint.cpp">
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
|
@ -1,213 +1,213 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="PrettyPrint"
|
||||
ProjectGUID="{5A6FC255-BE1D-4E09-A680-A67FF16E832F}"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="debug_shared|Win32"
|
||||
OutputDirectory="obj\debug_shared"
|
||||
IntermediateDirectory="obj\debug_shared"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
UseOfMFC="2"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=".\include;..\..\..\Foundation\include;..\..\..\XML\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
BufferSecurityCheck="true"
|
||||
TreatWChar_tAsBuiltInType="true"
|
||||
ForceConformanceInForLoopScope="true"
|
||||
RuntimeTypeInfo="true"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="PocoFoundationd.lib PocoXMLd.lib"
|
||||
OutputFile="bin/PrettyPrintd.exe"
|
||||
LinkIncremental="2"
|
||||
AdditionalLibraryDirectories="..\..\..\lib"
|
||||
GenerateDebugInformation="true"
|
||||
ProgramDatabaseFile="bin/PrettyPrintd.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="release_shared|Win32"
|
||||
OutputDirectory="obj\release_shared"
|
||||
IntermediateDirectory="obj\release_shared"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
UseOfMFC="2"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="4"
|
||||
InlineFunctionExpansion="1"
|
||||
EnableIntrinsicFunctions="true"
|
||||
FavorSizeOrSpeed="1"
|
||||
OmitFramePointers="true"
|
||||
AdditionalIncludeDirectories=".\include;..\..\..\Foundation\include;..\..\..\XML\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500"
|
||||
StringPooling="true"
|
||||
RuntimeLibrary="2"
|
||||
BufferSecurityCheck="false"
|
||||
TreatWChar_tAsBuiltInType="true"
|
||||
ForceConformanceInForLoopScope="true"
|
||||
RuntimeTypeInfo="true"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="PocoFoundation.lib PocoXML.lib"
|
||||
OutputFile="bin/PrettyPrint.exe"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories="..\..\..\lib"
|
||||
GenerateDebugInformation="false"
|
||||
ProgramDatabaseFile=""
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\src\PrettyPrint.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="PrettyPrint"
|
||||
ProjectGUID="{5A6FC255-BE1D-4E09-A680-A67FF16E832F}"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="debug_shared|Win32"
|
||||
OutputDirectory="obj\debug_shared"
|
||||
IntermediateDirectory="obj\debug_shared"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
UseOfMFC="2"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=".\include;..\..\..\Foundation\include;..\..\..\XML\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
BufferSecurityCheck="true"
|
||||
TreatWChar_tAsBuiltInType="true"
|
||||
ForceConformanceInForLoopScope="true"
|
||||
RuntimeTypeInfo="true"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="PocoFoundationd.lib PocoXMLd.lib"
|
||||
OutputFile="bin/PrettyPrintd.exe"
|
||||
LinkIncremental="2"
|
||||
AdditionalLibraryDirectories="..\..\..\lib"
|
||||
GenerateDebugInformation="true"
|
||||
ProgramDatabaseFile="bin/PrettyPrintd.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="release_shared|Win32"
|
||||
OutputDirectory="obj\release_shared"
|
||||
IntermediateDirectory="obj\release_shared"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
UseOfMFC="2"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="4"
|
||||
InlineFunctionExpansion="1"
|
||||
EnableIntrinsicFunctions="true"
|
||||
FavorSizeOrSpeed="1"
|
||||
OmitFramePointers="true"
|
||||
AdditionalIncludeDirectories=".\include;..\..\..\Foundation\include;..\..\..\XML\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500"
|
||||
StringPooling="true"
|
||||
RuntimeLibrary="2"
|
||||
BufferSecurityCheck="false"
|
||||
TreatWChar_tAsBuiltInType="true"
|
||||
ForceConformanceInForLoopScope="true"
|
||||
RuntimeTypeInfo="true"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="PocoFoundation.lib PocoXML.lib"
|
||||
OutputFile="bin/PrettyPrint.exe"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories="..\..\..\lib"
|
||||
GenerateDebugInformation="false"
|
||||
ProgramDatabaseFile=""
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\src\PrettyPrint.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
|
@ -1,78 +1,78 @@
|
||||
//
|
||||
// PrettyPrint.cpp
|
||||
//
|
||||
// $Id: //poco/1.2/XML/samples/PrettyPrint/src/PrettyPrint.cpp#1 $
|
||||
//
|
||||
// This sample demonstrates the SAXParser, WhitespaceFilter,
|
||||
// InputSource and XMLWriter classes.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#include "Poco/SAX/SAXParser.h"
|
||||
#include "Poco/SAX/WhitespaceFilter.h"
|
||||
#include "Poco/SAX/InputSource.h"
|
||||
#include "Poco/XML/XMLWriter.h"
|
||||
#include "Poco/Exception.h"
|
||||
#include <iostream>
|
||||
|
||||
|
||||
using Poco::XML::SAXParser;
|
||||
using Poco::XML::XMLReader;
|
||||
using Poco::XML::WhitespaceFilter;
|
||||
using Poco::XML::InputSource;
|
||||
using Poco::XML::XMLWriter;
|
||||
using Poco::Exception;
|
||||
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
// read XML from standard input and pretty-print it to standard output
|
||||
|
||||
SAXParser parser;
|
||||
WhitespaceFilter filter(&parser);
|
||||
|
||||
XMLWriter writer(std::cout, XMLWriter::CANONICAL | XMLWriter::PRETTY_PRINT);
|
||||
writer.setNewLine(XMLWriter::NEWLINE_LF);
|
||||
|
||||
filter.setContentHandler(&writer);
|
||||
filter.setDTDHandler(&writer);
|
||||
filter.setProperty(XMLReader::PROPERTY_LEXICAL_HANDLER, static_cast<Poco::XML::LexicalHandler*>(&writer));
|
||||
|
||||
try
|
||||
{
|
||||
InputSource source(std::cin);
|
||||
filter.parse(&source);
|
||||
}
|
||||
catch (Exception& exc)
|
||||
{
|
||||
std::cerr << exc.displayText() << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
//
|
||||
// PrettyPrint.cpp
|
||||
//
|
||||
// $Id: //poco/1.2/XML/samples/PrettyPrint/src/PrettyPrint.cpp#1 $
|
||||
//
|
||||
// This sample demonstrates the SAXParser, WhitespaceFilter,
|
||||
// InputSource and XMLWriter classes.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#include "Poco/SAX/SAXParser.h"
|
||||
#include "Poco/SAX/WhitespaceFilter.h"
|
||||
#include "Poco/SAX/InputSource.h"
|
||||
#include "Poco/XML/XMLWriter.h"
|
||||
#include "Poco/Exception.h"
|
||||
#include <iostream>
|
||||
|
||||
|
||||
using Poco::XML::SAXParser;
|
||||
using Poco::XML::XMLReader;
|
||||
using Poco::XML::WhitespaceFilter;
|
||||
using Poco::XML::InputSource;
|
||||
using Poco::XML::XMLWriter;
|
||||
using Poco::Exception;
|
||||
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
// read XML from standard input and pretty-print it to standard output
|
||||
|
||||
SAXParser parser;
|
||||
WhitespaceFilter filter(&parser);
|
||||
|
||||
XMLWriter writer(std::cout, XMLWriter::CANONICAL | XMLWriter::PRETTY_PRINT);
|
||||
writer.setNewLine(XMLWriter::NEWLINE_LF);
|
||||
|
||||
filter.setContentHandler(&writer);
|
||||
filter.setDTDHandler(&writer);
|
||||
filter.setProperty(XMLReader::PROPERTY_LEXICAL_HANDLER, static_cast<Poco::XML::LexicalHandler*>(&writer));
|
||||
|
||||
try
|
||||
{
|
||||
InputSource source(std::cin);
|
||||
filter.parse(&source);
|
||||
}
|
||||
catch (Exception& exc)
|
||||
{
|
||||
std::cerr << exc.displayText() << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,17 +1,17 @@
|
||||
#
|
||||
# Makefile
|
||||
#
|
||||
# $Id: //poco/1.2/XML/samples/SAXParser/Makefile#1 $
|
||||
#
|
||||
# Makefile for Poco SAXParser
|
||||
#
|
||||
|
||||
include $(POCO_BASE)/build/rules/global
|
||||
|
||||
objects = SAXParser
|
||||
|
||||
target = SAXParser
|
||||
target_version = 1
|
||||
target_libs = PocoXML PocoFoundation
|
||||
|
||||
include $(POCO_BASE)/build/rules/exec
|
||||
#
|
||||
# Makefile
|
||||
#
|
||||
# $Id: //poco/1.2/XML/samples/SAXParser/Makefile#1 $
|
||||
#
|
||||
# Makefile for Poco SAXParser
|
||||
#
|
||||
|
||||
include $(POCO_BASE)/build/rules/global
|
||||
|
||||
objects = SAXParser
|
||||
|
||||
target = SAXParser
|
||||
target_version = 1
|
||||
target_libs = PocoXML PocoFoundation
|
||||
|
||||
include $(POCO_BASE)/build/rules/exec
|
||||
|
@ -1,8 +1,8 @@
|
||||
#
|
||||
# sample.vmsbuild
|
||||
#
|
||||
# $Id: //poco/1.2/XML/samples/SAXParser/SAXParser.vmsbuild#1 $
|
||||
#
|
||||
EXE=SAXParser
|
||||
SAXParser
|
||||
<SourceFilesHere>
|
||||
#
|
||||
# sample.vmsbuild
|
||||
#
|
||||
# $Id: //poco/1.2/XML/samples/SAXParser/SAXParser.vmsbuild#1 $
|
||||
#
|
||||
EXE=SAXParser
|
||||
SAXParser
|
||||
<SourceFilesHere>
|
||||
|
@ -1,149 +1,149 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="SAXParser"
|
||||
ProjectGUID="{7E4D1B8E-B4FE-432A-92C9-352C98B646B4}"
|
||||
Keyword="Win32Proj">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="debug_shared|Win32"
|
||||
OutputDirectory="obj\debug_shared"
|
||||
IntermediateDirectory="obj\debug_shared"
|
||||
ConfigurationType="1"
|
||||
UseOfMFC="2"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=".\include;..\..\..\Foundation\include;..\..\..\XML\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500"
|
||||
MinimalRebuild="TRUE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
BufferSecurityCheck="TRUE"
|
||||
TreatWChar_tAsBuiltInType="TRUE"
|
||||
ForceConformanceInForLoopScope="TRUE"
|
||||
RuntimeTypeInfo="TRUE"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="4"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="PocoFoundationd.lib PocoXMLd.lib"
|
||||
OutputFile="bin/SAXParserd.exe"
|
||||
LinkIncremental="2"
|
||||
AdditionalLibraryDirectories="..\..\..\lib"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile="bin/SAXParserd.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="release_shared|Win32"
|
||||
OutputDirectory="obj\release_shared"
|
||||
IntermediateDirectory="obj\release_shared"
|
||||
ConfigurationType="1"
|
||||
UseOfMFC="2"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="4"
|
||||
InlineFunctionExpansion="1"
|
||||
EnableIntrinsicFunctions="TRUE"
|
||||
FavorSizeOrSpeed="1"
|
||||
OmitFramePointers="TRUE"
|
||||
OptimizeForWindowsApplication="TRUE"
|
||||
AdditionalIncludeDirectories=".\include;..\..\..\Foundation\include;..\..\..\XML\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500"
|
||||
StringPooling="TRUE"
|
||||
RuntimeLibrary="2"
|
||||
BufferSecurityCheck="FALSE"
|
||||
TreatWChar_tAsBuiltInType="TRUE"
|
||||
ForceConformanceInForLoopScope="TRUE"
|
||||
RuntimeTypeInfo="TRUE"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="3"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="PocoFoundation.lib PocoXML.lib"
|
||||
OutputFile="bin/SAXParser.exe"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories="..\..\..\lib"
|
||||
GenerateDebugInformation="FALSE"
|
||||
ProgramDatabaseFile=""
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="">
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="">
|
||||
<File
|
||||
RelativePath=".\src\SAXParser.cpp">
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="SAXParser"
|
||||
ProjectGUID="{7E4D1B8E-B4FE-432A-92C9-352C98B646B4}"
|
||||
Keyword="Win32Proj">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="debug_shared|Win32"
|
||||
OutputDirectory="obj\debug_shared"
|
||||
IntermediateDirectory="obj\debug_shared"
|
||||
ConfigurationType="1"
|
||||
UseOfMFC="2"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=".\include;..\..\..\Foundation\include;..\..\..\XML\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500"
|
||||
MinimalRebuild="TRUE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
BufferSecurityCheck="TRUE"
|
||||
TreatWChar_tAsBuiltInType="TRUE"
|
||||
ForceConformanceInForLoopScope="TRUE"
|
||||
RuntimeTypeInfo="TRUE"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="4"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="PocoFoundationd.lib PocoXMLd.lib"
|
||||
OutputFile="bin/SAXParserd.exe"
|
||||
LinkIncremental="2"
|
||||
AdditionalLibraryDirectories="..\..\..\lib"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile="bin/SAXParserd.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="release_shared|Win32"
|
||||
OutputDirectory="obj\release_shared"
|
||||
IntermediateDirectory="obj\release_shared"
|
||||
ConfigurationType="1"
|
||||
UseOfMFC="2"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="4"
|
||||
InlineFunctionExpansion="1"
|
||||
EnableIntrinsicFunctions="TRUE"
|
||||
FavorSizeOrSpeed="1"
|
||||
OmitFramePointers="TRUE"
|
||||
OptimizeForWindowsApplication="TRUE"
|
||||
AdditionalIncludeDirectories=".\include;..\..\..\Foundation\include;..\..\..\XML\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500"
|
||||
StringPooling="TRUE"
|
||||
RuntimeLibrary="2"
|
||||
BufferSecurityCheck="FALSE"
|
||||
TreatWChar_tAsBuiltInType="TRUE"
|
||||
ForceConformanceInForLoopScope="TRUE"
|
||||
RuntimeTypeInfo="TRUE"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="3"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="PocoFoundation.lib PocoXML.lib"
|
||||
OutputFile="bin/SAXParser.exe"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories="..\..\..\lib"
|
||||
GenerateDebugInformation="FALSE"
|
||||
ProgramDatabaseFile=""
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="">
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="">
|
||||
<File
|
||||
RelativePath=".\src\SAXParser.cpp">
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
|
@ -1,213 +1,213 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="SAXParser"
|
||||
ProjectGUID="{7E4D1B8E-B4FE-432A-92C9-352C98B646B4}"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="debug_shared|Win32"
|
||||
OutputDirectory="obj\debug_shared"
|
||||
IntermediateDirectory="obj\debug_shared"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
UseOfMFC="2"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=".\include;..\..\..\Foundation\include;..\..\..\XML\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
BufferSecurityCheck="true"
|
||||
TreatWChar_tAsBuiltInType="true"
|
||||
ForceConformanceInForLoopScope="true"
|
||||
RuntimeTypeInfo="true"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="PocoFoundationd.lib PocoXMLd.lib"
|
||||
OutputFile="bin/SAXParserd.exe"
|
||||
LinkIncremental="2"
|
||||
AdditionalLibraryDirectories="..\..\..\lib"
|
||||
GenerateDebugInformation="true"
|
||||
ProgramDatabaseFile="bin/SAXParserd.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="release_shared|Win32"
|
||||
OutputDirectory="obj\release_shared"
|
||||
IntermediateDirectory="obj\release_shared"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
UseOfMFC="2"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="4"
|
||||
InlineFunctionExpansion="1"
|
||||
EnableIntrinsicFunctions="true"
|
||||
FavorSizeOrSpeed="1"
|
||||
OmitFramePointers="true"
|
||||
AdditionalIncludeDirectories=".\include;..\..\..\Foundation\include;..\..\..\XML\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500"
|
||||
StringPooling="true"
|
||||
RuntimeLibrary="2"
|
||||
BufferSecurityCheck="false"
|
||||
TreatWChar_tAsBuiltInType="true"
|
||||
ForceConformanceInForLoopScope="true"
|
||||
RuntimeTypeInfo="true"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="PocoFoundation.lib PocoXML.lib"
|
||||
OutputFile="bin/SAXParser.exe"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories="..\..\..\lib"
|
||||
GenerateDebugInformation="false"
|
||||
ProgramDatabaseFile=""
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\src\SAXParser.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="SAXParser"
|
||||
ProjectGUID="{7E4D1B8E-B4FE-432A-92C9-352C98B646B4}"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="debug_shared|Win32"
|
||||
OutputDirectory="obj\debug_shared"
|
||||
IntermediateDirectory="obj\debug_shared"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
UseOfMFC="2"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=".\include;..\..\..\Foundation\include;..\..\..\XML\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
BufferSecurityCheck="true"
|
||||
TreatWChar_tAsBuiltInType="true"
|
||||
ForceConformanceInForLoopScope="true"
|
||||
RuntimeTypeInfo="true"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="PocoFoundationd.lib PocoXMLd.lib"
|
||||
OutputFile="bin/SAXParserd.exe"
|
||||
LinkIncremental="2"
|
||||
AdditionalLibraryDirectories="..\..\..\lib"
|
||||
GenerateDebugInformation="true"
|
||||
ProgramDatabaseFile="bin/SAXParserd.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="release_shared|Win32"
|
||||
OutputDirectory="obj\release_shared"
|
||||
IntermediateDirectory="obj\release_shared"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
UseOfMFC="2"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="4"
|
||||
InlineFunctionExpansion="1"
|
||||
EnableIntrinsicFunctions="true"
|
||||
FavorSizeOrSpeed="1"
|
||||
OmitFramePointers="true"
|
||||
AdditionalIncludeDirectories=".\include;..\..\..\Foundation\include;..\..\..\XML\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500"
|
||||
StringPooling="true"
|
||||
RuntimeLibrary="2"
|
||||
BufferSecurityCheck="false"
|
||||
TreatWChar_tAsBuiltInType="true"
|
||||
ForceConformanceInForLoopScope="true"
|
||||
RuntimeTypeInfo="true"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="PocoFoundation.lib PocoXML.lib"
|
||||
OutputFile="bin/SAXParser.exe"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories="..\..\..\lib"
|
||||
GenerateDebugInformation="false"
|
||||
ProgramDatabaseFile=""
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\src\SAXParser.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
|
@ -1,215 +1,215 @@
|
||||
//
|
||||
// SAXParser.cpp
|
||||
//
|
||||
// $Id: //poco/1.2/XML/samples/SAXParser/src/SAXParser.cpp#1 $
|
||||
//
|
||||
// This sample demonstrates the SAXParser class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#include "Poco/SAX/SAXParser.h"
|
||||
#include "Poco/SAX/ContentHandler.h"
|
||||
#include "Poco/SAX/LexicalHandler.h"
|
||||
#include "Poco/SAX/Attributes.h"
|
||||
#include "Poco/SAX/Locator.h"
|
||||
#include "Poco/Exception.h"
|
||||
#include <iostream>
|
||||
|
||||
|
||||
using Poco::XML::SAXParser;
|
||||
using Poco::XML::XMLReader;
|
||||
using Poco::XML::XMLString;
|
||||
using Poco::XML::XMLChar;
|
||||
using Poco::XML::ContentHandler;
|
||||
using Poco::XML::LexicalHandler;
|
||||
using Poco::XML::Attributes;
|
||||
using Poco::XML::Locator;
|
||||
|
||||
|
||||
class MyHandler: public ContentHandler, public LexicalHandler
|
||||
{
|
||||
public:
|
||||
MyHandler():
|
||||
_pLocator(0)
|
||||
{
|
||||
}
|
||||
|
||||
// ContentHandler
|
||||
void setDocumentLocator(const Locator* loc)
|
||||
{
|
||||
_pLocator = loc;
|
||||
}
|
||||
|
||||
void startDocument()
|
||||
{
|
||||
where("startDocument");
|
||||
}
|
||||
|
||||
void endDocument()
|
||||
{
|
||||
where("endDocument");
|
||||
}
|
||||
|
||||
void startElement(const XMLString& uri, const XMLString& localName, const XMLString& qname, const Attributes& attributes)
|
||||
{
|
||||
where("startElement");
|
||||
std::cout << "uri: " << uri << std::endl
|
||||
<< "localName: " << localName << std::endl
|
||||
<< "qname: " << qname << std::endl;
|
||||
std::cout << "Attributes: " << std::endl;
|
||||
for (int i = 0; i < attributes.getLength(); ++i)
|
||||
{
|
||||
std::cout << attributes.getLocalName(i) << "=" << attributes.getValue(i) << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
void endElement(const XMLString& uri, const XMLString& localName, const XMLString& qname)
|
||||
{
|
||||
where("endElement");
|
||||
}
|
||||
|
||||
void characters(const XMLChar ch[], int start, int length)
|
||||
{
|
||||
where("characters");
|
||||
std::cout << std::string(ch + start, length) << std::endl;
|
||||
}
|
||||
|
||||
void ignorableWhitespace(const XMLChar ch[], int start, int length)
|
||||
{
|
||||
where("ignorableWhitespace");
|
||||
}
|
||||
|
||||
void processingInstruction(const XMLString& target, const XMLString& data)
|
||||
{
|
||||
where("processingInstruction");
|
||||
std::cout << "target=" << target << ", data=" << data << std::endl;
|
||||
}
|
||||
|
||||
void startPrefixMapping(const XMLString& prefix, const XMLString& uri)
|
||||
{
|
||||
where("startPrefixMapping");
|
||||
std::cout << "prefix=" << prefix << " uri=" << uri << std::endl;
|
||||
}
|
||||
|
||||
void endPrefixMapping(const XMLString& prefix)
|
||||
{
|
||||
where("endPrefixMapping");
|
||||
std::cout << "prefix=" << prefix << std::endl;
|
||||
}
|
||||
|
||||
void skippedEntity(const XMLString& name)
|
||||
{
|
||||
where("skippedEntity");
|
||||
std::cout << "name=" << name << std::endl;
|
||||
}
|
||||
|
||||
// LexicalHandler
|
||||
void startDTD(const XMLString& name, const XMLString& publicId, const XMLString& systemId)
|
||||
{
|
||||
where("startDTD");
|
||||
}
|
||||
|
||||
void endDTD()
|
||||
{
|
||||
where("endDTD");
|
||||
}
|
||||
|
||||
void startEntity(const XMLString& name)
|
||||
{
|
||||
where("startEntity");
|
||||
}
|
||||
|
||||
void endEntity(const XMLString& name)
|
||||
{
|
||||
where("endEntity");
|
||||
}
|
||||
|
||||
void startCDATA()
|
||||
{
|
||||
where("startCDATA");
|
||||
}
|
||||
|
||||
void endCDATA()
|
||||
{
|
||||
where("endCDATA");
|
||||
}
|
||||
|
||||
void comment(const XMLChar ch[], int start, int length)
|
||||
{
|
||||
where("comment");
|
||||
}
|
||||
|
||||
protected:
|
||||
void where(const std::string& meth)
|
||||
{
|
||||
std::cout << "*** " << meth;
|
||||
if (_pLocator)
|
||||
{
|
||||
std::cout << " in "
|
||||
<< _pLocator->getSystemId()
|
||||
<< ", line " << _pLocator->getLineNumber()
|
||||
<< ", col " << _pLocator->getColumnNumber()
|
||||
<< std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
const Locator* _pLocator;
|
||||
};
|
||||
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
// parse an XML document and print the generated SAX events
|
||||
|
||||
if (argc < 2)
|
||||
{
|
||||
std::cout << "usage: " << argv[0] << ": <xmlfile>" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
MyHandler handler;
|
||||
|
||||
SAXParser parser;
|
||||
parser.setFeature(XMLReader::FEATURE_NAMESPACES, true);
|
||||
parser.setFeature(XMLReader::FEATURE_NAMESPACE_PREFIXES, true);
|
||||
parser.setContentHandler(&handler);
|
||||
parser.setProperty(XMLReader::PROPERTY_LEXICAL_HANDLER, static_cast<LexicalHandler*>(&handler));
|
||||
|
||||
try
|
||||
{
|
||||
parser.parse(argv[1]);
|
||||
}
|
||||
catch (Poco::Exception& e)
|
||||
{
|
||||
std::cerr << e.displayText() << std::endl;
|
||||
return 2;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
//
|
||||
// SAXParser.cpp
|
||||
//
|
||||
// $Id: //poco/1.2/XML/samples/SAXParser/src/SAXParser.cpp#1 $
|
||||
//
|
||||
// This sample demonstrates the SAXParser class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#include "Poco/SAX/SAXParser.h"
|
||||
#include "Poco/SAX/ContentHandler.h"
|
||||
#include "Poco/SAX/LexicalHandler.h"
|
||||
#include "Poco/SAX/Attributes.h"
|
||||
#include "Poco/SAX/Locator.h"
|
||||
#include "Poco/Exception.h"
|
||||
#include <iostream>
|
||||
|
||||
|
||||
using Poco::XML::SAXParser;
|
||||
using Poco::XML::XMLReader;
|
||||
using Poco::XML::XMLString;
|
||||
using Poco::XML::XMLChar;
|
||||
using Poco::XML::ContentHandler;
|
||||
using Poco::XML::LexicalHandler;
|
||||
using Poco::XML::Attributes;
|
||||
using Poco::XML::Locator;
|
||||
|
||||
|
||||
class MyHandler: public ContentHandler, public LexicalHandler
|
||||
{
|
||||
public:
|
||||
MyHandler():
|
||||
_pLocator(0)
|
||||
{
|
||||
}
|
||||
|
||||
// ContentHandler
|
||||
void setDocumentLocator(const Locator* loc)
|
||||
{
|
||||
_pLocator = loc;
|
||||
}
|
||||
|
||||
void startDocument()
|
||||
{
|
||||
where("startDocument");
|
||||
}
|
||||
|
||||
void endDocument()
|
||||
{
|
||||
where("endDocument");
|
||||
}
|
||||
|
||||
void startElement(const XMLString& uri, const XMLString& localName, const XMLString& qname, const Attributes& attributes)
|
||||
{
|
||||
where("startElement");
|
||||
std::cout << "uri: " << uri << std::endl
|
||||
<< "localName: " << localName << std::endl
|
||||
<< "qname: " << qname << std::endl;
|
||||
std::cout << "Attributes: " << std::endl;
|
||||
for (int i = 0; i < attributes.getLength(); ++i)
|
||||
{
|
||||
std::cout << attributes.getLocalName(i) << "=" << attributes.getValue(i) << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
void endElement(const XMLString& uri, const XMLString& localName, const XMLString& qname)
|
||||
{
|
||||
where("endElement");
|
||||
}
|
||||
|
||||
void characters(const XMLChar ch[], int start, int length)
|
||||
{
|
||||
where("characters");
|
||||
std::cout << std::string(ch + start, length) << std::endl;
|
||||
}
|
||||
|
||||
void ignorableWhitespace(const XMLChar ch[], int start, int length)
|
||||
{
|
||||
where("ignorableWhitespace");
|
||||
}
|
||||
|
||||
void processingInstruction(const XMLString& target, const XMLString& data)
|
||||
{
|
||||
where("processingInstruction");
|
||||
std::cout << "target=" << target << ", data=" << data << std::endl;
|
||||
}
|
||||
|
||||
void startPrefixMapping(const XMLString& prefix, const XMLString& uri)
|
||||
{
|
||||
where("startPrefixMapping");
|
||||
std::cout << "prefix=" << prefix << " uri=" << uri << std::endl;
|
||||
}
|
||||
|
||||
void endPrefixMapping(const XMLString& prefix)
|
||||
{
|
||||
where("endPrefixMapping");
|
||||
std::cout << "prefix=" << prefix << std::endl;
|
||||
}
|
||||
|
||||
void skippedEntity(const XMLString& name)
|
||||
{
|
||||
where("skippedEntity");
|
||||
std::cout << "name=" << name << std::endl;
|
||||
}
|
||||
|
||||
// LexicalHandler
|
||||
void startDTD(const XMLString& name, const XMLString& publicId, const XMLString& systemId)
|
||||
{
|
||||
where("startDTD");
|
||||
}
|
||||
|
||||
void endDTD()
|
||||
{
|
||||
where("endDTD");
|
||||
}
|
||||
|
||||
void startEntity(const XMLString& name)
|
||||
{
|
||||
where("startEntity");
|
||||
}
|
||||
|
||||
void endEntity(const XMLString& name)
|
||||
{
|
||||
where("endEntity");
|
||||
}
|
||||
|
||||
void startCDATA()
|
||||
{
|
||||
where("startCDATA");
|
||||
}
|
||||
|
||||
void endCDATA()
|
||||
{
|
||||
where("endCDATA");
|
||||
}
|
||||
|
||||
void comment(const XMLChar ch[], int start, int length)
|
||||
{
|
||||
where("comment");
|
||||
}
|
||||
|
||||
protected:
|
||||
void where(const std::string& meth)
|
||||
{
|
||||
std::cout << "*** " << meth;
|
||||
if (_pLocator)
|
||||
{
|
||||
std::cout << " in "
|
||||
<< _pLocator->getSystemId()
|
||||
<< ", line " << _pLocator->getLineNumber()
|
||||
<< ", col " << _pLocator->getColumnNumber()
|
||||
<< std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
const Locator* _pLocator;
|
||||
};
|
||||
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
// parse an XML document and print the generated SAX events
|
||||
|
||||
if (argc < 2)
|
||||
{
|
||||
std::cout << "usage: " << argv[0] << ": <xmlfile>" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
MyHandler handler;
|
||||
|
||||
SAXParser parser;
|
||||
parser.setFeature(XMLReader::FEATURE_NAMESPACES, true);
|
||||
parser.setFeature(XMLReader::FEATURE_NAMESPACE_PREFIXES, true);
|
||||
parser.setContentHandler(&handler);
|
||||
parser.setProperty(XMLReader::PROPERTY_LEXICAL_HANDLER, static_cast<LexicalHandler*>(&handler));
|
||||
|
||||
try
|
||||
{
|
||||
parser.parse(argv[1]);
|
||||
}
|
||||
catch (Poco::Exception& e)
|
||||
{
|
||||
std::cerr << e.displayText() << std::endl;
|
||||
return 2;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,22 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
||||
<!--
|
||||
This is a comment.
|
||||
-->
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
|
||||
<head>
|
||||
<link rel="stylesheet" href="styles.css" type="text/css"/>
|
||||
<?xml-stylesheet href="styles.css" type="text/css"?>
|
||||
<title>A XHTML Example</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>XHTML Example</h1>
|
||||
<p>This is a XHTML example page.</p>
|
||||
<img src="example.gif" width="256" height="192" alt="Example Picture" border="0"/>
|
||||
<![CDATA[
|
||||
The following <tag attr="value">is inside a CDATA section</tag>.
|
||||
]]>
|
||||
</body>
|
||||
</html>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
||||
<!--
|
||||
This is a comment.
|
||||
-->
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
|
||||
<head>
|
||||
<link rel="stylesheet" href="styles.css" type="text/css"/>
|
||||
<?xml-stylesheet href="styles.css" type="text/css"?>
|
||||
<title>A XHTML Example</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>XHTML Example</h1>
|
||||
<p>This is a XHTML example page.</p>
|
||||
<img src="example.gif" width="256" height="192" alt="Example Picture" border="0"/>
|
||||
<![CDATA[
|
||||
The following <tag attr="value">is inside a CDATA section</tag>.
|
||||
]]>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -1,45 +1,45 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 8.00
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SAXParser", "SAXParser\SAXParser_vs71.vcproj", "{7E4D1B8E-B4FE-432A-92C9-352C98B646B4}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PrettyPrint", "PrettyPrint\PrettyPrint_vs71.vcproj", "{5A6FC255-BE1D-4E09-A680-A67FF16E832F}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DOMParser", "DOMParser\DOMParser_vs71.vcproj", "{383DAD0B-41DF-4130-B3E3-C9A6B19E9F3A}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DOMWriter", "DOMWriter\DOMWriter_vs71.vcproj", "{68F63799-6BCA-4058-89AC-DAC545C6AB0F}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfiguration) = preSolution
|
||||
debug_shared = debug_shared
|
||||
release_shared = release_shared
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfiguration) = postSolution
|
||||
{7E4D1B8E-B4FE-432A-92C9-352C98B646B4}.debug_shared.ActiveCfg = debug_shared|Win32
|
||||
{7E4D1B8E-B4FE-432A-92C9-352C98B646B4}.debug_shared.Build.0 = debug_shared|Win32
|
||||
{7E4D1B8E-B4FE-432A-92C9-352C98B646B4}.release_shared.ActiveCfg = release_shared|Win32
|
||||
{7E4D1B8E-B4FE-432A-92C9-352C98B646B4}.release_shared.Build.0 = release_shared|Win32
|
||||
{5A6FC255-BE1D-4E09-A680-A67FF16E832F}.debug_shared.ActiveCfg = debug_shared|Win32
|
||||
{5A6FC255-BE1D-4E09-A680-A67FF16E832F}.debug_shared.Build.0 = debug_shared|Win32
|
||||
{5A6FC255-BE1D-4E09-A680-A67FF16E832F}.release_shared.ActiveCfg = release_shared|Win32
|
||||
{5A6FC255-BE1D-4E09-A680-A67FF16E832F}.release_shared.Build.0 = release_shared|Win32
|
||||
{383DAD0B-41DF-4130-B3E3-C9A6B19E9F3A}.debug_shared.ActiveCfg = debug_shared|Win32
|
||||
{383DAD0B-41DF-4130-B3E3-C9A6B19E9F3A}.debug_shared.Build.0 = debug_shared|Win32
|
||||
{383DAD0B-41DF-4130-B3E3-C9A6B19E9F3A}.release_shared.ActiveCfg = release_shared|Win32
|
||||
{383DAD0B-41DF-4130-B3E3-C9A6B19E9F3A}.release_shared.Build.0 = release_shared|Win32
|
||||
{68F63799-6BCA-4058-89AC-DAC545C6AB0F}.debug_shared.ActiveCfg = debug_shared|Win32
|
||||
{68F63799-6BCA-4058-89AC-DAC545C6AB0F}.debug_shared.Build.0 = debug_shared|Win32
|
||||
{68F63799-6BCA-4058-89AC-DAC545C6AB0F}.release_shared.ActiveCfg = release_shared|Win32
|
||||
{68F63799-6BCA-4058-89AC-DAC545C6AB0F}.release_shared.Build.0 = release_shared|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityAddIns) = postSolution
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
Microsoft Visual Studio Solution File, Format Version 8.00
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SAXParser", "SAXParser\SAXParser_vs71.vcproj", "{7E4D1B8E-B4FE-432A-92C9-352C98B646B4}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PrettyPrint", "PrettyPrint\PrettyPrint_vs71.vcproj", "{5A6FC255-BE1D-4E09-A680-A67FF16E832F}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DOMParser", "DOMParser\DOMParser_vs71.vcproj", "{383DAD0B-41DF-4130-B3E3-C9A6B19E9F3A}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DOMWriter", "DOMWriter\DOMWriter_vs71.vcproj", "{68F63799-6BCA-4058-89AC-DAC545C6AB0F}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfiguration) = preSolution
|
||||
debug_shared = debug_shared
|
||||
release_shared = release_shared
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfiguration) = postSolution
|
||||
{7E4D1B8E-B4FE-432A-92C9-352C98B646B4}.debug_shared.ActiveCfg = debug_shared|Win32
|
||||
{7E4D1B8E-B4FE-432A-92C9-352C98B646B4}.debug_shared.Build.0 = debug_shared|Win32
|
||||
{7E4D1B8E-B4FE-432A-92C9-352C98B646B4}.release_shared.ActiveCfg = release_shared|Win32
|
||||
{7E4D1B8E-B4FE-432A-92C9-352C98B646B4}.release_shared.Build.0 = release_shared|Win32
|
||||
{5A6FC255-BE1D-4E09-A680-A67FF16E832F}.debug_shared.ActiveCfg = debug_shared|Win32
|
||||
{5A6FC255-BE1D-4E09-A680-A67FF16E832F}.debug_shared.Build.0 = debug_shared|Win32
|
||||
{5A6FC255-BE1D-4E09-A680-A67FF16E832F}.release_shared.ActiveCfg = release_shared|Win32
|
||||
{5A6FC255-BE1D-4E09-A680-A67FF16E832F}.release_shared.Build.0 = release_shared|Win32
|
||||
{383DAD0B-41DF-4130-B3E3-C9A6B19E9F3A}.debug_shared.ActiveCfg = debug_shared|Win32
|
||||
{383DAD0B-41DF-4130-B3E3-C9A6B19E9F3A}.debug_shared.Build.0 = debug_shared|Win32
|
||||
{383DAD0B-41DF-4130-B3E3-C9A6B19E9F3A}.release_shared.ActiveCfg = release_shared|Win32
|
||||
{383DAD0B-41DF-4130-B3E3-C9A6B19E9F3A}.release_shared.Build.0 = release_shared|Win32
|
||||
{68F63799-6BCA-4058-89AC-DAC545C6AB0F}.debug_shared.ActiveCfg = debug_shared|Win32
|
||||
{68F63799-6BCA-4058-89AC-DAC545C6AB0F}.debug_shared.Build.0 = debug_shared|Win32
|
||||
{68F63799-6BCA-4058-89AC-DAC545C6AB0F}.release_shared.ActiveCfg = release_shared|Win32
|
||||
{68F63799-6BCA-4058-89AC-DAC545C6AB0F}.release_shared.Build.0 = release_shared|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityAddIns) = postSolution
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user