
We bake cookies in your browser for a better experience. Using this site means that you consent.Read More
TheQXmlNamespaceSupport class is a helper class for XML readers which want to include namespace support.More...
| Header: | #include <QXmlNamespaceSupport> |
| Since: | Qt 4.4 |
Note: All functions in this class arereentrant.
| QXmlNamespaceSupport() | |
| ~QXmlNamespaceSupport() | |
| void | popContext() |
| QString | prefix(const QString & uri) const |
| QStringList | prefixes() const |
| QStringList | prefixes(const QString & uri) const |
| void | processName(const QString & qname, bool isAttribute, QString & nsuri, QString & localname) const |
| void | pushContext() |
| void | reset() |
| void | setPrefix(const QString & pre, const QString & uri) |
| void | splitName(const QString & qname, QString & prefix, QString & localname) const |
| QString | uri(const QString & prefix) const |
TheQXmlNamespaceSupport class is a helper class for XML readers which want to include namespace support.
You can set the prefix for the current namespace withsetPrefix(), and get the list of current prefixes (or those for a given URI) withprefixes(). The namespace URI is available fromuri(). UsepushContext() to start a new namespace context, andpopContext() to return to the previous namespace context. UsesplitName() orprocessName() to split a name into its prefix and local name.
See alsoNamespace Support via Features.
Constructs aQXmlNamespaceSupport.
Destroys aQXmlNamespaceSupport.
Reverts to the previous namespace context.
Normally, you should pop the context at the end of each XML element. After popping the context, all namespace prefix mappings that were previously in force are restored.
See alsopushContext().
Returns one of the prefixes mapped to the namespace URIuri.
If more than one prefix is currently mapped to the same URI, this function makes an arbitrary selection; if you want all of the prefixes, useprefixes() instead.
Note: to check for a default prefix, use theuri() function with an argument of "".
See alsosetPrefix().
Returns a list of all the prefixes currently declared.
If there is a default prefix, this function does not return it in the list; check for the default prefix usinguri() with an argument of "".
This is an overloaded function.
Returns a list of all prefixes currently declared for the namespace URIuri.
The "xml:" prefix is included. If you only want one prefix that is mapped to the namespace URI, and you don't care which one you get, use theprefix() function instead.
Note: The empty (default) prefix is never included in this list; to check for the presence of a default namespace, calluri() with "" as the argument.
Processes a raw XML 1.0 name in the current context by removing the prefix and looking it up among the prefixes currently declared.
qname is the raw XML 1.0 name to be processed.isAttribute is true if the name is an attribute name.
This function stores the namespace URI innsuri (which will be set to an empty string if the raw name has an undeclared prefix), and stores the local name (without prefix) inlocalname (which will be set to an empty string if no namespace is in use).
Note that attribute names are processed differently than element names: an unprefixed element name gets the default namespace (if any), while an unprefixed attribute name does not.
Starts a new namespace context.
Normally, you should push a new context at the beginning of each XML element: the new context automatically inherits the declarations of its parent context, and it also keeps track of which declarations were made within this context.
See alsopopContext().
Resets this namespace support object ready for reuse.
This function declares a prefixpre in the current namespace context to be the namespace URIuri. The prefix remains in force until this context is popped, unless it is shadowed in a descendant context.
Note that there is an asymmetry in this library.prefix() does not return the default "" prefix, even if you have declared one; to check for a default prefix, you must look it up explicitly usinguri(). This asymmetry exists to make it easier to look up prefixes for attribute names, where the default prefix is not allowed.
See alsoprefix().
Splits the nameqname at the ':' and returns the prefix inprefix and the local name inlocalname.
See alsoprocessName().
Looks up the prefixprefix in the current context and returns the currently-mapped namespace URI. Use the empty string ("") for the default namespace.
© 2016 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of theGNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.