From 57168e1fbcebed4cf7fe559d8a9c10bbf74ef432 Mon Sep 17 00:00:00 2001 From: Jonas Fonseca Date: Thu, 29 Dec 2005 20:38:43 +0100 Subject: [PATCH] Handle as a self-closing tag Before the '/' before '>' would be interpreted as part of the attribute value. Hope this is sensible slurping of the markup soup. --- src/dom/sgml/scanner.c | 4 ++++ src/dom/test/test-sgml-parser-basic | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/src/dom/sgml/scanner.c b/src/dom/sgml/scanner.c index b51f79bc0..946c0bb6d 100644 --- a/src/dom/sgml/scanner.c +++ b/src/dom/sgml/scanner.c @@ -338,6 +338,8 @@ scan_sgml_element_token(struct dom_scanner *scanner, struct dom_scanner_token *t } else if (is_sgml_attribute(*string)) { scan_sgml_attribute(scanner, string); type = SGML_TOKEN_ATTRIBUTE; + if (string[-1] == '/' && string[0] == '>') + string--; } } else if (isquote(first_char)) { @@ -365,6 +367,8 @@ scan_sgml_element_token(struct dom_scanner *scanner, struct dom_scanner_token *t if (is_sgml_attribute(*string)) { scan_sgml_attribute(scanner, string); type = SGML_TOKEN_ATTRIBUTE; + if (string[-1] == '/' && string[0] == '>') + string--; } } diff --git a/src/dom/test/test-sgml-parser-basic b/src/dom/test/test-sgml-parser-basic index 358871c6e..d91709f5a 100755 --- a/src/dom/test/test-sgml-parser-basic +++ b/src/dom/test/test-sgml-parser-basic @@ -89,6 +89,15 @@ element: root attribute: i -> j attribute: k -> ' +test_output_equals \ +'Parse attribute with non-quoted values.' \ +'...' \ +' +element: root + attribute: color -> #abc + attribute: path -> /to/%61-&\one";files +#text: ...' + test_output_equals \ 'Parse entity references.' \ '&-*' \