XML File load
Hr = CoCreateInstance (CLSID_DOMDocument, NULL, CLSCTX_INPROC_SERVER | CLSCTX_LOCAL_SERVER, IID_IXMLDOMDocument, (LPVOID *) & m_piLib );
If (! M_piLib ){
Return false;
}
VARIANT_BOOL varOkay;
// VARIANT vXMLSrc, vXMLSrc1;
// VariantInit (& vXMLSrc );
// VariantInit (& vXMLSrc1 );
// CFileStream * fs = new CFileStream;
// BSTR bsLP = CString ("// memory card // eGistarXLite // linepatt.htm"). AllocSysString ();
// BSTR bsLP1 = CString ("// memory card // eGistarXLite // save.htm"). AllocSysString ();
// If (! Fs-> open (strPathName, true ))
//{
// Return false;
//}
// VXMLSrc. punkVal = fs;
// VXMLSrc. vt = VT_UNKNOWN;
// VXMLSrc. bstrVal = bsLP;
// VXMLSrc. vt = VT_BSTR;
// VXMLSrc1.bstrVal = bsLP1;
// VXMLSrc1.vt = VT_BSTR;
// M_piLib-> load (vXMLSrc, & varOkay );
Note:
Query The pocketpc2003 help file to find a comment in loadxml:LoadXMLWill work only with the UTF-16 or UCS-2 encodings; this section means that encodings is a UTF-16, not that you must write XML under the UTF-16; therefore, it is best not to use the resource editor in visual studio2005. You can edit the file in notepad and import the file to the resource. In addition, the file header must contain <? Xml version = "1.0" encoding = "UTF-16"?>
Finally, you want to add a few spaces after the end of the file;
CeGistarXLiteApp * pApp = (CeGistarXLiteApp *) AfxGetApp ();
HMODULE hM = pApp-> m_hInstance;
HRSRC hsLP;
HGLOBAL hLP;
Char * PLP;
Hslp =: findresource (HM, makeintresource (idr_html1), makeintresource (23 ));
If (! Hslp) return false;
HLP = loadresource (HM, hslp );
PLP = (char *) lockresource (HLP );
BSTR = cstring (PLP). allocsysstring ();
M_pilib-> put_async (variant_false );
M_pilib-> loadxml (BSTR, & varokay );
Ixmldomelement * pilibelt = NULL;
BSTR nodename;
If (varokay ){
HR = m_pilib-> get_documentelement (& pilibelt );
If (failed (HR) | pilibelt = NULL ){
Return false;
}
Cstring strt1, strt2, strt3;
Ixmldomnodelist * pistyles;
PiLibElt-> selectNodes (L "* [@ name! = '']", & PiStyles );
IXMLDOMNode * piStyle;
For (piStyles-> nextNode (& piStyle); piStyle! = NULL; piStyles-> nextNode (& piStyle ))
{
PiStyle-> get_baseName (& nodeName );
StrT1 = nodeName;
If (strT1 = "LinePattern ")
{
CGSLLinePattern LP;
LP. Init (IXMLDOMElement *) piStyle );
M_LinePatterns.push_back (LP );
}
}
}