diff --git a/dlls/webservices/reader.c b/dlls/webservices/reader.c index a8990d84ed6..f85b5e75d4f 100644 --- a/dlls/webservices/reader.c +++ b/dlls/webservices/reader.c @@ -746,7 +746,7 @@ static HRESULT read_attribute( struct reader *reader, WS_XML_ATTRIBUTE **ret ) { WS_XML_ATTRIBUTE *attr; WS_XML_UTF8_TEXT *text; - unsigned int len = 0, ch, skip; + unsigned int len = 0, ch, skip, quote; const char *start; HRESULT hr = WS_E_INVALID_FORMAT; @@ -775,7 +775,8 @@ static HRESULT read_attribute( struct reader *reader, WS_XML_ATTRIBUTE **ret ) read_skip( reader, 1 ); read_skip_whitespace( reader ); - if (read_cmp( reader, "\"", 1 )) goto error; + if (read_cmp( reader, "\"", 1 ) && read_cmp( reader, "'", 1 )) goto error; + quote = read_utf8_char( reader, &skip ); read_skip( reader, 1 ); len = 0; @@ -783,7 +784,7 @@ static HRESULT read_attribute( struct reader *reader, WS_XML_ATTRIBUTE **ret ) for (;;) { if (!(ch = read_utf8_char( reader, &skip ))) goto error; - if (ch == '"') break; + if (ch == quote) break; read_skip( reader, skip ); len += skip; } @@ -795,6 +796,7 @@ static HRESULT read_attribute( struct reader *reader, WS_XML_ATTRIBUTE **ret ) return E_OUTOFMEMORY; } attr->value = (WS_XML_TEXT *)text; + attr->singleQuote = (quote == '\''); *ret = attr; return S_OK; diff --git a/dlls/webservices/tests/reader.c b/dlls/webservices/tests/reader.c index 0d32864afd9..f4ac601fb25 100644 --- a/dlls/webservices/tests/reader.c +++ b/dlls/webservices/tests/reader.c @@ -50,7 +50,7 @@ static const char data5[] = static const char data6[] = "" - "test"; + "test"; static const char data8[] = "test"; @@ -872,7 +872,7 @@ static void test_WsReadNode(void) ok( elem->ns != NULL, "ns not set\n" ); ok( !elem->ns->length, "got %u\n", elem->ns->length ); ok( elem->ns->bytes != NULL, "bytes not set\n" ); - ok( elem->attributeCount == 1, "got %u\n", elem->attributeCount ); + ok( elem->attributeCount == 2, "got %u\n", elem->attributeCount ); ok( elem->attributes != NULL, "attributes not set\n" ); ok( !elem->isEmpty, "isEmpty not zero\n" ); @@ -894,6 +894,25 @@ static void test_WsReadNode(void) ok( attr->value->textType == WS_XML_TEXT_TYPE_UTF8, "got %u\n", attr->value->textType ); ok( text->value.length == 5, "got %u\n", text->value.length ); ok( !memcmp( text->value.bytes, "value", 5 ), "wrong data\n" ); + + attr = elem->attributes[1]; + ok( attr->singleQuote == 1, "got %u\n", attr->singleQuote ); + ok( !attr->isXmlNs, "got %u\n", attr->isXmlNs ); + ok( attr->prefix != NULL, "prefix not set\n" ); + ok( !attr->prefix->length, "got %u\n", attr->prefix->length ); + ok( attr->prefix->bytes == NULL, "bytes set\n" ); + ok( attr->localName != NULL, "localName not set\n" ); + ok( attr->localName->length == 5, "got %u\n", attr->localName->length ); + ok( !memcmp( attr->localName->bytes, "attr2", 5 ), "wrong data\n" ); + ok( attr->ns != NULL, "ns not set\n" ); + ok( !attr->ns->length, "got %u\n", attr->ns->length ); + ok( attr->ns->bytes == NULL, "bytes set\n" ); + ok( attr->value != NULL, "value not set\n" ); + + text = (WS_XML_UTF8_TEXT *)attr->value; + ok( attr->value->textType == WS_XML_TEXT_TYPE_UTF8, "got %u\n", attr->value->textType ); + ok( text->value.length == 6, "got %u\n", text->value.length ); + ok( !memcmp( text->value.bytes, "value2", 6 ), "wrong data\n" ); } WsFreeReader( reader );