BOOL CDlgExportDownloads::ExportDownloads_ToDLInfoListFile(LPCSTR pszFile, DLDS_LIST* pvpDlds, BOOL bAppend) { IXMLDOMDocumentPtr spXML; IXMLDOMNodePtr spNode, spNode2; spXML.CreateInstance (__uuidof (DOMDocument)); if (spXML == NULL) return FALSE; spXML->put_async (FALSE); VARIANT_BOOL bRes = FALSE; if (bAppend) { spXML->load (COleVariant (pszFile), &bRes); if (bRes) { spXML->selectSingleNode (L"FDM_Downloads_Info_List", &spNode); if (spNode == NULL) bRes = FALSE; } } if (bRes == FALSE) { spXML->createNode (COleVariant ((long)NODE_ELEMENT), L"FDM_Downloads_Info_List", NULL, &spNode); spXML->appendChild (spNode, &spNode2); } for (size_t i = 0; i < pvpDlds->size (); i++) { ExportDownload_ToXML (spXML, spNode, pvpDlds->at (i)); } CComBSTR bstr; spXML->get_xml (&bstr); CString str = bstr; str.Replace ("><", ">\n<"); bstr = str; spXML->loadXML (bstr, &bRes); spXML->save (COleVariant (pszFile)); return TRUE; }
BOOL vmsVideoSiteHtmlCodeParser::Parse_Further_MySpace(LPCSTR pszHtml) { USES_CONVERSION; IXMLDOMDocumentPtr spXML; IXMLDOMNodePtr spNode, spNode2; while (*pszHtml && *pszHtml != '<') pszHtml++; spXML.CreateInstance (__uuidof (DOMDocument)); if (spXML == NULL) return FALSE; spXML->put_async (FALSE); VARIANT_BOOL bRes; spXML->loadXML (A2W (pszHtml), &bRes); if (bRes == FALSE) return FALSE; spXML->selectSingleNode (L"rss", &spNode); if (spNode == NULL) return FALSE; spNode->selectSingleNode (L"channel", &spNode2); if (spNode2 == NULL) return FALSE; spNode = NULL; spNode2->selectSingleNode (L"item", &spNode); if (spNode == NULL) return FALSE; spNode2 = NULL; spNode->selectSingleNode (L"title", &spNode2); if (spNode2 == NULL) return FALSE; CComBSTR bstrTitle; spNode2->get_text (&bstrTitle); spNode2 = NULL; spNode->selectSingleNode (L"media:content", &spNode2); if (spNode2 == NULL) return FALSE; IXMLDOMNamedNodeMapPtr spAttrs; spNode2->get_attributes (&spAttrs); if (spAttrs == NULL) return FALSE; IXMLDOMNodePtr spUrlValue; spAttrs->getNamedItem (L"url", &spUrlValue); if (spUrlValue == NULL) return FALSE; COleVariant vtUrl; spUrlValue->get_nodeValue (&vtUrl); ASSERT (vtUrl.vt == VT_BSTR); if (vtUrl.vt != VT_BSTR) return FALSE; m_strVideoTitle = W2A (bstrTitle); fsDecodeHtmlText (m_strVideoTitle); m_strVideoUrl = W2A (vtUrl.bstrVal); m_strVideoType = (LPCSTR)m_strVideoUrl + m_strVideoUrl.GetLength () - 3; m_bDirectLink = TRUE; return TRUE; }
BOOL BitmapPropertiesRecordHandler::HandleRecord( CXaraFileRecord* pCXaraFileRecord ) { ERROR2IF(pCXaraFileRecord == NULL,FALSE,"BitmapPropertiesRecordHandler::HandleRecord pCXaraFileRecord is NULL"); BOOL ok = TRUE; UINT32 tag = pCXaraFileRecord->GetTag(); // read in the record --------------------------------------------------------- // read bitmap reference INT32 BmpRef = 0; INT32 MasterRef = 0; String_256 BitmapName; ok = pCXaraFileRecord->ReadINT32(&BmpRef); // read flags BYTE Flags; if (ok) ok = pCXaraFileRecord->ReadBYTE(&Flags); // read other stuff BYTE Temp; for( INT32 i=0; i<7; i++ ) { if (ok) ok = pCXaraFileRecord->ReadBYTE(&Temp); } // Read XPE master ref and XML edits list // _bstr_t bstrXML; StringVar strXML; if (ok && tag==TAG_XPE_BITMAP_PROPERTIES) { ok = pCXaraFileRecord->ReadINT32(&MasterRef); if (ok) ok = pCXaraFileRecord->ReadUnicode(&BitmapName); // if (ok) ok = pCXaraFileRecord->ReadBSTR(&bstrXML, pCXaraFileRecord->GetSize()); if (ok) ok = pCXaraFileRecord->ReadUTF16STR(&strXML, pCXaraFileRecord->GetSize()); } // process the record --------------------------------------------------------- // look up the bitmap from BmpRef if (BmpRef == 0) { // no such bitmap ok = FALSE; } else { KernelBitmap *pBitmap = NULL; pBitmap = GetReadBitmapReference(BmpRef); if (pBitmap == NULL) { // no such bitmap ok = FALSE; } else { // process the flags BOOL bSmoothWhenScaledUp = Flags & 0x01; pBitmap->SetInterpolation(bSmoothWhenScaledUp); // Setup XPE info // (If we don't have it, it's not important - this bitmap will just lose // it's XPE edit info and will become its own master) PORTNOTETRACE("other","BitmapPropertiesRecordHandler::HandleRecord - remove XML code"); #ifndef EXCLUDE_FROM_XARALX if (tag==TAG_XPE_BITMAP_PROPERTIES && MasterRef!=0) { KernelBitmap* pMasterBitmap = NULL; pMasterBitmap = GetReadBitmapReference(MasterRef); VARIANT_BOOL varResult; IXMLDOMDocumentPtr pxmlDoc = CXMLUtils::NewDocument(); HRESULT hr = pxmlDoc->loadXML(bstrXML, &varResult); if (pMasterBitmap && SUCCEEDED(hr) && VARIANT_TRUE == varResult) { // We now know that this master bitmap will be used // so add it to the document's bitmap list... // Get the bitmap list from the current document Document* pDoc = Document::GetCurrent(); BitmapList* pBmpList = pDoc->GetBitmapList(); if (!pBmpList->FindDuplicateBitmap(pMasterBitmap->ActualBitmap)) // and then attach the bitmap pMasterBitmap->Attach(pBmpList); // See whether we need to regenerate this bitmap from the // Master and the Edits... if (pBitmap->IsDefaultBitmap()) { XPEEditOp::DoProcessBitmap(pBitmap, pMasterBitmap, pxmlDoc); } pBitmap->SetXPEInfo(pMasterBitmap, pxmlDoc); // Can only do this after DoProcessBitmap... } pBitmap->SetName(BitmapName); // ...and this, because process may create new OILBitmap } #endif } } return ok; }