本文整理汇总了C++中XmlElement::getStringAttribute方法的典型用法代码示例。如果您正苦于以下问题:C++ XmlElement::getStringAttribute方法的具体用法?C++ XmlElement::getStringAttribute怎么用?C++ XmlElement::getStringAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XmlElement
的用法示例。
在下文中一共展示了XmlElement::getStringAttribute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: login
void SmugMug::login(const String& username, const String& password)
{
sessionId = String::empty;
StringPairArray params;
params.set(("EmailAddress"), username);
params.set(("Password"), password);
XmlElement* n = smugMugRequest(("smugmug.login.withPassword"), params);
if (n)
{
XmlElement* l = n->getChildByName(("Login"));
if (l)
{
accountType = l->getStringAttribute(("AccountType"));
XmlElement* s = l->getChildByName(("Session"));
if (s)
{
sessionId = s->getStringAttribute(("id"));
addLogEntry(("Info: logged in session: ") + sessionId);
}
}
delete n;
}
}
示例2: smugMugRequest
XmlElement* SmugMug::smugMugRequest(const String& method, const StringPairArray& params_, bool upload)
{
StringPairArray params(params_);
params.set(("method"), method);
params.set(("APIKey"), APIKEY);
startTimer(LOGOUT_TIMER);
if (sessionId.isNotEmpty())
params.set(("SessionID"), sessionId);
URL url(upload ? UPLOAD_URL : BASE_URL);
StringArray keys = params.getAllKeys();
StringArray vals = params.getAllValues();
for (int i = 0; i < keys.size(); i++)
url = url.withParameter(keys[i], vals[i]);
XmlElement* x = url.readEntireXmlStream(upload);
#ifdef JUCE_DEBUG
Logger::outputDebugString(url.toString(true));
if (x)
Logger::outputDebugString(x->createDocument(String::empty, true));
#endif
if (x && x->getStringAttribute(("stat")) == ("fail"))
{
XmlElement* err = x->getChildByName(("err"));
if (err)
{
addLogEntry(("Error: ") + err->getStringAttribute(("msg")));
}
}
return x;
}
示例3: handleXmlReply
OnlineUnlockStatus::UnlockResult OnlineUnlockStatus::handleXmlReply (XmlElement xml)
{
UnlockResult r;
if (const XmlElement* keyNode = xml.getChildByName ("KEY"))
{
const String keyText (keyNode->getAllSubText().trim());
r.succeeded = keyText.length() > 10 && applyKeyFile (keyText);
}
else
{
r.succeeded = false;
}
if (xml.hasTagName ("MESSAGE"))
r.informativeMessage = xml.getStringAttribute ("message").trim();
if (xml.hasTagName ("ERROR"))
r.errorMessage = xml.getStringAttribute ("error").trim();
if (xml.getStringAttribute ("url").isNotEmpty())
r.urlToLaunch = xml.getStringAttribute ("url").trim();
if (r.errorMessage.isEmpty() && r.informativeMessage.isEmpty() && r.urlToLaunch.isEmpty() && ! r.succeeded)
r.errorMessage = TRANS ("Unexpected or corrupted reply from XYZ").replace ("XYZ", getWebsiteName()) + "...\n\n"
+ TRANS("Please try again in a few minutes, and contact us for support if this message appears again.");
return r;
}
示例4: restoreFromXml
void CDPlayer::restoreFromXml(const XmlElement& element, const File& /*projectDirectory*/)
{
setColor(Colour::fromString(element.getStringAttribute("color", "0xffffffff")));
repaint();
XmlElement* boundsXml = element.getChildByName("Bounds");
if (boundsXml)
{
String x = boundsXml->getStringAttribute("x", "0");
String y = boundsXml->getStringAttribute("y", "0");
String width = boundsXml->getStringAttribute("width", "150");
String height = boundsXml->getStringAttribute("height", "150");
getParentComponent()->setBounds(x.getIntValue(), y.getIntValue(), width.getIntValue(), height.getIntValue());
}
else
{
XmlElement* mdiDocumentPosXml = element.getChildByName("MdiDocumentPos");
if (mdiDocumentPosXml->getNumChildElements() > 0 && mdiDocumentPosXml->getFirstChildElement()->isTextElement())
{
getProperties().set("mdiDocumentPos_", mdiDocumentPosXml->getFirstChildElement()->getText());
}
}
XmlElement* nameXml = element.getChildByName("Name");
setName(nameXml->getAllSubText().trim());
XmlElement* driveXml = element.getChildByName("Drive");
m_availableCDsComboBox.selectDrive(driveXml->getAllSubText().trim());
}
示例5: restoreFromXml
void RelativePositionedRectangle::restoreFromXml (const XmlElement& e,
const RelativePositionedRectangle& defaultPos)
{
rect = PositionedRectangle (e.getStringAttribute ("pos", defaultPos.rect.toString()));
relativeToX = e.getStringAttribute ("posRelativeX", String::toHexString (defaultPos.relativeToX)).getHexValue64();
relativeToY = e.getStringAttribute ("posRelativeY", String::toHexString (defaultPos.relativeToY)).getHexValue64();
relativeToW = e.getStringAttribute ("posRelativeW", String::toHexString (defaultPos.relativeToW)).getHexValue64();
relativeToH = e.getStringAttribute ("posRelativeH", String::toHexString (defaultPos.relativeToH)).getHexValue64();
}
示例6: loadColourAttributes
bool ColouredElement::loadColourAttributes (const XmlElement& xml)
{
fillType.restoreFromString (xml.getStringAttribute ("fill", String::empty));
isStrokePresent = showOutline && xml.getBoolAttribute ("hasStroke", false);
strokeType.restoreFromString (xml.getStringAttribute ("stroke", String::empty));
strokeType.fill.restoreFromString (xml.getStringAttribute ("strokeColour", String::empty));
return true;
}
示例7: getAlbumList
bool SmugMug::getAlbumList(OwnedArray<Album>& albums)
{
StringPairArray params;
XmlElement* n = smugMugRequest(("smugmug.albums.get"), params);
if (n)
{
XmlElement* a = n->getChildByName(("Albums"));
if (a)
{
XmlElement* alb = a->getChildByName(("Album"));
while (alb)
{
Album* album = new Album();
album->id.id = alb->getIntAttribute(("id"));
album->id.key = alb->getStringAttribute(("Key"));
album->title = alb->getStringAttribute(("Title"));
XmlElement* cat = alb->getChildByName(("Category"));
if (cat)
{
album->category = cat->getStringAttribute(("Name"));
album->categoryId = cat->getIntAttribute(("id"));
}
else
{
album->category = String::empty;
album->categoryId = -1;
}
XmlElement* subcat = alb->getChildByName(("SubCategory"));
if (subcat)
{
album->subCategory = subcat->getStringAttribute(("Name"));
album->subCategoryId = subcat->getIntAttribute(("id"));
}
else
{
album->subCategory = String::empty;
album->subCategoryId = -1;
}
albums.add(album);
alb = alb->getNextElementWithTagName(("Album"));
}
}
delete n;
return true;
}
return false;
}
示例8: initDefaultPropertiesFile
void StoredSettings::initDefaultPropertiesFile()
{
XmlDocument defaultValuesXml(String::createStringFromData(BinaryData::default_values_xml,
BinaryData::default_values_xmlSize));
ScopedPointer<XmlElement> elem(defaultValuesXml.getDocumentElement());
if (getDefaultValues().getAllProperties().size() != elem->getNumChildElements())
{
for (int i = 0; i < elem->getNumChildElements(); ++i)
{
XmlElement* c = elem->getChildElement(i);
getDefaultValues().setValue(c->getStringAttribute("name"), c->getStringAttribute("val"));
}
}
}
示例9: getCategoryList
bool SmugMug::getCategoryList(OwnedArray<Category>& categories)
{
StringPairArray params;
XmlElement* n = smugMugRequest(("smugmug.categories.get"), params);
if (n)
{
XmlElement* c = n->getChildByName(("Categories"));
if (c)
{
XmlElement* cat = c->getChildByName(("Category"));
while (cat)
{
Category* category = new Category();
category->id = cat->getIntAttribute(("id"));
category->title = cat->getStringAttribute(("Name"));
categories.add(category);
cat = cat->getNextElementWithTagName(("Category"));
}
}
delete n;
return true;
}
return false;
}
示例10: createAlbum
SmugID SmugMug::createAlbum(const String& title, const int categoryId, const StringPairArray& albumFlags)
{
SmugID newAlbum;
newAlbum.id = -1;
StringPairArray params(albumFlags);
params.set(("Title"), title);
params.set(("CategoryID"), String(categoryId));
XmlElement* n = smugMugRequest(("smugmug.albums.create"), params);
if (n)
{
XmlElement* a = n->getChildByName(("Album"));
if (a)
{
newAlbum.id = a->getIntAttribute(("id"), -1);
newAlbum.key = a->getStringAttribute(("Key"));
}
if (newAlbum.id != -1)
addLogEntry(("Info: album created: ") + title);
delete n;
}
return newAlbum;
}
示例11: readConfig
void XmlParser::readConfig()
{
XmlDocument* xmlConfigDoc = new XmlDocument(File(File::getCurrentWorkingDirectory().getChildFile(configFile)));
XmlElement* xmlConfigElem = xmlConfigDoc->getDocumentElement();
if (xmlConfigElem != NULL)
{
XmlElement* pictures = xmlConfigElem->getChildByName(T("pictures"));
if (pictures != NULL)
{
if (pictures->hasAttribute(T("path")))
{
m_picturePath = pictures->getStringAttribute(T("path"));
}
else
{
LOG_ERROR(T("Element \"pictures\" is incomplete"));
}
}
else
{
LOG_ERROR(T("Element \"pictures\" not found"));
}
delete xmlConfigElem;
}
else
{
LOG_ERROR((T("XML load failed: %ls"), (const juce_wchar*)xmlConfigDoc->getLastParseError()));
}
delete xmlConfigDoc;
}
示例12: getSubCategoryList
bool SmugMug::getSubCategoryList(OwnedArray<SubCategory>& subCategories)
{
StringPairArray params;
XmlElement* n = smugMugRequest(("smugmug.subcategories.getAll"), params);
if (n)
{
XmlElement* c = n->getChildByName(("SubCategories"));
if (c)
{
XmlElement* subCat = c->getChildByName(("SubCategory"));
while (subCat)
{
SubCategory* subCategory = new SubCategory();
subCategory->id = subCat->getIntAttribute(("id"));
subCategory->title = subCat->getStringAttribute(("Name"));
XmlElement* cat = subCat->getChildByName(("Category"));
if (cat)
subCategory->parentId = cat->getIntAttribute(("id"));
subCategories.add(subCategory);
subCat = subCat->getNextElementWithTagName(("SubCategory"));
}
}
delete n;
return true;
}
return false;
}
示例13: initExporters
void StoredSettings::initExporters()
{
if(getExporters().getAllProperties().size() == 0)
{
XmlDocument xml(String::createStringFromData(BinaryData::default_exporters_xml,
BinaryData::default_exporters_xmlSize));
ScopedPointer<XmlElement> elem(xml.getDocumentElement());
for (int i = 0; i < elem->getNumChildElements(); ++i)
{
XmlElement* c = elem->getChildElement(i);
getExporters().setValue(c->getStringAttribute("name"), c->getStringAttribute("val"));
}
String currentExporter = getExporters().getAllProperties().getAllKeys()[0];
setCurrentExporter(currentExporter);
}
}
示例14: getMachineNumbers
static StringArray getMachineNumbers (XmlElement xml, StringRef attributeName)
{
StringArray numbers;
numbers.addTokens (xml.getStringAttribute (attributeName), ",; ", StringRef());
numbers.trim();
numbers.removeEmptyStrings();
return numbers;
}
示例15: buildFromXml
void CommandTableModel::buildFromXml(XmlElement *root)
{
if (root->getTagName().compare("settings") != 0)
return;
removeAllRows();
XmlElement* setting = root->getFirstChildElement();
while ((setting) && (m_commandMap))
{
if (setting->hasAttribute("controller"))
{
MIDI_Message cc(setting->getIntAttribute("channel"), setting->getIntAttribute("controller"), true);
addRow(cc.channel, cc.controller, true);
// older versions of MIDI2LR stored the index of the string, so we should attempt to parse this as well
if (setting->getIntAttribute("command", -1) != -1)
{
m_commandMap->addCommandforMessage(setting->getIntAttribute("command"), cc);
}
else
{
m_commandMap->addCommandforMessage(setting->getStringAttribute("command_string"), cc);
}
}
else if (setting->hasAttribute("note"))
{
MIDI_Message note(setting->getIntAttribute("channel"), setting->getIntAttribute("note"), false);
addRow(note.channel, note.pitch, false);
// older versions of MIDI2LR stored the index of the string, so we should attempt to parse this as well
if (setting->getIntAttribute("command", -1) != -1)
{
m_commandMap->addCommandforMessage(setting->getIntAttribute("command"), note);
}
else
{
m_commandMap->addCommandforMessage(setting->getStringAttribute("command_string"), note);
}
}
setting = setting->getNextElement();
}
}