XmlUtils.h

Go to the documentation of this file.
00001 // vim:expandtab:autoindent:tabstop=4:shiftwidth=4:filetype=c:cindent:
00002 /*
00003  * Copyright (C) 2005 Dell Inc.
00004  *  by Michael Brown <Michael_E_Brown@dell.com>
00005  * Licensed under the Open Software License version 2.1
00006  *
00007  * Alternatively, you can redistribute it and/or modify
00008  * it under the terms of the GNU General Public License as published
00009  * by the Free Software Foundation; either version 2 of the License,
00010  * or (at your option) any later version.
00011 
00012  * This program is distributed in the hope that it will be useful, but
00013  * WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00015  * See the GNU General Public License for more details.
00016  */
00017 
00018 
00019 // compat header should always be first header
00020 #include "smbios/compat.h"
00021 
00022 #include <xercesc/util/PlatformUtils.hpp>
00023 #include <xercesc/dom/DOM.hpp>
00024 #include <xercesc/dom/DOMImplementationLS.hpp>
00025 #include <xercesc/framework/StdOutFormatTarget.hpp>
00026 #include <xercesc/framework/LocalFileFormatTarget.hpp>
00027 #include <xercesc/parsers/XercesDOMParser.hpp>
00028 #include <xercesc/util/XMLUni.hpp>
00029 #include <xercesc/framework/MemBufInputSource.hpp>
00030 #include <xercesc/framework/Wrapper4InputSource.hpp>
00031 
00032 #include "ExceptionImpl.h"
00033 
00034 #define X(x)  XMLString::transcode(x)
00035 
00036 namespace xmlutils
00037 {
00038 
00039     // declare exceptions
00040     //    Internal users should catch() these...
00041     DECLARE_EXCEPTION( XmlUtilsException );
00042     DECLARE_EXCEPTION_EX( NotFound, xmlutils, XmlUtilsException );
00043     DECLARE_EXCEPTION_EX( Invalid, xmlutils, XmlUtilsException );
00044 
00045     // Since this is also a private header, define them
00046     //  internal use only inside XmlUtils.cpp
00047     DEFINE_EXCEPTION_EX( NotFoundImpl, xmlutils, NotFound );
00048     DEFINE_EXCEPTION_EX( InvalidImpl, xmlutils, Invalid );
00049 
00050     XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *castNode2Element(       XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *node );
00051     const XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *castNode2Element( const XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *node );
00052 
00053     std::string safeXMLChToString( const XMLCh *src );
00054 
00055     std::string safeGetAttribute( const XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *node, const std::string &attr );
00056 
00057     XERCES_CPP_NAMESPACE_QUALIFIER DOMBuilder *getParser( );
00058 
00059     XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *findElement( XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *root, const std::string elementName, const std::string &attribute, const std::string &value );
00060     XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *findElementWithNumericAttr( XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *root, const std::string elementName, const std::string &attribute, long value);
00061 
00062     std::string getNodeText( XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *elem );
00063     int getNumberFromXmlAttr( XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *element, const std::string field, int base );
00064 }

Generated on Tue Jul 11 20:46:46 2006 for SMBIOS Library by  doxygen 1.4.7