本文整理汇总了C++中XmlAttribute::GetName方法的典型用法代码示例。如果您正苦于以下问题:C++ XmlAttribute::GetName方法的具体用法?C++ XmlAttribute::GetName怎么用?C++ XmlAttribute::GetName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XmlAttribute
的用法示例。
在下文中一共展示了XmlAttribute::GetName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _readNodeCallback
bool LibreOfficeInspector::_readNodeCallback(XmlNode node, void *data)
{
vector <XmlAttribute>* attributes;
bool bIsItem;
if (g_parsing_state == PropUILocale && node.GetName().compare(L"value")==0)
{
wstring* lang_found = (wstring *) data;
*lang_found = node.GetText();
g_parsing_state = ItemOther;
return false;
}
bIsItem = node.GetName().compare(L"item") == 0;
if (bIsItem && g_parsing_state != ItemOther)
{
g_parsing_state = ItemOther;
}
attributes = node.GetAttributes();
for (unsigned int i = 0; i < attributes->size(); i++)
{
XmlAttribute attribute;
attribute = attributes->at(i);
if (g_parsing_state == ItemOther && bIsItem && attribute.GetName() == L"oor:path" && attribute.GetValue() == L"/org.openoffice.Office.Linguistic/General")
{
g_parsing_state = ItemLinguisticGeneral;
}
if (g_parsing_state == ItemLinguisticGeneral && attribute.GetName() == L"oor:name" && attribute.GetValue() == L"UILocale")
{
g_parsing_state = PropUILocale;
}
}
return true;
}
示例2: OnParse
//[-------------------------------------------------------]
//[ Protected virtual XmlTextElement functions ]
//[-------------------------------------------------------]
void XmlTextImage::OnParse(XmlNode &cXmlNode)
{
// Is this an XML element?
if (cXmlNode.GetType() == XmlNode::Element) {
// Destroy the previous image
if (m_pImage) {
delete m_pImage;
m_pImage = nullptr;
}
// Get XML element
XmlElement &cXmlElement = static_cast<XmlElement&>(cXmlNode);
// Parse attributes
XmlAttribute *pAttribute = cXmlElement.GetFirstAttribute();
while (pAttribute) {
// Get name and value
String sName = pAttribute->GetName();
String sValue = pAttribute->GetValue();
// Save attribute
if (sName.CompareNoCase("Src")) {
// Image filename
m_sFilename = sValue;
} else if (sName.CompareNoCase("Width")) {
// Image width
m_vSize.x = sValue.GetInt();
} if (sName.CompareNoCase("Height")) {
// Image height
m_vSize.y = sValue.GetInt();
}
// Next attribute
pAttribute = pAttribute->GetNext();
}
}
}
示例3: SkipWhiteSpace
//.........这里部分代码省略.........
if (*pszData == '/') {
++pszData;
// Empty tag
if (*pszData != '>') {
// Set error code
XmlDocument *pDocument = GetDocument();
if (pDocument)
pDocument->SetError(ErrorParsingEmpty, pszData, pData, nEncoding);
// Error!
return nullptr;
}
return (pszData + 1);
} else if (*pszData == '>') {
// Done with attributes (if there were any)
// Read the value -- which can include other elements -- read the end tag, and return
++pszData;
pszData = ReadValue(pszData, pData, nEncoding); // Note this is an Element method, and will set the error if one happens
if (!pszData || !*pszData) {
// We were looking for the end tag, but found nothing
XmlDocument *pDocument = GetDocument();
if (pDocument)
pDocument->SetError(ErrorReadingEndTag, pszData, pData, nEncoding);
// Error!
return nullptr;
}
// We should find the end tag now
// Note that:
// </foo > and
// </foo>
// are both valid end tags
if (StringEqual(pszData, sEndTag, false, nEncoding)) {
pszData += sEndTag.GetLength();
pszData = SkipWhiteSpace(pszData, nEncoding);
if (pszData && *pszData && *pszData == '>') {
++pszData;
return pszData;
}
// Set error code
XmlDocument *pDocument = GetDocument();
if (pDocument)
pDocument->SetError(ErrorReadingEndTag, pszData, pData, nEncoding);
// Error!
return nullptr;
} else {
// Set error code
XmlDocument *pDocument = GetDocument();
if (pDocument)
pDocument->SetError(ErrorReadingEndTag, pszData, pData, nEncoding);
// Error!
return nullptr;
}
} else {
// Try to read an attribute
XmlAttribute *pAttribute = new XmlAttribute();
pAttribute->m_pDocument = GetDocument();
pszError = pszData;
pszData = pAttribute->Parse(pszData, pData, nEncoding);
if (!pszData || !*pszData) {
// Set error code
XmlDocument *pDocument = GetDocument();
if (pDocument)
pDocument->SetError(ErrorParsingElement, pszError, pData, nEncoding);
// Destroy the created attribute
delete pAttribute;
// Error!
return nullptr;
}
// Handle the strange case of double attributes
XmlAttribute *pNode = m_cAttributeSet.Find(pAttribute->GetName());
if (pNode) {
// Set error code
XmlDocument *pDocument = GetDocument();
if (pDocument)
pDocument->SetError(ErrorParsingElement, pszError, pData, nEncoding);
// Destroy the created attribute
delete pAttribute;
// Error!
return nullptr;
}
// Register the created attribute
m_cAttributeSet.Add(*pAttribute);
}
}
// Done
return pszData;
}