Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 5

Qt-interest Archive, February 2008
QtXml DOM namespace handling


Message 1 in thread

Hi guys,

I have a possibly tricky question here.
Do you know any way to retrieve the namespace URI for a given prefix
using Qt's DOM classes?

Let me explain the issue better.

I have parsed an XML document using QDomDocument::setContent(CONTENT,
YES_ENABLE_NAMESPACE_PROCESSING).

Suppose I have the following document (yes it's a WSDL-like snippet ;-):

<definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema";>
  <message name="doSomething">
    <part name="key" type="xsd:string"/>
  </message>
</definitions>

I need to retrieve the "http://www.w3.org/2001/XMLSchema"; URI for the
"xsd" namespace prefix.
I see no way to do this, unless the namespace is attached to an
element or attribute name (but not to its value).

IOW, I was looking for something like
myMessagePartElement.resolveNamespace("xsd") .

The QDomSimpleReader parses uses QXmlNamespaceSupport to keep track of
the namespaces but there is no way to access this information after
parsing completes.

Any suggestion is appreciated :-)

--
 [ signature omitted ]