Signed-off-by: Jeff Smith whydoubt@gmail.com --- dlls/xmllite/reader.c | 5 +++++ dlls/xmllite/tests/reader.c | 10 ++++++++++ 2 files changed, 15 insertions(+)
diff --git a/dlls/xmllite/reader.c b/dlls/xmllite/reader.c index 3875676f01..9731734258 100644 --- a/dlls/xmllite/reader.c +++ b/dlls/xmllite/reader.c @@ -1966,6 +1966,7 @@ static HRESULT reader_parse_dtd(xmlreader *reader) { static const WCHAR doctypeW[] = {'<','!','D','O','C','T','Y','P','E',0}; strval prefix, local, qname; + struct reader_position position; WCHAR *cur; HRESULT hr;
@@ -1980,6 +1981,7 @@ static HRESULT reader_parse_dtd(xmlreader *reader) if (!reader_skipspaces(reader)) return WC_E_WHITESPACE;
/* name */ + position = reader->position; hr = reader_parse_qname(reader, &prefix, &local, &qname); if (FAILED(hr)) return WC_E_DECLDOCTYPE;
@@ -2001,6 +2003,7 @@ static HRESULT reader_parse_dtd(xmlreader *reader) reader_skipn(reader, 1);
reader->nodetype = XmlNodeType_DocumentType; + reader->empty_element.position = position; reader_free_strvalued(reader, &reader->empty_element.localname); reader_strvaldup(reader, &local, &reader->empty_element.localname); if (prefix.len) @@ -3468,6 +3471,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: @@ -3500,6 +3504,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 a928456571..bcd0e1e552 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);
@@ -1387,6 +1394,7 @@ static void test_read_system_dtd_ns(void) set_input_string(reader, test_system_dtd_ns);
read_node(reader, XmlNodeType_DocumentType); + TEST_READER_POSITION2(reader, 1, 11, ~0u, 45);
count = 0; hr = IXmlReader_GetAttributeCount(reader, &count); @@ -1395,6 +1403,7 @@ static void test_read_system_dtd_ns(void)
hr = IXmlReader_MoveToFirstAttribute(reader); ok(hr == S_OK, "got %08x\n", hr); + TEST_READER_POSITION2(reader, 1, 21, ~0u, 45);
type = XmlNodeType_None; hr = IXmlReader_GetNodeType(reader, &type); @@ -1407,6 +1416,7 @@ static void test_read_system_dtd_ns(void) move_to_element(reader); reader_name(reader, "testdtd"); reader_qname(reader, "a:testdtd"); + TEST_READER_POSITION2(reader, 1, 11, ~0u, 45);
IXmlReader_Release(reader); }