Commit 760190b5 authored by Owen Rudge's avatar Owen Rudge Committed by Alexandre Julliard

wsdapi: Implement WSDXMLGetValueFromAny.

parent db94c527
......@@ -42,4 +42,4 @@
@ stdcall WSDXMLCleanupElement(ptr)
@ stdcall WSDXMLCreateContext(ptr)
@ stub WSDXMLGetNameFromBuiltinNamespace
@ stub WSDXMLGetValueFromAny
@ stdcall WSDXMLGetValueFromAny(wstr wstr ptr wstr)
......@@ -238,6 +238,46 @@ HRESULT WINAPI WSDXMLCleanupElement(WSDXML_ELEMENT *pAny)
return S_OK;
}
HRESULT WINAPI WSDXMLGetValueFromAny(const WCHAR *pszNamespace, const WCHAR *pszName, WSDXML_ELEMENT *pAny, LPCWSTR *ppszValue)
{
WSDXML_ELEMENT *element;
WSDXML_TEXT *text;
if (pAny == NULL)
return E_INVALIDARG;
if (ppszValue == NULL)
return E_POINTER;
if ((pszNamespace == NULL) || (pszName == NULL) || (lstrlenW(pszNamespace) > WSD_MAX_TEXT_LENGTH) || (lstrlenW(pszName) > WSD_MAX_TEXT_LENGTH))
return E_INVALIDARG;
element = pAny;
while (element != NULL)
{
if (element->Node.Type == ElementType)
{
if ((lstrcmpW(element->Name->LocalName, pszName) == 0) && (lstrcmpW(element->Name->Space->Uri, pszNamespace) == 0))
{
if ((element->FirstChild == NULL) || (element->FirstChild->Type != TextType))
{
return E_FAIL;
}
text = (WSDXML_TEXT *) element->FirstChild;
*ppszValue = (LPCWSTR) text->Text;
return S_OK;
}
}
element = (WSDXML_ELEMENT *) element->Node.Next;
}
return E_FAIL;
}
/* IWSDXMLContext implementation */
struct xmlNamespace
......
......@@ -28,5 +28,6 @@ HRESULT WINAPI WSDXMLAddChild(WSDXML_ELEMENT *pParent, WSDXML_ELEMENT *pChild);
HRESULT WINAPI WSDXMLAddSibling(WSDXML_ELEMENT *pFirst, WSDXML_ELEMENT *pSecond);
HRESULT WINAPI WSDXMLBuildAnyForSingleElement(WSDXML_NAME *pElementName, LPCWSTR pszText, WSDXML_ELEMENT **ppAny);
HRESULT WINAPI WSDXMLCleanupElement(WSDXML_ELEMENT *pAny);
HRESULT WINAPI WSDXMLGetValueFromAny(const WCHAR *pszNamespace, const WCHAR *pszName, WSDXML_ELEMENT *pAny, LPCWSTR *ppszValue);
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment