#pragma once
|
|
typedef wchar_t* BSTR ;
|
namespace Hxsoft { namespace XFrame
|
{
|
class KXMLDOMNode;
|
class KXMLDOMAttribute;
|
class KXMLDOMElement;
|
class KXMLDOMCDATASection;
|
class KXMLDOMDocumentFragment;
|
class KXMLDOMComment;
|
class KXMLDOMEntityReference;
|
class KXMLDOMTextNode;
|
class KXMLDOMProcessingInstruction;
|
class KXMLDOMNodeList;
|
class KXMLParseError;
|
|
enum KDOMNodeType
|
{
|
KNODE_INVALID = 0,
|
KNODE_ELEMENT = (KNODE_INVALID + 1),
|
KNODE_ATTRIBUTE = (KNODE_ELEMENT + 1),
|
KNODE_TEXT = (KNODE_ATTRIBUTE + 1),
|
KNODE_CDATA_SECTION = (KNODE_TEXT + 1),
|
KNODE_ENTITY_REFERENCE = (KNODE_CDATA_SECTION + 1),
|
KNODE_ENTITY = (KNODE_ENTITY_REFERENCE + 1),
|
KNODE_PROCESSING_INSTRUCTION = (KNODE_ENTITY + 1),
|
KNODE_COMMENT = (KNODE_PROCESSING_INSTRUCTION + 1),
|
KNODE_DOCUMENT = (KNODE_COMMENT + 1),
|
KNODE_DOCUMENT_TYPE = (KNODE_DOCUMENT + 1),
|
KNODE_DOCUMENT_FRAGMENT = (KNODE_DOCUMENT_TYPE + 1),
|
KNODE_NOTATION = (KNODE_DOCUMENT_FRAGMENT + 1)
|
};
|
|
class KXMLDOMNodeList
|
{
|
public:
|
long length();
|
bool length(long&);
|
bool length(long*);
|
bool gen_length(long* v) { return length(v);}
|
KXMLDOMNode item(int index);
|
bool item(int index, KXMLDOMNode& node);
|
bool item(int index, KXMLDOMNode* node);
|
bool get_item(int index, KXMLDOMNode* node) { return item(index, node); }
|
private:
|
void* impl;
|
public:
|
void* getImpl();
|
public:
|
KXMLDOMNodeList(void* impl);
|
KXMLDOMNodeList() :impl(nullptr) {}
|
~KXMLDOMNodeList();
|
public:
|
operator bool() { return impl ? true : false; }
|
public:
|
KXMLDOMNodeList(const KXMLDOMNodeList& rhs);
|
const KXMLDOMNodeList& operator =(const KXMLDOMNodeList& rhs);
|
};
|
|
class KXMLDOMElement;
|
class KXMLDOMAttribute;
|
class KXMLDOMDocument;
|
class KXMLDOMNode {
|
public:
|
// attributes
|
// baseName
|
KXMLDOMNodeList childNodes();
|
// dataType
|
// definition
|
KXMLDOMNode firstChild();
|
KXMLDOMNode lastChild();
|
// namespaceURI
|
// namespaceURI
|
KXMLDOMNode nextSibling();
|
const wchar_t* nodeName();
|
KDOMNodeType nodeType();
|
KDOMNodeType get_nodeType() { return nodeType(); }
|
// nodeTypedValue
|
// nodeTypeString
|
// nodeValue
|
KXMLDOMDocument ownerDocument();
|
KXMLDOMNode parentNode();
|
// parsed
|
// prefix
|
KXMLDOMNode previousSibling();
|
// specified
|
const wchar_t* tagName();
|
const wchar_t* text();
|
const wchar_t* xml();
|
|
bool get_tagName(BSTR& str);
|
bool get_text(BSTR& str);
|
bool get_xml(BSTR& str);
|
bool get_tagName(BSTR* str) { return get_tagName(*str); }
|
bool get_text(BSTR* str) { return get_text(*str); }
|
bool get_xml(BSTR* str) { return get_xml(*str); }
|
bool settext(const wchar_t* txt);
|
bool put_text(const wchar_t* txt) { return settext(txt); }
|
|
|
bool appendChild(KXMLDOMNode);
|
KXMLDOMNode cloneNode(bool);
|
wchar_t* getAttribute(const wchar_t* name);
|
void getAttribute(const wchar_t* name,void * vt);
|
KXMLDOMAttribute getAttributeNode(const wchar_t* name);
|
KXMLDOMNodeList getElementsByTagName(const wchar_t* name);
|
bool hasChildNodes();
|
bool insertBefore(KXMLDOMNode newnode, KXMLDOMNode at);
|
void normalize();
|
bool removeAttribute(const wchar_t* name);
|
bool removeAttributeNode(KXMLDOMNode attr);
|
bool removeChild(KXMLDOMNode val);
|
bool replaceChild(KXMLDOMNode newChild, KXMLDOMNode oldChild);
|
KXMLDOMNodeList selectNodes(const wchar_t*);
|
KXMLDOMNode selectSingleNode(const wchar_t*);
|
bool selectNodes(const wchar_t*, KXMLDOMNodeList& pNodeList);
|
bool selectSingleNode(const wchar_t*, KXMLDOMNode& pNode);
|
bool selectNodes(const wchar_t*, KXMLDOMNodeList* pNodeList);
|
bool selectSingleNode(const wchar_t*, KXMLDOMNode* pNode);
|
void setAttribute(const wchar_t* name, const wchar_t* value);
|
void setAttribute(const wchar_t* name, long val);
|
void setAttribute(const wchar_t* name, double val);
|
wchar_t* transformNode(KXMLDOMNode stylesheet);
|
KXMLDOMNode transformNodeToObject(KXMLDOMNode);
|
protected:
|
void* impl;
|
public:
|
KXMLDOMNode(void* impl);
|
KXMLDOMNode():KXMLDOMNode(nullptr) {}
|
~KXMLDOMNode();
|
public:
|
KXMLDOMNode(const KXMLDOMNode& rhs);
|
const KXMLDOMNode& operator =(const KXMLDOMNode& rhs);
|
public:
|
operator bool() { return impl ? true : false; }
|
public:
|
void* getImpl();
|
};
|
|
class KXMLDOMDocument : public KXMLDOMNode
|
{
|
public:
|
const wchar_t* text();
|
const wchar_t* url();
|
const wchar_t* xml();
|
KXMLDOMElement documentElement();
|
bool documentElement(KXMLDOMElement * pDoc);
|
bool get_documentElement(KXMLDOMElement* pDoc) { return documentElement(pDoc); }
|
public:
|
bool appendChild(KXMLDOMNode);
|
KXMLDOMAttribute createAttribute(const wchar_t*);
|
KXMLDOMCDATASection createCDATASection(const wchar_t*);
|
KXMLDOMComment createComment(const wchar_t*);
|
KXMLDOMDocumentFragment createDocumentFragment();
|
KXMLDOMElement createElement(const wchar_t*);
|
bool createElement(const wchar_t*, KXMLDOMElement* ele);
|
KXMLDOMEntityReference createEntityReference(const wchar_t*);
|
KXMLDOMNode createNode(KDOMNodeType ty, const wchar_t* name, const wchar_t* ns);
|
KXMLDOMProcessingInstruction createProcessingInstruction(const wchar_t* target, const wchar_t* data);
|
KXMLDOMTextNode createTextNode(const wchar_t*);
|
|
KXMLDOMNodeList getElementsByTagName(const wchar_t*);
|
wchar_t* getProperty(const wchar_t*);
|
bool setProperty(const wchar_t* prop, const wchar_t* val);
|
bool setProperty(const wchar_t* prop, bool val);
|
bool hasChildNodes();
|
bool importNode(KXMLDOMNode);
|
bool insertBefore(KXMLDOMNode newnode, KXMLDOMNode at);
|
bool load(const wchar_t*);
|
bool loadXML(const wchar_t*);
|
KXMLDOMNode nodeFromID(const wchar_t*);
|
bool removeChild(KXMLDOMNode);
|
bool replaceChild(KXMLDOMNode newChild, KXMLDOMNode oldChild);
|
bool save(const wchar_t*);
|
KXMLDOMNodeList selectNodes(const wchar_t*);
|
KXMLDOMNode selectSingleNode(const wchar_t*);
|
bool selectNodes(const wchar_t*, KXMLDOMNodeList& pNodeList);
|
bool selectSingleNode(const wchar_t*, KXMLDOMNode& pNode);
|
bool selectNodes(const wchar_t*, KXMLDOMNodeList* pNodeList);
|
bool selectSingleNode(const wchar_t*, KXMLDOMNode* pNode);
|
|
wchar_t* transformNode(KXMLDOMNode);
|
KXMLDOMNode transformNodeToObject(KXMLDOMNode);
|
KXMLParseError validate();
|
//bool validateNode();
|
public:
|
KXMLDOMDocument(void* impl);
|
KXMLDOMDocument();
|
~KXMLDOMDocument();
|
public:
|
const KXMLDOMDocument& operator =(const KXMLDOMDocument& rhs);
|
KXMLDOMDocument(const KXMLDOMDocument& rhs);
|
};
|
|
class KXMLDOMElement : public KXMLDOMNode
|
{
|
public:
|
KXMLDOMElement( KXMLDOMNode v);
|
KXMLDOMElement(void* impl) :KXMLDOMNode(impl) {}
|
KXMLDOMElement() :KXMLDOMNode() {}
|
};
|
class KXMLDOMAttribute : public KXMLDOMNode
|
{
|
public:
|
KXMLDOMAttribute(KXMLDOMNode& v);
|
KXMLDOMAttribute(void* impl) :KXMLDOMNode(impl) {}
|
};
|
class KXMLDOMCDATASection : public KXMLDOMNode
|
{
|
public:
|
KXMLDOMCDATASection(KXMLDOMNode& v);
|
KXMLDOMCDATASection(void* impl) :KXMLDOMNode(impl) {}
|
};
|
|
class KXMLDOMComment: public KXMLDOMNode
|
{
|
public:
|
KXMLDOMComment(KXMLDOMNode& v);
|
KXMLDOMComment(void* impl) :KXMLDOMNode(impl) {}
|
};
|
|
class KXMLDOMEntityReference : public KXMLDOMNode
|
{
|
public:
|
KXMLDOMEntityReference(KXMLDOMNode& v);
|
KXMLDOMEntityReference(void* impl) :KXMLDOMNode(impl) {}
|
};
|
|
class KXMLDOMTextNode : public KXMLDOMNode
|
{
|
public:
|
KXMLDOMTextNode(KXMLDOMNode& v);
|
KXMLDOMTextNode(void* impl) :KXMLDOMNode(impl) {}
|
};
|
|
class KXMLDOMProcessingInstruction : public KXMLDOMNode
|
{
|
public:
|
KXMLDOMProcessingInstruction(KXMLDOMNode& v);
|
KXMLDOMProcessingInstruction(void* impl) :KXMLDOMNode(impl) {}
|
};
|
class KXMLDOMDocumentFragment : public KXMLDOMNode
|
{
|
public:
|
KXMLDOMDocumentFragment(KXMLDOMNode& v);
|
KXMLDOMDocumentFragment(void* impl) :KXMLDOMNode(impl) {}
|
};
|
|
}}
|
|
|
|
using KXMLDOMDocument=Hxsoft::XFrame::KXMLDOMDocument;
|
using KXMLDOMNode=Hxsoft::XFrame::KXMLDOMNode;
|
using KXMLDOMElement=Hxsoft::XFrame::KXMLDOMElement;
|
using KXMLDOMNodeList = Hxsoft::XFrame::KXMLDOMNodeList;
|
|
class KXMLParseError : public KXMLDOMNode
|
{
|
public:
|
KXMLParseError(KXMLDOMNode& v);
|
KXMLParseError(void* impl) :KXMLDOMNode(impl) {}
|
};
|
|
class KXMLDOMElementPtr
|
{
|
private:
|
KXMLDOMElement* m_pElement;
|
public:
|
KXMLDOMElementPtr(LPARAM ele) :m_pElement((KXMLDOMElement*)ele) {}
|
KXMLDOMElementPtr(KXMLDOMElement* pEle) :m_pElement((KXMLDOMElement*)pEle) {}
|
KXMLDOMElementPtr(KXMLDOMElement ele) :m_pElement(new KXMLDOMElement(ele)) {}
|
public:
|
KXMLDOMElement* value() { return m_pElement; }
|
public:
|
operator KXMLDOMElement* () { return m_pElement; }
|
operator KXMLDOMElement& () { return *m_pElement; }
|
KXMLDOMElement* operator -> () { return m_pElement; }
|
};
|