webservices: Implement WsWriteStartAttribute.

Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Hans Leidekker 2015-11-11 11:02:06 +01:00 committed by Alexandre Julliard
parent 08c32f4ec3
commit 919b1b5fdc
4 changed files with 48 additions and 3 deletions

View File

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

View File

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

View File

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

View File

@ -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.@]
*/