Some problems encountered when reading XML files in Windows moblie Development

Source: Internet
Author: User
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 );
}
}

}


 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.