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);