bool FrissConfig::Save( const char* path ) { XmlNode* root = new XmlNode( NULL, "" ); XmlNode* fs = NULL, *f = NULL; BString s; fs = root->CreateChild("settings"); fs->AddAttribute("version", m_iVersion); f = new XmlNode(fs, "comment"); f->Comment("This file is auto-generated. See documentation for help."); fs->AddChild(f); f = fs->CreateChild("generic/feeds"); f->AddAttribute("a", m_iIndex); f->AddAttribute("b", m_iAnz); f = fs->CreateChild("generic/refresh"); f->AddAttribute("rate", RefreshRate ); if (RefreshAdvances) f->AddAttribute("advance", "true"); else f->AddAttribute("advance", "false"); fs->CreateChild("generic/language", Lang.String()); fs->CreateChild("generic/feedfile", Feedlist.String()); f = fs->CreateChild("window/position"); f->AddAttribute("x", m_rWindow.left); f->AddAttribute("y", m_rWindow.top); f->AddAttribute("width", m_rWindow.Width()); f->AddAttribute("height", m_rWindow.Height()); fs->CreateChild("window/background/mode", (int)ColBackMode); f = fs->CreateChild("window/background/colour"); f->AddAttribute("red", col.red); f->AddAttribute("green", col.green); f->AddAttribute("blue", col.blue); fs->CreateChild("window/foreground/mode", (int)ColForeMode); f = fs->CreateChild("window/foreground/colour"); f->AddAttribute("red", high.red); f->AddAttribute("green", high.green); f->AddAttribute("blue", high.blue); fs->CreateChild("window/windowmode", (int)WindowMode); fs->CreateChild("browser/mode", (int)BrowserType); fs->CreateChild("browser/mime", BrowserMime.String()); root->SaveToFile(path); delete root; return false; }
void XmlParser::_parseNodeGetAttributes(MSXML2::IXMLDOMNode *pIDOMNode, XmlNode& node) { MSXML2::IXMLDOMNamedNodeMapPtr attributes = pIDOMNode->attributes; BSTR attrName; for (int i = 0; i < attributes->Getlength(); i++) { MSXML2::IXMLDOMNodePtr atrr = attributes->Getitem(i); atrr->get_nodeName(&attrName); _variant_t val = atrr->GetnodeValue(); wstring name(attrName); BSTR b = val.bstrVal; wstring value(b); XmlAttribute attribute(name, value); node.AddAttribute(attribute); } }