wsdapi: Implement WSDXMLGetValueFromAny.

Signed-off-by: Owen Rudge <orudge@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Owen Rudge 2017-06-28 22:13:26 +01:00 committed by Alexandre Julliard
parent db94c52719
commit 760190b524
3 changed files with 42 additions and 1 deletions

View File

@ -42,4 +42,4 @@
@ stdcall WSDXMLCleanupElement(ptr)
@ stdcall WSDXMLCreateContext(ptr)
@ stub WSDXMLGetNameFromBuiltinNamespace
@ stub WSDXMLGetValueFromAny
@ stdcall WSDXMLGetValueFromAny(wstr wstr ptr wstr)

View File

@ -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

View File

@ -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