本文整理汇总了C++中dom::Element::ownerDocument方法的典型用法代码示例。如果您正苦于以下问题:C++ Element::ownerDocument方法的具体用法?C++ Element::ownerDocument怎么用?C++ Element::ownerDocument使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dom::Element
的用法示例。
在下文中一共展示了Element::ownerDocument方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: KUrl
LinkItem::LinkItem( DOM::Element link )
: m_valid( false )
{
DOM::NamedNodeMap attrs = link.attributes();
DOM::Node href = attrs.getNamedItem( "href" );
// Load source address of images too
DOM::Node src = attrs.getNamedItem( "src" );
if ( href.nodeValue().string().isEmpty() && !src.nodeValue().string().isEmpty() )
href = src;
// qDebug("*** href: %s", href.nodeValue().string().latin1() );
QString urlString = link.ownerDocument().completeURL( href.nodeValue() ).string();
if ( urlString.isEmpty() )
return;
url = KUrl( urlString );
if ( !KProtocolManager::supportsReading( url ) )
return;
// somehow getElementsByTagName("#text") doesn't work :(
DOM::NodeList children = link.childNodes();
for ( uint i = 0; i < children.length(); i++ )
{
DOM::Node node = children.item( i );
if ( node.nodeType() == DOM::Node::TEXT_NODE )
text.append( node.nodeValue().string() );
}
// force "local file" mimetype determination
KMimeType::Ptr mt = KMimeType::findByUrl( url, 0, true, true);
icon = mt->iconName();
mimeType = mt->comment();
m_valid = true;
}
示例2: initializeCSSInfoFromElement
void DOMTreeView::initializeCSSInfoFromElement(const DOM::Element &element)
{
DOM::Document doc = element.ownerDocument();
DOM::AbstractView view = doc.defaultView();
DOM::CSSStyleDeclaration styleDecl = view.getComputedStyle(element,
DOM::DOMString());
unsigned long l = styleDecl.length();
cssProperties->clear();
cssProperties->setEnabled(true);
QList<QTreeWidgetItem *> items;
for (unsigned long i = 0; i < l; ++i) {
DOM::DOMString name = styleDecl.item(i);
DOM::DOMString value = styleDecl.getPropertyValue(name);
QStringList values;
values.append(name.string());
values.append(value.string());
items.append(new QTreeWidgetItem(static_cast<QTreeWidget*>(0), values));
}
cssProperties->insertTopLevelItems(0, items);
cssProperties->resizeColumnToContents(0);
}