Index: xword/TestXWikiLib/XmlDocumentExtensionTest.cs
===================================================================
--- xword/TestXWikiLib/XmlDocumentExtensionTest.cs (revision 0)
+++ xword/TestXWikiLib/XmlDocumentExtensionTest.cs (revision 0)
@@ -0,0 +1,69 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Xml;
+using XWiki.Xml;
+using NUnit.Framework;
+
+namespace TestXWikiLib
+{
+ ///
+ /// Test class for XmlDocument extensions.
+ ///
+ [TestFixture]
+ public class XmlDocumentExtensionTest
+ {
+ private XmlDocument xmlDoc;
+ private string html;
+ private string expectedHtml;
+ ///
+ /// Default constructor.
+ ///
+ public XmlDocumentExtensionTest()
+ {
+ }
+
+ ///
+ /// Initialize the test.
+ ///
+ [TestFixtureSetUp]
+ public void GlobalSetUp()
+ {
+ xmlDoc = new XmlDocument();
+ html = "Page Title"
+ + "\nDocument Title
"
+ + "Some content goes here
"
+ + "Related links:
"
+ + "Example.com
"
+ + "";
+ expectedHtml = "" + Environment.NewLine +
+ "" + Environment.NewLine +
+ " " + Environment.NewLine +
+ " Page Title" + Environment.NewLine +
+ " " + Environment.NewLine +
+ " " + Environment.NewLine +
+ " Document Title
" + Environment.NewLine +
+ " Some content goes here
" + Environment.NewLine +
+ " " + Environment.NewLine +
+ " Related links:" + Environment.NewLine +
+ "
" + Environment.NewLine +
+ " Example.com" + Environment.NewLine +
+ "
" + Environment.NewLine +
+ " " + Environment.NewLine +
+ "";
+ }
+
+ ///
+ /// Test method for GetIndendedXml() extension method.
+ ///
+ [Test]
+ public void TestGetIndentedXml()
+ {
+ string indentedHtml;
+ xmlDoc.LoadXml(html);
+ indentedHtml = xmlDoc.GetIndentedXml();
+ Assert.AreEqual(indentedHtml, expectedHtml);
+ }
+ }
+}
Index: xword/XWikiLib/Office/Word/LocalToWebHTML.cs
===================================================================
--- xword/XWikiLib/Office/Word/LocalToWebHTML.cs (revision 18239)
+++ xword/XWikiLib/Office/Word/LocalToWebHTML.cs (working copy)
@@ -5,6 +5,7 @@
using System.IO;
using System.Xml;
using System.Xml.XPath;
+using XWiki.Xml;
namespace XWiki.Office.Word
{
@@ -51,7 +52,7 @@
AdaptLists(ref xmlDoc);
AdaptMacros(ref xmlDoc);
ClearOfficeAttributes(ref xmlDoc);
- StringBuilder sb = new StringBuilder(xmlDoc.InnerXml);
+ StringBuilder sb = new StringBuilder(xmlDoc.GetIndentedXml());
sb.Replace(" xmlns=\"\"","");
return sb.ToString();
}
Index: xword/XWikiLib/Office/Word/WebToLocalHTML.cs
===================================================================
--- xword/XWikiLib/Office/Word/WebToLocalHTML.cs (revision 18239)
+++ xword/XWikiLib/Office/Word/WebToLocalHTML.cs (working copy)
@@ -9,6 +9,7 @@
using System.Xml.XPath;
using XWiki.Clients;
using XWiki.Html;
+using XWiki.Xml;
namespace XWiki.Office.Word
{
@@ -109,7 +110,7 @@
}
AdaptMacros(ref xmlDoc);
AdaptImages(ref xmlDoc);
- return xmlDoc.InnerXml;
+ return xmlDoc.GetIndentedXml();
}
///
Index: xword/XWikiLib/XWikiLib.csproj
===================================================================
--- xword/XWikiLib/XWikiLib.csproj (revision 18239)
+++ xword/XWikiLib/XWikiLib.csproj (working copy)
@@ -72,6 +72,7 @@
True
Settings.settings
+
@@ -89,9 +90,6 @@
-
-
-