lib Library API Documentation

KoDom Namespace Reference

This namespace contains a few convenience functions to simplify code using QDom (when loading OASIS documents, in particular). More...


Functions

KOFFICECORE_EXPORT QDomElement namedItemNS (const QDomNode &node, const char *nsURI, const char *localName)


Detailed Description

This namespace contains a few convenience functions to simplify code using QDom (when loading OASIS documents, in particular).

To find the child element with a given name, use KoDom::namedItemNS.

To find all child elements with a given name, use QDomElement e; forEachElement( e, parent ) { if ( e.localName() == "..." && e.namespaceURI() == KoXmlNS::... ) { ... } } Note that this means you don't ever need to use QDomNode nor toElement anymore! Also note that localName is the part without the prefix, this is the whole point of namespace-aware methods.

To find the attribute with a given name, use QDomElement::attributeNS.

Do not use getElementsByTagNameNS, it's recursive (which is never needed in KOffice). Do not use tagName() or nodeName() or prefix(), since the prefix isn't fixed.

Author:
David Faure <faure@kde.org>


Function Documentation

KOFFICECORE_EXPORT QDomElement KoDom::namedItemNS const QDomNode node,
const char *  nsURI,
const char *  localName
 

A namespace-aware version of QDomNode::namedItem(), which also takes care of casting to a QDomElement.

Use this when a domelement is known to have only *one* child element with a given tagname.

Note: do *NOT* use getElementsByTagNameNS, it's recursive!

Referenced by KoStyleStack::attributeNS(), KoStyleStack::childNodeNS(), KoOasisStyles::createStyleMap(), KoListStyleStack::currentListStyleProperties(), KoStyleStack::fontSize(), KoStyleStack::hasAttributeNS(), KoStyleStack::hasChildNodeNS(), KoPageLayout::loadOasis(), and KoOasisContext::pushOutlineListLevelStyle().

KDE Logo
This file is part of the documentation for lib Library Version 1.4.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Mon Feb 13 09:42:08 2006 by doxygen 1.4.2 written by Dimitri van Heesch, © 1997-2003