Author: akhaldi
Date: Sat Sep 28 15:42:58 2013
New Revision: 60439
URL:
http://svn.reactos.org/svn/reactos?rev=60439&view=rev
Log:
[XMLLITE]
* Sync with Wine 1.7.1.
CORE-7469
Modified:
trunk/reactos/dll/win32/xmllite/CMakeLists.txt
trunk/reactos/dll/win32/xmllite/reader.c
trunk/reactos/dll/win32/xmllite/xmllite_main.c
trunk/reactos/media/doc/README.WINE
Modified: trunk/reactos/dll/win32/xmllite/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/xmllite/CMakeLis…
==============================================================================
--- trunk/reactos/dll/win32/xmllite/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/xmllite/CMakeLists.txt [iso-8859-1] Sat Sep 28 15:42:58 2013
@@ -1,25 +1,17 @@
add_definitions(-D__WINESRC__)
include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine)
-
spec2def(xmllite.dll xmllite.spec ADD_IMPORTLIB)
list(APPEND SOURCE
reader.c
writer.c
xmllite_main.c
- #${REACTOS_BINARY_DIR}/include/psdk/xmllite_i.c
${CMAKE_CURRENT_BINARY_DIR}/xmllite_stubs.c
${CMAKE_CURRENT_BINARY_DIR}/xmllite.def)
-if(NOT MSVC)
- # FIXME:
http://www.cmake.org/Bug/view.php?id=12998
- #allow_warnings(xmllite)
- set_source_files_properties(${SOURCE} PROPERTIES COMPILE_FLAGS
"-Wno-error")
-endif()
-
add_library(xmllite SHARED ${SOURCE})
set_module_type(xmllite win32dll)
-target_link_libraries(xmllite wine uuid)
+target_link_libraries(xmllite wine)
add_importlibs(xmllite msvcrt kernel32 ntdll)
add_cd_file(TARGET xmllite DESTINATION reactos/system32 FOR all)
Modified: trunk/reactos/dll/win32/xmllite/reader.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/xmllite/reader.c…
==============================================================================
--- trunk/reactos/dll/win32/xmllite/reader.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/xmllite/reader.c [iso-8859-1] Sat Sep 28 15:42:58 2013
@@ -24,6 +24,7 @@
#define COBJMACROS
+#include <stdio.h>
#include <stdarg.h>
#include <windef.h>
#include <winbase.h>
@@ -57,7 +58,8 @@
XmlReadInState_DTD_Misc,
XmlReadInState_Element,
XmlReadInState_Content,
- XmlReadInState_MiscEnd
+ XmlReadInState_MiscEnd, /* optional Misc at the end of a document */
+ XmlReadInState_Eof
} XmlReaderInternalState;
/* This state denotes where parsing was interrupted by input problem.
@@ -69,7 +71,8 @@
XmlReadResumeState_PIBody,
XmlReadResumeState_CDATA,
XmlReadResumeState_Comment,
- XmlReadResumeState_STag
+ XmlReadResumeState_STag,
+ XmlReadResumeState_CharData
} XmlReaderResumeState;
/* saved pointer index to resume from particular input position */
@@ -77,13 +80,14 @@
{
XmlReadResume_Name, /* PITarget, name for NCName, prefix for QName */
XmlReadResume_Local, /* local for QName */
- XmlReadResume_Body, /* PI body, comment text, CDATA text */
+ XmlReadResume_Body, /* PI body, comment text, CDATA text, CharData text */
XmlReadResume_Last
} XmlReaderResume;
typedef enum
{
StringValue_LocalName,
+ StringValue_Prefix,
StringValue_QualifiedName,
StringValue_Value,
StringValue_Last
@@ -98,6 +102,62 @@
static const WCHAR gtW[] = {'>',0};
static const WCHAR commentW[] = {'<','!','-','-',0};
static const WCHAR piW[] = {'<','?',0};
+
+static const char *debugstr_nodetype(XmlNodeType nodetype)
+{
+ static const char* type_names[] =
+ {
+ "None",
+ "Element",
+ "Attribute",
+ "Text",
+ "CDATA",
+ "",
+ "",
+ "ProcessingInstruction",
+ "Comment",
+ "",
+ "DocumentType",
+ "",
+ "",
+ "Whitespace",
+ "",
+ "EndElement",
+ "",
+ "XmlDeclaration"
+ };
+
+ if (nodetype > _XmlNodeType_Last)
+ {
+ static char buf[25];
+ sprintf(buf, "unknown type=%d", nodetype);
+ return buf;
+ }
+ return type_names[nodetype];
+}
+
+static const char *debugstr_prop(XmlReaderProperty prop)
+{
+ static const char* prop_names[] =
+ {
+ "MultiLanguage",
+ "ConformanceLevel",
+ "RandomAccess",
+ "XmlResolver",
+ "DtdProcessing",
+ "ReadState",
+ "MaxElementDepth",
+ "MaxEntityExpansion"
+ };
+
+ if (prop > _XmlReaderProperty_Last)
+ {
+ static char buf[25];
+ sprintf(buf, "unknown property=%d", prop);
+ return buf;
+ }
+ return prop_names[prop];
+}
struct xml_encoding_data
{
@@ -151,9 +211,9 @@
*/
typedef struct
{
+ WCHAR *str; /* allocated null-terminated string */
+ UINT len; /* length in WCHARs, altered after ReadValueChunk */
WCHAR *start; /* input position where value starts */
- UINT len; /* length in WCHARs, altered after ReadValueChunk */
- WCHAR *str; /* allocated null-terminated string */
} strval;
static WCHAR emptyW[] = {0};
@@ -170,6 +230,7 @@
{
struct list entry;
strval qname;
+ strval localname;
};
typedef struct
@@ -190,6 +251,8 @@
struct list elements;
strval strvalues[StringValue_Last];
UINT depth;
+ UINT max_depth;
+ BOOL empty_element;
WCHAR *resume[XmlReadResume_Last]; /* pointers used to resume reader */
} xmlreader;
@@ -365,16 +428,21 @@
reader_free(reader, elem);
}
list_init(&reader->elements);
+ reader->empty_element = FALSE;
}
static HRESULT reader_inc_depth(xmlreader *reader)
{
- /* FIXME: handle XmlReaderProperty_MaxElementDepth property */
- reader->depth++;
- return S_OK;
-}
-
-static HRESULT reader_push_element(xmlreader *reader, strval *qname)
+ if (++reader->depth > reader->max_depth) return SC_E_MAXELEMENTDEPTH;
+ return S_OK;
+}
+
+static void reader_dec_depth(xmlreader *reader)
+{
+ if (reader->depth > 1) reader->depth--;
+}
+
+static HRESULT reader_push_element(xmlreader *reader, strval *qname, strval *localname)
{
struct element *elem;
HRESULT hr;
@@ -383,15 +451,30 @@
if (!elem) return E_OUTOFMEMORY;
hr = reader_strvaldup(reader, qname, &elem->qname);
- if (FAILED(hr)) return hr;
+ if (FAILED(hr)) {
+ reader_free(reader, elem);
+ return hr;
+ }
+
+ hr = reader_strvaldup(reader, localname, &elem->localname);
+ if (FAILED(hr))
+ {
+ reader_free_strvalued(reader, &elem->qname);
+ reader_free(reader, elem);
+ return hr;
+ }
if (!list_empty(&reader->elements))
{
hr = reader_inc_depth(reader);
- if (FAILED(hr)) return hr;
+ if (FAILED(hr)) {
+ reader_free(reader, elem);
+ return hr;
+ }
}
list_add_head(&reader->elements, &elem->entry);
+ reader->empty_element = FALSE;
return hr;
}
@@ -403,7 +486,9 @@
{
list_remove(&elem->entry);
reader_free_strvalued(reader, &elem->qname);
+ reader_free_strvalued(reader, &elem->localname);
reader_free(reader, elem);
+ reader_dec_depth(reader);
}
}
@@ -1034,7 +1119,7 @@
reader_skipn(reader, reader_cmp(reader, yesW) ? 2 : 3);
ptr = reader_get_cur(reader);
TRACE("standalone=%s\n", debugstr_wn(start, ptr-start));
- val.str = start;
+ val.str = val.start = start;
val.len = ptr-start;
if (reader_cmp(reader, quoteW) && reader_cmp(reader, dblquoteW))
@@ -1072,6 +1157,7 @@
if (reader_cmp(reader, declcloseW)) return WC_E_XMLDECL;
reader_skipn(reader, 2);
+ reader_inc_depth(reader);
reader->nodetype = XmlNodeType_XmlDeclaration;
reader_set_strvalue(reader, StringValue_LocalName, &strval_empty);
reader_set_strvalue(reader, StringValue_QualifiedName, &strval_empty);
@@ -1216,6 +1302,14 @@
return (ch == ':') || is_ncnamechar(ch);
}
+static XmlNodeType reader_get_nodetype(const xmlreader *reader)
+{
+ /* When we're on attribute always return attribute type, container node type is
kept.
+ Note that container is not necessarily an element, and attribute doesn't mean
it's
+ an attribute in XML spec terms. */
+ return reader->attr ? XmlNodeType_Attribute : reader->nodetype;
+}
+
/* [4] NameStartChar ::= ":" | [A-Z] | "_" | [a-z] | [#xC0-#xD6] |
[#xD8-#xF6] | [#xF8-#x2FF] | [#x370-#x37D] |
[#x37F-#x1FFF] | [#x200C-#x200D] | [#x2070-#x218F] |
[#x2C00-#x2FEF] | [#x3001-#xD7FF] |
[#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF]
@@ -1298,6 +1392,9 @@
case XmlReadResumeState_PITarget:
hr = reader_parse_pitarget(reader, &target);
if (FAILED(hr)) return hr;
+ reader_set_strvalue(reader, StringValue_LocalName, &target);
+ reader_set_strvalue(reader, StringValue_QualifiedName, &target);
+ reader_set_strvalue(reader, StringValue_Value, &strval_empty);
reader->resumestate = XmlReadResumeState_PIBody;
default:
;
@@ -1311,9 +1408,6 @@
reader_skipn(reader, 2);
reader->nodetype = XmlNodeType_ProcessingInstruction;
reader->resumestate = XmlReadResumeState_Initial;
- reader_set_strvalue(reader, StringValue_LocalName, &target);
- reader_set_strvalue(reader, StringValue_QualifiedName, &target);
- reader_set_strvalue(reader, StringValue_Value, &strval_empty);
return S_OK;
}
@@ -1346,8 +1440,6 @@
reader->resumestate = XmlReadResumeState_Initial;
reader->resume[XmlReadResume_Body] = NULL;
reader_init_strvalue(start, ptr-start, &value);
- reader_set_strvalue(reader, StringValue_LocalName, &target);
- reader_set_strvalue(reader, StringValue_QualifiedName, &target);
reader_set_strvalue(reader, StringValue_Value, &value);
return S_OK;
}
@@ -1446,8 +1538,7 @@
}
if (*cur == quote) reader_skipn(reader, 1);
- literal->str = start;
- literal->len = cur-start;
+ reader_init_strvalue(start, cur-start, literal);
TRACE("%s\n", debugstr_wn(start, cur-start));
return S_OK;
}
@@ -1679,36 +1770,280 @@
return S_OK;
}
+/* Applies normalization rules to a single char, used for attribute values.
+
+ Rules include 2 steps:
+
+ 1) replacing \r\n with a single \n;
+ 2) replacing all whitespace chars with ' '.
+
+ */
+static void reader_normalize_space(xmlreader *reader, WCHAR *ptr)
+{
+ encoded_buffer *buffer = &reader->input->buffer->utf16;
+
+ if (!is_wchar_space(*ptr)) return;
+
+ if (*ptr == '\r' && *(ptr+1) == '\n')
+ {
+ int len = buffer->written - ((char*)ptr - buffer->data) - 2*sizeof(WCHAR);
+ memmove(ptr+1, ptr+2, len);
+ }
+ *ptr = ' ';
+}
+
+static WCHAR get_predefined_entity(const strval *name)
+{
+ static const WCHAR entltW[] = {'l','t'};
+ static const WCHAR entgtW[] = {'g','t'};
+ static const WCHAR entampW[] = {'a','m','p'};
+ static const WCHAR entaposW[] = {'a','p','o','s'};
+ static const WCHAR entquotW[] = {'q','u','o','t'};
+
+ static const strval lt = { (WCHAR*)entltW, 2 };
+ static const strval gt = { (WCHAR*)entgtW, 2 };
+ static const strval amp = { (WCHAR*)entampW, 3 };
+ static const strval apos = { (WCHAR*)entaposW, 4 };
+ static const strval quot = { (WCHAR*)entquotW, 4 };
+
+ switch (name->str[0])
+ {
+ case 'l':
+ if (strval_eq(name, <)) return '<';
+ break;
+ case 'g':
+ if (strval_eq(name, >)) return '>';
+ break;
+ case 'a':
+ if (strval_eq(name, &))
+ return '&';
+ else if (strval_eq(name, &apos))
+ return '\'';
+ break;
+ case 'q':
+ if (strval_eq(name, ")) return '\"';
+ break;
+ default:
+ ;
+ }
+
+ return 0;
+}
+
+/* [66] CharRef ::= '&#' [0-9]+ ';' | '&#x' [0-9a-fA-F]+
';'
+ [67] Reference ::= EntityRef | CharRef
+ [68] EntityRef ::= '&' Name ';' */
+static HRESULT reader_parse_reference(xmlreader *reader)
+{
+ encoded_buffer *buffer = &reader->input->buffer->utf16;
+ WCHAR *start = reader_get_cur(reader), *ptr;
+ WCHAR ch = 0;
+ int len;
+
+ /* skip '&' */
+ reader_skipn(reader, 1);
+ ptr = reader_get_cur(reader);
+
+ if (*ptr == '#')
+ {
+ reader_skipn(reader, 1);
+ ptr = reader_get_cur(reader);
+
+ /* hex char or decimal */
+ if (*ptr == 'x')
+ {
+ reader_skipn(reader, 1);
+ ptr = reader_get_cur(reader);
+
+ while (*ptr != ';')
+ {
+ if ((*ptr >= '0' && *ptr <= '9'))
+ ch = ch*16 + *ptr - '0';
+ else if ((*ptr >= 'a' && *ptr <= 'f'))
+ ch = ch*16 + *ptr - 'a' + 10;
+ else if ((*ptr >= 'A' && *ptr <= 'F'))
+ ch = ch*16 + *ptr - 'A' + 10;
+ else
+ return ch ? WC_E_SEMICOLON : WC_E_HEXDIGIT;
+ reader_skipn(reader, 1);
+ ptr = reader_get_cur(reader);
+ }
+ }
+ else
+ {
+ while (*ptr != ';')
+ {
+ if ((*ptr >= '0' && *ptr <= '9'))
+ {
+ ch = ch*10 + *ptr - '0';
+ reader_skipn(reader, 1);
+ ptr = reader_get_cur(reader);
+ }
+ else
+ return ch ? WC_E_SEMICOLON : WC_E_DIGIT;
+ }
+ }
+
+ if (!is_char(ch)) return WC_E_XMLCHARACTER;
+
+ /* normalize */
+ if (is_wchar_space(ch)) ch = ' ';
+
+ len = buffer->written - ((char*)ptr - buffer->data) - sizeof(WCHAR);
+ memmove(start+1, ptr+1, len);
+ buffer->cur = (char*)(start+1);
+
+ *start = ch;
+ }
+ else
+ {
+ strval name;
+ HRESULT hr;
+
+ hr = reader_parse_name(reader, &name);
+ if (FAILED(hr)) return hr;
+
+ ptr = reader_get_cur(reader);
+ if (*ptr != ';') return WC_E_SEMICOLON;
+
+ /* predefined entities resolve to a single character */
+ ch = get_predefined_entity(&name);
+ if (ch)
+ {
+ len = buffer->written - ((char*)ptr - buffer->data) - sizeof(WCHAR);
+ memmove(start+1, ptr+1, len);
+ buffer->cur = (char*)(start+1);
+
+ *start = ch;
+ }
+ else
+ {
+ FIXME("undeclared entity %s\n", debugstr_wn(name.str, name.len));
+ return WC_E_UNDECLAREDENTITY;
+ }
+
+ }
+
+ return S_OK;
+}
+
+/* [10 NS] AttValue ::= '"' ([^<&"] | Reference)*
'"' | "'" ([^<&'] | Reference)* "'"
*/
+static HRESULT reader_parse_attvalue(xmlreader *reader, strval *value)
+{
+ WCHAR *ptr, *start;
+ WCHAR quote;
+
+ ptr = reader_get_cur(reader);
+
+ /* skip opening quote */
+ quote = *ptr;
+ if (quote != '\"' && quote != '\'') return
WC_E_QUOTE;
+ reader_skipn(reader, 1);
+
+ start = ptr = reader_get_cur(reader);
+ while (*ptr)
+ {
+ if (*ptr == '<') return WC_E_LESSTHAN;
+
+ if (*ptr == quote)
+ {
+ /* skip closing quote */
+ reader_skipn(reader, 1);
+ break;
+ }
+
+ if (*ptr == '&')
+ {
+ HRESULT hr = reader_parse_reference(reader);
+ if (FAILED(hr)) return hr;
+ }
+ else
+ {
+ reader_normalize_space(reader, ptr);
+ reader_skipn(reader, 1);
+ }
+ ptr = reader_get_cur(reader);
+ }
+
+ reader_init_strvalue(start, ptr-start, value);
+
+ return S_OK;
+}
+
+/* [1 NS] NSAttName ::= PrefixedAttName | DefaultAttName
+ [2 NS] PrefixedAttName ::= 'xmlns:' NCName
+ [3 NS] DefaultAttName ::= 'xmlns'
+ [15 NS] Attribute ::= NSAttName Eq AttValue | QName Eq AttValue */
+static HRESULT reader_parse_attribute(xmlreader *reader)
+{
+ static const WCHAR xmlnsW[] =
{'x','m','l','n','s',0};
+ strval prefix, local, qname, xmlns, value;
+ HRESULT hr;
+
+ hr = reader_parse_qname(reader, &prefix, &local, &qname);
+ if (FAILED(hr)) return hr;
+
+ reader_init_strvalue((WCHAR*)xmlnsW, 5, &xmlns);
+
+ if (strval_eq(&prefix, &xmlns))
+ {
+ FIXME("namespace definitions not supported\n");
+ return E_NOTIMPL;
+ }
+
+ if (strval_eq(&qname, &xmlns))
+ {
+ FIXME("default namespace definitions not supported\n");
+ return E_NOTIMPL;
+ }
+
+ hr = reader_parse_eq(reader);
+ if (FAILED(hr)) return hr;
+
+ hr = reader_parse_attvalue(reader, &value);
+ if (FAILED(hr)) return hr;
+
+ TRACE("%s=%s\n", debugstr_wn(local.str, local.len), debugstr_wn(value.str,
value.len));
+ return reader_add_attr(reader, &local, &value);
+}
+
/* [12 NS] STag ::= '<' QName (S Attribute)* S? '>'
[14 NS] EmptyElemTag ::= '<' QName (S Attribute)* S? '/>' */
static HRESULT reader_parse_stag(xmlreader *reader, strval *prefix, strval *local, strval
*qname, int *empty)
{
- static const WCHAR endW[] = {'/','>',0};
HRESULT hr;
hr = reader_parse_qname(reader, prefix, local, qname);
if (FAILED(hr)) return hr;
- reader_skipspaces(reader);
-
- /* empty element */
- if ((*empty = !reader_cmp(reader, endW)))
- {
- /* skip '/>' */
- reader_skipn(reader, 2);
- return S_OK;
- }
-
- /* got a start tag */
- if (!reader_cmp(reader, gtW))
- {
- /* skip '>' */
- reader_skipn(reader, 1);
- return reader_push_element(reader, qname);
- }
-
- FIXME("only empty elements/start tags without attribute list
supported\n");
- return E_NOTIMPL;
+ while (1)
+ {
+ static const WCHAR endW[] = {'/','>',0};
+
+ reader_skipspaces(reader);
+
+ /* empty element */
+ if ((*empty = !reader_cmp(reader, endW)))
+ {
+ /* skip '/>' */
+ reader_skipn(reader, 2);
+ reader->empty_element = TRUE;
+ return S_OK;
+ }
+
+ /* got a start tag */
+ if (!reader_cmp(reader, gtW))
+ {
+ /* skip '>' */
+ reader_skipn(reader, 1);
+ return reader_push_element(reader, qname, local);
+ }
+
+ hr = reader_parse_attribute(reader);
+ if (FAILED(hr)) return hr;
+ }
+
+ return S_OK;
}
/* [39] element ::= EmptyElemTag | STag content ETag */
@@ -1749,6 +2084,7 @@
reader->nodetype = XmlNodeType_Element;
reader->resumestate = XmlReadResumeState_Initial;
reader_set_strvalue(reader, StringValue_LocalName, &local);
+ reader_set_strvalue(reader, StringValue_Prefix, &prefix);
reader_set_strvalue(reader, StringValue_QualifiedName, &qname);
break;
}
@@ -1785,6 +2121,10 @@
if (!strval_eq(&elem->qname, &qname)) return WC_E_ELEMENTMATCH;
reader_pop_element(reader);
+
+ /* It was a root element, the rest is expected as Misc */
+ if (list_empty(&reader->elements))
+ reader->instate = XmlReadInState_MiscEnd;
reader->nodetype = XmlNodeType_EndElement;
reader_set_strvalue(reader, StringValue_LocalName, &local);
@@ -1839,6 +2179,12 @@
}
else
{
+ /* Value normalization is not fully implemented, rules are:
+
+ - single '\r' -> '\n';
+ - sequence '\r\n' -> '\n', in this case value length
changes;
+ */
+ if (*ptr == '\r') *ptr = '\n';
reader_skipn(reader, 1);
ptr++;
}
@@ -1847,20 +2193,51 @@
return S_OK;
}
-/* [66] CharRef ::= '&#' [0-9]+ ';' | '&#x' [0-9a-fA-F]+
';'
- [67] Reference ::= EntityRef | CharRef
- [68] EntityRef ::= '&' Name ';' */
-static HRESULT reader_parse_reference(xmlreader *reader)
-{
- FIXME("References not supported\n");
- return E_NOTIMPL;
-}
-
/* [14] CharData ::= [^<&]* - ([^<&]* ']]>' [^<&]*) */
static HRESULT reader_parse_chardata(xmlreader *reader)
{
- FIXME("CharData not supported\n");
- return E_NOTIMPL;
+ WCHAR *start, *ptr;
+
+ if (reader->resume[XmlReadResume_Body])
+ {
+ start = reader->resume[XmlReadResume_Body];
+ ptr = reader_get_cur(reader);
+ }
+ else
+ {
+ reader_shrink(reader);
+ ptr = start = reader_get_cur(reader);
+ /* There's no text */
+ if (!*ptr || *ptr == '<') return S_OK;
+ reader->nodetype = XmlNodeType_Text;
+ reader->resume[XmlReadResume_Body] = start;
+ reader->resumestate = XmlReadResumeState_CharData;
+ reader_set_strvalue(reader, StringValue_LocalName, &strval_empty);
+ reader_set_strvalue(reader, StringValue_QualifiedName, &strval_empty);
+ reader_set_strvalue(reader, StringValue_Value, NULL);
+ }
+
+ while (*ptr)
+ {
+ /* CDATA closing sequence ']]>' is not allowed */
+ if (ptr[0] == ']' && ptr[1] == ']' && ptr[2] ==
'>')
+ return WC_E_CDSECTEND;
+
+ /* Found next markup part */
+ if (ptr[0] == '<')
+ {
+ strval value;
+
+ reader_init_strvalue(start, ptr-start, &value);
+ reader_set_strvalue(reader, StringValue_Value, &value);
+ return S_OK;
+ }
+
+ reader_skipn(reader, 1);
+ ptr++;
+ }
+
+ return S_OK;
}
/* [43] content ::= CharData? ((element | Reference | CDSect | PI | Comment) CharData?)*
*/
@@ -1881,6 +2258,8 @@
case XmlReadResumeState_PIBody:
case XmlReadResumeState_PITarget:
return reader_parse_pi(reader);
+ case XmlReadResumeState_CharData:
+ return reader_parse_chardata(reader);
default:
ERR("unknown resume state %d\n", reader->resumestate);
}
@@ -1914,6 +2293,9 @@
static HRESULT reader_parse_nextnode(xmlreader *reader)
{
HRESULT hr;
+
+ if (!is_reader_pending(reader))
+ reader_clear_attrs(reader);
while (1)
{
@@ -1978,6 +2360,15 @@
return reader_parse_element(reader);
case XmlReadInState_Content:
return reader_parse_content(reader);
+ case XmlReadInState_MiscEnd:
+ hr = reader_parse_misc(reader);
+ if (FAILED(hr)) return hr;
+
+ if (hr == S_FALSE)
+ reader->instate = XmlReadInState_Eof;
+ return hr;
+ case XmlReadInState_Eof:
+ return S_FALSE;
default:
FIXME("internal state %d not handled\n", reader->instate);
return E_NOTIMPL;
@@ -2107,7 +2498,7 @@
{
xmlreader *This = impl_from_IXmlReader(iface);
- TRACE("(%p %u %p)\n", This, property, value);
+ TRACE("(%p)->(%s %p)\n", This, debugstr_prop(property), value);
if (!value) return E_INVALIDARG;
@@ -2131,7 +2522,7 @@
{
xmlreader *This = impl_from_IXmlReader(iface);
- TRACE("(%p %u %lu)\n", iface, property, value);
+ TRACE("(%p)->(%s %lu)\n", This, debugstr_prop(property), value);
switch (property)
{
@@ -2160,7 +2551,11 @@
hr = reader_parse_nextnode(This);
if (oldtype == XmlNodeType_None && This->nodetype != oldtype)
This->state = XmlReadState_Interactive;
- if (hr == S_OK) *nodetype = This->nodetype;
+ if (hr == S_OK)
+ {
+ TRACE("node type %s\n", debugstr_nodetype(This->nodetype));
+ *nodetype = This->nodetype;
+ }
return hr;
}
@@ -2170,10 +2565,7 @@
xmlreader *This = impl_from_IXmlReader(iface);
TRACE("(%p)->(%p)\n", This, node_type);
- /* When we're on attribute always return attribute type, container node type is
kept.
- Note that container is not necessarily an element, and attribute doesn't mean
it's
- an attribute in XML spec terms. */
- *node_type = This->attr ? XmlNodeType_Attribute : This->nodetype;
+ *node_type = reader_get_nodetype(This);
return This->state == XmlReadState_Closed ? S_FALSE : S_OK;
}
@@ -2185,6 +2577,9 @@
if (!This->attr_count) return S_FALSE;
This->attr = LIST_ENTRY(list_head(&This->attrs), struct attribute, entry);
+ reader_set_strvalue(This, StringValue_LocalName, &This->attr->localname);
+ reader_set_strvalue(This, StringValue_Value, &This->attr->value);
+
return S_OK;
}
@@ -2202,7 +2597,11 @@
next = list_next(&This->attrs, &This->attr->entry);
if (next)
+ {
This->attr = LIST_ENTRY(next, struct attribute, entry);
+ reader_set_strvalue(This, StringValue_LocalName,
&This->attr->localname);
+ reader_set_strvalue(This, StringValue_Value, &This->attr->value);
+ }
return next ? S_OK : S_FALSE;
}
@@ -2218,11 +2617,21 @@
static HRESULT WINAPI xmlreader_MoveToElement(IXmlReader* iface)
{
xmlreader *This = impl_from_IXmlReader(iface);
+ struct element *elem;
TRACE("(%p)\n", This);
if (!This->attr_count) return S_FALSE;
This->attr = NULL;
+
+ /* FIXME: support other node types with 'attributes' like DTD */
+ elem = LIST_ENTRY(list_head(&This->elements), struct element, entry);
+ if (elem)
+ {
+ reader_set_strvalue(This, StringValue_QualifiedName, &elem->qname);
+ reader_set_strvalue(This, StringValue_LocalName, &elem->localname);
+ }
+
return S_OK;
}
@@ -2250,16 +2659,18 @@
TRACE("(%p)->(%p %p)\n", This, name, len);
*name = This->strvalues[StringValue_LocalName].str;
- *len = This->strvalues[StringValue_LocalName].len;
- return S_OK;
-}
-
-static HRESULT WINAPI xmlreader_GetPrefix(IXmlReader* iface,
- LPCWSTR *prefix,
- UINT *prefix_length)
-{
- FIXME("(%p %p %p): stub\n", iface, prefix, prefix_length);
- return E_NOTIMPL;
+ if (len) *len = This->strvalues[StringValue_LocalName].len;
+ return S_OK;
+}
+
+static HRESULT WINAPI xmlreader_GetPrefix(IXmlReader* iface, LPCWSTR *prefix, UINT *len)
+{
+ xmlreader *This = impl_from_IXmlReader(iface);
+
+ TRACE("(%p)->(%p %p)\n", This, prefix, len);
+ *prefix = This->strvalues[StringValue_Prefix].str;
+ if (len) *len = This->strvalues[StringValue_Prefix].len;
+ return S_OK;
}
static HRESULT WINAPI xmlreader_GetValue(IXmlReader* iface, const WCHAR **value, UINT
*len)
@@ -2330,13 +2741,16 @@
static BOOL WINAPI xmlreader_IsDefault(IXmlReader* iface)
{
FIXME("(%p): stub\n", iface);
- return E_NOTIMPL;
+ return FALSE;
}
static BOOL WINAPI xmlreader_IsEmptyElement(IXmlReader* iface)
{
- FIXME("(%p): stub\n", iface);
- return E_NOTIMPL;
+ xmlreader *This = impl_from_IXmlReader(iface);
+ TRACE("(%p)\n", This);
+ /* Empty elements are not placed in stack, it's stored as a global reader flag
that makes sense
+ when current node is start tag of an element */
+ return (reader_get_nodetype(This) == XmlNodeType_Element) ? This->empty_element :
FALSE;
}
static HRESULT WINAPI xmlreader_GetLineNumber(IXmlReader* iface, UINT *lineNumber)
@@ -2516,6 +2930,8 @@
reader->attr = NULL;
list_init(&reader->elements);
reader->depth = 0;
+ reader->max_depth = 256;
+ reader->empty_element = FALSE;
memset(reader->resume, 0, sizeof(reader->resume));
for (i = 0; i < StringValue_Last; i++)
Modified: trunk/reactos/dll/win32/xmllite/xmllite_main.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/xmllite/xmllite_…
==============================================================================
--- trunk/reactos/dll/win32/xmllite/xmllite_main.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/xmllite/xmllite_main.c [iso-8859-1] Sat Sep 28 15:42:58 2013
@@ -39,8 +39,6 @@
case DLL_PROCESS_ATTACH:
DisableThreadLibraryCalls(hinstDLL);
break;
- case DLL_PROCESS_DETACH:
- break;
}
return TRUE;
Modified: trunk/reactos/media/doc/README.WINE
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=…
==============================================================================
--- trunk/reactos/media/doc/README.WINE [iso-8859-1] (original)
+++ trunk/reactos/media/doc/README.WINE [iso-8859-1] Sat Sep 28 15:42:58 2013
@@ -216,7 +216,7 @@
reactos/dll/win32/xinput1_2 # Synced to Wine-1.7.1
reactos/dll/win32/xinput1_3 # Synced to Wine-1.7.1
reactos/dll/win32/xinput9_1_0 # Synced to Wine-1.7.1
-reactos/dll/win32/xmllite # Synced to Wine-1.5.26
+reactos/dll/win32/xmllite # Synced to Wine-1.7.1
reactos/dll/cpl/inetcpl # Synced to Wine-1.3.21