diff --git a/mozilla/htmlparser/src/nsHTMLToTXTSinkStream.cpp b/mozilla/htmlparser/src/nsHTMLToTXTSinkStream.cpp
index 3f1aae8e93e..ac872bc8393 100644
--- a/mozilla/htmlparser/src/nsHTMLToTXTSinkStream.cpp
+++ b/mozilla/htmlparser/src/nsHTMLToTXTSinkStream.cpp
@@ -426,7 +426,7 @@ nsHTMLToTXTSinkStream::OpenContainer(const nsIParserNode& aNode)
printf("OpenContainer: %d ", type);
#endif
const nsString& name = aNode.GetText();
- if (name.Equals("XIF_DOC_INFO"))
+ if (name.Equals("document_info"))
{
nsString value;
if (NS_SUCCEEDED(GetValueOfAttribute(aNode, "charset", value)))
diff --git a/mozilla/htmlparser/src/nsXIFDTD.cpp b/mozilla/htmlparser/src/nsXIFDTD.cpp
index 79dbd298a8e..c69dd936853 100644
--- a/mozilla/htmlparser/src/nsXIFDTD.cpp
+++ b/mozilla/htmlparser/src/nsXIFDTD.cpp
@@ -603,11 +603,6 @@ nsresult nsXIFDTD::HandleStartToken(CToken* aToken) {
ProcessEncodeTag(node);
break;
- case eXIFTag_document_info:
- ProcessDocumentInfoTag(node);
- break;
-
-
case eXIFTag_attr:
AddAttribute(node);
break;
@@ -633,6 +628,11 @@ nsresult nsXIFDTD::HandleStartToken(CToken* aToken) {
AddCSSDeclaration(node);
break;
+ case eXIFTag_document_info:
+ // This is XIF only tag. For HTML it's userdefined.
+ node.mToken->SetTypeID(eHTMLTag_userdefined);
+ // fall through to call OpenContainer:
+
case eXIFTag_markupDecl:
mSink->OpenContainer(node);
break;
@@ -1436,28 +1436,6 @@ void nsXIFDTD::ProcessEntityTag(const nsIParserNode& aNode)
}
}
-
-void nsXIFDTD::ProcessDocumentInfoTag(const nsIParserNode& aNode)
-{
- nsString value;
- nsString key("charset");
-
- if (GetAttribute(aNode,key,value))
- {
- nsString tmpString("document_info");
- PushNodeAndToken(tmpString);
- nsIParserNode* top = PeekNode();
- if (top != nsnull)
- {
- CAttributeToken* attribute = new CAttributeToken(key,value);
- ((nsCParserNode*)top)->AddAttribute(attribute);
- }
- }
-}
-
-
-
-
/*** CSS Methods ****/
void nsXIFDTD::BeginCSSStyleSheet(const nsIParserNode& aNode)
diff --git a/mozilla/htmlparser/tests/outsinks/Makefile.in b/mozilla/htmlparser/tests/outsinks/Makefile.in
index 86d5f0e6114..8885d4da830 100644
--- a/mozilla/htmlparser/tests/outsinks/Makefile.in
+++ b/mozilla/htmlparser/tests/outsinks/Makefile.in
@@ -54,6 +54,9 @@ TEST_FILES = \
htmltable.out \
xifstuff.xif \
xifstuff.out \
+ doctype.xif \
+ xifdtplain.out \
+ xifdthtml.out \
$(NULL)
include $(topsrcdir)/config/rules.mk
diff --git a/mozilla/htmlparser/tests/outsinks/TestOutSinks b/mozilla/htmlparser/tests/outsinks/TestOutSinks
index 4e38b770982..93ed9db442c 100755
--- a/mozilla/htmlparser/tests/outsinks/TestOutSinks
+++ b/mozilla/htmlparser/tests/outsinks/TestOutSinks
@@ -44,7 +44,7 @@ endif
echo "Testing simple html to plaintext formatting ..."
TestOutput -i text/html -o text/plain -f 34 -w 70 -c OutTestData/simplefmt.out OutTestData/simple.html
if ($status != 0) then
- echo "Simple copy test failed.\n"
+ echo "Simple formatting test failed.\n"
set errmsg = ($errmsg "simplefmt.out")
endif
@@ -90,6 +90,20 @@ if ($status != 0) then
set errmsg = ($errmsg "htmltable.out")
endif
+echo "Testing XIF to plain with doctype (bug 28447) ..."
+TestOutput -i text/xif -o text/plain -f 2 -c OutTestData/xifdtplain.out OutTestData/doctype.xif
+if ($status != 0) then
+ echo "XIF to plain with doctype failed."
+ set errmsg = ($errmsg "xifdtplain.out")
+endif
+
+echo "Testing XIF to html with doctype ..."
+TestOutput -i text/xif -o text/html -f 0 -c OutTestData/xifdthtml.out OutTestData/doctype.xif
+if ($status != 0) then
+ echo "XIF to html with doctype failed."
+ set errmsg = ($errmsg "xifdthtml.out")
+endif
+
if ("$errmsg" != "") then
echo " "
echo TESTS FAILED: $errmsg
diff --git a/mozilla/htmlparser/tests/outsinks/TestOutSinks.bat b/mozilla/htmlparser/tests/outsinks/TestOutSinks.bat
index 9363ad99513..d22a2789b30 100644
--- a/mozilla/htmlparser/tests/outsinks/TestOutSinks.bat
+++ b/mozilla/htmlparser/tests/outsinks/TestOutSinks.bat
@@ -28,13 +28,17 @@ set errmsg=
set has_err=
echo Testing simple html to html ...
-TestOutput -i text/html -o text\html -f 0 -c OutTestData/simple.html OutTestData/simple.html
+TestOutput -i text/html -o text/html -f 0 -c OutTestData/simple.html OutTestData/simple.html
if errorlevel 1 echo Simple html to html failed (%errorlevel%). && set has_err=1 && set errmsg=%errmsg% simple.html
echo Testing simple copy case ...
TestOutput -i text/html -o text/plain -f 0 -w 0 -c OutTestData/simplecopy.out OutTestData/simple.html
if errorlevel 1 echo Simple copy test failed. && set has_err=1 && set errmsg=%errmsg% simplecopy.out
+echo "Testing simple html to plaintext formatting ..."
+TestOutput -i text/html -o text/plain -f 34 -w 70 -c OutTestData/simplefmt.out OutTestData/simple.html
+if errorlevel 1 echo Simple formatting test failed. && set has_err=1 && set errmsg=%errmsg% plainnowrap.out
+
echo Testing non-wrapped plaintext ...
TestOutput -i text/html -o text/plain -f 0 -w 0 -c OutTestData/plainnowrap.out OutTestData/plain.html
if errorlevel 1 echo Non-wrapped plaintext test failed. && set has_err=1 && set errmsg=%errmsg% plainnowrap.out
@@ -59,6 +63,14 @@ echo Testing HTML Table to Text ...
TestOutput -i text/html -o text/plain -c OutTestData/htmltable.out OutTestData/htmltable.html
if errorlevel 1 echo HTML Table to Plain text failed (%errorlevel%). && set has_err=1 && set errmsg=%errmsg% htmltable.out
+echo "Testing XIF to plain with doctype (bug 28447) ..."
+TestOutput -i text/xif -o text/plain -f 2 -c OutTestData/xifdtplain.out OutTestData/doctype.xif
+if errorlevel 1 echo XIF to plain with doctype failed (%errorlevel%). && set has_err=1 && set errmsg=%errmsg% xifdtplain.out
+
+REM echo "Testing XIF to html with doctype ..."
+REM TestOutput -i text/xif -o text/html -f 0 -c OutTestData/xifdthtml.out OutTestData/doctype.xif
+REM if errorlevel 1 echo XIF to html with doctype failed (%errorlevel%). && set has_err=1 && set errmsg=%errmsg% xifdthtml.out
+
if %has_err% == 0 goto success
echo.
echo TESTS FAILED: %errmsg%
diff --git a/mozilla/htmlparser/tests/outsinks/doctype.xif b/mozilla/htmlparser/tests/outsinks/doctype.xif
new file mode 100644
index 00000000000..0a691a75e03
--- /dev/null
+++ b/mozilla/htmlparser/tests/outsinks/doctype.xif
@@ -0,0 +1,17 @@
+
+
+