diff --git a/src/reader/parser.rs b/src/reader/parser.rs index 53455525..07b60f48 100644 --- a/src/reader/parser.rs +++ b/src/reader/parser.rs @@ -226,6 +226,7 @@ pub enum OpeningTagSubstate { AfterAttributeName, InsideAttributeValue, + AfterAttributeValue, } #[derive(Copy, Clone, PartialEq)] diff --git a/src/reader/parser/inside_opening_tag.rs b/src/reader/parser/inside_opening_tag.rs index a9105701..b7f185ac 100644 --- a/src/reader/parser/inside_opening_tag.rs +++ b/src/reader/parser/inside_opening_tag.rs @@ -75,7 +75,7 @@ impl PullParser { Some(this.error(SyntaxError::CannotUndefinePrefix(ln.into()))) } else { this.nst.put(name.local_name.clone(), value); - this.into_state_continue(State::InsideOpeningTag(OpeningTagSubstate::InsideTag)) + this.into_state_continue(State::InsideOpeningTag(OpeningTagSubstate::AfterAttributeValue)) } } @@ -86,7 +86,7 @@ impl PullParser { Some(this.error(SyntaxError::InvalidDefaultNamespace(value.into()))), _ => { this.nst.put(namespace::NS_NO_PREFIX, value.clone()); - this.into_state_continue(State::InsideOpeningTag(OpeningTagSubstate::InsideTag)) + this.into_state_continue(State::InsideOpeningTag(OpeningTagSubstate::AfterAttributeValue)) } }, @@ -96,11 +96,18 @@ impl PullParser { name: name.clone(), value }); - this.into_state_continue(State::InsideOpeningTag(OpeningTagSubstate::InsideTag)) + this.into_state_continue(State::InsideOpeningTag(OpeningTagSubstate::AfterAttributeValue)) } } } - }) + }), + + OpeningTagSubstate::AfterAttributeValue => match t { + Token::Character(c) if is_whitespace_char(c) => self.into_state_continue(State::InsideOpeningTag(OpeningTagSubstate::InsideTag)), + Token::TagEnd => self.emit_start_element(false), + Token::EmptyTagEnd => self.emit_start_element(true), + _ => Some(self.error(SyntaxError::UnexpectedTokenInOpeningTag(t))) + }, } } } diff --git a/tests/oasis.fail.txt b/tests/oasis.fail.txt index 4c22812b..209e0aa1 100644 --- a/tests/oasis.fail.txt +++ b/tests/oasis.fail.txt @@ -11,8 +11,6 @@ o-p12fail6 p12fail6.xml built-in entity refs excluded o-p12fail7 p12fail7.xml The public ID has a tab character, which is disallowed o-p30fail1 p30fail1.xml An XML declaration is not the same as a TextDecl o-p31fail1 p31fail1.xml external subset excludes doctypedecl -o-p40fail1 p40fail1.xml S is required between attributes -o-p44fail4 p44fail4.xml Whitespace required between attributes. o-p45fail2 p45fail2.xml S before contentspec is required. o-p45fail3 p45fail3.xml only one content spec o-p45fail4 p45fail4.xml no comments in declarations (contrast with SGML) diff --git a/tests/sun-not-wf.fail.txt b/tests/sun-not-wf.fail.txt index e06a5b96..89de530b 100644 --- a/tests/sun-not-wf.fail.txt +++ b/tests/sun-not-wf.fail.txt @@ -7,8 +7,6 @@ attlist06 attlist06.xml SGML's NAME attribute type is not allowed. attlist07 attlist07.xml SGML's NAMES attribute type is not allowed. attlist08 attlist08.xml SGML's #CURRENT is not allowed. attlist09 attlist09.xml SGML's #CONREF is not allowed. -attlist10 attlist10.xml Whitespace required between attributes -attlist11 attlist11.xml Whitespace required between attributes cond01 cond01.xml Only INCLUDE and IGNORE are conditional section keywords cond02 cond02.xml Must have keyword in conditional sections content01 content01.xml No whitespace before "?" in content model diff --git a/tests/xmltest.fail.txt b/tests/xmltest.fail.txt index d2b44c63..05925015 100644 --- a/tests/xmltest.fail.txt +++ b/tests/xmltest.fail.txt @@ -62,7 +62,6 @@ not-wf-sa-181 181.xml Internal parsed entities must match the content product not-wf-sa-182 182.xml Internal parsed entities must match the content production to be well formed. not-wf-sa-183 183.xml Mixed content declarations may not include content particles. not-wf-sa-184 184.xml In mixed content models, element names must not be parenthesized. -not-wf-sa-186 186.xml Whitespace is required between attribute/value pairs. not-wf-not-sa-001 001.xml Conditional sections must be properly terminated ("]>" used instead of "]]>"). not-wf-not-sa-002 002.xml Processing instruction target names may not be "XML" in any combination of cases. not-wf-not-sa-003 003.xml Conditional sections must be properly terminated ("]]>" omitted).