1 /************************************************************************
\r
3 ** Copyright (C) 2010 Strahinja Markovic
\r
5 ** This file is part of FlightCrew.
\r
7 ** FlightCrew is free software: you can redistribute it and/or modify
\r
8 ** it under the terms of the GNU Lesser General Public License as published
\r
9 ** by the Free Software Foundation, either version 3 of the License, or
\r
10 ** (at your option) any later version.
\r
12 ** FlightCrew is distributed in the hope that it will be useful,
\r
13 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
14 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
15 ** GNU Lesser General Public License for more details.
\r
17 ** You should have received a copy of the GNU Lesser General Public License
\r
18 ** along with FlightCrew. If not, see <http://www.gnu.org/licenses/>.
\r
20 *************************************************************************/
\r
28 #include <xercesc/dom/DOMNode.hpp>
\r
29 #include "NodeLocationInfo.h"
\r
32 namespace XERCES_CPP_NAMESPACE
\r
33 { class DOMElement; class DOMDocument; class DOMAttr; class DOMNodeList; }
\r
34 namespace xc = XERCES_CPP_NAMESPACE;
\r
38 NodeLocationInfo GetNodeLocationInfo( const xc::DOMNode &node );
\r
40 NodeLocationInfo GetNearestNodeLocationInfo( const xc::DOMNode &node );
\r
43 * Returns a list of elements that are descendants of the provided element
\r
44 * that also match the provided qualified name.
\r
46 * @param start_element The ancestor element.
\r
47 * @param element_qname The qname to search for.
\r
48 * @return The matching list of descendants.
\r
50 std::vector< xc::DOMElement* > GetElementsByQName( const xc::DOMElement &start_element,
\r
51 const QName &element_qname );
\r
54 * Returns a list of elements that are present in the provided document
\r
55 * that also match the provided qualified name.
\r
57 * @param start_element The parent DOM document.
\r
58 * @param element_qname The qname to search for.
\r
59 * @return The matching list of descendants.
\r
61 std::vector< xc::DOMElement* > GetElementsByQName( const xc::DOMDocument &document,
\r
62 const QName &element_qname );
\r
64 std::vector< xc::DOMElement* > GetElementChildren( const xc::DOMElement &element );
\r
66 std::vector< xc::DOMAttr* > GetAllAttributesFromElements( const QName &element_qname,
\r
67 const QName &attribute_qname,
\r
68 const xc::DOMDocument &document );
\r
70 std::vector< xc::DOMElement* > ExtractElementsFromNodeList( const xc::DOMNodeList &node_list );
\r
72 bool ElementListContains( std::vector< xc::DOMElement* > element_list,
\r
73 const QName &element_qname );
\r
76 * From the provided list of element names, returns the first element
\r
77 * present in the document.
\r
79 * @param element_qnames The list of element names to search for.
\r
80 * @param document The parent DOM document.
\r
81 * @return The first element matching one of the provided names
\r
82 * or NULL if none were found.
\r
84 xc::DOMNode* GetFirstAvailableElement( const std::vector< QName > &element_qnames,
\r
85 const xc::DOMDocument &document );
\r
88 * Returns the first element present in the document that matches
\r
89 * the provided name.
\r
91 * @param element The element to search for.
\r
92 * @param document The parent DOM document.
\r
93 * @return The first element matching the provided name
\r
94 * or NULL if none were found.
\r
96 xc::DOMNode* GetFirstAvailableElement( const QName &element_qname,
\r
97 const xc::DOMDocument &document );
\r
99 void XercesStringDeallocator( XMLCh *xstring );
\r
101 template< class T >
\r
102 void XercesDeallocator( T *xerclass )
\r
104 xerclass->release();
\r
108 #endif // XMLUTILS_H
\r