Index: xword/ContentFiltering/Office/Word/Cleaners/CorrectAttributesCleaner.cs =================================================================== --- xword/ContentFiltering/Office/Word/Cleaners/CorrectAttributesCleaner.cs (revision 26060) +++ xword/ContentFiltering/Office/Word/Cleaners/CorrectAttributesCleaner.cs (working copy) @@ -24,13 +24,15 @@ foreach (String initialValue in tags) { String value = initialValue; - char[] separators = { ' ', '>', '/', '\r' }; + string[] separators = { " ", ">", "/>", "/ >", "\r" }; bool hasChanged = false; - foreach (String s in initialValue.Split(separators)) + + foreach (String s in initialValue.Split(separators,StringSplitOptions.RemoveEmptyEntries)) { - String[] attribute = s.Split('='); - if (attribute.Length == 2) + int equalSignPosition = s.IndexOf('='); + if (equalSignPosition > 0) { + String[] attribute = { s.Substring(0, equalSignPosition), s.Substring(equalSignPosition+1) }; try { String newValue = attribute[1]; Index: xword/ContentFiltering/Test/Office/Word/Cleaners/CorrectAttributesCleanerTest.cs =================================================================== --- xword/ContentFiltering/Test/Office/Word/Cleaners/CorrectAttributesCleanerTest.cs (revision 26060) +++ xword/ContentFiltering/Test/Office/Word/Cleaners/CorrectAttributesCleanerTest.cs (working copy) @@ -30,7 +30,10 @@ public void GlobalSetup() { initialHTML = "Title" - +"" + +"" + +"" + +"" + +"" +"" + "

text

" + "

text

" @@ -38,7 +41,10 @@ + "red text" + ""; expectedHTML = "Title" - +"" + +"" + + "" + + "" + + "" +"" + "

text

" + "

text

" @@ -51,15 +57,17 @@ { bool canLoadXML = false; initialHTML = new CorrectAttributesCleaner().Clean(initialHTML); - Assert.AreEqual(initialHTML, expectedHTML); + Assert.AreEqual(expectedHTML, initialHTML); try { new XmlDocument().LoadXml(initialHTML); canLoadXML = true; } - catch + catch(Exception e) { + Console.WriteLine(initialHTML.Replace(">",">\n")); + Console.WriteLine(e); canLoadXML = false; }