diff --git a/dlls/webservices/reader.c b/dlls/webservices/reader.c index a0d0792b4b8..cc71f982bd2 100644 --- a/dlls/webservices/reader.c +++ b/dlls/webservices/reader.c @@ -284,7 +284,7 @@ struct node *alloc_node( WS_XML_NODE_TYPE type ) return ret; } -static void free_attribute( WS_XML_ATTRIBUTE *attr ) +void free_attribute( WS_XML_ATTRIBUTE *attr ) { if (!attr) return; heap_free( attr->prefix ); @@ -807,7 +807,7 @@ static HRESULT read_xmldecl( struct reader *reader ) return S_OK; } -static HRESULT append_attribute( WS_XML_ELEMENT_NODE *elem, WS_XML_ATTRIBUTE *attr ) +HRESULT append_attribute( WS_XML_ELEMENT_NODE *elem, WS_XML_ATTRIBUTE *attr ) { if (elem->attributeCount) { diff --git a/dlls/webservices/webservices.spec b/dlls/webservices/webservices.spec index df56adbfef2..c92588b5938 100644 --- a/dlls/webservices/webservices.spec +++ b/dlls/webservices/webservices.spec @@ -181,7 +181,7 @@ @ stub WsWriteMessageStart @ stub WsWriteNode @ stub WsWriteQualifiedName -@ stub WsWriteStartAttribute +@ stdcall WsWriteStartAttribute(ptr ptr ptr ptr long ptr) @ stub WsWriteStartCData @ stdcall WsWriteStartElement(ptr ptr ptr ptr ptr) @ stub WsWriteText diff --git a/dlls/webservices/webservices_private.h b/dlls/webservices/webservices_private.h index cac9b87a2da..3bb039fe5cd 100644 --- a/dlls/webservices/webservices_private.h +++ b/dlls/webservices/webservices_private.h @@ -29,6 +29,8 @@ void *ws_realloc( WS_HEAP *, void *, SIZE_T ) DECLSPEC_HIDDEN; void ws_free( WS_HEAP *, void * ) DECLSPEC_HIDDEN; const char *debugstr_xmlstr( const WS_XML_STRING * ) DECLSPEC_HIDDEN; WS_XML_STRING *alloc_xml_string( const char *, ULONG ) DECLSPEC_HIDDEN; +HRESULT append_attribute( WS_XML_ELEMENT_NODE *, WS_XML_ATTRIBUTE * ) DECLSPEC_HIDDEN; +void free_attribute( WS_XML_ATTRIBUTE * ) DECLSPEC_HIDDEN; struct node { diff --git a/dlls/webservices/writer.c b/dlls/webservices/writer.c index 976f97bcebe..a9ff7611a30 100644 --- a/dlls/webservices/writer.c +++ b/dlls/webservices/writer.c @@ -632,6 +632,49 @@ HRESULT WINAPI WsWriteEndStartElement( WS_XML_WRITER *handle, WS_ERROR *error ) return S_OK; } +/************************************************************************** + * WsWriteStartAttribute [webservices.@] + */ +HRESULT WINAPI WsWriteStartAttribute( WS_XML_WRITER *handle, const WS_XML_STRING *prefix, + const WS_XML_STRING *localname, const WS_XML_STRING *ns, + BOOL single, WS_ERROR *error ) +{ + struct writer *writer = (struct writer *)handle; + WS_XML_ELEMENT_NODE *elem; + WS_XML_ATTRIBUTE *attr; + HRESULT hr = E_OUTOFMEMORY; + + TRACE( "%p %s %s %s %d %p\n", handle, debugstr_xmlstr(prefix), debugstr_xmlstr(localname), + debugstr_xmlstr(ns), single, error ); + if (error) FIXME( "ignoring error parameter\n" ); + + if (!writer || !localname || !ns) return E_INVALIDARG; + + if (writer->state != WRITER_STATE_STARTELEMENT) return WS_E_INVALID_OPERATION; + elem = (WS_XML_ELEMENT_NODE *)writer->current; + + if (!(attr = heap_alloc_zero( sizeof(*attr) ))) return E_OUTOFMEMORY; + attr->singleQuote = !!single; + + if (prefix && !(attr->prefix = alloc_xml_string( (const char *)prefix->bytes, prefix->length ))) + goto error; + + if (!(attr->localName = alloc_xml_string( (const char *)localname->bytes, localname->length ))) + goto error; + + if (!(attr->ns = alloc_xml_string( (const char *)ns->bytes, ns->length ))) + goto error; + + if ((hr = append_attribute( elem, attr )) != S_OK) goto error; + + writer->state = WRITER_STATE_STARTATTRIBUTE; + return S_OK; + +error: + free_attribute( attr ); + return hr; +} + /************************************************************************** * WsWriteStartElement [webservices.@] */