本文整理汇总了C++中KoXmlDocument::firstChild方法的典型用法代码示例。如果您正苦于以下问题:C++ KoXmlDocument::firstChild方法的具体用法?C++ KoXmlDocument::firstChild怎么用?C++ KoXmlDocument::firstChild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KoXmlDocument
的用法示例。
在下文中一共展示了KoXmlDocument::firstChild方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parseManifest
bool KoOdfLoadingContext::parseManifest(const KoXmlDocument &manifestDocument)
{
// First find the manifest:manifest node.
KoXmlNode n = manifestDocument.firstChild();
kDebug(30006) << "Searching for manifest:manifest " << n.toElement().nodeName();
for (; !n.isNull(); n = n.nextSibling()) {
if (!n.isElement()) {
kDebug(30006) << "NOT element";
continue;
} else {
kDebug(30006) << "element";
}
kDebug(30006) << "name:" << n.toElement().localName()
<< "namespace:" << n.toElement().namespaceURI();
if (n.toElement().localName() == "manifest"
&& n.toElement().namespaceURI() == KoXmlNS::manifest)
{
kDebug(30006) << "found manifest:manifest";
break;
}
}
if (n.isNull()) {
kDebug(30006) << "Could not find manifest:manifest";
return false;
}
// Now loop through the children of the manifest:manifest and
// store all the manifest:file-entry elements.
const KoXmlElement manifestElement = n.toElement();
for (n = manifestElement.firstChild(); !n.isNull(); n = n.nextSibling()) {
if (!n.isElement())
continue;
KoXmlElement el = n.toElement();
if (!(el.localName() == "file-entry" && el.namespaceURI() == KoXmlNS::manifest))
continue;
QString fullPath = el.attributeNS(KoXmlNS::manifest, "full-path", QString());
QString mediaType = el.attributeNS(KoXmlNS::manifest, "media-type", QString(""));
QString version = el.attributeNS(KoXmlNS::manifest, "version", QString());
// Only if fullPath is valid, should we store this entry.
// If not, we don't bother to find out exactly what is wrong, we just skip it.
if (!fullPath.isNull()) {
d->manifestEntries.insert(fullPath,
new KoOdfManifestEntry(fullPath, mediaType, version));
}
}
return true;
}