--- /dev/null
+Usage ./text_xml_read file.xml
--- /dev/null
+<?xml version="1.0" encoding="us-ascii" standalone="yes"?><!-- Above is XMLDecl ---><!DOCTYPE animal [
+<!ELEMENT animal (cat|tiger|leopard)+>
+<!ELEMENT cat EMPTY>
+<!ELEMENT tiger (#PCDATA)>
+<!ELEMENT leopard ANY>
+<!ELEMENT small EMPTY>
+<!ELEMENT big EMPTY>
+<!ATTLIST tiger color CDATA #REQUIRED>
+]><!-- Above is DTD ---><?music "Here is a PI" ?><animal><cat/><tiger color="white">This is a white tiger in Mirage!!</tiger><cat/><leopard><small/><big/></leopard></animal><!-- Above is element animal --->
--- /dev/null
+XML Error: Invalid string delimiter `?` for attribute `version` at line 1, position 7
--- /dev/null
+XML Error: Invalid string delimiter `v` for attribute `'1.0'` at line 1, position 7
--- /dev/null
+<?xml versioN='1.0'?><!DOCTYPE doc [
+ <!ELEMENT doc EMPTY>
+]><doc/><!-- Wrong key word 'versioN' --->
--- /dev/null
+XML Error: Invalid string delimiter `=` for attribute `version` at line 1, position 7
--- /dev/null
+<?xml version="1.0"?><!DOCTYPE student [
+ <!ELEMENT student (#PCDATA)>
+ <!ATTLIST student first CDATA #REQUIRED
+ last CDATA #IMPLIED>
+]><!-- testing chardata with empty string ---><student first="Snow"></student>
--- /dev/null
+XML Error: Malformatted attribute at line 7, position 7
--- /dev/null
+XML Error: Invalid string delimiter `?` for attribute `version'1.0'` at line 1, position 7
--- /dev/null
+XML Error: Unfinished attribute `version` at line 1, position 7
--- /dev/null
+XML Error: Malformatted attribute at line 1, position 7
--- /dev/null
+<?xml version="1.0"?><!DOCTYPE student [
+ <!ELEMENT student (#PCDATA)>
+ <!ATTLIST student first CDATA #REQUIRED
+ last CDATA #IMPLIED>
+]><!-- testing chardata with white space ---><student first="Eric">
 	 
 </student>
--- /dev/null
+XML Error: Missing matching tag for `testing` at line 7, position 37
--- /dev/null
+XML Error: Malformatted attribute at line 1, position 7
--- /dev/null
+<?xml Version='1.0'?><!DOCTYPE doc [
+ <!ELEMENT doc EMPTY>
+]><doc/><!-- Wrong key word 'Version' --->
--- /dev/null
+XML Error: Unfinished attribute `version` at line 1, position 7
--- /dev/null
+XML Error: Malformatted Processing Instruction tag at line 2, position 1
--- /dev/null
+XML Error: Unfinished attribute `first` at line 14, position 10
--- /dev/null
+<?xml version="1.0"?><!DOCTYPE student [
+ <!ELEMENT student (#PCDATA)>
+ <!ATTLIST student first CDATA #REQUIRED
+ last CDATA #IMPLIED>
+]><!-- testing chardata with a string of sample legal char except '<' and '&' nor does it contain sequence "]]>" ---><student first="Snow" last="Man">This is a test</student>
--- /dev/null
+xml_tests/ibm01v01.xml
+xml_tests/ibm14v02.xml
+xml_tests/ibm20n01.xml
+xml_tests/ibm24n03.xml
+xml_tests/ibm24n06.xml
+xml_tests/ibm24n09.xml
+xml_tests/ibm28n08.xml
+xml_tests/ibm10n04.xml
+xml_tests/ibm14v03.xml
+xml_tests/ibm24n01.xml
+xml_tests/ibm24n04.xml
+xml_tests/ibm24n07.xml
+xml_tests/ibm25n01.xml
+xml_tests/ibm14v01.xml
+xml_tests/ibm17n03.xml
+xml_tests/ibm24n05.xml
+xml_tests/ibm24n08.xml
+xml_tests/ibm25n02.xml
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import dom
+
+if args.length < 1 then
+ print "Usage ./text_xml_read file.xml"
+ exit 1
+end
+
+var fr = new FileReader.open(args[0])
+
+var s = fr.read_all
+
+fr.close
+
+print s.to_xml
--- /dev/null
+<?xml version="1.0" encoding="us-ascii" standalone="yes" ?>
+<!-- Above is XMLDecl -->
+<!DOCTYPE animal [
+<!ELEMENT animal (cat|tiger|leopard)+>
+<!ELEMENT cat EMPTY>
+<!ELEMENT tiger (#PCDATA)>
+<!ELEMENT leopard ANY>
+<!ELEMENT small EMPTY>
+<!ELEMENT big EMPTY>
+<!ATTLIST tiger color CDATA #REQUIRED>
+]>
+<!-- Above is DTD -->
+<?music "Here is a PI" ?>
+<animal>
+ <cat/>
+ <tiger color="white">This is a white tiger in Mirage!!</tiger>
+ <cat/>
+ <leopard>
+ <small/>
+ <big/>
+ </leopard>
+</animal>
+<!-- Above is element animal -->
--- /dev/null
+<?xml version="1.0"?>
+<!DOCTYPE student [
+ <!ELEMENT student (#PCDATA)>
+ <!ATTLIST student
+ first CDATA #REQUIRED
+ middle CDATA #IMPLIED
+ last CDATA #IMPLIED >
+ <!ENTITY myfirst "Snow">
+ <!ENTITY mymiddle "I">
+ <!ENTITY mylast "Man">
+]>
+
+<!-- testing invalid attvalue with no closing bracket -->
+<student first="Snow >My Name is SnowMan. </student>
--- /dev/null
+<?xml version="1.0"?>
+<!DOCTYPE student [
+ <!ELEMENT student (#PCDATA)>
+ <!ATTLIST student first CDATA #REQUIRED
+ last CDATA #IMPLIED>
+]>
+
+<!-- testing chardata with empty string -->
+<student first="Snow"></student>
--- /dev/null
+<?xml version="1.0"?>
+<!DOCTYPE student [
+ <!ELEMENT student (#PCDATA)>
+ <!ATTLIST student first CDATA #REQUIRED
+ last CDATA #IMPLIED>
+]>
+
+<!-- testing chardata with white space -->
+<student first="Eric"> 
 	 
 </student>
--- /dev/null
+<?xml version="1.0"?>
+<!DOCTYPE student [
+ <!ELEMENT student (#PCDATA)>
+ <!ATTLIST student first CDATA #REQUIRED
+ last CDATA #IMPLIED>
+]>
+
+<!-- testing chardata with a string of sample legal char except '<' and '&' nor does it contain sequence "]]>" -->
+<student first="Snow" last="Man">This is a test</student>
--- /dev/null
+<?xml version="1.0"?>
+<!DOCTYPE student [
+ <!ELEMENT student (#PCDATA)>
+]>
+
+<!-- testing invalid PITarget -->
+<?xml This is a test ?>
+<student>My Name is SnowMan. </student>
--- /dev/null
+<?xml version="1.0"?>
+<!DOCTYPE student [
+ <!ELEMENT student (#PCDATA)>
+]>
+
+<!-- testing invalid CData with illegal sequence -->
+<![CDATA[<testing>This is ]]> a test</testing>]]>
+<student>My Name is SnowMan. </student>
--- /dev/null
+<?xml version= ?>
+<!DOCTYPE doc [
+ <!ELEMENT doc EMPTY>
+]>
+<doc/>
+<!-- VersioNum is missing in VersionInfo -->
--- /dev/null
+<?xml version'1.0' ?>
+<!DOCTYPE doc [
+ <!ELEMENT doc EMPTY>
+]>
+<doc/>
+<!-- Eq is missing in VersionInfo -->
--- /dev/null
+<?xml '1.0'=version ?>
+<!DOCTYPE doc [
+ <!ELEMENT doc EMPTY>
+]>
+<doc/>
+<!-- Wrong ordering VersionNum Eq 'version' -->
--- /dev/null
+<?xml version'1.0'= ?>
+<!DOCTYPE doc [
+ <!ELEMENT doc EMPTY>
+]>
+<doc/>
+<!-- Wrong ordering version VersionNum Eq -->
--- /dev/null
+<?xml Version='1.0' ?>
+<!DOCTYPE doc [
+ <!ELEMENT doc EMPTY>
+]>
+<doc/>
+<!-- Wrong key word 'Version' -->
--- /dev/null
+<?xml versioN='1.0' ?>
+<!DOCTYPE doc [
+ <!ELEMENT doc EMPTY>
+]>
+<doc/>
+<!-- Wrong key word 'versioN' -->
--- /dev/null
+<?xml version='1.0" ?>
+<!DOCTYPE doc [
+ <!ELEMENT doc EMPTY>
+]>
+<doc/>
+<!-- Mismatched qotes in VersionInfo -->
--- /dev/null
+<?xml version='1.0 ?>
+<!DOCTYPE doc [
+ <!ELEMENT doc EMPTY>
+]>
+<doc/>
+<!-- Mismatched qotes in VersionInfo -->
--- /dev/null
+<?xml version=='1.0' ?>
+<!DOCTYPE doc [
+ <!ELEMENT doc EMPTY>
+]>
+<doc/>
+<!-- Wrong key word "==" in Eq -->
--- /dev/null
+<?xml version eq '1.0' ?>
+<!DOCTYPE doc [
+ <!ELEMENT doc EMPTY>
+]>
+<doc/>
+<!-- Wrong key word "eq" in Eq -->
--- /dev/null
+<?xml version="1.0" encoding='UTF-8'?>
+<?DOCTYPE animal [
+ <!ELEMENT animal EMPTY>
+]>
+<!-- Wrong opening sequence in doctypedecl -->
+<animal/>