mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 04:53:31 +08:00
[XMLLITE] Sync with Wine Staging 2.16. CORE-13762
49a57bc xmllite/writer: Improve handling of the output with invalid encoding. a6d6beb xmllite/writer: Do not indent after just BOM has been written. 5773a5d xmllite/writer: Fix indentation on WriteElementString(). 5f4ed88 xmllite/writer: Fix empty element and state handling in WriteElementString(). b06dd7d xmllite/reader: Added a helper for setting current attribute cursor. be56791 xmllite/reader: Implement MoveToAttributeByName(). svn path=/trunk/; revision=75950
This commit is contained in:
parent
73ddc666c6
commit
c95d5971f0
@ -146,7 +146,7 @@ struct xml_encoding_data
|
||||
|
||||
static const struct xml_encoding_data xml_encoding_map[] = {
|
||||
{ usasciiW, XmlEncoding_USASCII, 20127 },
|
||||
{ utf16W, XmlEncoding_UTF16, ~0 },
|
||||
{ utf16W, XmlEncoding_UTF16, 1200 },
|
||||
{ utf8W, XmlEncoding_UTF8, CP_UTF8 },
|
||||
};
|
||||
|
||||
@ -511,6 +511,19 @@ static void reader_clear_elements(xmlreader *reader)
|
||||
reader->is_empty_element = FALSE;
|
||||
}
|
||||
|
||||
static struct ns *reader_lookup_ns(xmlreader *reader, const strval *prefix)
|
||||
{
|
||||
struct list *nslist = prefix ? &reader->ns : &reader->nsdef;
|
||||
struct ns *ns;
|
||||
|
||||
LIST_FOR_EACH_ENTRY_REV(ns, nslist, struct ns, entry) {
|
||||
if (strval_eq(reader, prefix, &ns->prefix))
|
||||
return ns;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static HRESULT reader_inc_depth(xmlreader *reader)
|
||||
{
|
||||
return (++reader->depth >= reader->max_depth && reader->max_depth) ? SC_E_MAXELEMENTDEPTH : S_OK;
|
||||
@ -1061,7 +1074,7 @@ static HRESULT reader_more(xmlreader *reader)
|
||||
prev_len = dest->written / sizeof(WCHAR);
|
||||
|
||||
/* just copy for UTF-16 case */
|
||||
if (cp == ~0)
|
||||
if (cp == 1200)
|
||||
{
|
||||
readerinput_grow(readerinput, len);
|
||||
memcpy(dest->data + dest->written, src->data + src->cur, len);
|
||||
@ -2928,6 +2941,15 @@ static HRESULT WINAPI xmlreader_GetNodeType(IXmlReader* iface, XmlNodeType *node
|
||||
return This->state == XmlReadState_Closed ? S_FALSE : S_OK;
|
||||
}
|
||||
|
||||
static void reader_set_current_attribute(xmlreader *reader, struct attribute *attr)
|
||||
{
|
||||
reader->attr = attr;
|
||||
reader->chunk_read_off = 0;
|
||||
reader_set_strvalue(reader, StringValue_Prefix, &attr->prefix);
|
||||
reader_set_strvalue(reader, StringValue_QualifiedName, &attr->qname);
|
||||
reader_set_strvalue(reader, StringValue_Value, &attr->value);
|
||||
}
|
||||
|
||||
static HRESULT reader_move_to_first_attribute(xmlreader *reader)
|
||||
{
|
||||
if (!reader->attr_count)
|
||||
@ -2936,11 +2958,7 @@ static HRESULT reader_move_to_first_attribute(xmlreader *reader)
|
||||
if (!reader->attr)
|
||||
reader_inc_depth(reader);
|
||||
|
||||
reader->attr = LIST_ENTRY(list_head(&reader->attrs), struct attribute, entry);
|
||||
reader->chunk_read_off = 0;
|
||||
reader_set_strvalue(reader, StringValue_Prefix, &reader->attr->prefix);
|
||||
reader_set_strvalue(reader, StringValue_QualifiedName, &reader->attr->qname);
|
||||
reader_set_strvalue(reader, StringValue_Value, &reader->attr->value);
|
||||
reader_set_current_attribute(reader, LIST_ENTRY(list_head(&reader->attrs), struct attribute, entry));
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
@ -2968,23 +2986,111 @@ static HRESULT WINAPI xmlreader_MoveToNextAttribute(IXmlReader* iface)
|
||||
|
||||
next = list_next(&This->attrs, &This->attr->entry);
|
||||
if (next)
|
||||
{
|
||||
This->attr = LIST_ENTRY(next, struct attribute, entry);
|
||||
This->chunk_read_off = 0;
|
||||
reader_set_strvalue(This, StringValue_Prefix, &This->attr->prefix);
|
||||
reader_set_strvalue(This, StringValue_QualifiedName, &This->attr->qname);
|
||||
reader_set_strvalue(This, StringValue_Value, &This->attr->value);
|
||||
}
|
||||
reader_set_current_attribute(This, LIST_ENTRY(next, struct attribute, entry));
|
||||
|
||||
return next ? S_OK : S_FALSE;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI xmlreader_MoveToAttributeByName(IXmlReader* iface,
|
||||
LPCWSTR local_name,
|
||||
LPCWSTR namespaceUri)
|
||||
static void reader_get_attribute_ns_uri(xmlreader *reader, struct attribute *attr, const WCHAR **uri, UINT *len)
|
||||
{
|
||||
FIXME("(%p %p %p): stub\n", iface, local_name, namespaceUri);
|
||||
return E_NOTIMPL;
|
||||
static const WCHAR xmlns_uriW[] = {'h','t','t','p',':','/','/','w','w','w','.','w','3','.','o','r','g','/',
|
||||
'2','0','0','0','/','x','m','l','n','s','/',0};
|
||||
static const WCHAR xml_uriW[] = {'h','t','t','p',':','/','/','w','w','w','.','w','3','.','o','r','g','/',
|
||||
'X','M','L','/','1','9','9','8','/','n','a','m','e','s','p','a','c','e',0};
|
||||
|
||||
/* Check for reserved prefixes first */
|
||||
if ((strval_eq(reader, &attr->prefix, &strval_empty) && strval_eq(reader, &attr->localname, &strval_xmlns)) ||
|
||||
strval_eq(reader, &attr->prefix, &strval_xmlns))
|
||||
{
|
||||
*uri = xmlns_uriW;
|
||||
*len = sizeof(xmlns_uriW)/sizeof(xmlns_uriW[0]) - 1;
|
||||
}
|
||||
else if (strval_eq(reader, &attr->prefix, &strval_xml))
|
||||
{
|
||||
*uri = xml_uriW;
|
||||
*len = sizeof(xml_uriW)/sizeof(xml_uriW[0]) - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
*uri = NULL;
|
||||
*len = 0;
|
||||
}
|
||||
|
||||
if (!*uri)
|
||||
{
|
||||
struct ns *ns;
|
||||
|
||||
if ((ns = reader_lookup_ns(reader, &attr->prefix)))
|
||||
{
|
||||
*uri = ns->uri.str;
|
||||
*len = ns->uri.len;
|
||||
}
|
||||
else
|
||||
{
|
||||
*uri = emptyW;
|
||||
*len = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void reader_get_attribute_local_name(xmlreader *reader, struct attribute *attr, const WCHAR **name, UINT *len)
|
||||
{
|
||||
if (attr->flags & ATTRIBUTE_DEFAULT_NS_DEFINITION)
|
||||
{
|
||||
*name = xmlnsW;
|
||||
*len = 5;
|
||||
}
|
||||
else if (attr->flags & ATTRIBUTE_NS_DEFINITION)
|
||||
{
|
||||
const struct ns *ns = reader_lookup_ns(reader, &attr->localname);
|
||||
*name = ns->prefix.str;
|
||||
*len = ns->prefix.len;
|
||||
}
|
||||
else
|
||||
{
|
||||
*name = attr->localname.str;
|
||||
*len = attr->localname.len;
|
||||
}
|
||||
}
|
||||
|
||||
static HRESULT WINAPI xmlreader_MoveToAttributeByName(IXmlReader* iface,
|
||||
const WCHAR *local_name, const WCHAR *namespace_uri)
|
||||
{
|
||||
xmlreader *This = impl_from_IXmlReader(iface);
|
||||
UINT target_name_len, target_uri_len;
|
||||
struct attribute *attr;
|
||||
|
||||
TRACE("(%p)->(%s %s)\n", This, debugstr_w(local_name), debugstr_w(namespace_uri));
|
||||
|
||||
if (!local_name)
|
||||
return E_INVALIDARG;
|
||||
|
||||
if (!This->attr_count)
|
||||
return S_FALSE;
|
||||
|
||||
if (!namespace_uri)
|
||||
namespace_uri = emptyW;
|
||||
|
||||
target_name_len = strlenW(local_name);
|
||||
target_uri_len = strlenW(namespace_uri);
|
||||
|
||||
LIST_FOR_EACH_ENTRY(attr, &This->attrs, struct attribute, entry)
|
||||
{
|
||||
UINT name_len, uri_len;
|
||||
const WCHAR *name, *uri;
|
||||
|
||||
reader_get_attribute_local_name(This, attr, &name, &name_len);
|
||||
reader_get_attribute_ns_uri(This, attr, &uri, &uri_len);
|
||||
|
||||
if (name_len == target_name_len && uri_len == target_uri_len &&
|
||||
!strcmpW(name, local_name) && !strcmpW(uri, namespace_uri))
|
||||
{
|
||||
reader_set_current_attribute(This, attr);
|
||||
return S_OK;
|
||||
}
|
||||
}
|
||||
|
||||
return S_FALSE;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI xmlreader_MoveToElement(IXmlReader* iface)
|
||||
@ -3078,19 +3184,6 @@ static HRESULT WINAPI xmlreader_GetQualifiedName(IXmlReader* iface, LPCWSTR *nam
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static struct ns *reader_lookup_ns(xmlreader *reader, const strval *prefix)
|
||||
{
|
||||
struct list *nslist = prefix ? &reader->ns : &reader->nsdef;
|
||||
struct ns *ns;
|
||||
|
||||
LIST_FOR_EACH_ENTRY_REV(ns, nslist, struct ns, entry) {
|
||||
if (strval_eq(reader, prefix, &ns->prefix))
|
||||
return ns;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static struct ns *reader_lookup_nsdef(xmlreader *reader)
|
||||
{
|
||||
if (list_empty(&reader->nsdef))
|
||||
@ -3112,42 +3205,10 @@ static HRESULT WINAPI xmlreader_GetNamespaceUri(IXmlReader* iface, const WCHAR *
|
||||
if (!len)
|
||||
len = &length;
|
||||
|
||||
*uri = NULL;
|
||||
*len = 0;
|
||||
|
||||
switch ((nodetype = reader_get_nodetype(This)))
|
||||
{
|
||||
case XmlNodeType_Attribute:
|
||||
{
|
||||
static const WCHAR xmlns_uriW[] = {'h','t','t','p',':','/','/','w','w','w','.','w','3','.','o','r','g','/',
|
||||
'2','0','0','0','/','x','m','l','n','s','/',0};
|
||||
static const WCHAR xml_uriW[] = {'h','t','t','p',':','/','/','w','w','w','.','w','3','.','o','r','g','/',
|
||||
'X','M','L','/','1','9','9','8','/','n','a','m','e','s','p','a','c','e',0};
|
||||
|
||||
/* check for reserved prefixes first */
|
||||
if ((strval_eq(This, prefix, &strval_empty) && strval_eq(This, &This->attr->localname, &strval_xmlns)) ||
|
||||
strval_eq(This, prefix, &strval_xmlns))
|
||||
{
|
||||
*uri = xmlns_uriW;
|
||||
*len = sizeof(xmlns_uriW)/sizeof(xmlns_uriW[0]) - 1;
|
||||
}
|
||||
else if (strval_eq(This, prefix, &strval_xml)) {
|
||||
*uri = xml_uriW;
|
||||
*len = sizeof(xml_uriW)/sizeof(xml_uriW[0]) - 1;
|
||||
}
|
||||
|
||||
if (!*uri) {
|
||||
ns = reader_lookup_ns(This, prefix);
|
||||
if (ns) {
|
||||
*uri = ns->uri.str;
|
||||
*len = ns->uri.len;
|
||||
}
|
||||
else {
|
||||
*uri = emptyW;
|
||||
*len = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
reader_get_attribute_ns_uri(This, This->attr, uri, len);
|
||||
break;
|
||||
case XmlNodeType_Element:
|
||||
case XmlNodeType_EndElement:
|
||||
@ -3179,6 +3240,8 @@ static HRESULT WINAPI xmlreader_GetNamespaceUri(IXmlReader* iface, const WCHAR *
|
||||
break;
|
||||
default:
|
||||
FIXME("Unhandled node type %d\n", nodetype);
|
||||
*uri = NULL;
|
||||
*len = 0;
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
@ -3212,22 +3275,7 @@ static HRESULT WINAPI xmlreader_GetLocalName(IXmlReader* iface, LPCWSTR *name, U
|
||||
*len = element->localname.len;
|
||||
break;
|
||||
case XmlNodeType_Attribute:
|
||||
if (This->attr->flags & ATTRIBUTE_DEFAULT_NS_DEFINITION)
|
||||
{
|
||||
*name = xmlnsW;
|
||||
*len = 5;
|
||||
}
|
||||
else if (This->attr->flags & ATTRIBUTE_NS_DEFINITION)
|
||||
{
|
||||
const struct ns *ns = reader_lookup_ns(This, &This->attr->localname);
|
||||
*name = ns->prefix.str;
|
||||
*len = ns->prefix.len;
|
||||
}
|
||||
else
|
||||
{
|
||||
*name = This->attr->localname.str;
|
||||
*len = This->attr->localname.len;
|
||||
}
|
||||
reader_get_attribute_local_name(This, This->attr, name, len);
|
||||
break;
|
||||
default:
|
||||
*name = This->strvalues[StringValue_LocalName].str;
|
||||
|
@ -30,6 +30,7 @@ DEFINE_GUID(IID_IXmlWriterOutput, 0xc1131708, 0x0f59, 0x477f, 0x93, 0x59, 0x7d,
|
||||
#define ARRAY_SIZE(array) (sizeof(array)/sizeof((array)[0]))
|
||||
|
||||
static const WCHAR closeelementW[] = {'<','/'};
|
||||
static const WCHAR closetagW[] = {' ','/','>'};
|
||||
static const WCHAR closepiW[] = {'?','>'};
|
||||
static const WCHAR ltW[] = {'<'};
|
||||
static const WCHAR gtW[] = {'>'};
|
||||
@ -46,13 +47,14 @@ struct output_buffer
|
||||
|
||||
typedef enum
|
||||
{
|
||||
XmlWriterState_Initial, /* output is not set yet */
|
||||
XmlWriterState_Ready, /* SetOutput() was called, ready to start */
|
||||
XmlWriterState_PIDocStarted, /* document was started with manually added 'xml' PI */
|
||||
XmlWriterState_DocStarted, /* document was started with WriteStartDocument() */
|
||||
XmlWriterState_ElemStarted, /* writing element */
|
||||
XmlWriterState_Content, /* content is accepted at this point */
|
||||
XmlWriterState_DocClosed /* WriteEndDocument was called */
|
||||
XmlWriterState_Initial, /* output is not set yet */
|
||||
XmlWriterState_Ready, /* SetOutput() was called, ready to start */
|
||||
XmlWriterState_InvalidEncoding, /* SetOutput() was called, but output had invalid encoding */
|
||||
XmlWriterState_PIDocStarted, /* document was started with manually added 'xml' PI */
|
||||
XmlWriterState_DocStarted, /* document was started with WriteStartDocument() */
|
||||
XmlWriterState_ElemStarted, /* writing element */
|
||||
XmlWriterState_Content, /* content is accepted at this point */
|
||||
XmlWriterState_DocClosed /* WriteEndDocument was called */
|
||||
} XmlWriterState;
|
||||
|
||||
typedef struct
|
||||
@ -197,11 +199,11 @@ static HRESULT init_output_buffer(xmlwriteroutput *output)
|
||||
{
|
||||
struct output_buffer *buffer = &output->buffer;
|
||||
const int initial_len = 0x2000;
|
||||
UINT cp = ~0u;
|
||||
HRESULT hr;
|
||||
UINT cp;
|
||||
|
||||
hr = get_code_page(output->encoding, &cp);
|
||||
if (FAILED(hr)) return hr;
|
||||
if (FAILED(hr = get_code_page(output->encoding, &cp)))
|
||||
WARN("Failed to get code page for specified encoding.\n");
|
||||
|
||||
buffer->data = writeroutput_alloc(output, initial_len);
|
||||
if (!buffer->data) return E_OUTOFMEMORY;
|
||||
@ -245,16 +247,8 @@ static HRESULT write_output_buffer(xmlwriteroutput *output, const WCHAR *data, i
|
||||
HRESULT hr;
|
||||
char *ptr;
|
||||
|
||||
if (buffer->codepage != ~0) {
|
||||
length = WideCharToMultiByte(buffer->codepage, 0, data, len, NULL, 0, NULL, NULL);
|
||||
hr = grow_output_buffer(output, length);
|
||||
if (FAILED(hr)) return hr;
|
||||
ptr = buffer->data + buffer->written;
|
||||
length = WideCharToMultiByte(buffer->codepage, 0, data, len, ptr, length, NULL, NULL);
|
||||
buffer->written += len == -1 ? length-1 : length;
|
||||
}
|
||||
else {
|
||||
/* WCHAR data just copied */
|
||||
if (buffer->codepage == 1200) {
|
||||
/* For UTF-16 encoding just copy. */
|
||||
length = len == -1 ? strlenW(data) : len;
|
||||
if (length) {
|
||||
length *= sizeof(WCHAR);
|
||||
@ -270,6 +264,14 @@ static HRESULT write_output_buffer(xmlwriteroutput *output, const WCHAR *data, i
|
||||
*(WCHAR*)ptr = 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
length = WideCharToMultiByte(buffer->codepage, 0, data, len, NULL, 0, NULL, NULL);
|
||||
hr = grow_output_buffer(output, length);
|
||||
if (FAILED(hr)) return hr;
|
||||
ptr = buffer->data + buffer->written;
|
||||
length = WideCharToMultiByte(buffer->codepage, 0, data, len, ptr, length, NULL, NULL);
|
||||
buffer->written += len == -1 ? length-1 : length;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
@ -436,7 +438,9 @@ static void write_node_indent(xmlwriter *writer)
|
||||
if (!writer->indent)
|
||||
return;
|
||||
|
||||
if (writer->output->buffer.written)
|
||||
/* Do state check to prevent newline inserted after BOM. It is assumed that
|
||||
state does not change between writing BOM and inserting indentation. */
|
||||
if (writer->output->buffer.written && writer->state != XmlWriterState_Ready)
|
||||
write_output_buffer(writer->output, crlfW, ARRAY_SIZE(crlfW));
|
||||
while (indent_level--)
|
||||
write_output_buffer(writer->output, dblspaceW, ARRAY_SIZE(dblspaceW));
|
||||
@ -533,7 +537,6 @@ static HRESULT WINAPI xmlwriter_SetOutput(IXmlWriter *iface, IUnknown *output)
|
||||
writeroutput, writeroutput->lpVtbl);
|
||||
IUnknown_Release(writeroutput);
|
||||
return E_FAIL;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -544,7 +547,10 @@ static HRESULT WINAPI xmlwriter_SetOutput(IXmlWriter *iface, IUnknown *output)
|
||||
This->output = impl_from_IXmlWriterOutput(writeroutput);
|
||||
}
|
||||
|
||||
This->state = XmlWriterState_Ready;
|
||||
if (This->output->encoding == XmlEncoding_Unknown)
|
||||
This->state = XmlWriterState_InvalidEncoding;
|
||||
else
|
||||
This->state = XmlWriterState_Ready;
|
||||
return writeroutput_query_for_stream(This->output);
|
||||
}
|
||||
|
||||
@ -630,6 +636,8 @@ static HRESULT WINAPI xmlwriter_WriteAttributeString(IXmlWriter *iface, LPCWSTR
|
||||
case XmlWriterState_DocClosed:
|
||||
This->state = XmlWriterState_DocClosed;
|
||||
return WR_E_INVALIDACTION;
|
||||
case XmlWriterState_InvalidEncoding:
|
||||
return MX_E_ENCODING;
|
||||
default:
|
||||
;
|
||||
}
|
||||
@ -677,6 +685,8 @@ static HRESULT WINAPI xmlwriter_WriteCData(IXmlWriter *iface, LPCWSTR data)
|
||||
case XmlWriterState_DocClosed:
|
||||
This->state = XmlWriterState_DocClosed;
|
||||
return WR_E_INVALIDACTION;
|
||||
case XmlWriterState_InvalidEncoding:
|
||||
return MX_E_ENCODING;
|
||||
default:
|
||||
;
|
||||
}
|
||||
@ -718,6 +728,8 @@ static HRESULT WINAPI xmlwriter_WriteCharEntity(IXmlWriter *iface, WCHAR ch)
|
||||
{
|
||||
case XmlWriterState_Initial:
|
||||
return E_UNEXPECTED;
|
||||
case XmlWriterState_InvalidEncoding:
|
||||
return MX_E_ENCODING;
|
||||
case XmlWriterState_ElemStarted:
|
||||
writer_close_starttag(This);
|
||||
break;
|
||||
@ -743,6 +755,8 @@ static HRESULT WINAPI xmlwriter_WriteChars(IXmlWriter *iface, const WCHAR *pwch,
|
||||
{
|
||||
case XmlWriterState_Initial:
|
||||
return E_UNEXPECTED;
|
||||
case XmlWriterState_InvalidEncoding:
|
||||
return MX_E_ENCODING;
|
||||
case XmlWriterState_DocClosed:
|
||||
return WR_E_INVALIDACTION;
|
||||
default:
|
||||
@ -765,6 +779,8 @@ static HRESULT WINAPI xmlwriter_WriteComment(IXmlWriter *iface, LPCWSTR comment)
|
||||
{
|
||||
case XmlWriterState_Initial:
|
||||
return E_UNEXPECTED;
|
||||
case XmlWriterState_InvalidEncoding:
|
||||
return MX_E_ENCODING;
|
||||
case XmlWriterState_ElemStarted:
|
||||
writer_close_starttag(This);
|
||||
break;
|
||||
@ -822,29 +838,33 @@ static HRESULT WINAPI xmlwriter_WriteElementString(IXmlWriter *iface, LPCWSTR pr
|
||||
{
|
||||
case XmlWriterState_Initial:
|
||||
return E_UNEXPECTED;
|
||||
case XmlWriterState_InvalidEncoding:
|
||||
return MX_E_ENCODING;
|
||||
case XmlWriterState_ElemStarted:
|
||||
writer_close_starttag(This);
|
||||
break;
|
||||
case XmlWriterState_Ready:
|
||||
case XmlWriterState_DocStarted:
|
||||
case XmlWriterState_PIDocStarted:
|
||||
break;
|
||||
default:
|
||||
This->state = XmlWriterState_DocClosed;
|
||||
case XmlWriterState_DocClosed:
|
||||
return WR_E_INVALIDACTION;
|
||||
default:
|
||||
;
|
||||
}
|
||||
|
||||
write_encoding_bom(This);
|
||||
write_node_indent(This);
|
||||
write_output_buffer(This->output, ltW, ARRAY_SIZE(ltW));
|
||||
write_output_qname(This->output, prefix, local_name);
|
||||
write_output_buffer(This->output, gtW, ARRAY_SIZE(gtW));
|
||||
|
||||
if (value)
|
||||
{
|
||||
write_output_buffer(This->output, gtW, ARRAY_SIZE(gtW));
|
||||
write_output_buffer(This->output, value, -1);
|
||||
write_output_buffer(This->output, closeelementW, ARRAY_SIZE(closeelementW));
|
||||
write_output_qname(This->output, prefix, local_name);
|
||||
write_output_buffer(This->output, gtW, ARRAY_SIZE(gtW));
|
||||
}
|
||||
else
|
||||
write_output_buffer(This->output, closetagW, ARRAY_SIZE(closetagW));
|
||||
|
||||
write_output_buffer(This->output, closeelementW, ARRAY_SIZE(closeelementW));
|
||||
write_output_qname(This->output, prefix, local_name);
|
||||
write_output_buffer(This->output, gtW, ARRAY_SIZE(gtW));
|
||||
This->state = XmlWriterState_Content;
|
||||
|
||||
return S_OK;
|
||||
@ -864,6 +884,8 @@ static HRESULT WINAPI xmlwriter_WriteEndDocument(IXmlWriter *iface)
|
||||
case XmlWriterState_DocClosed:
|
||||
This->state = XmlWriterState_DocClosed;
|
||||
return WR_E_INVALIDACTION;
|
||||
case XmlWriterState_InvalidEncoding:
|
||||
return MX_E_ENCODING;
|
||||
default:
|
||||
;
|
||||
}
|
||||
@ -891,6 +913,8 @@ static HRESULT WINAPI xmlwriter_WriteEndElement(IXmlWriter *iface)
|
||||
case XmlWriterState_DocClosed:
|
||||
This->state = XmlWriterState_DocClosed;
|
||||
return WR_E_INVALIDACTION;
|
||||
case XmlWriterState_InvalidEncoding:
|
||||
return MX_E_ENCODING;
|
||||
default:
|
||||
;
|
||||
}
|
||||
@ -901,8 +925,8 @@ static HRESULT WINAPI xmlwriter_WriteEndElement(IXmlWriter *iface)
|
||||
|
||||
writer_dec_indent(This);
|
||||
|
||||
if (This->starttagopen) {
|
||||
static WCHAR closetagW[] = {' ','/','>'};
|
||||
if (This->starttagopen)
|
||||
{
|
||||
write_output_buffer(This->output, closetagW, ARRAY_SIZE(closetagW));
|
||||
This->starttagopen = FALSE;
|
||||
}
|
||||
@ -927,6 +951,8 @@ static HRESULT WINAPI xmlwriter_WriteEntityRef(IXmlWriter *iface, LPCWSTR pwszNa
|
||||
{
|
||||
case XmlWriterState_Initial:
|
||||
return E_UNEXPECTED;
|
||||
case XmlWriterState_InvalidEncoding:
|
||||
return MX_E_ENCODING;
|
||||
case XmlWriterState_DocClosed:
|
||||
return WR_E_INVALIDACTION;
|
||||
default:
|
||||
@ -951,6 +977,8 @@ static HRESULT WINAPI xmlwriter_WriteFullEndElement(IXmlWriter *iface)
|
||||
case XmlWriterState_DocClosed:
|
||||
This->state = XmlWriterState_DocClosed;
|
||||
return WR_E_INVALIDACTION;
|
||||
case XmlWriterState_InvalidEncoding:
|
||||
return MX_E_ENCODING;
|
||||
default:
|
||||
;
|
||||
}
|
||||
@ -990,6 +1018,8 @@ static HRESULT WINAPI xmlwriter_WriteName(IXmlWriter *iface, LPCWSTR pwszName)
|
||||
case XmlWriterState_DocClosed:
|
||||
This->state = XmlWriterState_DocClosed;
|
||||
return WR_E_INVALIDACTION;
|
||||
case XmlWriterState_InvalidEncoding:
|
||||
return MX_E_ENCODING;
|
||||
default:
|
||||
;
|
||||
}
|
||||
@ -1011,6 +1041,8 @@ static HRESULT WINAPI xmlwriter_WriteNmToken(IXmlWriter *iface, LPCWSTR pwszNmTo
|
||||
case XmlWriterState_DocClosed:
|
||||
This->state = XmlWriterState_DocClosed;
|
||||
return WR_E_INVALIDACTION;
|
||||
case XmlWriterState_InvalidEncoding:
|
||||
return MX_E_ENCODING;
|
||||
default:
|
||||
;
|
||||
}
|
||||
@ -1051,6 +1083,8 @@ static HRESULT WINAPI xmlwriter_WriteProcessingInstruction(IXmlWriter *iface, LP
|
||||
{
|
||||
case XmlWriterState_Initial:
|
||||
return E_UNEXPECTED;
|
||||
case XmlWriterState_InvalidEncoding:
|
||||
return MX_E_ENCODING;
|
||||
case XmlWriterState_DocStarted:
|
||||
if (!strcmpW(name, xmlW))
|
||||
return WR_E_INVALIDACTION;
|
||||
@ -1087,6 +1121,8 @@ static HRESULT WINAPI xmlwriter_WriteQualifiedName(IXmlWriter *iface, LPCWSTR pw
|
||||
{
|
||||
case XmlWriterState_Initial:
|
||||
return E_UNEXPECTED;
|
||||
case XmlWriterState_InvalidEncoding:
|
||||
return MX_E_ENCODING;
|
||||
case XmlWriterState_DocClosed:
|
||||
return WR_E_INVALIDACTION;
|
||||
default:
|
||||
@ -1115,6 +1151,8 @@ static HRESULT WINAPI xmlwriter_WriteRaw(IXmlWriter *iface, LPCWSTR data)
|
||||
case XmlWriterState_DocStarted:
|
||||
case XmlWriterState_PIDocStarted:
|
||||
break;
|
||||
case XmlWriterState_InvalidEncoding:
|
||||
return MX_E_ENCODING;
|
||||
default:
|
||||
This->state = XmlWriterState_DocClosed;
|
||||
return WR_E_INVALIDACTION;
|
||||
@ -1134,6 +1172,8 @@ static HRESULT WINAPI xmlwriter_WriteRawChars(IXmlWriter *iface, const WCHAR *p
|
||||
{
|
||||
case XmlWriterState_Initial:
|
||||
return E_UNEXPECTED;
|
||||
case XmlWriterState_InvalidEncoding:
|
||||
return MX_E_ENCODING;
|
||||
case XmlWriterState_DocClosed:
|
||||
return WR_E_INVALIDACTION;
|
||||
default:
|
||||
@ -1158,6 +1198,8 @@ static HRESULT WINAPI xmlwriter_WriteStartDocument(IXmlWriter *iface, XmlStandal
|
||||
return S_OK;
|
||||
case XmlWriterState_Ready:
|
||||
break;
|
||||
case XmlWriterState_InvalidEncoding:
|
||||
return MX_E_ENCODING;
|
||||
default:
|
||||
This->state = XmlWriterState_DocClosed;
|
||||
return WR_E_INVALIDACTION;
|
||||
@ -1180,6 +1222,8 @@ static HRESULT WINAPI xmlwriter_WriteStartElement(IXmlWriter *iface, LPCWSTR pre
|
||||
{
|
||||
case XmlWriterState_Initial:
|
||||
return E_UNEXPECTED;
|
||||
case XmlWriterState_InvalidEncoding:
|
||||
return MX_E_ENCODING;
|
||||
case XmlWriterState_DocClosed:
|
||||
return WR_E_INVALIDACTION;
|
||||
default:
|
||||
@ -1195,12 +1239,13 @@ static HRESULT WINAPI xmlwriter_WriteStartElement(IXmlWriter *iface, LPCWSTR pre
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
write_encoding_bom(This);
|
||||
write_node_indent(This);
|
||||
|
||||
This->state = XmlWriterState_ElemStarted;
|
||||
This->starttagopen = TRUE;
|
||||
|
||||
push_element(This, element);
|
||||
|
||||
write_node_indent(This);
|
||||
write_output_buffer(This->output, ltW, ARRAY_SIZE(ltW));
|
||||
write_output_qname(This->output, prefix, local_name);
|
||||
writer_inc_indent(This);
|
||||
@ -1255,6 +1300,8 @@ static HRESULT WINAPI xmlwriter_WriteString(IXmlWriter *iface, const WCHAR *stri
|
||||
case XmlWriterState_DocClosed:
|
||||
This->state = XmlWriterState_DocClosed;
|
||||
return WR_E_INVALIDACTION;
|
||||
case XmlWriterState_InvalidEncoding:
|
||||
return MX_E_ENCODING;
|
||||
default:
|
||||
;
|
||||
}
|
||||
|
@ -218,7 +218,7 @@ reactos/dll/win32/xinput1_1 # Synced to WineStaging-2.9
|
||||
reactos/dll/win32/xinput1_2 # Synced to WineStaging-2.9
|
||||
reactos/dll/win32/xinput1_3 # Synced to WineStaging-2.9
|
||||
reactos/dll/win32/xinput9_1_0 # Synced to WineStaging-2.9
|
||||
reactos/dll/win32/xmllite # Synced to WineStaging-2.9
|
||||
reactos/dll/win32/xmllite # Synced to WineStaging-2.16
|
||||
|
||||
reactos/dll/cpl/inetcpl # Synced to WineStaging-2.9
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user