Share via


GetQualifiedName (Compact 2013)

3/26/2014

This interface returns the qualified name of the node on which the reader is currently positioned. If no qualified name is available, this interface returns an empty string.

Syntax

HRESULT GetQualifiedName (
  const WCHAR** ppwszQualifiedName, 
  UINT* pcwchQualifiedName
);

Arguments

  • ppwszQualifiedName
    [out] The qualified name of the node that the reader is currently positioned on. The returned string is always NULL-terminated.

    If no qualified name is available, the returned string is empty.

    The passed in value must not be NULL..

  • pcwchQualifiedName
    [out] The size of the string, in characters, is returned.

    This value is optional. You can pass NULL for it, and the method will not return a value.

Return Value

Returns S_OK if no error is generated.

Remarks

This method does not expand namespace prefixes. For example, if the reader is positioned on the element <p:abc />, this method returns the string "p:abc".

Note

The pointer that is returned by GetQualifiedName is only valid until you move the reader to another node. When you move the reader to another node, XmlLite can reuse the memory referenced by the pointer. Therefore, you should not use the pointer after you call one of the following methods: Read, MoveToNextAttribute, MoveToFirstAttribute, MoveToAttributeByName, or MoveToElement. Although they do not move the reader, the following two methods will also make the pointer invalid: SetInput and IUnknown::Release. If you want to preserve the value that was returned in ppwszQualifiedName, you should make a deep copy.

The following code returns the qualified name of the current node from the reader:

if (FAILED(hr = pReader->GetQualifiedName(&pQName, NULL)))
{
    wprintf(L"Error reading element name, error is %08.8lx", hr);
    return -1;
}

See Also

Reference

IXmlReader Methods
GetLocalName
IXmlReader Properties
Error Codes