?? xmltools.h
字號:
// ================================================================================
//
// author: Rainer Schuster
//
// created: 09.03.2005 10:18:56
//
// filename: xmltools.h
//
// This code is as it is. You are allowed to use, modify and/or redistribute it freely.
// I'm not responsible for any errors or damage. Use it at your own risk.
//
// ================================================================================
#ifndef _XMLTOOLS_H
#define _XMLTOOLS_H
// ---------------------------------------------------------------------------
// Includes
// ---------------------------------------------------------------------------
#include <xercesc/dom/DOMDocument.hpp>
#include <xercesc/dom/DOMNodeList.hpp>
#include <xercesc/dom/DOMNode.hpp>
#include <xercesc/util/XMLString.hpp>
XERCES_CPP_NAMESPACE_USE
// ============== codesnippet from xerces
// ---------------------------------------------------------------------------
// This is a simple class that lets us do easy (though not terribly efficient)
// trancoding of XMLCh data to local code page for display.
// ---------------------------------------------------------------------------
class XStr
{
public :
// -----------------------------------------------------------------------
// Constructors and Destructor
// -----------------------------------------------------------------------
XStr()
{
fLocalForm=NULL;
fUnicodeForm=NULL;
}
XStr(const XMLCh* const toTranscode)
{
// Call the private transcoding method
fLocalForm = XMLString::transcode(toTranscode);
fUnicodeForm=NULL;
}
XStr(const char* const toTranscode)
{
// Call the private transcoding method
fUnicodeForm = XMLString::transcode(toTranscode);
fLocalForm=NULL;
}
~XStr()
{
if (fLocalForm)
{
XMLString::release(&fLocalForm);
}
if (fUnicodeForm)
{
XMLString::release(&fUnicodeForm);
}
}
// -----------------------------------------------------------------------
// Getter methods
// -----------------------------------------------------------------------
const char* localForm() const
{
return fLocalForm;
}
const XMLCh* unicodeForm() const
{
return fUnicodeForm;
}
private :
// -----------------------------------------------------------------------
// Private data members
//
// fLocalForm
// This is the local code page form of the string.
// -----------------------------------------------------------------------
char* fLocalForm;
XMLCh* fUnicodeForm;
};
#define X(str) XStr(str).unicodeForm()
#define XC(str) XStr(str).localForm()
DOMNode *GetFirstNode(const DOMDocument *doc, const char *lpstrName);
bool GetAttributeValue (const DOMNode *nd, const char *lpstrName, char *lpstrValue, int nMaxLen);
bool GetAttributeValue (const DOMNode *nd, const char *lpstrName, long &lValue);
DOMNode *GetFirstSubNode(const DOMNode *nd, const char *lpstrName);
char *XMLDateToDate(const char *lpstrXMLDate);
#endif
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -