Signed-off-by: Jeff Smith whydoubt@gmail.com --- dlls/xmllite/reader.c | 5 ++++- dlls/xmllite/tests/reader.c | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/dlls/xmllite/reader.c b/dlls/xmllite/reader.c index e813ca37fe..02097d0789 100644 --- a/dlls/xmllite/reader.c +++ b/dlls/xmllite/reader.c @@ -1415,7 +1415,6 @@ static HRESULT reader_parse_xmldecl(xmlreader *reader) reader->nodetype = XmlNodeType_XmlDeclaration; reader->empty_element.position = position; reader_set_strvalue(reader, StringValue_LocalName, &strval_xml); - reader_set_strvalue(reader, StringValue_QualifiedName, &strval_xml);
return S_OK; } @@ -3184,6 +3183,10 @@ static HRESULT WINAPI xmlreader_GetQualifiedName(IXmlReader* iface, LPCWSTR *nam *len = attribute->localname.len; } break; + case XmlNodeType_XmlDeclaration: + *name = This->strvalues[StringValue_LocalName].str; + *len = This->strvalues[StringValue_LocalName].len; + break; default: *name = This->strvalues[StringValue_QualifiedName].str; *len = This->strvalues[StringValue_QualifiedName].len; diff --git a/dlls/xmllite/tests/reader.c b/dlls/xmllite/tests/reader.c index 41adad1598..64ae6191a6 100644 --- a/dlls/xmllite/tests/reader.c +++ b/dlls/xmllite/tests/reader.c @@ -2537,7 +2537,8 @@ static void test_string_pointers(void) ok(empty == reader_value(reader, ""), "empty != value\n"); ok(empty == reader_prefix(reader, ""), "empty != prefix\n"); xml = reader_name(reader, "xml"); - ptr = reader_qname(reader, "xml"); todo_wine ok(xml == ptr, "xml != qname\n"); + ptr = reader_qname(reader, "xml"); + ok(xml == ptr, "xml != qname\n"); ok(empty == reader_namespace(reader, ""), "empty != namespace\n");
next_attribute(reader);
Signed-off-by: Jeff Smith whydoubt@gmail.com --- dlls/xmllite/reader.c | 3 +-- dlls/xmllite/tests/reader.c | 35 ++++++++++------------------------- 2 files changed, 11 insertions(+), 27 deletions(-)
diff --git a/dlls/xmllite/reader.c b/dlls/xmllite/reader.c index 02097d0789..66870d63ec 100644 --- a/dlls/xmllite/reader.c +++ b/dlls/xmllite/reader.c @@ -1919,7 +1919,6 @@ static HRESULT reader_parse_dtd(xmlreader *reader)
reader->nodetype = XmlNodeType_DocumentType; reader_set_strvalue(reader, StringValue_LocalName, &name); - reader_set_strvalue(reader, StringValue_QualifiedName, &name);
return S_OK; } @@ -3114,7 +3113,6 @@ static HRESULT WINAPI xmlreader_MoveToElement(IXmlReader* iface)
This->attr = NULL;
- /* FIXME: support other node types with 'attributes' like DTD */ if (This->is_empty_element) { reader_set_strvalue(This, StringValue_Prefix, &This->empty_element.prefix); reader_set_strvalue(This, StringValue_QualifiedName, &This->empty_element.qname); @@ -3184,6 +3182,7 @@ static HRESULT WINAPI xmlreader_GetQualifiedName(IXmlReader* iface, LPCWSTR *nam } break; case XmlNodeType_XmlDeclaration: + case XmlNodeType_DocumentType: *name = This->strvalues[StringValue_LocalName].str; *len = This->strvalues[StringValue_LocalName].len; break; diff --git a/dlls/xmllite/tests/reader.c b/dlls/xmllite/tests/reader.c index 64ae6191a6..e38f1e5f37 100644 --- a/dlls/xmllite/tests/reader.c +++ b/dlls/xmllite/tests/reader.c @@ -1270,11 +1270,10 @@ static const char test_public_dtd[] =
static void test_read_public_dtd(void) { - static const WCHAR dtdnameW[] = {'t','e','s','t','d','t','d',0}; IXmlReader *reader; - const WCHAR *str; + const WCHAR *name, *qname; XmlNodeType type; - UINT len, count; + UINT count; HRESULT hr;
hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL); @@ -1314,16 +1313,10 @@ static void test_read_public_dtd(void) reader_value(reader, "externalid uri");
move_to_element(reader); - reader_name(reader, "testdtd"); + name = reader_name(reader, "testdtd"); + qname = reader_qname(reader, "testdtd"); + ok(name == qname, "name != qname\n");
- len = 0; - str = NULL; - hr = IXmlReader_GetQualifiedName(reader, &str, &len); - ok(hr == S_OK, "got 0x%08x\n", hr); -todo_wine { - ok(len == lstrlenW(dtdnameW), "got %u\n", len); - ok(!lstrcmpW(str, dtdnameW), "got %s\n", wine_dbgstr_w(str)); -} IXmlReader_Release(reader); }
@@ -1333,11 +1326,10 @@ static const char test_system_dtd[] =
static void test_read_system_dtd(void) { - static const WCHAR dtdnameW[] = {'t','e','s','t','d','t','d',0}; IXmlReader *reader; - const WCHAR *str; + const WCHAR *name, *qname; XmlNodeType type; - UINT len, count; + UINT count; HRESULT hr;
hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL); @@ -1367,16 +1359,9 @@ static void test_read_system_dtd(void) reader_value(reader, "externalid uri");
move_to_element(reader); - reader_name(reader, "testdtd"); - - len = 0; - str = NULL; - hr = IXmlReader_GetQualifiedName(reader, &str, &len); - ok(hr == S_OK, "got 0x%08x\n", hr); -todo_wine { - ok(len == lstrlenW(dtdnameW), "got %u\n", len); - ok(!lstrcmpW(str, dtdnameW), "got %s\n", wine_dbgstr_w(str)); -} + name = reader_name(reader, "testdtd"); + qname = reader_qname(reader, "testdtd"); + ok(name == qname, "name != qname\n");
read_node(reader, XmlNodeType_Comment);
Signed-off-by: Jeff Smith whydoubt@gmail.com --- dlls/xmllite/reader.c | 7 ++++++- dlls/xmllite/tests/reader.c | 7 +++++++ 2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/dlls/xmllite/reader.c b/dlls/xmllite/reader.c index 66870d63ec..55fa547d07 100644 --- a/dlls/xmllite/reader.c +++ b/dlls/xmllite/reader.c @@ -294,7 +294,7 @@ typedef struct UINT max_depth; BOOL is_empty_element; struct element empty_element; /* used for empty elements without end tag <a />, - and to keep <?xml reader position */ + and to keep <?xml and <!DOCTYPE reader position */ UINT resume[XmlReadResume_Last]; /* offsets used to resume reader */ } xmlreader;
@@ -1884,6 +1884,7 @@ static HRESULT reader_parse_dtd(xmlreader *reader) static const WCHAR doctypeW[] = {'<','!','D','O','C','T','Y','P','E',0}; strval name; WCHAR *cur; + struct reader_position position; HRESULT hr;
/* check if we have "<!DOCTYPE" */ @@ -1897,6 +1898,7 @@ static HRESULT reader_parse_dtd(xmlreader *reader) if (!reader_skipspaces(reader)) return WC_E_WHITESPACE;
/* name */ + position = reader->position; hr = reader_parse_name(reader, &name); if (FAILED(hr)) return WC_E_DECLDOCTYPE;
@@ -1918,6 +1920,7 @@ static HRESULT reader_parse_dtd(xmlreader *reader) reader_skipn(reader, 1);
reader->nodetype = XmlNodeType_DocumentType; + reader->empty_element.position = position; reader_set_strvalue(reader, StringValue_LocalName, &name);
return S_OK; @@ -3490,6 +3493,7 @@ static HRESULT WINAPI xmlreader_GetLineNumber(IXmlReader* iface, UINT *line_numb break; case XmlNodeType_Whitespace: case XmlNodeType_XmlDeclaration: + case XmlNodeType_DocumentType: *line_number = This->empty_element.position.line_number; break; default: @@ -3522,6 +3526,7 @@ static HRESULT WINAPI xmlreader_GetLinePosition(IXmlReader* iface, UINT *line_po break; case XmlNodeType_Whitespace: case XmlNodeType_XmlDeclaration: + case XmlNodeType_DocumentType: *line_position = This->empty_element.position.line_position; break; default: diff --git a/dlls/xmllite/tests/reader.c b/dlls/xmllite/tests/reader.c index e38f1e5f37..73389a5392 100644 --- a/dlls/xmllite/tests/reader.c +++ b/dlls/xmllite/tests/reader.c @@ -1285,6 +1285,7 @@ static void test_read_public_dtd(void) set_input_string(reader, test_public_dtd);
read_node(reader, XmlNodeType_DocumentType); + TEST_READER_POSITION2(reader, 1, 11, ~0u, 51);
count = 0; hr = IXmlReader_GetAttributeCount(reader, &count); @@ -1293,6 +1294,7 @@ static void test_read_public_dtd(void)
hr = IXmlReader_MoveToFirstAttribute(reader); ok(hr == S_OK, "got %08x\n", hr); + TEST_READER_POSITION2(reader, 1, 19, ~0u, 51);
type = XmlNodeType_None; hr = IXmlReader_GetNodeType(reader, &type); @@ -1303,6 +1305,7 @@ static void test_read_public_dtd(void) reader_value(reader, "pubid");
next_attribute(reader); + TEST_READER_POSITION2(reader, 1, 19, ~0u, 51);
type = XmlNodeType_None; hr = IXmlReader_GetNodeType(reader, &type); @@ -1316,6 +1319,7 @@ static void test_read_public_dtd(void) name = reader_name(reader, "testdtd"); qname = reader_qname(reader, "testdtd"); ok(name == qname, "name != qname\n"); + TEST_READER_POSITION2(reader, 1, 11, ~0u, 51);
IXmlReader_Release(reader); } @@ -1341,6 +1345,7 @@ static void test_read_system_dtd(void) set_input_string(reader, test_system_dtd);
read_node(reader, XmlNodeType_DocumentType); + TEST_READER_POSITION2(reader, 1, 11, ~0u, 43);
count = 0; hr = IXmlReader_GetAttributeCount(reader, &count); @@ -1349,6 +1354,7 @@ static void test_read_system_dtd(void)
hr = IXmlReader_MoveToFirstAttribute(reader); ok(hr == S_OK, "got %08x\n", hr); + TEST_READER_POSITION2(reader, 1, 19, ~0u, 43);
type = XmlNodeType_None; hr = IXmlReader_GetNodeType(reader, &type); @@ -1362,6 +1368,7 @@ static void test_read_system_dtd(void) name = reader_name(reader, "testdtd"); qname = reader_qname(reader, "testdtd"); ok(name == qname, "name != qname\n"); + TEST_READER_POSITION2(reader, 1, 11, ~0u, 43);
read_node(reader, XmlNodeType_Comment);
On Mon, Oct 28, 2019 at 12:05 AM Jeff Smith whydoubt@gmail.com wrote:
Signed-off-by: Jeff Smith whydoubt@gmail.com
dlls/xmllite/reader.c | 5 ++++- dlls/xmllite/tests/reader.c | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/dlls/xmllite/reader.c b/dlls/xmllite/reader.c index e813ca37fe..02097d0789 100644 --- a/dlls/xmllite/reader.c +++ b/dlls/xmllite/reader.c @@ -1415,7 +1415,6 @@ static HRESULT reader_parse_xmldecl(xmlreader *reader) reader->nodetype = XmlNodeType_XmlDeclaration; reader->empty_element.position = position; reader_set_strvalue(reader, StringValue_LocalName, &strval_xml);
reader_set_strvalue(reader, StringValue_QualifiedName, &strval_xml);
return S_OK;
} @@ -3184,6 +3183,10 @@ static HRESULT WINAPI xmlreader_GetQualifiedName(IXmlReader* iface, LPCWSTR *nam *len = attribute->localname.len; } break;
- case XmlNodeType_XmlDeclaration:
*name = This->strvalues[StringValue_LocalName].str;
*len = This->strvalues[StringValue_LocalName].len;
default: *name = This->strvalues[StringValue_QualifiedName].str; *len = This->strvalues[StringValue_QualifiedName].len;break;
diff --git a/dlls/xmllite/tests/reader.c b/dlls/xmllite/tests/reader.c index 41adad1598..64ae6191a6 100644 --- a/dlls/xmllite/tests/reader.c +++ b/dlls/xmllite/tests/reader.c @@ -2537,7 +2537,8 @@ static void test_string_pointers(void) ok(empty == reader_value(reader, ""), "empty != value\n"); ok(empty == reader_prefix(reader, ""), "empty != prefix\n"); xml = reader_name(reader, "xml");
- ptr = reader_qname(reader, "xml"); todo_wine ok(xml == ptr, "xml != qname\n");
ptr = reader_qname(reader, "xml");
ok(xml == ptr, "xml != qname\n"); ok(empty == reader_namespace(reader, ""), "empty != namespace\n");
next_attribute(reader);
-- 2.21.0
Please hold off on this set, as I am reworking it.