1 | /*
|
---|
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
|
---|
3 | * contributor license agreements. See the NOTICE file distributed with
|
---|
4 | * this work for additional information regarding copyright ownership.
|
---|
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
|
---|
6 | * (the "License"); you may not use this file except in compliance with
|
---|
7 | * the License. You may obtain a copy of the License at
|
---|
8 | *
|
---|
9 | * http://www.apache.org/licenses/LICENSE-2.0
|
---|
10 | *
|
---|
11 | * Unless required by applicable law or agreed to in writing, software
|
---|
12 | * distributed under the License is distributed on an "AS IS" BASIS,
|
---|
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
---|
14 | * See the License for the specific language governing permissions and
|
---|
15 | * limitations under the License.
|
---|
16 | */
|
---|
17 |
|
---|
18 | #ifndef _LOG4CXX_HELPERS_XML_H
|
---|
19 | #define _LOG4CXX_HELPERS_XML_H
|
---|
20 |
|
---|
21 | #if defined(_MSC_VER)
|
---|
22 | #pragma warning ( push )
|
---|
23 | #pragma warning ( disable: 4231 4251 4275 4786 )
|
---|
24 | #endif
|
---|
25 |
|
---|
26 |
|
---|
27 | #include <log4cxx/logstring.h>
|
---|
28 | #include <log4cxx/helpers/objectptr.h>
|
---|
29 | #include <log4cxx/helpers/object.h>
|
---|
30 | #include <log4cxx/helpers/exception.h>
|
---|
31 |
|
---|
32 | namespace log4cxx
|
---|
33 | {
|
---|
34 | class File;
|
---|
35 | namespace helpers
|
---|
36 | {
|
---|
37 | class XMLDOMNode;
|
---|
38 | typedef helpers::ObjectPtrT<XMLDOMNode> XMLDOMNodePtr;
|
---|
39 |
|
---|
40 | class XMLDOMDocument;
|
---|
41 | typedef helpers::ObjectPtrT<XMLDOMDocument> XMLDOMDocumentPtr;
|
---|
42 |
|
---|
43 | class XMLDOMNodeList;
|
---|
44 | typedef helpers::ObjectPtrT<XMLDOMNodeList> XMLDOMNodeListPtr;
|
---|
45 |
|
---|
46 | class LOG4CXX_EXPORT DOMException : public RuntimeException
|
---|
47 | {
|
---|
48 | public:
|
---|
49 | DOMException() : RuntimeException(LOG4CXX_STR("DOM exception")) {}
|
---|
50 | };
|
---|
51 |
|
---|
52 |
|
---|
53 | /**
|
---|
54 | The XMLDOMNode interface is the primary datatype for the entire Document
|
---|
55 | Object Model.
|
---|
56 | */
|
---|
57 | class LOG4CXX_EXPORT XMLDOMNode : virtual public Object
|
---|
58 | {
|
---|
59 | public:
|
---|
60 | DECLARE_ABSTRACT_LOG4CXX_OBJECT(XMLDOMNode)
|
---|
61 | enum XMLDOMNodeType
|
---|
62 | {
|
---|
63 | NOT_IMPLEMENTED_NODE = 0,
|
---|
64 | ELEMENT_NODE = 1,
|
---|
65 | DOCUMENT_NODE = 9
|
---|
66 | };
|
---|
67 |
|
---|
68 | virtual XMLDOMNodeListPtr getChildNodes() = 0;
|
---|
69 | virtual XMLDOMNodeType getNodeType() = 0;
|
---|
70 | virtual XMLDOMDocumentPtr getOwnerDocument() = 0;
|
---|
71 | };
|
---|
72 | LOG4CXX_PTR_DEF(XMLDOMNode);
|
---|
73 |
|
---|
74 |
|
---|
75 | /**
|
---|
76 | The XMLDOMElement interface represents an element in an XML document
|
---|
77 | */
|
---|
78 | class LOG4CXX_EXPORT XMLDOMElement : virtual public XMLDOMNode
|
---|
79 | {
|
---|
80 | public:
|
---|
81 | DECLARE_ABSTRACT_LOG4CXX_OBJECT(XMLDOMElement)
|
---|
82 | virtual LogString getTagName() = 0;
|
---|
83 | virtual LogString getAttribute(const LogString& name) = 0;
|
---|
84 | };
|
---|
85 | LOG4CXX_PTR_DEF(XMLDOMElement);
|
---|
86 |
|
---|
87 | /**
|
---|
88 | The XMLDOMDocument interface represents an entire XML document.
|
---|
89 |
|
---|
90 | Conceptually, it is the root of the document tree, and provides the
|
---|
91 | primary access to the document's data.
|
---|
92 | */
|
---|
93 | class LOG4CXX_EXPORT XMLDOMDocument : virtual public XMLDOMNode
|
---|
94 | {
|
---|
95 | public:
|
---|
96 | DECLARE_ABSTRACT_LOG4CXX_OBJECT(XMLDOMDocument)
|
---|
97 | virtual void load(const File& fileName) = 0;
|
---|
98 | virtual XMLDOMElementPtr getDocumentElement() = 0;
|
---|
99 | virtual XMLDOMElementPtr getElementById(const LogString& tagName,
|
---|
100 | const LogString& elementId) = 0;
|
---|
101 | };
|
---|
102 | LOG4CXX_PTR_DEF(XMLDOMDocument);
|
---|
103 |
|
---|
104 | /**
|
---|
105 | The XMLDOMNodeList interface provides the abstraction of an ordered
|
---|
106 | collection of nodes, without defining or constraining how this
|
---|
107 | collection is implemented.
|
---|
108 |
|
---|
109 | XMLDOMNodeList objects in the DOM are live.
|
---|
110 |
|
---|
111 | The items in the XMLDOMNodeList are accessible via an integral index,
|
---|
112 | starting from 0.
|
---|
113 | */
|
---|
114 | class LOG4CXX_EXPORT XMLDOMNodeList : virtual public Object
|
---|
115 | {
|
---|
116 | public:
|
---|
117 | DECLARE_ABSTRACT_LOG4CXX_OBJECT(XMLDOMNodeList)
|
---|
118 | virtual int getLength() = 0;
|
---|
119 | virtual XMLDOMNodePtr item(int index) = 0;
|
---|
120 | };
|
---|
121 | LOG4CXX_PTR_DEF(XMLDOMNodeList);
|
---|
122 | } // namespace helpers
|
---|
123 | } // namespace log4cxx
|
---|
124 |
|
---|
125 |
|
---|
126 | #if defined(_MSC_VER)
|
---|
127 | #pragma warning ( pop )
|
---|
128 | #endif
|
---|
129 |
|
---|
130 | #endif // _LOG4CXX_HELPERS_XML_H
|
---|
131 |
|
---|