refresh
diff --git a/bundles/org.eclipse.wst.dtd.core/.classpath b/bundles/org.eclipse.wst.dtd.core/.classpath
index 065ac06..df094ee 100644
--- a/bundles/org.eclipse.wst.dtd.core/.classpath
+++ b/bundles/org.eclipse.wst.dtd.core/.classpath
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
-	<classpathentry kind="src" path="src"/>
-	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
-	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
-	<classpathentry kind="output" path="bin"/>
+    <classpathentry kind="src" path="src"/>
+    <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+    <classpathentry kind="output" path="bin"/>
 </classpath>
diff --git a/bundles/org.eclipse.wst.dtd.core/.compatibility b/bundles/org.eclipse.wst.dtd.core/.compatibility
new file mode 100644
index 0000000..d77886b
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/.compatibility
@@ -0,0 +1,2 @@
+#Wed Mar 24 13:53:52 EST 2004

+.project=54098

diff --git a/bundles/org.eclipse.wst.dtd.core/.cvsignore b/bundles/org.eclipse.wst.dtd.core/.cvsignore
index ba077a4..3b2bc5c 100644
--- a/bundles/org.eclipse.wst.dtd.core/.cvsignore
+++ b/bundles/org.eclipse.wst.dtd.core/.cvsignore
@@ -1 +1,7 @@
 bin
+temp.folder
+dtdmodel.jar
+.project
+dev.properties
+org.eclipse.wst.dtd.core_6.0.0.jar
+build.xml
diff --git a/bundles/org.eclipse.wst.dtd.core/.project b/bundles/org.eclipse.wst.dtd.core/.project
index 3bb71a0..f4ab18c 100644
--- a/bundles/org.eclipse.wst.dtd.core/.project
+++ b/bundles/org.eclipse.wst.dtd.core/.project
@@ -1,8 +1,21 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <projectDescription>
-	<name>org.eclipse.wst.dtd.core</name>
+	<name>org.eclipse.wst.dtd.core.util</name>
 	<comment></comment>
 	<projects>
+		<project>org.eclipse.wst.common.encoding</project>
+		<project>org.eclipse.wst.common.encoding.contentspecific</project>
+		<project>org.eclipse.wst.sse.core</project>
+		<project>org.eclipse.wst.xml.core</project>
+		<project>org.eclipse.core.resources</project>
+		<project>org.eclipse.core.runtime</project>
+		<project>org.eclipse.core.runtime.compatibility</project>
+		<project>org.eclipse.jface.text</project>
+		<project>org.eclipse.ui</project>
+		<project>org.eclipse.ui.editors</project>
+		<project>org.eclipse.ui.ide</project>
+		<project>org.eclipse.ui.views</project>
+		<project>org.eclipse.ui.workbench.texteditor</project>
 	</projects>
 	<buildSpec>
 		<buildCommand>
@@ -22,7 +35,7 @@
 		</buildCommand>
 	</buildSpec>
 	<natures>
-		<nature>org.eclipse.jdt.core.javanature</nature>
 		<nature>org.eclipse.pde.PluginNature</nature>
+		<nature>org.eclipse.jdt.core.javanature</nature>
 	</natures>
 </projectDescription>
diff --git a/bundles/org.eclipse.wst.dtd.core/build.properties b/bundles/org.eclipse.wst.dtd.core/build.properties
new file mode 100644
index 0000000..8267abc
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/build.properties
@@ -0,0 +1,22 @@
+###############################################################################
+# Copyright (c) 2001, 2004 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+# 
+# Contributors:
+#     IBM Corporation - initial API and implementation
+#     Jens Lukowski/Innoopract - initial renaming/restructuring
+#     
+###############################################################################
+bin.includes = plugin.xml,\
+               *.jar,\
+               dtd.jar,\
+               plugin.properties,\
+               icons/
+src.includes = plugin.xml,\
+               plugin.properties,\
+               build.xml,\
+               icons/
+source.dtdmodel.jar = src/
diff --git a/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/DTDFile.gif b/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/DTDFile.gif
new file mode 100644
index 0000000..64ee536
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/DTDFile.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/any.gif b/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/any.gif
new file mode 100644
index 0000000..7017d91
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/any.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/attribute.gif b/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/attribute.gif
new file mode 100644
index 0000000..00bb7b4
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/attribute.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/attribute_list.gif b/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/attribute_list.gif
new file mode 100644
index 0000000..795eb5e
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/attribute_list.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/comment.gif b/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/comment.gif
new file mode 100644
index 0000000..28c2ccb
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/comment.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/element.gif b/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/element.gif
new file mode 100644
index 0000000..01f4889
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/element.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/element_ref.gif b/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/element_ref.gif
new file mode 100644
index 0000000..749acfc
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/element_ref.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/emptycontent.gif b/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/emptycontent.gif
new file mode 100644
index 0000000..bc8e66c
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/emptycontent.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/entity.gif b/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/entity.gif
new file mode 100644
index 0000000..6a91888
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/entity.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/entity_reference.gif b/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/entity_reference.gif
new file mode 100644
index 0000000..d30b26b
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/entity_reference.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/fldr_el.gif b/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/fldr_el.gif
new file mode 100644
index 0000000..801c133
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/fldr_el.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/fldr_ent.gif b/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/fldr_ent.gif
new file mode 100644
index 0000000..2fb2ca7
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/fldr_ent.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/fldr_not.gif b/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/fldr_not.gif
new file mode 100644
index 0000000..5909668
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/fldr_not.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/fldr_unrec.gif b/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/fldr_unrec.gif
new file mode 100644
index 0000000..6fd82e6
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/fldr_unrec.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/folder_attlist_obj.gif b/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/folder_attlist_obj.gif
new file mode 100644
index 0000000..f849c75
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/folder_attlist_obj.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/folder_comments_obj.gif b/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/folder_comments_obj.gif
new file mode 100644
index 0000000..c9f0945
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/folder_comments_obj.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/genhtmform_wiz.gif b/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/genhtmform_wiz.gif
new file mode 100644
index 0000000..5f54702
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/genhtmform_wiz.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/newdtd_wiz.gif b/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/newdtd_wiz.gif
new file mode 100644
index 0000000..2c115ff
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/newdtd_wiz.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/notation.gif b/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/notation.gif
new file mode 100644
index 0000000..ce9df98
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/notation.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/one.gif b/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/one.gif
new file mode 100644
index 0000000..694c26f
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/one.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/onechoice.gif b/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/onechoice.gif
new file mode 100644
index 0000000..d13ba2e
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/onechoice.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/oneormore.gif b/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/oneormore.gif
new file mode 100644
index 0000000..8b2b357
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/oneormore.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/oneormorechoice.gif b/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/oneormorechoice.gif
new file mode 100644
index 0000000..96398c0
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/oneormorechoice.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/oneormoresequence.gif b/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/oneormoresequence.gif
new file mode 100644
index 0000000..041db27
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/oneormoresequence.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/onesequence.gif b/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/onesequence.gif
new file mode 100644
index 0000000..5f9658e
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/onesequence.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/optional.gif b/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/optional.gif
new file mode 100644
index 0000000..e7422d7
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/optional.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/optionalchoice.gif b/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/optionalchoice.gif
new file mode 100644
index 0000000..fb4f9bd
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/optionalchoice.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/optionalsequence.gif b/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/optionalsequence.gif
new file mode 100644
index 0000000..f8d5289
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/optionalsequence.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/txtext.gif b/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/txtext.gif
new file mode 100644
index 0000000..efa7a38
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/txtext.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/unrecognized_content.gif b/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/unrecognized_content.gif
new file mode 100644
index 0000000..358997d
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/unrecognized_content.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/zeroormore.gif b/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/zeroormore.gif
new file mode 100644
index 0000000..daf514d
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/zeroormore.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/zeroormorechoice.gif b/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/zeroormorechoice.gif
new file mode 100644
index 0000000..a1ac131
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/zeroormorechoice.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/zeroormoresequence.gif b/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/zeroormoresequence.gif
new file mode 100644
index 0000000..8ed4cb7
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/zeroormoresequence.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.dtd.core/plugin.properties b/bundles/org.eclipse.wst.dtd.core/plugin.properties
new file mode 100644
index 0000000..35a5f4d
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/plugin.properties
@@ -0,0 +1,124 @@
+###############################################################################
+# Copyright (c) 2001, 2004 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+# 
+# Contributors:
+#     IBM Corporation - initial API and implementation
+#     Jens Lukowski/Innoopract - initial renaming/restructuring
+#     
+###############################################################################
+Structured_Source_DTD_Model.name=Structured Source DTD Model
+Structured_Source_DTD_Model_NL_Support.name=Structured Source DTD Model NL Support
+! Properties file for component: XML tools SSE DTD Model
+! Packaged for translation in:  xml.zip
+
+!plugin.xml
+_UI_PLUGIN_NAME=SSE DTD Model
+
+! Strings for DTDBasicTypeImpl type descriptions
+_UI_NONE_DESC=None
+
+!! NOTE TO TRANSLATOR: Do not translate following text in parentheses on following 10 lines i.e.(CDATA)
+_UI_CHARACTER_DATA_DESC=Character Data (CDATA)
+_UI_IDENTIFIER_DESC=Identifier (ID)
+_UI_ID_REFERENCE_DESC=ID Reference (IDREF)
+_UI_ID_REFERENCES_DESC=ID References (IDREFS)
+_UI_ENTITY_NAME_DESC=Entity Name (ENTITY)
+_UI_ENTITY_NAMES_DESC=Entity Names (ENTITIES)
+_UI_NAME_TOKEN_DESC=Name Token (NMTOKEN)
+_UI_NAME_TOKENS_DESC=Name Tokens (NMTOKENS)
+_UI_ENUM_NAME_TOKENS_DESC=Enumerated Name Tokens
+_UI_ENUM_NOTATION_DESC=Enumerated NOTATION
+
+!dtd/util/CreateListItems.java
+_UI_LABEL_NONE=(none)
+
+! Strings from sed/model
+
+! Attribute.java
+_UI_LABEL_ATTR_DEFAULT_VAL=Attribute Default Change Value
+_UI_LABEL_ATTR_DEFAULT_KIND=Change Attribute Default Value
+_UI_LABEL_ATTR_TYPE=Change Attribute Type
+
+! AttributeEnumList
+_UI_LABEL_ATTR_ENUM_ITEMS=Change Attribute Enumeration Value
+
+! AttributeList
+_UI_LABEL_ATTR_LIST_ADD=Add Attribute
+
+! CMGroupNode
+_UI_LABEL_CM_GRP_NODE_CONNECTOR=Change Connector
+_UI_LABEL_CM_GRP_NODE_INSERT_ELEMENT=Insert Element
+_UI_LABEL_CM_GRP_NODE_ADD_GRP=Add Group
+_UI_LABEL_CM_GRP_NODE_ADD_CHILD=Add Child Element
+
+! CMNode
+_UI_LABEL_CM_NODE_MIX_CONTENT=Mixed Content
+_UI_LABEL_CM_NODE_CHILD_CONTENT=Children Content
+_UI_LABEL_CM_NODE_SET_MIX_CONTENT=Set Mixed Content
+_UI_LABEL_CM_NODE_SET_CHILD_CONTENT=Set Children Content
+
+!! NOTE TO TRANSLATOR - USAGE: "Set <variable content> Content"
+_UI_LABEL_CM_NODE_SET=Set
+_UI_LABEL_CM_NODE_CONTENT=Content
+
+!! NOTE TO TRANSLATOR - DO NOT TRANSLATE FOLLOWING 3 LINES
+_UI_LABEL_CM_NODE_PCDATA=(#PCDATA)
+_UI_LABEL_CM_NODE_ANY=ANY
+_UI_LABEL_CM_NODE_EMPTY=EMPTY
+
+! CMRepeatableNode
+_UI_LABEL_CM_REP_NODE_CHG_OCCUR=Change Occurrence
+
+! Comment
+_UI_LABEL_COMMENT_CHG=Comment Change
+
+! DTDFile
+_UI_LABEL_DTD_FILE_ADD_ELEMENT=Add Element
+_UI_LABEL_DTD_FILE_ADD_ENTITY=Add Entity
+_UI_LABEL_DTD_FILE_ADD_COMMENT=Add Comment
+_UI_LABEL_DTD_FILE_ADD_PARM_ENTITY_REF=Add Parameter Entity Reference
+_UI_LABEL_DTD_FILE_ADD_NOTATION=Add Notation
+_UI_LABEL_DTD_FILE_ADD_ATTR_LIST=Add Attribute List
+_UI_LABEL_DTD_FILE_DELETE=Delete
+
+! DTDNode
+_UI_LABEL_DTD_NODE_NAME_CHG=Name Change
+_UI_LABEL_DTD_NODE_DELETE=Delete
+
+! Element
+_UI_LABEL_ELEMENT_ADD_ATTR=Add Attribute
+_UI_LABEL_ELEMENT_ADD_GRP=Add Group
+_UI_LABEL_ELEMENT_ADD_CHILD=Add Child Element
+
+! Entity
+_UI_LABEL_ENTITY_SET_PARM_ENTITY=Set Parameter Entity
+_UI_LABEL_ENTITY_SET_GENERAL_ENTITY=Set General Entity
+_UI_LABEL_ENTITY_SET_EXT_ENTITY=Set External Entity
+_UI_LABEL_ENTITY_SET_INT_ENTITY=Set Internal Entity
+_UI_LABEL_ENTITY_VALUE_CHG=Entity Value Change
+
+!! NOTE TO TRANSLATOR - USAGE: "NDATA Change"
+_UI_LABEL_ENTITY_NDATA_CHANGE=Change
+
+! ExternalNode
+_UI_LABEL_EXT_NODE_PUBLIC_ID_CHG=Public ID Change
+_UI_LABEL_EXT_NODE_SYSTEM_ID_CHG=System ID Change
+
+! NodeList
+_UI_LABEL_NODE_LIST_ELEMENTS=Elements
+_UI_LABEL_NODE_LIST_ENTITIES=Entities
+_UI_LABEL_NODE_LIST_NOTATIONS=Notations
+_UI_LABEL_NODE_LIST_COMMENTS=Comments
+_UI_LABEL_NODE_LIST_OTHER=Other
+_UI_LABEL_NODE_LIST_ATTRIBUTES=Attributes
+
+! ParameterEntityReference
+_UI_LABEL_PARM_ENTITY_REF_CHG_ENTITY_REF=Change Entity Reference
+_UI_LABEL_PARM_ENTITY_REF_COMMENT_CHG=Comment Change
+
+! TopLevelNode
+_UI_LABEL_TOP_LEVEL_NODE_DELETE=Delete
diff --git a/bundles/org.eclipse.wst.dtd.core/plugin.xml b/bundles/org.eclipse.wst.dtd.core/plugin.xml
new file mode 100644
index 0000000..2c793f3
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/plugin.xml
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+<plugin
+	id="org.eclipse.wst.dtd.core"
+	name="%Structured_Source_DTD_Model.name"
+	version="1.0.0"
+	provider-name="IBM"
+	class="org.eclipse.wst.dtd.core.DTDPlugin">
+
+	<runtime>
+		<library name="dtdmodel.jar">
+			<export name="*" />
+		</library>
+	</runtime>
+	<requires>
+		<import plugin="org.eclipse.core.runtime.compatibility" />
+		<import plugin="org.eclipse.ui.ide" />
+		<import plugin="org.eclipse.ui.views" />
+		<import plugin="org.eclipse.jface.text" />
+		<import plugin="org.eclipse.ui.workbench.texteditor" />
+		<import plugin="org.eclipse.ui.editors" />
+		<import plugin="org.eclipse.wst.sse.core" />
+		<import plugin="org.eclipse.wst.xml.core" />
+		<import plugin="org.eclipse.core.resources" />
+		<import plugin="org.eclipse.core.runtime" />
+		<import plugin="org.eclipse.wst.common.encoding" />
+		<import plugin="org.eclipse.ui" />
+	</requires>
+
+
+	<extension point="org.eclipse.wst.sse.core.modelHandler">
+		<modelHandler
+			class="org.eclipse.wst.dtd.core.modelhandler.ModelHandlerForDTD"
+			associatedContentTypeId="org.eclipse.wst.dtd.core.dtdsource"
+			id="org.eclipse.wst.sse.core.handler.dtd">
+		</modelHandler>
+	</extension>
+	<extension
+		point="org.eclipse.wst.sse.core.builderdelegate"
+		id="org.eclipse.wst.dtd.core.builderdelegate.todo">
+		<participant
+			class="org.eclipse.wst.dtd.core.builder.delegates.DTDTaskTagSeeker"
+			contentType="org.eclipse.wst.dtd.core.dtdsource"
+		/>
+	</extension>
+
+   <extension point="org.eclipse.core.filebuffers.documentCreation"
+         id="org.eclipse.wst.dtd.core.documentfactories"
+         name="Structured DTD Document Factory">
+      <factory
+            contentTypeId="org.eclipse.wst.dtd.core.dtdsource"
+            class="org.eclipse.wst.sse.core.filebuffers.BasicStructuredDocumentFactory:org.eclipse.wst.dtd.core.dtdsource"/>
+   </extension>
+
+	<extension point="org.eclipse.team.core.fileTypes">
+		<fileTypes
+			type="text"
+			extension="dtd" />
+		<fileTypes
+			type="text"
+			extension="mod" />
+		<fileTypes
+			type="text"
+			extension="ent" />
+	</extension>
+	
+	   <extension
+         point="org.eclipse.core.runtime.contentTypes">
+         <content-type
+               file-extensions="dtd,mod,ent"
+               priority="normal"
+               name="DTD Content Type"
+               id="dtdsource"
+               base-type="org.eclipse.core.runtime.text"
+			   default-charset="UTF-8">
+			<describer class="org.eclipse.wst.dtd.core.content.ContentDescriberForDTD"/>
+		</content-type>
+   </extension>
+	
+	
+</plugin>
diff --git a/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/Attribute.java b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/Attribute.java
new file mode 100644
index 0000000..7914575
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/Attribute.java
@@ -0,0 +1,369 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+package org.eclipse.wst.dtd.core;
+
+import java.util.Hashtable;
+
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.wst.dtd.core.internal.text.RegionIterator;
+import org.eclipse.wst.dtd.core.parser.DTDRegionTypes;
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegion;
+import org.eclipse.wst.sse.core.text.ITextRegion;
+
+
+// base class for an Element's contentmodel
+public class Attribute extends DTDNode {
+
+	public static final String CDATA = DTDPlugin.getDTDString("_UI_CHARACTER_DATA_DESC"); //$NON-NLS-1$
+	public static final String ENTITIES = DTDPlugin.getDTDString("_UI_ENTITY_NAMES_DESC"); //$NON-NLS-1$
+	public static final String ENTITY = DTDPlugin.getDTDString("_UI_ENTITY_NAME_DESC"); //$NON-NLS-1$
+	public static final String ENUMERATED_NAME = DTDPlugin.getDTDString("_UI_ENUM_NAME_TOKENS_DESC"); //$NON-NLS-1$
+	public static final String ENUMERATED_NOTATION = DTDPlugin.getDTDString("_UI_ENUM_NOTATION_DESC"); //$NON-NLS-1$
+	public static final String FIXED = "#FIXED"; //$NON-NLS-1$
+	public static final String ID = DTDPlugin.getDTDString("_UI_IDENTIFIER_DESC"); //$NON-NLS-1$
+	public static final String IDREF = DTDPlugin.getDTDString("_UI_ID_REFERENCE_DESC"); //$NON-NLS-1$
+	public static final String IDREFS = DTDPlugin.getDTDString("_UI_ID_REFERENCES_DESC"); //$NON-NLS-1$
+
+	public static final String IMPLIED = "#IMPLIED"; //$NON-NLS-1$
+	public static final String NMTOKEN = DTDPlugin.getDTDString("_UI_NAME_TOKEN_DESC"); //$NON-NLS-1$
+	public static final String NMTOKENS = DTDPlugin.getDTDString("_UI_NAME_TOKENS_DESC"); //$NON-NLS-1$
+	public static final String REQUIRED = "#REQUIRED"; //$NON-NLS-1$
+
+	protected static Hashtable typeHash = new Hashtable();
+
+	public static final String[] types = {CDATA, ID, IDREF, IDREFS, ENTITY, ENTITIES, NMTOKEN, NMTOKENS, ENUMERATED_NAME, ENUMERATED_NOTATION};
+
+	{
+		typeHash.put(DTDRegionTypes.CDATA_KEYWORD, CDATA);
+		typeHash.put(DTDRegionTypes.ID_KEYWORD, ID);
+		typeHash.put(DTDRegionTypes.IDREF_KEYWORD, IDREF);
+		typeHash.put(DTDRegionTypes.IDREFS_KEYWORD, IDREFS);
+		typeHash.put(DTDRegionTypes.ENTITY_KEYWORD, ENTITY);
+		typeHash.put(DTDRegionTypes.ENTITIES_KEYWORD, ENTITIES);
+		typeHash.put(DTDRegionTypes.NMTOKEN_KEYWORD, NMTOKEN);
+		typeHash.put(DTDRegionTypes.NMTOKENS_KEYWORD, NMTOKENS);
+		typeHash.put(DTDRegionTypes.NOTATION_KEYWORD, ENUMERATED_NOTATION);
+		// this one's a special case since there is no keyword for
+		// enumerated name tokens
+		typeHash.put("()", ENUMERATED_NAME); //$NON-NLS-1$
+
+		// now put the reverse in place. This gives us a 2 way lookup
+		// for when we want to retrieve the value and when we want to set it
+		typeHash.put(CDATA, "CDATA"); //$NON-NLS-1$
+		typeHash.put(ID, "ID"); //$NON-NLS-1$
+		typeHash.put(IDREF, "IDREF"); //$NON-NLS-1$
+		typeHash.put(IDREFS, "IDREFS"); //$NON-NLS-1$
+		typeHash.put(ENTITY, "ENTITY"); //$NON-NLS-1$
+		typeHash.put(ENTITIES, "ENTITIES"); //$NON-NLS-1$
+		typeHash.put(NMTOKEN, "NMTOKEN"); //$NON-NLS-1$
+		typeHash.put(NMTOKENS, "NMTOKENS"); //$NON-NLS-1$
+		typeHash.put(ENUMERATED_NAME, ""); //$NON-NLS-1$
+		typeHash.put(ENUMERATED_NOTATION, "NOTATION"); //$NON-NLS-1$
+	}
+
+	private AttributeEnumList enumList = null;
+
+	//  public static final String IMPLIED = "IMPLIED";
+
+	public Attribute(DTDFile file, IStructuredDocumentRegion flatNode) {
+		super(file, flatNode);
+	}
+
+	public String getDefaultKind() {
+		ITextRegion defaultKindRegion = getDefaultKindRegion();
+		if (defaultKindRegion != null) {
+			return getStructuredDocumentRegion().getText(defaultKindRegion);
+		}
+
+		return ""; //$NON-NLS-1$
+	}
+
+	public ITextRegion getDefaultKindRegion() {
+		RegionIterator iter = iterator();
+		while (iter.hasNext()) {
+			ITextRegion region = iter.next();
+			if (region.getType() == DTDRegionTypes.IMPLIED_KEYWORD || region.getType() == DTDRegionTypes.REQUIRED_KEYWORD || region.getType() == DTDRegionTypes.FIXED_KEYWORD) {
+				return region;
+			}
+		}
+		return null;
+	}
+
+	public String getDefaultValue() {
+		ITextRegion defaultValue = getNextQuotedLiteral(iterator());
+		if (defaultValue != null) {
+			return getValueFromQuotedRegion(defaultValue);
+		}
+		return ""; //$NON-NLS-1$
+	}
+
+	public AttributeEnumList getEnumList() {
+		return enumList;
+	}
+
+	public Image getImage() {
+		return DTDPlugin.getInstance().getImage(DTDResource.ATTRIBUTEICON);
+	}
+
+	public ITextRegion getNameRegion() {
+		return getNextRegion(iterator(), DTDRegionTypes.ATTRIBUTE_NAME);
+	}
+
+	public ITextRegion getNextQuotedLiteral(RegionIterator iter) {
+		while (iter.hasNext()) {
+			ITextRegion region = iter.next();
+			if (region.getType().equals(DTDRegionTypes.SINGLEQUOTED_LITERAL) || region.getType().equals(DTDRegionTypes.DOUBLEQUOTED_LITERAL)) {
+				return region;
+			}
+		}
+		return null;
+	}
+
+	protected int getOffsetAfterType() {
+		ITextRegion typeRegion = getTypeRegion();
+
+		String type = getType();
+		boolean isEnumeration = type.equals(ENUMERATED_NAME) || type.equals(ENUMERATED_NOTATION);
+		if (isEnumeration) {
+			// now check if maybe this is an enumeration
+			if (getEnumList() != null) {
+				return getEnumList().getEndOffset();
+			}
+		}
+		if (typeRegion != null) {
+			return getStructuredDocumentRegion().getEndOffset(typeRegion);
+		} else {
+			ITextRegion nameRegion = getNameRegion();
+			return getStructuredDocumentRegion().getEndOffset(nameRegion);
+			//        // create one
+			//        typeRegion =
+			// findOrCreateTypeRegion((String)typeHash.get(CDATA));
+		}
+	}
+
+	public String getType() {
+		ITextRegion region = getTypeRegion();
+		if (region != null) {
+			String type = (String) typeHash.get(region.getType());
+			if (type == null) {
+				// just return the text of the type region since this may be
+				// an entity representing the type;
+				return getStructuredDocumentRegion().getText(region);
+			}
+			return type;
+		} else if (getEnumList() != null) {
+			// enumerated name tokens don't have a type keyword. just
+			// the existence of the left paren is enough
+			return (String) typeHash.get("()"); //$NON-NLS-1$
+		}
+
+		return ""; //$NON-NLS-1$
+	}
+
+	public ITextRegion getTypeRegion() {
+		RegionIterator iter = iterator();
+
+		while (iter.hasNext()) {
+			ITextRegion region = iter.next();
+			if (region.getType() == DTDRegionTypes.CDATA_KEYWORD || region.getType() == DTDRegionTypes.ID_KEYWORD || region.getType() == DTDRegionTypes.IDREF_KEYWORD || region.getType() == DTDRegionTypes.IDREFS_KEYWORD || region.getType() == DTDRegionTypes.ENTITY_KEYWORD || region.getType() == DTDRegionTypes.ENTITIES_KEYWORD || region.getType() == DTDRegionTypes.NMTOKEN_KEYWORD || region.getType() == DTDRegionTypes.NMTOKENS_KEYWORD || region.getType() == DTDRegionTypes.NOTATION_KEYWORD || region.getType() == DTDRegionTypes.PARM_ENTITY_TYPE) {
+				return region;
+			}
+		}
+		return null;
+	}
+
+	public String getValueFromQuotedRegion(ITextRegion region) {
+		String type = region.getType();
+		if (type.equals(DTDRegionTypes.SINGLEQUOTED_LITERAL) || type.equals(DTDRegionTypes.DOUBLEQUOTED_LITERAL)) {
+			String text = getStructuredDocumentRegion().getText(region);
+			return text.substring(1, text.length() - 1);
+		}
+		return ""; //$NON-NLS-1$
+	}
+
+	public void resolveRegions() {
+		removeChildNodes();
+		RegionIterator iter = iterator();
+
+		while (iter.hasNext()) {
+			ITextRegion currentRegion = iter.next();
+			if (currentRegion.getType().equals(DTDRegionTypes.LEFT_PAREN)) {
+				enumList = new AttributeEnumList(getDTDFile(), getStructuredDocumentRegion());
+			}
+			if (enumList != null) {
+				enumList.addRegion(currentRegion);
+				if (currentRegion.getType() == DTDRegionTypes.RIGHT_PAREN) {
+					return;
+				}
+			}
+		}
+
+	}
+
+	public void setDefaultKind(Object requestor, String kind) {
+
+		ITextRegion defaultKindRegion = getDefaultKindRegion();
+		String oldDefaultKind = defaultKindRegion == null ? "" : getStructuredDocumentRegion().getText(defaultKindRegion); //$NON-NLS-1$
+		if (!kind.equals(oldDefaultKind)) {
+			String newText = kind;
+			int startOffset = 0;
+			int length = 0;
+			if (defaultKindRegion != null) {
+				startOffset = getStructuredDocumentRegion().getStartOffset(defaultKindRegion);
+				length = getStructuredDocumentRegion().getEndOffset(defaultKindRegion) - startOffset;
+			} else {
+				startOffset = getOffsetAfterType();
+				newText = " " + newText; //$NON-NLS-1$
+			}
+
+			ITextRegion defaultValue = getNextQuotedLiteral(iterator());
+
+			if (kind.equals(Attribute.FIXED) || kind.equals("")) { //$NON-NLS-1$
+				if (defaultValue == null) {
+					// we are changing to fixed and wehave no quoted region.
+					// put in an empty value
+					newText += " \"\""; //$NON-NLS-1$
+				}
+			} else {
+				if (defaultValue != null) {
+					length = getStructuredDocumentRegion().getEndOffset(defaultValue) - startOffset;
+				}
+			}
+			replaceText(requestor, startOffset, length, newText);
+			// do something if there is no "kind" region
+		}
+	}
+
+	public void setDefaultKind(String kind) {
+		beginRecording(this, DTDPlugin.getDTDString("_UI_LABEL_ATTR_DEFAULT_KIND")); //$NON-NLS-1$
+		setDefaultKind(this, kind);
+		endRecording(this);
+	}
+
+	public void setDefaultValue(Object requestor, String value, boolean fixed) {
+		ITextRegion defaultValue = getNextQuotedLiteral(iterator());
+		String quoteChar = value.indexOf("\"") == -1 ? "\"" : "'"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+		int startOffset = 0;
+		int endOffset = 0;
+		String newText = ""; //$NON-NLS-1$
+
+		String oldValue = getDefaultValue();
+		boolean oldKindIsFixed = getDefaultKind().equals(Attribute.FIXED);
+		if (oldValue.equals(value) && fixed == oldKindIsFixed) {
+			// nothing to do
+			return;
+		}
+
+		if (defaultValue != null) {
+			startOffset = getStructuredDocumentRegion().getStartOffset(defaultValue);
+			endOffset = getStructuredDocumentRegion().getEndOffset(defaultValue);
+		}
+
+		ITextRegion defaultKindRegion = getDefaultKindRegion();
+		if (defaultKindRegion != null) {
+			startOffset = getStructuredDocumentRegion().getStartOffset(defaultKindRegion);
+			endOffset = endOffset == 0 ? getStructuredDocumentRegion().getEndOffset(defaultKindRegion) : endOffset;
+		} else {
+			if (startOffset == 0) {
+				endOffset = startOffset = getOffsetAfterType();
+				newText += " "; //$NON-NLS-1$
+			}
+			ITextRegion typeRegion = getTypeRegion();
+			if (typeRegion == null && getEnumList() == null) {
+				// tack on a default type
+				//        newText += "CDATA ";
+			}
+		}
+		if (fixed) {
+			newText += "#FIXED "; //$NON-NLS-1$
+		} else {
+			if (getDefaultKind().equals("") && value.equals("")) { //$NON-NLS-1$ //$NON-NLS-2$
+				// if not fixed and value is "" then reset the default kind to
+				// implied
+				newText += "#IMPLIED"; //$NON-NLS-1$
+			}
+		}
+
+		if (!getType().equals("") && !value.equals("")) { //$NON-NLS-1$ //$NON-NLS-2$
+			newText += quoteChar + value + quoteChar;
+		}
+		replaceText(requestor, startOffset, endOffset - startOffset, newText);
+	}
+
+	public void setDefaultValue(String value, boolean fixed) {
+		beginRecording(this, DTDPlugin.getDTDString("_UI_LABEL_ATTR_DEFAULT_VAL")); //$NON-NLS-1$
+		setDefaultValue(this, value, fixed);
+		endRecording(this);
+	}
+
+	public void setType(Object requestor, String type) {
+		String oldType = getType();
+		if (!type.equals(oldType)) {
+			boolean wasEnumeration = oldType.equals(ENUMERATED_NAME) || oldType.equals(ENUMERATED_NOTATION);
+			boolean isEnumeration = type.equals(ENUMERATED_NAME) || type.equals(ENUMERATED_NOTATION);
+			String newText = ""; //$NON-NLS-1$
+			int startOffset = 0;
+			int endOffset = 0;
+
+			if (wasEnumeration && !isEnumeration) {
+				// get rid of the old enumlist
+				AttributeEnumList enumList = getEnumList();
+				if (enumList != null) {
+					startOffset = enumList.getStartOffset();
+					endOffset = enumList.getEndOffset();
+				}
+			}
+
+			ITextRegion region = getTypeRegion();
+			if (region != null) {
+				startOffset = getStructuredDocumentRegion().getStartOffset(region);
+				if (endOffset == 0) {
+					endOffset = getStructuredDocumentRegion().getEndOffset(region);
+				}
+			} else if (startOffset == 0) {
+				ITextRegion nameRegion = getNameRegion();
+				newText += " "; //$NON-NLS-1$
+				endOffset = startOffset = getStructuredDocumentRegion().getEndOffset(nameRegion);
+			}
+
+			String newTypeWord = (String) typeHash.get(type);
+			if (newTypeWord == null) {
+				// then this must be a parm entity being used in the type
+				// use the type text directly
+				newTypeWord = type;
+			}
+
+			newText += newTypeWord;
+
+			if (isEnumeration && !wasEnumeration) {
+				// put in a new numlist
+				boolean isSpaceNeeded = !type.equals(ENUMERATED_NAME);
+				newText += isSpaceNeeded ? " " : ""; //$NON-NLS-1$ //$NON-NLS-2$
+				newText += "()"; //$NON-NLS-1$
+			}
+			replaceText(requestor, startOffset, endOffset - startOffset, newText);
+			if (newTypeWord.equals("") && !type.equals(ENUMERATED_NAME)) { //$NON-NLS-1$
+				// the set the defaultkind to ""
+				//        setDefaultKind(requestor, "");
+				setDefaultValue(requestor, "", false); //$NON-NLS-1$
+			}
+
+		}
+	}
+
+	public void setType(String type) {
+		beginRecording(this, DTDPlugin.getDTDString("_UI_LABEL_ATTR_TYPE")); //$NON-NLS-1$
+		setType(this, type);
+		endRecording(this);
+	}
+}
diff --git a/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/AttributeEnumList.java b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/AttributeEnumList.java
new file mode 100644
index 0000000..635c001
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/AttributeEnumList.java
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+package org.eclipse.wst.dtd.core;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.wst.dtd.core.internal.text.RegionIterator;
+import org.eclipse.wst.dtd.core.parser.DTDRegionTypes;
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegion;
+import org.eclipse.wst.sse.core.text.ITextRegion;
+
+
+public class AttributeEnumList extends DTDNode {
+
+	private ArrayList list = new ArrayList();
+
+	public AttributeEnumList(DTDFile file, IStructuredDocumentRegion flatNode) {
+		super(file, flatNode);
+	}
+
+	public Image getImage() {
+		// never exposed in tree
+		return null;
+	}
+
+	// return the items that are in this enumerated list
+	public List getItems() {
+		list.clear();
+		RegionIterator iter = iterator();
+		while (iter.hasNext()) {
+			ITextRegion name = getNextRegion(iter, DTDRegionTypes.NAME);
+			if (name != null) {
+				list.add(getStructuredDocumentRegion().getText(name));
+			}
+		}
+		return list;
+	}
+
+	public void setItems(Object requestor, String[] items) {
+		if (items != null) {
+			String text = "("; //$NON-NLS-1$
+			for (int i = 0; i < items.length; i++) {
+				if (i > 0) {
+					text += " | " + items[i]; //$NON-NLS-1$
+				} else {
+					text += items[i];
+				}
+			}
+			text += ")"; //$NON-NLS-1$
+			replaceText(requestor, getStartOffset(), getNodeLength(), text);
+		}
+	}
+
+	public void setItems(String[] items) {
+		beginRecording(this, DTDPlugin.getDTDString("_UI_LABEL_ATTR_ENUM_ITEMS")); //$NON-NLS-1$
+		setItems(this, items);
+		endRecording(this);
+	}
+}
diff --git a/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/AttributeList.java b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/AttributeList.java
new file mode 100644
index 0000000..b52422c
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/AttributeList.java
@@ -0,0 +1,115 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+package org.eclipse.wst.dtd.core;
+
+import java.util.ArrayList;
+
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.wst.dtd.core.internal.text.RegionIterator;
+import org.eclipse.wst.dtd.core.parser.DTDRegionTypes;
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegion;
+import org.eclipse.wst.sse.core.text.ITextRegion;
+
+
+public class AttributeList extends NamedTopLevelNode {
+	public AttributeList(DTDFile file, IStructuredDocumentRegion flatNode) {
+		super(file, flatNode, DTDRegionTypes.ATTLIST_TAG);
+	}
+
+	public void addAttribute(String name) {
+		beginRecording(this, DTDPlugin.getDTDString("_UI_LABEL_ATTR_LIST_ADD")); //$NON-NLS-1$
+
+		DTDNode lastAttribute = (DTDNode) getLastChild();
+		if (lastAttribute != null) {
+			replaceText(this, lastAttribute.getEndOffset(), 0, "\n\t" + name + " CDATA #IMPLIED"); //$NON-NLS-1$ //$NON-NLS-2$
+		} else {
+			ITextRegion nameRegion = getNameRegion();
+			if (nameRegion != null) {
+				replaceText(this, getStructuredDocumentRegion().getEndOffset(nameRegion), 0, "\n\t" + name + " CDATA #IMPLIED"); //$NON-NLS-1$ //$NON-NLS-2$
+			}
+
+		}
+
+		endRecording(this);
+	}
+
+	public Image getImage() {
+		return DTDPlugin.getInstance().getImage(DTDResource.ATTRIBUTELISTICON);
+	}
+
+	public void insertIntoModel(Object requestor, Attribute reference, Attribute node, boolean isAfter) {
+		int offset = 0;
+		String newText = ""; //$NON-NLS-1$
+		String nodeText = node.getFullNodeText();
+		boolean isLastChild = false;
+		if (!isAfter) {
+			offset = reference.getStartOffset();
+		} else {
+			// try and get next child
+			Attribute attr = (Attribute) reference.getNextSibling();
+			if (attr != null) {
+				offset = attr.getStartOffset();
+			} else {
+				// just use the end offset
+				offset = reference.getWhitespaceEndOffset();
+			}
+		}
+		newText += nodeText;// + (isLastChild ? "\n" : "\n\t");
+		if (!node.hasTrailingWhitespace()) {
+			newText += "\n\t"; //$NON-NLS-1$
+		}
+		replaceText(requestor, offset, 0, newText);
+	}
+
+	public void resolveRegions() {
+		removeChildNodes();
+		RegionIterator iter = iterator();
+
+		if (getNameRegion() != null) {
+			// we skip past the name token is our name
+			skipPastName(iter);
+		}
+
+		ArrayList children = new ArrayList();
+		Attribute attribute = null;
+		boolean trailingWhitespace = false;
+		while (iter.hasNext()) {
+			ITextRegion currentRegion = iter.next();
+			if (currentRegion.getType().equals(DTDRegionTypes.ATTRIBUTE_NAME)) {
+				attribute = new Attribute(getDTDFile(), getStructuredDocumentRegion());
+				children.add(attribute);
+				appendChild(attribute);
+				trailingWhitespace = false;
+			}
+			if (attribute != null && currentRegion.getType() != DTDRegionTypes.END_TAG) {
+				if (!trailingWhitespace) {
+					attribute.addRegion(currentRegion);
+				} else {
+					if (currentRegion.getType() == DTDRegionTypes.WHITESPACE) {
+						attribute.addWhitespaceRegion(currentRegion);
+					}
+				}
+
+				// the following prevents extra whitespace from being picked
+				// up by the attribute
+				if (currentRegion.getType() == DTDRegionTypes.REQUIRED_KEYWORD || currentRegion.getType() == DTDRegionTypes.IMPLIED_KEYWORD || currentRegion.getType() == DTDRegionTypes.SINGLEQUOTED_LITERAL || currentRegion.getType() == DTDRegionTypes.DOUBLEQUOTED_LITERAL) {
+					trailingWhitespace = true;
+				}
+			}
+		}
+		int numKids = children.size();
+		for (int i = 0; i < numKids; i++) {
+			((Attribute) children.get(i)).resolveRegions();
+		} // end of for ()
+	}
+}
diff --git a/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/CMBasicNode.java b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/CMBasicNode.java
new file mode 100644
index 0000000..618cb92
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/CMBasicNode.java
@@ -0,0 +1,162 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+package org.eclipse.wst.dtd.core;
+
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.wst.dtd.core.internal.text.RegionIterator;
+import org.eclipse.wst.dtd.core.parser.DTDRegionTypes;
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegion;
+import org.eclipse.wst.sse.core.text.ITextRegion;
+
+
+/*
+ * CMBasicNode combines all the different content types into one. The idea
+ * behind this is to allow arbitrary name changes to not require a tree
+ * update.
+ */
+public class CMBasicNode extends CMRepeatableNode {
+
+	//    static final int EMPTY = 0;
+	//    static final int ANY = 1;
+	//    static final int PCDATA = 2;
+
+	public CMBasicNode(DTDFile file, IStructuredDocumentRegion flatNode) {
+		super(file, flatNode);
+	}
+
+	public Image getImage() {
+		final String name = getName();
+		ITextRegion pcdata = getNextRegion(iterator(), DTDRegionTypes.CONTENT_PCDATA);
+		if (pcdata != null) {
+			return DTDPlugin.getInstance().getImage(DTDResource.PCDATAICON);
+		}
+
+		if (isRootElementContent()) {
+			if (name.equals(EMPTY)) {
+				return DTDPlugin.getInstance().getImage(DTDResource.EMPTYICON);
+			} else if (name.equals(ANY)) {
+				return DTDPlugin.getInstance().getImage(DTDResource.ANYICON);
+			}
+		}
+
+		// Otherwise this is just an element reference node. Just return
+		// what CMRepeatableNode would give us
+		return super.getImage();
+	}
+
+	public ITextRegion getNameRegion() {
+		RegionIterator iter = iterator();
+		while (iter.hasNext()) {
+			ITextRegion region = iter.next();
+			if (region.getType() == DTDRegionTypes.NAME || region.getType() == DTDRegionTypes.CONTENT_PCDATA) {
+				return region;
+			}
+		}
+		return null;
+	}
+
+	// returns the occurrencetoken, or the token where the occurrence token
+	// should appear after
+	public ITextRegion getOccurrenceRegion() {
+		RegionIterator iter = iterator();
+		skipPastName(iter);
+		if (iter.hasNext()) {
+			ITextRegion region = iter.next();
+			if (region.getType() == DTDRegionTypes.OCCUR_TYPE) {
+				return region;
+			}
+		}
+		return getNameRegion();
+	}
+
+	public String getType() {
+		ITextRegion pcdata = getNextRegion(iterator(), DTDRegionTypes.CONTENT_PCDATA);
+		if (pcdata != null) {
+			return PCDATA;
+		}
+
+		if (isRootElementContent()) {
+			final String name = getName();
+			if (isRootElementContent()) {
+				if (name.equals(EMPTY)) {
+					return EMPTY;
+				} else if (name.equals(ANY)) {
+					return ANY;
+				} else {
+					// otherwise just return it's name as the type
+					return name;
+				}
+
+			}
+		}
+		return ""; //$NON-NLS-1$
+	}
+
+	public boolean isEmptyAnyOrPCData() {
+		if (isPCData()) {
+			return true;
+		}
+
+
+		final String name = getName();
+		if (isRootElementContent()) {
+			if (name.equals(EMPTY) || name.equals(ANY)) {
+				return true;
+			}
+		}
+		return false;
+	}
+
+	public boolean isPCData() {
+		ITextRegion pcdata = getNextRegion(iterator(), DTDRegionTypes.CONTENT_PCDATA);
+		if (pcdata != null) {
+			return true;
+		}
+		return false;
+	}
+
+	//    public Node insertRegion(Region token)
+	//    {
+	//      if (!tokenStream.containsToken(token) && token.getType() ==
+	// Token.OCCUR_TYPE)
+	//      {
+	//        // then add it so that our range contains it
+	//        insertIntoTokenStream(token);
+	//      }
+	//      return this;
+	//    }
+
+	public boolean isReference() {
+		return !isEmptyAnyOrPCData();
+	}
+
+	public void setName(Object requestor, String name) {
+		//    beginRecording(requestor, "Name Change");
+
+		super.setName(requestor, name);
+		if (!isReference()) {
+			// if it is no longer a reference node, remove the occurrence
+			// token
+			setOccurrence(requestor, CMRepeatableNode.ONCE);
+		}
+
+		//    endRecording(requestor);
+	}
+
+	/*
+	 * public static String getName(int type) { switch (type) { case EMPTY:
+	 * return emptyString; case ANY: return anyString; case PCDATA: return
+	 * pcdataString; default: break; } // end of switch () return ""; }
+	 */
+
+}// CMBasicNode
diff --git a/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/CMGroupNode.java b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/CMGroupNode.java
new file mode 100644
index 0000000..e242136
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/CMGroupNode.java
@@ -0,0 +1,424 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+package org.eclipse.wst.dtd.core;
+
+import java.util.List;
+
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.wst.dtd.core.internal.text.RegionIterator;
+import org.eclipse.wst.dtd.core.parser.DTDRegionTypes;
+import org.eclipse.wst.dtd.core.util.DTDUniqueNameHelper;
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegion;
+import org.eclipse.wst.sse.core.text.ITextRegion;
+
+
+public class CMGroupNode extends CMRepeatableNode {
+
+	public static final char CHOICE = '|';
+	public static final char SEQUENCE = ',';
+
+	protected char connector = SEQUENCE;
+
+	//  protected ArrayList children = new ArrayList();
+
+	public CMGroupNode(DTDFile file, IStructuredDocumentRegion flatNode) {
+		super(file, flatNode);
+	}
+
+	public void addChild() {
+		beginRecording(this, DTDPlugin.getDTDString("_UI_LABEL_CM_GRP_NODE_ADD_CHILD")); //$NON-NLS-1$
+		DTDNode lastNode = (DTDNode) getLastChild();
+		String elementName = DTDUniqueNameHelper.getUniqueName(getChildrenList(), "ChildNode"); //$NON-NLS-1$
+		if (lastNode != null) {
+			replaceText(this, lastNode.getEndOffset(), 0, String.valueOf(getConnector()) + elementName); //$NON-NLS-1$
+		} else {
+			replaceText(this, getStartOffset() + 1, 0, elementName); //$NON-NLS-1$
+		}
+
+		endRecording(this);
+	}
+
+	public void addGroup() {
+		beginRecording(this, DTDPlugin.getDTDString("_UI_LABEL_CM_GRP_NODE_ADD_GRP")); //$NON-NLS-1$
+		DTDNode lastNode = (DTDNode) getLastChild();
+		if (lastNode != null) {
+			replaceText(this, lastNode.getEndOffset(), 0, String.valueOf(getConnector()) + " ()"); //$NON-NLS-1$
+		} else {
+			replaceText(this, getStartOffset() + 1, 0, "()"); //$NON-NLS-1$
+		}
+
+		endRecording(this);
+	}
+
+	public void delete(Object requestor, DTDNode child) {
+		Object[] children = getChildren();
+
+		if (children.length == 1 && getFirstChild() == child) {
+			replaceText(requestor, child.getStartOffset(), child.getNodeLength(), null);
+			return;
+		}
+
+		for (int i = 0; i < children.length - 1; i++) {
+			DTDNode childA = (DTDNode) children[i];
+			DTDNode childB = (DTDNode) children[i + 1];
+
+			boolean childADeleted = childA == child;
+			boolean childBDeleted = childB == child;
+			if (childADeleted || childBDeleted) {
+				// we found the child
+				int startOffset = childADeleted ? childA.getStartOffset() : childA.getEndOffset();
+				int endOffset = childADeleted ? childB.getStartOffset() : childB.getEndOffset();
+				replaceText(requestor, startOffset, endOffset - startOffset, ""); //$NON-NLS-1$
+				removeChild(child);
+				break;
+			}
+		}
+	}
+
+	/**
+	 * Get the value of connector.
+	 * 
+	 * @return value of connector.
+	 */
+	public char getConnector() {
+		Object[] children = getChildren();
+		for (int i = 0; i < children.length - 1; i++) {
+			DTDNode childA = (DTDNode) children[i];
+			DTDNode childB = (DTDNode) children[i + 1];
+
+			// create a stream between the two siblings and walk it
+			// note that this stream includes the last region of the first
+			// sibling and the first region of the next sibling.
+			// both these should be ignored
+			RegionIterator iter = new RegionIterator(getStructuredDocumentRegion(), childA.getEndOffset(), childB.getStartOffset());
+			//      stream.setFirstRegion(childA.getLastRegion());
+			//      stream.setLastRegion(childB.getFirstRegion());
+			//      Iterator iter = stream.iterator();
+			// skip the first region which is the last region of childA
+			//do we need this now ?
+			//      iter.next();
+			ITextRegion currentRegion = null;
+			while (iter.hasNext() && currentRegion != childB.getStartRegion()) {
+				currentRegion = iter.next();
+				if (currentRegion.getType() == DTDRegionTypes.CONNECTOR) {
+					connector = getStructuredDocumentRegion().getText(currentRegion).charAt(0);
+					return connector;
+				}
+			}
+		}
+		return connector;
+	}
+
+	public Image getImage() {
+		DTDPlugin resourcePlugin = DTDPlugin.getInstance();
+		switch (getConnector()) {
+			case SEQUENCE :
+				return resourcePlugin.getImage(DTDResource.ONESEQUENCEICON);
+			/*
+			 * switch (getOccurrence()) { case ONCE : return
+			 * resourcePlugin.getImage(DTDResource.ONESEQUENCEICON); case
+			 * OPTIONAL : return
+			 * resourcePlugin.getImage(DTDResource.OPTIONALSEQUENCEICON); case
+			 * ONE_OR_MORE : return
+			 * resourcePlugin.getImage(DTDResource.ONEORMORESEQUENCEICON);
+			 * case ZERO_OR_MORE : return
+			 * resourcePlugin.getImage(DTDResource.ZEROORMORESEQUENCEICON); }
+			 */
+			case CHOICE :
+				return resourcePlugin.getImage(DTDResource.ONECHOICEICON);
+		/*
+		 * switch (getOccurrence()) { case ONCE : return
+		 * resourcePlugin.getImage(DTDResource.ONECHOICEICON); case OPTIONAL :
+		 * return resourcePlugin.getImage(DTDResource.OPTIONALCHOICEICON);
+		 * case ONE_OR_MORE : return
+		 * resourcePlugin.getImage(DTDResource.ONEORMORECHOICEICON); case
+		 * ZERO_OR_MORE : return
+		 * resourcePlugin.getImage(DTDResource.ZEROORMORECHOICEICON); }
+		 */
+		}
+		return null;
+	}
+
+	public String getName() {
+		return ""; //$NON-NLS-1$
+	}
+
+	// returns the occurrenceregion, or the last region where the occurrence
+	// region should appear after
+	public ITextRegion getOccurrenceRegion() {
+		int nesting = 0;
+
+		// we skip past the first left paren we see since that is the
+		// beginning of our own node
+		RegionIterator iter = iterator();
+		// we assume the first region is the '('
+		iter.next();
+		ITextRegion currentRegion = null;
+		while (iter.hasNext() && nesting >= 0) {
+			currentRegion = iter.next();
+			if (currentRegion.getType() == DTDRegionTypes.LEFT_PAREN) {
+				nesting++;
+			}
+			if (currentRegion.getType() == DTDRegionTypes.RIGHT_PAREN) {
+				nesting--;
+			}
+		}
+		if (nesting < 0) {
+			// This means we have passed over the right paren that marks the
+			// end of our grouping.
+			// Look for an occurrence region
+			while (iter.hasNext()) {
+				currentRegion = iter.next();
+				if (currentRegion.getType() == DTDRegionTypes.OCCUR_TYPE) {
+					return currentRegion;
+				}
+			}
+		}
+		// if we're here, this means that there is no occur region. return the
+		// last region
+		return iter.previous();
+	}
+
+	public String getType() {
+		if (isRootElementContent()) {
+			if (getFirstChild() != null) {
+				CMNode node = (CMNode) getFirstChild();
+				if (node.getType().equals(PCDATA)) {
+					return MIXED;
+				} else {
+					return CHILDREN;
+				}
+			}
+		}
+		return ""; //$NON-NLS-1$
+	}
+
+	public void insertChildNode(Object requestor, String nodeText, int position) {
+		Object[] children = getChildren();
+
+		int startOffset = 0;
+		boolean isLastChild = position == children.length;
+		String newText = ""; //$NON-NLS-1$
+		if (position < children.length) {
+			DTDNode reference = (DTDNode) children[position];
+			startOffset = reference.getStartOffset();
+			newText = nodeText + " " + String.valueOf(getConnector()) + " "; //$NON-NLS-1$ //$NON-NLS-2$
+		} else if (position == children.length) {
+			// add to end
+			DTDNode reference = (DTDNode) children[position - 1];
+			startOffset = reference.getEndOffset();
+			newText = " " + String.valueOf(getConnector()) + " " + nodeText; //$NON-NLS-1$ //$NON-NLS-2$
+		}
+		replaceText(requestor, startOffset, 0, newText);
+	}
+
+	public void insertChildNode(String nodeText, int position) {
+		beginRecording(this, DTDPlugin.getDTDString("_UI_LABEL_CM_GRP_NODE_INSERT_ELEMENT")); //$NON-NLS-1$
+		insertChildNode(this, nodeText, position);
+		endRecording(this);
+	}
+
+	public void insertIntoModel(Object requestor, CMNode reference, CMNode node, boolean isAfter) {
+		String nodeText = node.getNodeText();
+		List children = getChildrenList();
+
+		int index = children.indexOf(reference);
+		if (index == -1) {
+			// no reference node, add it to the end??
+			index = children.size();
+		} else {
+			// got an index. if we want to add after, increase by 1
+			index = isAfter ? index + 1 : index;
+		}
+		insertChildNode(requestor, nodeText, index);
+	}
+
+	public void resolveRegions() {
+		int nesting = 0;
+		//    children.clear();
+		removeChildNodes();
+		// we skip past the first left paren we see since that is the
+		// beginning of our own node
+		boolean isConnectorSet = false;
+		DTDNode currentGroupNode = null;
+		CMBasicNode currentReferenceNode = null;
+		RegionIterator iter = iterator();
+		// we assume the first region is the '('
+		iter.next();
+		while (iter.hasNext() && nesting >= 0) {
+			ITextRegion currentRegion = iter.next();
+			if (nesting == 0) {
+				if (currentRegion.getType().equals(DTDRegionTypes.CONTENT_PCDATA)) {
+					currentGroupNode = currentReferenceNode = null;
+					DTDNode pcData = new CMBasicNode(getDTDFile(), getStructuredDocumentRegion());
+					pcData.addRegion(currentRegion);
+					appendChild(pcData);
+					//          children.add(pcData);
+				} else if (currentRegion.getType().equals(DTDRegionTypes.NAME)) {
+					// we have hit a new reference node. Make sure we reset
+					// the groupnode var so it doesn't collect more regions
+					currentGroupNode = null;
+					currentReferenceNode = new CMBasicNode(getDTDFile(), getStructuredDocumentRegion());
+					currentReferenceNode.addRegion(currentRegion);
+					appendChild(currentReferenceNode);
+					//          children.add(currentReferenceNode);
+				} else if (currentRegion.getType().equals(DTDRegionTypes.OCCUR_TYPE)) {
+					// we could potentially flag an error here if we hit an
+					// occurrence type and currentRefNode and currentGroupNode
+					// are null
+					if (currentReferenceNode != null) {
+						//           currentReferenceNode.setOccurrence(currentRegion.getText().toCharArray()[0]);
+						currentReferenceNode.addRegion(currentRegion);
+						currentReferenceNode = null;
+					}
+				} else if (currentRegion.getType().equals(DTDRegionTypes.CONNECTOR)) {
+					// note that if connector is already set and it is
+					// different from the current connector region, then we
+					// have an error!
+					//         setConnector(currentRegion.getText().toCharArray()[0]);
+				} else if (currentRegion.getType().equals(DTDRegionTypes.LEFT_PAREN)) {
+					if (currentGroupNode == null) {
+						// we have hit a new group. Make sure we reset the
+						// referencenode var so it doesn't collect any more
+						// regions
+						currentReferenceNode = null;
+						currentGroupNode = new CMGroupNode(getDTDFile(), getStructuredDocumentRegion());
+						appendChild(currentGroupNode);
+						//            children.add(currentGroupNode);
+					}
+				}
+			}
+
+			if (currentRegion.getType().equals(DTDRegionTypes.LEFT_PAREN)) {
+				nesting++;
+			}
+			if (currentRegion.getType().equals(DTDRegionTypes.RIGHT_PAREN)) {
+				nesting--;
+				if (nesting == 0 && currentGroupNode != null) {
+					currentGroupNode.addRegion(currentRegion);
+					// peek at next region to see if it is an occur region. if
+					// so, add it to the groupnode
+					if (iter.hasNext()) {
+						ITextRegion nextRegion = iter.next();
+						if (nextRegion.getType().equals(DTDRegionTypes.OCCUR_TYPE)) {
+							currentGroupNode.addRegion(nextRegion);
+						} else {
+							// Otherwise, push it back as the next item to be
+							// retrieved by a future next() call
+							iter.previous();
+						}
+					}
+					currentGroupNode = null;
+				}
+			}
+			if (currentGroupNode != null) {
+				currentGroupNode.addRegion(currentRegion);
+			}
+		}
+
+		if (nesting < 0) {
+			// This means we have passed over the right paren that marks the
+			// end of our grouping.
+			// Look for an occurrence region
+			while (iter.hasNext()) {
+				ITextRegion currentRegion = iter.next();
+				if (currentRegion.getType().equals(DTDRegionTypes.OCCUR_TYPE)) {
+					//          setOccurrence(currentRegion.getText().toCharArray()[0]);
+				}
+			} // end of while ()
+		}
+
+		//      for (org.w3c.dom.Node child = getFirstChild(); child != null; child
+		// = child.getNextSibling())
+		//      {
+		//        System.out.println("child found = " + child);
+		//      }
+
+		Object[] children = getChildren();
+		//    System.out.println("children legnth = " + children.length);
+
+		for (int i = 0; i < children.length; i++) {
+			DTDNode currentNode = (DTDNode) children[i];
+			currentNode.resolveRegions();
+		} // end of while ()
+
+	}
+
+	/**
+	 * Set the value of connector.
+	 * 
+	 * @param v
+	 *            Value to assign to connector.
+	 */
+	public void setConnector(char v) {
+		if (connector != v) {
+			connector = v;
+			// walk through our kids and see if there is a connector between
+			// each sibling. if not, create one and set the connector. if
+			// there is
+			// then just change the text of the connector
+			Object[] children = getChildren();
+			if (children.length <= 1) {
+				// there won't be any connector existing between the children
+				// just notify a change in the node and return;
+				getDTDFile().notifyNodeChanged(this);
+				return;
+			}
+			beginRecording(this, DTDPlugin.getDTDString("_UI_LABEL_CM_GRP_NODE_CONNECTOR")); //$NON-NLS-1$
+			for (int i = 0; i < children.length - 1; i++) {
+				DTDNode childA = (DTDNode) children[i];
+				DTDNode childB = (DTDNode) children[i + 1];
+
+				// create a stream between the two siblings and walk it
+				// note that this stream includes the last region of the first
+				// sibling and the first region of the next sibling.
+				// both these should be ignored
+				RegionIterator iter = new RegionIterator(getStructuredDocumentRegion(), childA.getEndOffset(), childB.getStartOffset());
+				// skip the first region which is the last region of childA
+
+				// do we still need this
+				//        iter.next();
+				ITextRegion currentRegion = null;
+				boolean foundConnector = false;
+				while (iter.hasNext() && currentRegion != childB.getStartRegion()) {
+					currentRegion = iter.next();
+					if (currentRegion.getType() == DTDRegionTypes.CONNECTOR) {
+						foundConnector = true;
+						//            Region oldRegion = currentRegion.createCopy();
+						// found a connector! on to the next sibling pair
+						//            currentRegion.updateText(String.valueOf(v));
+						replaceText(this, getStructuredDocumentRegion().getStartOffset(currentRegion), 1, String.valueOf(connector));
+						//changeStructuredDocument(oldRegion, currentRegion);
+						break;
+					}
+				}
+
+				if (!foundConnector) {
+					//if we're here, that means we need to insert a new
+					// connector region after childA
+					replaceText(this, childA.getEndOffset(), 0, String.valueOf(connector));
+					//          DTDRegion connectorRegion = new
+					// DTDRegion(DTDRegionTypes.CONNECTOR,
+					// childA.getEndOffset(), 1);
+					//          insertIntoStructuredDocument(connectorRegion);
+				}
+			}
+			endRecording(this);
+		}
+	}
+
+	//    public Object[] getChildren()
+	//    {
+	//      return children.toArray();
+	//    }
+}// CMGroupNode
diff --git a/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/CMNode.java b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/CMNode.java
new file mode 100644
index 0000000..168cefd
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/CMNode.java
@@ -0,0 +1,133 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+package org.eclipse.wst.dtd.core;
+
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegion;
+
+// base class for an Element's contentmodel
+public abstract class CMNode extends DTDNode {
+	public static final String ANY = DTDPlugin.getDTDString("_UI_LABEL_CM_NODE_ANY"); //$NON-NLS-1$
+	public static final String CHILDREN = DTDPlugin.getDTDString("_UI_LABEL_CM_NODE_CHILD_CONTENT"); //$NON-NLS-1$
+
+	public static final String EMPTY = DTDPlugin.getDTDString("_UI_LABEL_CM_NODE_EMPTY"); //$NON-NLS-1$
+	public static final String MIXED = DTDPlugin.getDTDString("_UI_LABEL_CM_NODE_MIX_CONTENT"); //$NON-NLS-1$
+	public static final String PCDATA = DTDPlugin.getDTDString("_UI_LABEL_CM_NODE_PCDATA"); //$NON-NLS-1$
+
+
+	boolean rootElementContent;
+
+	public CMNode(DTDFile file, IStructuredDocumentRegion flatNode) {
+		super(file, flatNode);
+	}
+
+	// this is only valid to ask if the content is a root element content
+	abstract public String getType();
+
+	/**
+	 * Get the value of rootElementContent. This tells us whether this element
+	 * content's parent is a direct decendent of the containing element
+	 * 
+	 * @return value of rootElementContent.
+	 */
+	public boolean isRootElementContent() {
+		return rootElementContent;
+	}
+
+	// if this is a root element, change the content to children
+	// ie . (child1)
+	public void setChildrenContent(String newChild) {
+		if (isRootElementContent()) {
+			if (!newChild.equals("")) { //$NON-NLS-1$
+				beginRecording(this, DTDPlugin.getDTDString("_UI_LABEL_CM_NODE_SET_CHILD_CONTENT")); //$NON-NLS-1$
+				replaceText(this, getStartOffset(), getNodeLength(), "(" + newChild + ")"); //$NON-NLS-1$ //$NON-NLS-2$
+				endRecording(this);
+				return;
+			}
+
+			if (!getType().equals(CHILDREN)) {
+				beginRecording(this, DTDPlugin.getDTDString("_UI_LABEL_CM_NODE_SET_CHILD_CONTENT")); //$NON-NLS-1$
+				if (this instanceof CMBasicNode) {
+					replaceText(this, getStartOffset(), getNodeLength(), "(newChild)"); //$NON-NLS-1$
+				} else {
+					// now must convert from mixed content to this one. must
+					// preserve the remaining children
+					CMGroupNode group = (CMGroupNode) this;
+					CMNode firstChild = (CMNode) group.getFirstChild();
+					if (firstChild.getType().equals(PCDATA)) {
+						group.delete(firstChild);
+					}
+				}
+
+				endRecording(this);
+			}
+		}
+	}
+
+	public void setContent(String content) {
+		if (isRootElementContent()) {
+			beginRecording(this, DTDPlugin.getDTDString("_UI_LABEL_CM_NODE_SET") + " " + content + " " + DTDPlugin.getDTDString("_UI_LABEL_CM_NODE_CONTENT")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+			replaceText(this, getStartOffset(), getNodeLength(), content);
+			endRecording(this);
+		}
+	}
+
+	// if this is a root element, change the content to mixed
+	// ie . (#PCDATA, child1)
+	public void setMixedContent() {
+		if (isRootElementContent()) {
+			if (!getType().equals(MIXED)) {
+				beginRecording(this, DTDPlugin.getDTDString("_UI_LABEL_CM_NODE_SET_MIX_CONTENT")); //$NON-NLS-1$
+				if (this instanceof CMBasicNode) {
+					replaceText(this, getStartOffset(), getNodeLength(), "(#PCDATA | newChild)*"); //$NON-NLS-1$
+				} else {
+					// now must convert from children content to this one.
+					// must
+					// preserve the children
+					CMGroupNode group = (CMGroupNode) this;
+					group.setConnector(CMGroupNode.CHOICE);
+					group.setOccurrence(CMRepeatableNode.ZERO_OR_MORE);
+					CMNode firstChild = (CMNode) group.getFirstChild();
+					if (!firstChild.getType().equals(PCDATA)) {
+						group.insertChildNode("#PCDATA", 0); //$NON-NLS-1$
+					}
+				}
+				endRecording(this);
+			}
+		}
+	}
+
+	/**
+	 * Set the value of rootElementContent.
+	 * 
+	 * @param v
+	 *            Value to assign to rootElementContent.
+	 */
+	public void setRootElementContent(boolean v) {
+		this.rootElementContent = v;
+	}
+
+	//    public void delete()
+	//    {
+	//      if (isRootElementContent())
+	//      {
+	//        // then the superclasses delete will be fine
+	//        super.delete();
+	//        return;
+	//      }
+
+	//      CMGroupNode parent = (CMGroupNode) getParentNode();
+	//      parent.removeChildNode(this);
+	//    }
+
+
+}
diff --git a/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/CMRepeatableNode.java b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/CMRepeatableNode.java
new file mode 100644
index 0000000..be37d13
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/CMRepeatableNode.java
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+package org.eclipse.wst.dtd.core;
+
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.wst.dtd.core.parser.DTDRegionTypes;
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegion;
+import org.eclipse.wst.sse.core.text.ITextRegion;
+
+
+public abstract class CMRepeatableNode extends CMNode {
+
+	public static final char ONCE = '1';
+	public static final char ONE_OR_MORE = '+';
+	public static final char OPTIONAL = '?';
+	public static final char ZERO_OR_MORE = '*';
+
+
+	public CMRepeatableNode(DTDFile file, IStructuredDocumentRegion flatNode) {
+		super(file, flatNode);
+	}
+
+	public Image getImage() {
+		DTDPlugin resourcePlugin = DTDPlugin.getInstance();
+		return resourcePlugin.getImage(DTDResource.ELEMENTREFICON);
+	}
+
+	public char getOccurrence() {
+		ITextRegion occurRegion = getOccurrenceRegion();
+		if (occurRegion != null && occurRegion.getType() == DTDRegionTypes.OCCUR_TYPE) {
+			return getStructuredDocumentRegion().getText(occurRegion).charAt(0);
+		}
+		return CMRepeatableNode.ONCE;
+	}
+
+	// returns the occurrenceregion, or the last region where the occurrence
+	// region should appear after
+	abstract public ITextRegion getOccurrenceRegion();
+
+	public void setOccurrence(char occurrence) {
+		beginRecording(this, DTDPlugin.getDTDString("_UI_LABEL_CM_REP_NODE_CHG_OCCUR")); //$NON-NLS-1$
+		setOccurrence(this, occurrence);
+		endRecording(this);
+	}
+
+	public void setOccurrence(Object requestor, char occurrence) {
+		if (getOccurrence() != occurrence) {
+			ITextRegion region = getOccurrenceRegion();
+			if (region != null) {
+				if (region.getType().equals(DTDRegionTypes.OCCUR_TYPE)) {
+					if (occurrence == CMRepeatableNode.ONCE) {
+						// we need to remove the occur region from the flat
+						// model;
+						getDTDFile().getStructuredDocument().replaceText(requestor, getStructuredDocumentRegion().getStartOffset(region), 1, ""); //$NON-NLS-1$
+					} else {
+						//            Region oldOccur = region.createCopy();
+						getDTDFile().getStructuredDocument().replaceText(requestor, getStructuredDocumentRegion().getStartOffset(region), 1, String.valueOf(occurrence));
+						//            changeStructuredDocument(oldOccur, region);
+					}
+				} else if (occurrence != CMRepeatableNode.ONCE) {
+					//          System.out.println(getString());
+					// we need to create an occurrenceRegion
+					replaceText(requestor, getStructuredDocumentRegion().getEndOffset(region), 0, String.valueOf(occurrence));
+				}
+			}
+		}
+	}
+
+}// CMRepeatableNode
diff --git a/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/Comment.java b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/Comment.java
new file mode 100644
index 0000000..fa58df0
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/Comment.java
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+package org.eclipse.wst.dtd.core;
+
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.wst.dtd.core.internal.text.RegionIterator;
+import org.eclipse.wst.dtd.core.parser.DTDRegionTypes;
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegion;
+import org.eclipse.wst.sse.core.text.ITextRegion;
+
+
+public class Comment extends NamedTopLevelNode {
+
+	public class StartEndPair {
+		public int startOffset, endOffset;
+	}
+
+	public Comment(DTDFile file, IStructuredDocumentRegion flatNode) {
+		super(file, flatNode, DTDRegionTypes.COMMENT_START);
+	}
+
+	public Image getImage() {
+		return DTDPlugin.getInstance().getImage(DTDResource.COMMENTICON);
+	}
+
+	public String getName() {
+		String text = getText();
+		if (text.length() <= 30) {
+			return text;
+		} else {
+			return text.substring(0, 29) + "..."; //$NON-NLS-1$
+		}
+	}
+
+	private void getStartAndEndOffsetForText(StartEndPair pair) {
+		RegionIterator iter = iterator();
+		ITextRegion commentStartTag = getStartTag(iter);
+		ITextRegion endCommentTag = getNextRegion(iter, DTDRegionTypes.COMMENT_END);
+		pair.endOffset = getStructuredDocumentRegion().getEndOffset();
+		if (commentStartTag != null) {
+			pair.startOffset = getStructuredDocumentRegion().getEndOffset(commentStartTag);
+		}
+		if (endCommentTag != null) {
+			pair.endOffset = getStructuredDocumentRegion().getStartOffset(endCommentTag);
+		}
+	}
+
+	public String getText() {
+		String text = getStructuredDocumentRegion().getText();
+		int flatNodeStart = getStructuredDocumentRegion().getStartOffset();
+		StartEndPair pair = new StartEndPair();
+		getStartAndEndOffsetForText(pair);
+		return text.substring(pair.startOffset - flatNodeStart, pair.endOffset - flatNodeStart);
+	}
+
+	public void setText(String newText) {
+		beginRecording(this, DTDPlugin.getDTDString("_UI_LABEL_COMMENT_CHG")); //$NON-NLS-1$
+		int flatNodeStart = getStructuredDocumentRegion().getStartOffset();
+		StartEndPair pair = new StartEndPair();
+		getStartAndEndOffsetForText(pair);
+		replaceText(this, pair.startOffset, pair.endOffset - pair.startOffset, newText);
+		endRecording(this);
+	}
+
+}
diff --git a/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/DTDFile.java b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/DTDFile.java
new file mode 100644
index 0000000..2e6b0bb
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/DTDFile.java
@@ -0,0 +1,667 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+package org.eclipse.wst.dtd.core;
+
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.wst.dtd.core.document.DTDModelImpl;
+import org.eclipse.wst.dtd.core.event.IDTDFileListener;
+import org.eclipse.wst.dtd.core.event.NodesEvent;
+import org.eclipse.wst.dtd.core.parser.DTDRegionTypes;
+import org.eclipse.wst.dtd.core.util.DTDExternalReferenceRemover;
+import org.eclipse.wst.dtd.core.util.DTDModelUpdater;
+import org.eclipse.wst.dtd.core.util.DTDNotationReferenceRemover;
+import org.eclipse.wst.sse.core.IndexedRegion;
+import org.eclipse.wst.sse.core.events.NewDocumentEvent;
+import org.eclipse.wst.sse.core.events.RegionChangedEvent;
+import org.eclipse.wst.sse.core.events.RegionsReplacedEvent;
+import org.eclipse.wst.sse.core.events.StructuredDocumentRegionsReplacedEvent;
+import org.eclipse.wst.sse.core.text.IStructuredDocument;
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegion;
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegionList;
+import org.eclipse.wst.sse.core.text.ITextRegion;
+import org.eclipse.wst.sse.core.text.ITextRegionList;
+
+
+public class DTDFile implements IndexedRegion {
+	protected NodeList attlistList = new NodeList(this, DTDRegionTypes.ATTLIST_TAG);
+	protected NodeList commentList = new NodeList(this, DTDRegionTypes.COMMENT_START);
+
+	boolean creatingNewModel = false;
+	protected DTDModelImpl dtdModel;
+
+	protected NodeList elementList = new NodeList(this, DTDRegionTypes.ELEMENT_TAG);
+	protected NodeList entityList = new NodeList(this, DTDRegionTypes.ENTITY_TAG);
+
+	protected ArrayList folderList = null;
+	protected IStructuredDocument fStructuredDocument;
+
+	private boolean isMovingNode = false;
+
+	protected ArrayList lists = new ArrayList();
+
+	protected ArrayList modelListeners = new ArrayList();
+
+	protected ArrayList nodeList = new ArrayList();
+	protected NodeList notationList = new NodeList(this, DTDRegionTypes.NOTATION_TAG);
+	protected NodeList unrecognizedList = new NodeList(this, DTDRegionTypes.UNKNOWN_CONTENT);
+
+	public DTDFile(DTDModelImpl dtdModel) {
+		this.dtdModel = dtdModel;
+		this.fStructuredDocument = dtdModel.getStructuredDocument();
+	}
+
+	public void addDTDFileListener(IDTDFileListener listener) {
+		modelListeners.add(listener);
+	}
+
+	protected void addNode(DTDNode node) {
+		addNode(nodeList.size(), node);
+	}
+
+	protected void addNode(int index, DTDNode node) {
+		nodeList.add(index, node);
+		/*
+		 * if (index < nodeList.size()) { insertBefore(node, (DTDNode)
+		 * nodeList.get(index)); } else { appendChild(node); }
+		 */
+	}
+
+	public DTDNode buildNode(IStructuredDocumentRegion flatNode) {
+		//    ITextRegionList regions = flatNode.getRegions();
+		DTDNode node = null;
+		if (isElement(flatNode)) {
+			// then this is an element
+			node = new Element(this, flatNode);
+		} else if (isEntity(flatNode)) {
+			node = new Entity(this, flatNode);
+		} else if (isNotation(flatNode)) {
+			node = new Notation(this, flatNode);
+		} else if (isAttributeList(flatNode)) {
+			node = new AttributeList(this, flatNode);
+		} else if (isComment(flatNode)) {
+			node = new Comment(this, flatNode);
+		} else if (isParameterEntityReference(flatNode)) {
+			node = new ParameterEntityReference(this, flatNode);
+		} else if (!flatNode.getText().trim().equals("")) { //$NON-NLS-1$
+			node = new Unrecognized(this, flatNode);
+		}
+		if (node != null) {
+			insertNode(node);
+			node.resolveRegions();
+		}
+		return node;
+	}
+
+	public void buildNodes(IStructuredDocumentRegionList list) {
+		NodesEvent addedDTDNodes = new NodesEvent();
+
+		Enumeration flatNodes = list.elements();
+		TopLevelNode previousNode = null;
+		while (flatNodes.hasMoreElements()) {
+			IStructuredDocumentRegion flatNode = (IStructuredDocumentRegion) flatNodes.nextElement();
+			TopLevelNode node = (TopLevelNode) buildNode(flatNode);
+			// if we don't create a node, then we assume that the flat
+			// node was whitespace. Tack it on to a previous toplevel
+			// node
+			if (node != null) {
+				previousNode = node;
+				addedDTDNodes.add(node);
+			} else {
+				if (previousNode != null) {
+					previousNode.addWhitespaceStructuredDocumentRegion(flatNode);
+				}
+			}
+
+		}
+		if (addedDTDNodes.getNodes().size() > 0)// &&
+		//        creatingNewModel == false)
+		{
+			// now tell people about the additions
+			notifyNodesAdded(addedDTDNodes);
+		}
+	}
+
+	// Implements IndexedRegion
+
+	public boolean contains(int testPosition) {
+		return getStartOffset() <= testPosition && testPosition <= getEndOffset();
+	}
+
+	public void createAttributeList(DTDNode node, String name, boolean isAfter) {
+		getDTDModel().beginRecording(this, DTDPlugin.getDTDString("_UI_LABEL_DTD_FILE_ADD_ATTR_LIST")); //$NON-NLS-1$
+		DTDNode topLevelNode = null;
+		String newStream = "<!ATTLIST " + name + ">\n"; //$NON-NLS-1$ //$NON-NLS-2$
+		int offset = getInsertOffset(node, isAfter);
+		getStructuredDocument().replaceText(this, offset, 0, newStream);
+		getDTDModel().endRecording(this);
+	}
+
+	public void createComment(DTDNode node, String name, boolean isAfter) {
+		getDTDModel().beginRecording(this, DTDPlugin.getDTDString("_UI_LABEL_DTD_FILE_ADD_COMMENT")); //$NON-NLS-1$
+		DTDNode topLevelNode = null;
+		String newStream = "<!-- " + name + " -->\n"; //$NON-NLS-1$ //$NON-NLS-2$
+		int offset = getInsertOffset(node, isAfter);
+		getStructuredDocument().replaceText(this, offset, 0, newStream);
+		getDTDModel().endRecording(this);
+	}
+
+	public void createElement(DTDNode node, String name, boolean isAfter) {
+		getDTDModel().beginRecording(this, DTDPlugin.getDTDString("_UI_LABEL_DTD_FILE_ADD_ELEMENT")); //$NON-NLS-1$
+		DTDNode topLevelNode = null;
+		String newStream = "<!ELEMENT " + name + " EMPTY>\n"; //$NON-NLS-1$ //$NON-NLS-2$
+		int offset = getInsertOffset(node, isAfter);
+		getStructuredDocument().replaceText(this, offset, 0, newStream);
+		getDTDModel().endRecording(this);
+	}
+
+	public void createEntity(DTDNode node, String name, boolean isAfter) {
+		getDTDModel().beginRecording(this, DTDPlugin.getDTDString("_UI_LABEL_DTD_FILE_ADD_ENTITY")); //$NON-NLS-1$
+		DTDNode topLevelNode = null;
+		String newStream = "<!ENTITY " + name + " \"\">\n"; //$NON-NLS-1$//$NON-NLS-2$
+		int offset = getInsertOffset(node, isAfter);
+		getStructuredDocument().replaceText(this, offset, 0, newStream);
+		getDTDModel().endRecording(this);
+	}
+
+	public void createNotation(DTDNode node, String name, boolean isAfter) {
+		getDTDModel().beginRecording(this, DTDPlugin.getDTDString("_UI_LABEL_DTD_FILE_ADD_NOTATION")); //$NON-NLS-1$
+		DTDNode topLevelNode = null;
+		String newStream = "<!NOTATION " + name + " SYSTEM \"\">\n"; //$NON-NLS-1$ //$NON-NLS-2$
+		int offset = getInsertOffset(node, isAfter);
+		getStructuredDocument().replaceText(this, offset, 0, newStream);
+		getDTDModel().endRecording(this);
+	}
+
+	public void createParameterEntityReference(DTDNode node, String name, boolean isAfter) {
+		getDTDModel().beginRecording(this, DTDPlugin.getDTDString("_UI_LABEL_DTD_FILE_ADD_PARM_ENTITY_REF")); //$NON-NLS-1$
+		DTDNode topLevelNode = null;
+		String newStream = name + "\n"; //$NON-NLS-1$
+		int offset = getInsertOffset(node, isAfter);
+		getStructuredDocument().replaceText(this, offset, 0, newStream);
+		getDTDModel().endRecording(this);
+	}
+
+	public void deleteNode(DTDNode node) {
+		getDTDModel().beginRecording(this, DTDPlugin.getDTDString("_UI_LABEL_DTD_FILE_DELETE")); //$NON-NLS-1$
+		deleteNode(this, node);
+		getDTDModel().endRecording(this);
+	}
+
+	public void deleteNode(Object requestor, DTDNode node) {
+		DTDNode parent = (DTDNode) node.getParentNode();
+		if (parent != null) {
+			parent.delete(requestor, node);
+		} else {
+			if (!isMovingNode) {
+				DTDModelUpdater updater = new DTDModelUpdater();
+				updater.objectAboutToBeDeleted(requestor, node);
+				if (node instanceof ParameterEntityReference) {
+					Entity referencedEntity = ((ParameterEntityReference) node).getEntityObject();
+					if (referencedEntity != null) {
+						// remove references to all elements and parm entities
+						// contained in our current model
+						DTDExternalReferenceRemover remover = new DTDExternalReferenceRemover();
+						remover.externalReferenceAboutToChange(requestor, referencedEntity);
+					}
+				} else if (node instanceof Notation) {
+					Notation notation = ((Notation) node);
+					DTDNotationReferenceRemover remover = new DTDNotationReferenceRemover();
+					remover.notationAboutToBeDeleted(requestor, notation);
+				}
+			}
+
+			// no parent? then delete up until the start of the next node
+			// if it is a top level node
+			int startOffset = node.getStartOffset();
+			int endOffset = node.getWhitespaceEndOffset();
+			if (node instanceof TopLevelNode) {
+				endOffset = getInsertOffset(node, true);
+			}
+			getStructuredDocument().replaceText(requestor, startOffset, endOffset - startOffset, ""); //$NON-NLS-1$
+		}
+	}
+
+	public NodeList getComments() {
+		return commentList;
+	}
+
+	public DTDModelImpl getDTDModel() {
+		return dtdModel;
+	}
+
+	public NodeList getElementsAndParameterEntityReferences() {
+		return elementList;
+	}
+
+	public int getEndOffset() {
+		IStructuredDocumentRegion region = getStructuredDocument().getFirstStructuredDocumentRegion();
+		if (region != null)
+			return region.getEndOffset();
+		else
+			return 1;
+	}
+
+	public NodeList getEntities() {
+		return entityList;
+	}
+
+	public Image getImage() {
+		return DTDPlugin.getInstance().getImage(DTDResource.DTDFILEICON);
+	}
+
+
+
+	public int getInsertOffset(DTDNode node, boolean isAfter) {
+		int offset = 0;
+		if (node != null) {
+			if (isAfter) {
+				// then get the next node and use it's start offset
+				int index = getNodes().indexOf(getNode(node.getStructuredDocumentRegion()));
+
+				DTDNode afterNode = null;
+				if (index + 1 < getNodes().size()) {
+					afterNode = (DTDNode) getNodes().get(index + 1);
+				}
+				if (afterNode != null) {
+					offset = afterNode.getStructuredDocumentRegion().getStartOffset();
+				} else {
+					// add to end
+					if (getStructuredDocument().getLastStructuredDocumentRegion() != null) {
+						offset = getStructuredDocument().getLastStructuredDocumentRegion().getEndOffset();
+					}
+				}
+			} else {
+				offset = node.getStructuredDocumentRegion().getStartOffset();
+			}
+		} else {
+			// add to end
+			if (getStructuredDocument().getLastStructuredDocumentRegion() != null) {
+				offset = getStructuredDocument().getLastStructuredDocumentRegion().getEndOffset();
+			}
+		}
+		return offset;
+	}
+
+	public String getName() {
+		org.eclipse.core.runtime.Path path = new org.eclipse.core.runtime.Path(getDTDModel().getId().toString());
+		return path.lastSegment();
+	}
+
+	public DTDNode getNode(IStructuredDocumentRegion flatNode) {
+		for (int i = 0; i < nodeList.size(); i++) {
+			DTDNode node = (DTDNode) nodeList.get(i);
+			if (node.getStructuredDocumentRegion() == flatNode) {
+				return node;
+			}
+		}
+		return null;
+	}
+
+	public IndexedRegion getNodeAt(int offset) {
+		DTDNode node = getTopLevelNodeAt(offset);
+		if (node != null) {
+			return node.getDeepestNode(offset);
+		}
+		return null;
+	}
+
+	public IndexedRegion getNodeAt(int startOffset, int endOffset) {
+		DTDNode node = getTopLevelNodeAt(startOffset);
+		if (node != null) {
+			return node.getDeepestNode(startOffset, endOffset);
+		}
+		return null;
+	}
+
+	public ArrayList getNodeLists() {
+		if (folderList == null) {
+			folderList = new ArrayList();
+			folderList.add(notationList);
+			folderList.add(entityList);
+			folderList.add(elementList);
+			// http://w3.opensource.ibm.com/bugzilla/show_bug.cgi?id=4200
+			//folderList.add(attlistList);
+			//folderList.add(commentList);
+			folderList.add(unrecognizedList);
+		}
+		return folderList;
+	}
+
+	public ArrayList getNodes() {
+		return nodeList;
+	}
+
+	public NodeList getNotations() {
+		return notationList;
+	}
+
+	public int getStartOffset() {
+		IStructuredDocumentRegion region = getStructuredDocument().getFirstStructuredDocumentRegion();
+		if (region != null)
+			return region.getStartOffset();
+		else
+			return 1;
+	}
+
+	public IStructuredDocument getStructuredDocument() {
+		return fStructuredDocument;
+	}
+
+	public DTDNode getTopLevelNodeAt(int offset) {
+		for (int i = 0; i < nodeList.size(); i++) {
+			DTDNode node = (DTDNode) nodeList.get(i);
+			if (node.contains(offset)) {
+				return node;
+			}
+		}
+		return null;
+	}
+
+	public NodeList getUnrecognized() {
+		return unrecognizedList;
+	}
+
+	public void insertIntoModel(Object requestor, DTDNode reference, DTDNode node, boolean isAfter) {
+		String nodeText = ""; //$NON-NLS-1$
+		if (node instanceof TopLevelNode) {
+			nodeText = ((TopLevelNode) node).getFullText();
+		} else {
+			nodeText = node.getNodeText();
+		}
+		int offset = getInsertOffset(reference, isAfter);
+		getStructuredDocument().replaceText(requestor, offset, 0, nodeText);
+	}
+
+
+	public void insertNode(DTDNode node) {
+		int startOffset = node.getStartOffset();
+		int insertIndex = -1;
+		//    System.out.println("startoffset = " + startOffset);
+		for (int i = 0; i < getNodes().size(); i++) {
+			DTDNode currentNode = (DTDNode) getNodes().get(i);
+			//      System.out.println("currentNode endOffset = "
+			// +currentNode.getEndOffset());
+
+			if (currentNode.getEndOffset() > startOffset) {
+				//        System.out.println("endoffset " +
+				// currentNode.getEndOffset() + " > " + startOffset);
+				insertIndex = i;
+				break;
+			}
+		}
+		if (insertIndex == -1) {
+			insertIndex = getNodes().size();
+		}
+
+
+		//    System.out.println("insert index = " + insertIndex);
+
+		addNode(insertIndex, node);
+	}
+
+	// it is assumed that flatnode contains at least 3 regions
+	public boolean isAttributeList(IStructuredDocumentRegion flatNode) {
+		if (flatNode.getRegions().size() >= 3) {
+			ITextRegion second = flatNode.getRegions().get(1);
+			ITextRegion third = flatNode.getRegions().get(2);
+			if (second.getType().equals(DTDRegionTypes.EXCLAMATION) && third.getType().equals(DTDRegionTypes.ATTLIST_TAG)) {
+				return true;
+			}
+		}
+		return false;
+	}
+
+	// it is assumed that flatnode contains at least 3 regions
+	public boolean isComment(IStructuredDocumentRegion flatNode) {
+		if (flatNode.getRegions().size() >= 2) {
+			ITextRegion region = flatNode.getRegions().get(1);
+			if (region.getType().equals(DTDRegionTypes.COMMENT_START)) {
+				return true;
+			}
+		}
+		return false;
+	}
+
+	// it is assumed that flatnode contains at least 3 regions
+	public boolean isElement(IStructuredDocumentRegion flatNode) {
+		if (flatNode.getRegions().size() >= 3) {
+			ITextRegion second = flatNode.getRegions().get(1);
+			ITextRegion third = flatNode.getRegions().get(2);
+			if (second.getType().equals(DTDRegionTypes.EXCLAMATION) && third.getType().equals(DTDRegionTypes.ELEMENT_TAG)) {
+				return true;
+			}
+		}
+		return false;
+	}
+
+	// it is assumed that flatnode contains at least 3 regions
+	public boolean isEntity(IStructuredDocumentRegion flatNode) {
+		if (flatNode.getRegions().size() >= 3) {
+			ITextRegion second = flatNode.getRegions().get(1);
+			ITextRegion third = flatNode.getRegions().get(2);
+			if (second.getType().equals(DTDRegionTypes.EXCLAMATION) && third.getType().equals(DTDRegionTypes.ENTITY_TAG)) {
+				return true;
+			}
+		}
+		return false;
+	}
+
+	// it is assumed that flatnode contains at least 3 regions
+	public boolean isNotation(IStructuredDocumentRegion flatNode) {
+		if (flatNode.getRegions().size() >= 3) {
+			ITextRegion second = flatNode.getRegions().get(1);
+			ITextRegion third = flatNode.getRegions().get(2);
+			if (second.getType().equals(DTDRegionTypes.EXCLAMATION) && third.getType().equals(DTDRegionTypes.NOTATION_TAG)) {
+				return true;
+			}
+		}
+		return false;
+	}
+
+	// it is assumed that flatnode contains at least 3 regions
+	public boolean isParameterEntityReference(IStructuredDocumentRegion flatNode) {
+		if (flatNode.getRegions().size() == 1) {
+			ITextRegion region = flatNode.getRegions().get(0);
+			if (region.getType().equals(DTDRegionTypes.ENTITY_PARM)) {
+				return true;
+			}
+		}
+		return false;
+	}
+
+	boolean isSameTopLevelType(DTDNode affectedNode) {
+		IStructuredDocumentRegion flatNode = affectedNode.getStructuredDocumentRegion();
+		// return true if the flatnode still matches what the affectedNode
+		// is representing
+		if (affectedNode instanceof Element && isElement(flatNode)) {
+			return true;
+		}
+		if (affectedNode instanceof Entity && isEntity(flatNode)) {
+			return true;
+		}
+		if (affectedNode instanceof Comment && isComment(flatNode)) {
+			return true;
+		}
+		if (affectedNode instanceof AttributeList && isAttributeList(flatNode)) {
+			return true;
+		}
+		if (affectedNode instanceof Notation && isNotation(flatNode)) {
+			return true;
+		}
+		if (affectedNode instanceof Unrecognized && isUnrecognized(flatNode)) {
+			return true;
+		}
+		return false;
+	}
+
+	public boolean isUnrecognized(IStructuredDocumentRegion flatNode) {
+		return !isElement(flatNode) && !isEntity(flatNode) && !isNotation(flatNode) && !isParameterEntityReference(flatNode) && !isAttributeList(flatNode) && !isComment(flatNode);
+	}
+
+	public void moveNode(Object requestor, DTDNode referenceNode, DTDNode nodeToMove, boolean isAfter) {
+		isMovingNode = true;
+
+		deleteNode(requestor, nodeToMove);
+		insertIntoModel(requestor, referenceNode, nodeToMove, isAfter);
+		isMovingNode = false;
+	}
+
+	public void newModel(NewDocumentEvent event) {
+		creatingNewModel = true;
+		nodeList.clear();
+		NodesEvent removeEvent = new NodesEvent();
+		removeEvent.getNodes().addAll(nodeList);
+		notifyNodesRemoved(removeEvent);
+		/* removeChildNodes(); */
+
+		if (fStructuredDocument != null && fStructuredDocument.getRegionList() != null) {
+			buildNodes(fStructuredDocument.getRegionList());
+		}
+		creatingNewModel = false;
+	}
+
+	public void nodesReplaced(StructuredDocumentRegionsReplacedEvent event) {
+		IStructuredDocumentRegionList oldNodes = event.getOldStructuredDocumentRegions();
+		NodesEvent removedDTDNodes = new NodesEvent();
+		for (int i = 0; i < oldNodes.getLength(); i++) {
+			IStructuredDocumentRegion flatNode = oldNodes.item(i);
+
+			for (Iterator iter = getNodes().iterator(); iter.hasNext();) {
+				DTDNode node = (DTDNode) iter.next();
+				if (node.getStructuredDocumentRegion() == flatNode) {
+					removedDTDNodes.add(node);
+				}
+			}
+		}
+
+		buildNodes(event.getNewStructuredDocumentRegions());
+
+		if (removedDTDNodes.getNodes().size() > 0) {
+			notifyNodesRemoved(removedDTDNodes);
+			removeNodes(removedDTDNodes.getNodes());
+		}
+	}
+
+	public void notifyNodeChanged(DTDNode node) {
+		Iterator iter = modelListeners.iterator();
+		while (iter.hasNext()) {
+			IDTDFileListener listener = (IDTDFileListener) iter.next();
+			listener.nodeChanged(node);
+		}
+	}
+
+	public void notifyNodesAdded(NodesEvent addedNodes) {
+		Iterator iter = modelListeners.iterator();
+		while (iter.hasNext()) {
+			IDTDFileListener listener = (IDTDFileListener) iter.next();
+			listener.nodesAdded(addedNodes);
+		}
+	}
+
+	protected void notifyNodesRemoved(NodesEvent event) {
+		Iterator iter = modelListeners.iterator();
+		while (iter.hasNext()) {
+			IDTDFileListener listener = (IDTDFileListener) iter.next();
+			listener.nodesRemoved(event);
+		}
+	}
+
+	public void rebuildNodes(List nodes) {
+		// remove the old nodes
+		removeNodes(nodes);
+
+		// now rebuild them
+		NodesEvent addedDTDNodes = new NodesEvent();
+		Iterator dtdNodes = nodes.iterator();
+		while (dtdNodes.hasNext()) {
+			DTDNode dtdNode = (DTDNode) dtdNodes.next();
+			//      System.out.println("rebuilding " +
+			// dtdNode.getStructuredDocumentRegion().getText());
+
+			DTDNode node = buildNode(dtdNode.getStructuredDocumentRegion());
+			if (node != null) {
+				addedDTDNodes.add(node);
+			}
+		}
+		if (addedDTDNodes.getNodes().size() > 0) {
+			// now tell people about the additions
+			notifyNodesAdded(addedDTDNodes);
+		}
+	}
+
+	public void regionChanged(RegionChangedEvent event) {
+		ITextRegion changedRegion = event.getRegion();
+		IStructuredDocumentRegion flatNode = event.getStructuredDocumentRegion();
+		DTDNode affectedNode = (DTDNode) getNodeAt(flatNode.getStartOffset(changedRegion), flatNode.getEndOffset(changedRegion));
+		if (affectedNode != null) {
+			// no need to resolve regions as it is just a change
+			//      affectedNode.resolveRegions();
+			notifyNodeChanged(affectedNode);
+		}
+	}
+
+	public void regionsReplaced(RegionsReplacedEvent event) {
+		List nodesToRebuild = new ArrayList();
+		IStructuredDocumentRegion flatNode = event.getStructuredDocumentRegion();
+		DTDNode affectedNode = getNode(flatNode);
+
+		if (!isSameTopLevelType(affectedNode)) {
+			nodesToRebuild.add(affectedNode);
+			rebuildNodes(nodesToRebuild);
+		} else {
+			affectedNode.resolveRegions();
+			notifyNodeChanged(affectedNode);
+			// now try and determine which ones were added
+			NodesEvent addedDTDNodes = new NodesEvent();
+			ITextRegionList newRegions = event.getNewRegions();
+			int size = newRegions.size();
+			for (int i = 0; i < size; i++) {
+				ITextRegion region = newRegions.get(i);
+				DTDNode deepestNode = affectedNode.getDeepestNode(flatNode.getStartOffset(region), flatNode.getEndOffset(region));
+				if (!addedDTDNodes.getNodes().contains(deepestNode)) {
+					addedDTDNodes.add(deepestNode);
+				}
+			}
+			if (addedDTDNodes.getNodes().size() > 0) {
+				notifyNodesAdded(addedDTDNodes);
+			}
+		}
+	}
+
+	public void removeDTDFileListener(IDTDFileListener listener) {
+		modelListeners.remove(listener);
+	}
+
+	protected void removeNodes(List nodes) {
+		getNodes().removeAll(nodes);
+		/*
+		 * for (int i = 0; i < nodes.size(); i++) {
+		 * removeChild((DTDNode)nodes.get(i)); } // end of for ()
+		 */
+	}
+
+	/**
+	 * Sets the flatModel.
+	 * 
+	 * @param flatModel
+	 *            The flatModel to set
+	 */
+	public void setStructuredDocument(IStructuredDocument flatModel) {
+		this.fStructuredDocument = flatModel;
+	}
+}
diff --git a/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/DTDNode.java b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/DTDNode.java
new file mode 100644
index 0000000..8edc3e4
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/DTDNode.java
@@ -0,0 +1,327 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+package org.eclipse.wst.dtd.core;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.wst.dtd.core.document.DTDModelImpl;
+import org.eclipse.wst.dtd.core.internal.text.RegionIterator;
+import org.eclipse.wst.dtd.core.parser.DTDRegionTypes;
+import org.eclipse.wst.sse.core.IFactoryRegistry;
+import org.eclipse.wst.sse.core.IndexedRegion;
+import org.eclipse.wst.sse.core.internal.text.TextRegionListImpl;
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegion;
+import org.eclipse.wst.sse.core.text.ITextRegion;
+import org.eclipse.wst.xml.core.internal.document.NodeContainer;
+
+
+public abstract class DTDNode extends NodeContainer implements IndexedRegion {
+
+	// these are characteroffsets
+	protected DTDFile dtdFile;
+
+	// flat node that contains this node
+	protected IStructuredDocumentRegion flatNode;
+
+	protected TextRegionListImpl regions = new TextRegionListImpl();
+
+	protected TextRegionListImpl whitespace = new TextRegionListImpl();
+
+	public DTDNode(DTDFile dtdFile, IStructuredDocumentRegion flatNode) {
+		this.dtdFile = dtdFile;
+		this.flatNode = flatNode;
+	}
+
+	public void addRegion(ITextRegion region) {
+		/*
+		 * if (startRegion == null) { startRegion = region; } endRegion =
+		 * region;
+		 */
+		regions.add(region);
+	}
+
+	public void addWhitespaceRegion(ITextRegion region) {
+		whitespace.add(region);
+	}
+
+	public org.w3c.dom.Node appendChild(org.w3c.dom.Node newChild) throws org.w3c.dom.DOMException {
+		//    System.out.println("appendchild called with " + newChild);
+		return super.appendChild(newChild);
+	}
+
+	public void beginRecording(Object requestor, String label) {
+		getDTDFile().getDTDModel().beginRecording(requestor, label);
+	}
+
+	public org.w3c.dom.Node cloneNode(boolean deepest) {
+		return null;
+	}
+
+	public boolean contains(int testPosition) {
+		return containsRange(testPosition, testPosition);
+	}
+
+	public boolean containsRange(int start, int end) {
+		return getStartOffset() <= start && end <= getEndOffset();
+	}
+
+	public void delete(DTDNode child) {
+		beginRecording(this, DTDPlugin.getDTDString("_UI_LABEL_DTD_NODE_DELETE")); //$NON-NLS-1$
+		delete(this, child);
+		endRecording(this);
+	}
+
+	public void delete(Object requestor, DTDNode child) {
+		replaceText(requestor, child.getStartOffset(), child.getFullNodeLength(), ""); //$NON-NLS-1$
+	}
+
+	public void endRecording(Object requestor) {
+		getDTDFile().getDTDModel().endRecording(requestor);
+	}
+
+	public Object[] getChildren() {
+		return getChildrenList().toArray();
+	}
+
+	public List getChildrenList() {
+		org.w3c.dom.Node child = getFirstChild();
+		if (child != null) {
+			List children = new ArrayList();
+			for (; child != null; child = child.getNextSibling()) {
+				children.add(child);
+			}
+			return children;
+		} else {
+			return Collections.EMPTY_LIST;
+		}
+	}
+
+	public DTDNode getDeepestNode(int offset) {
+		if (contains(offset)) {
+			// now see if a child contains this offset
+			Object[] children = getChildren();
+			for (int i = 0; i < children.length; i++) {
+				DTDNode child = (DTDNode) children[i];
+				DTDNode deepest = child.getDeepestNode(offset);
+				if (deepest != null) {
+					return deepest;
+				}
+			} // end of for ()
+			return this;
+		}
+		return null;
+	}
+
+	public DTDNode getDeepestNode(int start, int end) {
+		if (containsRange(start, end)) {
+			// now see if a child contains this offset
+			Object[] children = getChildren();
+			for (int i = 0; i < children.length; i++) {
+				DTDNode child = (DTDNode) children[i];
+				DTDNode deepest = child.getDeepestNode(start, end);
+				if (deepest != null) {
+					return deepest;
+				}
+			} // end of for ()
+			return this;
+		}
+		return null;
+	}
+
+	public DTDFile getDTDFile() {
+		return dtdFile;
+	}
+
+	public int getEndOffset() {
+		return getStructuredDocumentRegion().getEndOffset(getEndRegion());
+	}
+
+	public ITextRegion getEndRegion() {
+		return regions.get(regions.size() - 1);//endRegion;
+	}
+
+	/**
+	 */
+	public IFactoryRegistry getFactoryRegistry() {
+		DTDModelImpl model = dtdFile.getDTDModel();
+		if (model != null) {
+			IFactoryRegistry reg = model.getFactoryRegistry();
+			if (reg != null)
+				return reg;
+		}
+		return null;
+	}
+
+	public int getFullNodeLength() {
+		return getWhitespaceEndOffset() - getStartOffset();
+	}
+
+	public String getFullNodeText() {
+		String text = getNodeText();
+		if (whitespace.size() > 0) {
+			RegionIterator iter = new RegionIterator(whitespace);
+			while (iter.hasNext()) {
+				ITextRegion region = iter.next();
+				text += getStructuredDocumentRegion().getText(region);
+			}
+		}
+		return text;
+	}
+
+	abstract public Image getImage();
+
+	public String getName() {
+		ITextRegion region = getNameRegion();
+		if (region != null) {
+			return getStructuredDocumentRegion().getText(region);
+		}
+		return ""; //$NON-NLS-1$
+	}
+
+	public ITextRegion getNameRegion() {
+		RegionIterator iter = iterator();
+		while (iter.hasNext()) {
+			ITextRegion region = iter.next();
+			if (region.getType() == DTDRegionTypes.NAME) {
+				return region;
+			}
+		}
+		return null;
+	}
+
+	// return the first token containing the specified token type
+	public ITextRegion getNextRegion(RegionIterator iter, String type) {
+		while (iter.hasNext()) {
+			ITextRegion region = iter.next();
+			if (region.getType().equals(type)) {
+				return region;
+			}
+		}
+		return null;
+	}
+
+	public int getNodeLength() {
+		return getEndOffset() - getStartOffset();
+	}
+
+	public String getNodeName() {
+		return getName();
+	}
+
+	public String getNodeText() {
+		StringBuffer sb = new StringBuffer();
+
+		RegionIterator iter = iterator();
+		while (iter.hasNext()) {
+			ITextRegion region = iter.next();
+			sb.append(getStructuredDocumentRegion().getText(region));
+		}
+		return sb.toString();
+	}
+
+	public short getNodeType() {
+		return -1;
+	}
+
+	public int getStartOffset() {
+		return getStructuredDocumentRegion().getStartOffset(getStartRegion());
+	}
+
+	//  private Region startRegion,endRegion;
+	public ITextRegion getStartRegion() {
+		return regions.get(0);
+		//    return startRegion;
+	}
+
+	/**
+	 * Get the value of flatNode.
+	 * 
+	 * @return value of flatNode.
+	 */
+	public IStructuredDocumentRegion getStructuredDocumentRegion() {
+		return flatNode;
+	}
+
+	// return end offset including whitespace
+	// or just the end offset if there is no whitespace
+	public int getWhitespaceEndOffset() {
+		if (whitespace.size() > 0) {
+			ITextRegion region = whitespace.get(whitespace.size() - 1);
+			return getStructuredDocumentRegion().getEndOffset(region);
+		}
+
+		return getEndOffset();
+	}
+
+	public boolean hasTrailingWhitespace() {
+		return whitespace.size() > 0;
+	}
+
+	public RegionIterator iterator() {
+		//    System.out.println("create region iter " + this.getClass() + " with
+		// start , end = " + getStartOffset() + ", " +getEndOffset());
+		return new RegionIterator(regions);
+	}
+
+	public void replaceText(Object requestor, int start, int length, String newText) {
+		getDTDFile().getStructuredDocument().replaceText(requestor, start, length, newText);
+	}
+
+	public void resolveRegions() {
+	}
+
+	public void setName(Object requestor, String name) {
+		if (!getName().equals(name)) {
+			ITextRegion nameRegion = getNameRegion();
+			if (nameRegion != null) {
+				//        nameToken.updateText(name);
+				getDTDFile().getDTDModel().getReferenceUpdater().nameAboutToChange(requestor, this, name);
+				replaceText(requestor, getStructuredDocumentRegion().getStartOffset(nameRegion), nameRegion.getLength(), name);
+			}
+		}
+	}
+
+	public void setName(String name) {
+		beginRecording(this, DTDPlugin.getDTDString("_UI_LABEL_DTD_NODE_NAME_CHG")); //$NON-NLS-1$
+		setName(this, name);
+		endRecording(this);
+	}
+
+	/**
+	 * Set the value of flatNode.
+	 * 
+	 * @param v
+	 *            Value to assign to flatNode.
+	 */
+	public void setStructuredDocumentRegion(IStructuredDocumentRegion v) {
+		this.flatNode = v;
+	}
+
+	// skips past next name token in the iterator
+	protected void skipPastName(RegionIterator iter) {
+		while (iter.hasNext()) {
+			ITextRegion currentRegion = iter.next();
+			if (currentRegion.getType() == DTDRegionTypes.NAME) {
+				break;
+			}
+		}
+	}
+
+	public boolean supports(java.lang.String feature, java.lang.String version) {
+		return false;
+	}
+
+}
diff --git a/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/DTDPlugin.java b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/DTDPlugin.java
new file mode 100644
index 0000000..6a9d11f
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/DTDPlugin.java
@@ -0,0 +1,108 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+package org.eclipse.wst.dtd.core;
+
+import java.text.MessageFormat;
+import java.util.ResourceBundle;
+
+import org.eclipse.core.runtime.IPluginDescriptor;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+public class DTDPlugin extends AbstractUIPlugin {
+	private static DTDPlugin instance;
+
+	public static Image getDTDImage(String iconName) {
+		return getInstance().getImage(iconName);
+	}
+
+	public static ImageDescriptor getDTDImageDescriptor(String iconName) {
+		String thisID = getInstance().getBundle().getSymbolicName();
+		return AbstractUIPlugin.imageDescriptorFromPlugin(thisID, iconName);
+	}
+
+	public static String getDTDString(String key) {
+		// In case it is invoked from a command line
+		if (getInstance() == null) {
+			return ""; //$NON-NLS-1$
+		}
+
+		return getInstance().getString(key);
+	}
+
+	public synchronized static DTDPlugin getInstance() {
+		return instance;
+	}
+
+	public static DTDPlugin getPlugin() {
+		return instance;
+	}
+
+	private ResourceBundle resourceBundle;
+
+	public DTDPlugin(IPluginDescriptor descriptor) {
+		super(descriptor);
+		instance = this;
+		try {
+			resourceBundle = descriptor.getResourceBundle();
+		} catch (java.util.MissingResourceException exception) {
+			//B2BUtilPlugin.getPlugin().getMsgLogger().write(B2BUtilPlugin.getGUIString("_WARN_PLUGIN_PROPERTIES_MISSING")
+			// + descriptor.getLabel());
+			resourceBundle = null;
+		}
+	}
+
+	public Image getImage(String iconName) {
+		ImageRegistry imageRegistry = getImageRegistry();
+		Image image = imageRegistry.get(iconName);
+
+		if (image == null) {
+			String thisID = getInstance().getBundle().getSymbolicName();
+			imageRegistry.put(iconName, imageDescriptorFromPlugin(thisID, iconName));
+			image = imageRegistry.get(iconName);
+		}
+
+		return image;
+	}
+
+	public ResourceBundle getResourceBundle() {
+		return resourceBundle;
+	}
+
+	/**
+	 * This gets the string resource.
+	 */
+	public String getString(String key) {
+		return getResourceBundle().getString(key);
+	}
+
+	/**
+	 * This gets the string resource and does one substitution.
+	 */
+	public String getString(String key, Object s1) {
+		return MessageFormat.format(getString(key), new Object[]{s1});
+	}
+
+	/**
+	 * This gets the string resource and does two substitutions.
+	 */
+	public String getString(String key, Object s1, Object s2) {
+		return MessageFormat.format(getString(key), new Object[]{s1, s2});
+	}
+
+	public void startup() {
+		instance = this;
+	}
+}
diff --git a/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/DTDResource.java b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/DTDResource.java
new file mode 100644
index 0000000..0f1d053
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/DTDResource.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+package org.eclipse.wst.dtd.core;
+
+
+public interface DTDResource {
+	//Enumeration Constants
+	public static final String ANYICON = "icons/full/obj16/any.gif"; //$NON-NLS-1$
+	public static final String ATTRIBUTEICON = "icons/full/obj16/attribute.gif"; //$NON-NLS-1$
+	public static final String ATTRIBUTELISTICON = "icons/full/obj16/attribute_list.gif"; //$NON-NLS-1$
+	public static final String COMMENTICON = "icons/full/obj16/comment.gif"; //$NON-NLS-1$
+
+	public static final String DTDFILEICON = "icons/full/obj16/DTDFile.gif"; //$NON-NLS-1$
+	public static final String ELEMENTICON = "icons/full/obj16/element.gif"; //$NON-NLS-1$
+	public static final String ELEMENTREFICON = "icons/full/obj16/element_ref.gif"; //$NON-NLS-1$
+	public static final String EMPTYICON = "icons/full/obj16/emptycontent.gif"; //$NON-NLS-1$
+	public static final String ENTITYICON = "icons/full/obj16/entity.gif"; //$NON-NLS-1$
+	public static final String ENTITYREFERENCEICON = "icons/full/obj16/entity_reference.gif"; //$NON-NLS-1$
+	public static final String FLDR_ATTLIST = "icons/full/obj16/folder_attlist_obj.gif"; //$NON-NLS-1$
+	public static final String FLDR_COMM = "icons/full/obj16/folder_comments_obj.gif"; //$NON-NLS-1$
+
+	public static final String FLDR_EL = "icons/full/obj16/fldr_el.gif"; //$NON-NLS-1$
+	public static final String FLDR_ENT = "icons/full/obj16/fldr_ent.gif"; //$NON-NLS-1$
+	public static final String FLDR_NOT = "icons/full/obj16/fldr_not.gif"; //$NON-NLS-1$
+	public static final String FLDR_UNREC = "icons/full/obj16/fldr_unrec.gif"; //$NON-NLS-1$
+
+	public static final String NEWDTD = "icons/full/obj16/newdtd_wiz.gif"; //$NON-NLS-1$
+	public static final String NEWHTMLFORM = "icons/full/obj16/genhtmform_wiz.gif"; //$NON-NLS-1$
+	public static final String NOTATIONICON = "icons/full/obj16/notation.gif"; //$NON-NLS-1$
+
+	public static final String ONECHOICEICON = "icons/full/obj16/onechoice.gif"; //$NON-NLS-1$
+
+	public static final String ONEICON = "icons/full/obj16/one.gif"; //$NON-NLS-1$
+	public static final String ONEORMORECHOICEICON = "icons/full/obj16/oneormorechoice.gif"; //$NON-NLS-1$
+	public static final String ONEORMOREICON = "icons/full/obj16/oneormore.gif"; //$NON-NLS-1$
+	public static final String ONEORMORESEQUENCEICON = "icons/full/obj16/oneormoresequence.gif"; //$NON-NLS-1$
+
+	public static final String ONESEQUENCEICON = "icons/full/obj16/onesequence.gif"; //$NON-NLS-1$
+	public static final String OPTIONALCHOICEICON = "icons/full/obj16/optionalchoice.gif"; //$NON-NLS-1$
+	public static final String OPTIONALICON = "icons/full/obj16/optional.gif"; //$NON-NLS-1$
+	public static final String OPTIONALSEQUENCEICON = "icons/full/obj16/optionalsequence.gif"; //$NON-NLS-1$
+	public static final String PCDATAICON = "icons/full/obj16/txtext.gif"; //$NON-NLS-1$
+	public static final String UNRECOGNIZEDICON = "icons/full/obj16/unrecognized_content.gif"; //$NON-NLS-1$
+	public static final String ZEROORMORECHOICEICON = "icons/full/obj16/zeroormorechoice.gif"; //$NON-NLS-1$
+	public static final String ZEROORMOREICON = "icons/full/obj16/zeroormore.gif"; //$NON-NLS-1$
+	public static final String ZEROORMORESEQUENCEICON = "icons/full/obj16/zeroormoresequence.gif"; //$NON-NLS-1$
+}
diff --git a/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/Element.java b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/Element.java
new file mode 100644
index 0000000..492cd71
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/Element.java
@@ -0,0 +1,197 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+package org.eclipse.wst.dtd.core;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.wst.dtd.core.internal.text.RegionIterator;
+import org.eclipse.wst.dtd.core.parser.DTDRegionTypes;
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegion;
+import org.eclipse.wst.sse.core.text.ITextRegion;
+import org.w3c.dom.Node;
+
+
+public class Element extends NamedTopLevelNode {
+
+	List attListList = new ArrayList();
+
+	List attributes = new ArrayList();
+
+	protected CMNode contentModel;
+
+	public Element(DTDFile dtdFile, IStructuredDocumentRegion flatNode) {
+		super(dtdFile, flatNode, DTDRegionTypes.ELEMENT_TAG);
+	}
+
+	public void addAttribute(String name) {
+		beginRecording(this, DTDPlugin.getDTDString("_UI_LABEL_ELEMENT_ADD_ATTR")); //$NON-NLS-1$
+		List attLists = getAttributeLists();
+		if (attLists.size() == 0) {
+			getDTDFile().createAttributeList(this, getName(), true);
+			attLists = getAttributeLists();
+		}
+		if (attLists.size() > 0) {
+			AttributeList attList = (AttributeList) attLists.get(attLists.size() - 1);
+			attList.addAttribute(name);
+		}
+		endRecording(this);
+	}
+
+	public void addChild() {
+		beginRecording(this, DTDPlugin.getDTDString("_UI_LABEL_ELEMENT_ADD_CHILD")); //$NON-NLS-1$
+		addContent(this, " EMPTY"); //$NON-NLS-1$
+		endRecording(this);
+	}
+
+	protected void addContent(Object requestor, String content) {
+		ITextRegion whitespace = getWhitespaceAfterName();
+		int startOffset = 0;
+		int length = 0;
+		if (whitespace != null) {
+			startOffset = getStructuredDocumentRegion().getStartOffset(whitespace);
+			length = whitespace.getLength() >= 2 ? 1 : 0;
+		} else {
+			ITextRegion nameRegion = getNameRegion();
+			if (nameRegion != null) {
+				startOffset = getStructuredDocumentRegion().getEndOffset(nameRegion);
+			} else {
+				ITextRegion elementTag = getNextRegion(iterator(), DTDRegionTypes.ELEMENT_TAG);
+				startOffset = getStructuredDocumentRegion().getEndOffset(elementTag);
+			}
+		}
+		replaceText(requestor, startOffset, length, content);
+	}
+
+	public void addGroup() {
+		beginRecording(this, DTDPlugin.getDTDString("_UI_LABEL_ELEMENT_ADD_GRP")); //$NON-NLS-1$
+		addContent(this, " ()"); //$NON-NLS-1$
+		endRecording(this);
+	}
+
+	public Node cloneNode(boolean deep) {
+		return new Element(dtdFile, flatNode);
+	}
+
+	public List getAttributeLists() {
+		attListList.clear();
+		String elementName = getName();
+		Iterator iter = dtdFile.getNodes().iterator();
+		while (iter.hasNext()) {
+			DTDNode node = (DTDNode) iter.next();
+			if (node instanceof AttributeList && node.getName().equals(elementName)) {
+				attListList.add(node);
+			}
+		}
+		return attListList;
+	}
+
+
+
+	public CMNode getContentModel() {
+		//    Object[] children = getChildren()
+		return (CMNode) getFirstChild();//contentModel;
+	}
+
+	public List getElementAttributes() {
+		attributes.clear();
+		Iterator attLists = getAttributeLists().iterator();
+		while (attLists.hasNext()) {
+			AttributeList attList = (AttributeList) attLists.next();
+
+			Object[] children = attList.getChildren();
+			for (int i = 0; i < children.length; i++) {
+				attributes.add(children[i]);
+			}
+		}
+		return attributes;
+	}
+
+	public Image getImage() {
+		return DTDPlugin.getInstance().getImage(DTDResource.ELEMENTICON);
+	}
+
+	public short getNodeType() {
+		return Node.ELEMENT_NODE;
+	}
+
+	public void replaceContentModel(Object requestor, CMNode node) {
+		int offset = 0;
+		int length = 0;
+		String nodeText = node.getNodeText();
+		CMNode contentModel = getContentModel();
+		if (contentModel != null) {
+			offset = contentModel.getStartOffset();
+			length = contentModel.getWhitespaceEndOffset() - offset;
+			replaceText(requestor, offset, length, nodeText);
+		} else {
+			addContent(requestor, nodeText);
+		}
+	}
+
+	public void resolveRegions() {
+		//    System.out.println("element node stream = " +
+		// tokenStream.getString());
+		contentModel = null;
+		removeChildNodes();
+		RegionIterator iter = iterator();
+
+		if (getNameRegion() != null) {
+			// we skip past the name token is our name
+			skipPastName(iter);
+		}
+
+		CMBasicNode basicNode = null;
+		while (iter.hasNext()) {
+			ITextRegion currentRegion = iter.next();
+
+			if (contentModel == null) {
+				if (currentRegion.getType().equals(DTDRegionTypes.NAME)) {
+					contentModel = basicNode = new CMBasicNode(getDTDFile(), getStructuredDocumentRegion());
+				} else if (currentRegion.getType().equals(DTDRegionTypes.CONTENT_PCDATA)) {
+					contentModel = basicNode = new CMBasicNode(getDTDFile(), getStructuredDocumentRegion());
+				} else if (currentRegion.getType().equals(DTDRegionTypes.LEFT_PAREN)) {
+					contentModel = new CMGroupNode(getDTDFile(), getStructuredDocumentRegion());
+				}
+			}
+
+			if (contentModel != null) {
+				if (!currentRegion.getType().equals(DTDRegionTypes.END_TAG)) {
+					// content model gets all regions except for the '>'
+					contentModel.addRegion(currentRegion);
+				} else {
+					// if it is equal to the end tag, then don't add anymore
+					// regions
+					// for the content model
+					break;
+				}
+
+			}
+
+		}
+		if (contentModel != null) {
+			appendChild(contentModel);
+			// this is the root element content so set it true
+			contentModel.setRootElementContent(true);
+			// now tell the content model to resolve it's regions
+			contentModel.resolveRegions();
+
+		}
+	}
+
+	public void setContentModel(CMNode contentModel) {
+		this.contentModel = contentModel;
+	}
+}
diff --git a/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/Entity.java b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/Entity.java
new file mode 100644
index 0000000..ff93bf7
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/Entity.java
@@ -0,0 +1,324 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+package org.eclipse.wst.dtd.core;
+
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.wst.dtd.core.internal.text.RegionIterator;
+import org.eclipse.wst.dtd.core.parser.DTDRegionTypes;
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegion;
+import org.eclipse.wst.sse.core.text.ITextRegion;
+
+
+// external node contains code to help set and get public ids
+public class Entity extends ExternalNode {
+
+	private static String setExternalEntity = DTDPlugin.getDTDString("_UI_LABEL_ENTITY_SET_EXT_ENTITY"); //$NON-NLS-1$
+	private static String setGeneralEntity = DTDPlugin.getDTDString("_UI_LABEL_ENTITY_SET_GENERAL_ENTITY"); //$NON-NLS-1$
+	private static String setInternalEntity = DTDPlugin.getDTDString("_UI_LABEL_ENTITY_SET_INT_ENTITY"); //$NON-NLS-1$
+
+	private static String setParameterEntity = DTDPlugin.getDTDString("_UI_LABEL_ENTITY_SET_PARM_ENTITY"); //$NON-NLS-1$
+
+	public Entity(DTDFile file, IStructuredDocumentRegion flatNode) {
+		super(file, flatNode, DTDRegionTypes.ENTITY_TAG);
+	}
+
+	public Image getImage() {
+		return DTDPlugin.getInstance().getImage(DTDResource.ENTITYICON);
+	}
+
+
+	/**
+	 * Get the value of notationName.
+	 * 
+	 * @return value of notationName.
+	 */
+	public String getNotationName() {
+		ITextRegion ndataRegion = getNextRegion(iterator(), DTDRegionTypes.NDATA_VALUE);
+		if (ndataRegion != null) {
+			return getStructuredDocumentRegion().getText(ndataRegion);
+		}
+		return ""; //$NON-NLS-1$
+	}
+
+	public ITextRegion getPercentRegion() {
+		return getNextRegion(iterator(), DTDRegionTypes.PERCENT);
+	}
+
+	/**
+	 * Get the value of value.
+	 * 
+	 * @return value of value.
+	 */
+	public String getValue() {
+		if (!isExternalEntity()) {
+			ITextRegion valueRegion = getNextQuotedLiteral(iterator());
+			if (valueRegion != null) {
+				return getValueFromQuotedRegion(valueRegion);
+			}
+		}
+		return ""; //$NON-NLS-1$
+	}
+
+	/**
+	 * Get the value of externalEntity.
+	 * 
+	 * @return value of externalEntity.
+	 */
+	public boolean isExternalEntity() {
+		return getPublicKeywordRegion(iterator()) != null || getSystemKeywordRegion(iterator()) != null;
+	}
+
+	/**
+	 * Get the value of isParameterEntity.
+	 * 
+	 * @return value of isParameterEntity.
+	 */
+	public boolean isParameterEntity() {
+		return getPercentRegion() != null;
+	}
+
+	private void removeNData(Object requestor) {
+		ITextRegion ndataRegion = null;
+
+		// see if we have an NDATA keyword
+		ndataRegion = getNextRegion(iterator(), DTDRegionTypes.NDATA_KEYWORD);
+		int startOffset = 0, endOffset = 0;
+		if (ndataRegion != null) {
+			startOffset = getStructuredDocumentRegion().getStartOffset(ndataRegion);
+			endOffset = getStructuredDocumentRegion().getEndOffset(ndataRegion);
+		}
+		ITextRegion value = getNextRegion(iterator(), DTDRegionTypes.NDATA_VALUE);
+		if (value != null) {
+			if (startOffset == 0) {
+				startOffset = getStructuredDocumentRegion().getStartOffset(value);
+			}
+			endOffset = getStructuredDocumentRegion().getEndOffset(value);
+		}
+		replaceText(requestor, startOffset, endOffset - startOffset, ""); //$NON-NLS-1$
+	}
+
+	/**
+	 * Set the value of externalEntity.
+	 * 
+	 * @param v
+	 *            Value to assign to externalEntity.
+	 */
+	public void setExternalEntity(boolean isExternalEntity) {
+		if (isExternalEntity() != isExternalEntity) {
+			//      externalEntity = v;
+			beginRecording(this, isExternalEntity ? setExternalEntity : setInternalEntity);
+			if (isExternalEntity) {
+				// we need to get rid of the value literal
+				ITextRegion quote = getNextRegion(iterator(), DTDRegionTypes.SINGLEQUOTED_LITERAL);
+				if (quote == null) {
+					quote = getNextRegion(iterator(), DTDRegionTypes.DOUBLEQUOTED_LITERAL);
+				}
+				if (quote != null) {
+					replaceText(this, getStructuredDocumentRegion().getStartOffset(quote), quote.getLength(), ""); //$NON-NLS-1$
+				}
+				setSystemID(""); //$NON-NLS-1$
+			} else {
+				// we need to get rid of text between end of name region and
+				// the last double quoted literal
+				RegionIterator iter = iterator();
+				ITextRegion keyword = getSystemKeywordRegion(iter);
+				int startOffset = 0;
+				int length = 0;
+				if (keyword == null) {
+					// reset the iterator
+					iter = iterator();
+					keyword = getPublicKeywordRegion(iter);
+				}
+				if (keyword != null) {
+					startOffset = getStructuredDocumentRegion().getStartOffset(keyword);
+					// start with a length just equal to the keyword for now
+					length = keyword.getLength();
+				} else {
+					// reset the iterator since we didn't find the keyword
+					iter = iterator();
+					// just go from after the name
+					startOffset = getStructuredDocumentRegion().getEndOffset(getNameRegion());
+				}
+
+				// now that we have the start, look for the end
+				ITextRegion lastRegion = null;
+
+				if (lastRegion == null) {
+					// then look for last quoted literal
+					while (iter.hasNext()) {
+						ITextRegion literal = getNextQuotedLiteral(iter);
+						if (literal != null) {
+							lastRegion = literal;
+						}
+					}
+				}
+
+				if (lastRegion != null) {
+					length = getStructuredDocumentRegion().getEndOffset(lastRegion) - startOffset;
+				}
+				replaceText(this, startOffset, length, "\"\""); //$NON-NLS-1$
+				removeNData(this);
+			}
+			endRecording(this);
+		}
+	}
+
+	public void setNotationName(Object requestor, String newNotation) {
+		if (!getNotationName().equals(newNotation)) {
+			if (!newNotation.equals("")) { //$NON-NLS-1$
+				// 
+				ITextRegion ndataRegion = getNextRegion(iterator(), DTDRegionTypes.NDATA_VALUE);
+				if (ndataRegion != null) {
+					replaceText(requestor, getStructuredDocumentRegion().getStartOffset(ndataRegion), ndataRegion.getLength(), newNotation);
+				} else {
+					// time to create one
+					int startOffset = 0;
+					String string = ""; //$NON-NLS-1$
+					RegionIterator iter = iterator();
+					ITextRegion ndataKeyword = getNextRegion(iter, DTDRegionTypes.NDATA_KEYWORD);
+					if (ndataKeyword == null) {
+						// we'll need to create one after the last quoted
+						// literal
+						// Reset iterator
+						string += " NDATA "; //$NON-NLS-1$
+						iter = iterator();
+						ITextRegion lastQuotedLiteral = null;
+						while (iter.hasNext()) {
+							ITextRegion literal = getNextQuotedLiteral(iter);
+							if (literal != null) {
+								lastQuotedLiteral = literal;
+							}
+						}
+						if (lastQuotedLiteral != null) {
+							startOffset = getStructuredDocumentRegion().getEndOffset(lastQuotedLiteral);
+						} else {
+							// created after the system or public keyword
+							ITextRegion keyword = getPublicKeywordRegion(iterator());
+							if (keyword == null) {
+								keyword = getSystemKeywordRegion(iterator());
+							}
+							// we shouldn't be null here since we check if we
+							// were external already
+							startOffset = getStructuredDocumentRegion().getEndOffset(keyword);
+						}
+
+					} else {
+						startOffset = getStructuredDocumentRegion().getEndOffset(ndataKeyword);
+					}
+					replaceText(requestor, startOffset, 0, string + newNotation);
+				}
+			} else {
+				// need to remove the ndata stuff
+				removeNData(requestor);
+			}
+		}
+	}
+
+	/**
+	 * Set the value of notationName.
+	 * 
+	 * @param newNotation
+	 *            Value to assign to notationName.
+	 */
+	public void setNotationName(String newNotation) {
+		beginRecording(this, "NDATA " + DTDPlugin.getDTDString("_UI_LABEL_ENTITY_NDATA_CHANGE")); //$NON-NLS-1$ //$NON-NLS-2$
+		setNotationName(this, newNotation);
+		endRecording(this);
+	}
+
+	/**
+	 * Set the value of isParameterEntity.
+	 * 
+	 * @param v
+	 *            Value to assign to isParameterEntity.
+	 */
+	public void setParameterEntity(boolean v) {
+		if (isParameterEntity() != v) {
+			beginRecording(this, v ? setParameterEntity : setGeneralEntity);
+			if (v) {
+				RegionIterator iter = iterator();
+				ITextRegion startTag = getNextRegion(iter, DTDRegionTypes.ENTITY_TAG);
+				int startOffset = 0, length = 0;
+
+				if (iter.hasNext()) {
+					ITextRegion region = iter.next();
+					startOffset = getStructuredDocumentRegion().getStartOffset(region);
+					if (region.getType() == DTDRegionTypes.WHITESPACE && region.getLength() > 1) {
+						length = 1;
+					}
+				} else {
+					startOffset = getStructuredDocumentRegion().getEndOffset(startTag);
+				}
+				replaceText(this, startOffset, length, " %"); //$NON-NLS-1$
+				// now get rid of any NData since it is only allowed if the
+				// entity is a general entity and not a parameter entity
+				removeNData(this);
+			} else {
+				// get rid of percent region
+				ITextRegion percentRegion = getPercentRegion();
+				replaceText(this, getStructuredDocumentRegion().getStartOffset(percentRegion), percentRegion.getLength(), ""); //$NON-NLS-1$
+			}
+
+			endRecording(this);
+		}
+	}
+
+	/**
+	 * Set the value of value.
+	 * 
+	 * @param v
+	 *            Value to assign to value.
+	 */
+	public void setValue(Object requestor, String v) {
+		if (!isExternalEntity()) {
+			if (!getValue().equals(v)) {
+				// then it makes sense to change the value
+				ITextRegion valueRegion = getNextQuotedLiteral(iterator());
+				String quoteChar = v.indexOf("\"") == -1 ? "\"" : "'"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+				if (valueRegion != null) {
+					replaceText(requestor, getStructuredDocumentRegion().getStartOffset(valueRegion), valueRegion.getLength(), quoteChar + v + quoteChar);
+				} else {
+					int startOffset = 0, length = 0;
+					RegionIterator iter = iterator();
+					ITextRegion region = getNextRegion(iter, DTDRegionTypes.NAME);
+					if (region == null) {
+						// create it after the percent if there is one
+						region = getPercentRegion();
+					}
+					if (region == null) {
+						// if still null, then create it after the element tag
+						region = getStartTag(iterator());
+					}
+
+					if (region != null) {
+						startOffset = getStructuredDocumentRegion().getEndOffset(region);
+						replaceText(requestor, startOffset, 0, quoteChar + v + quoteChar);
+					}
+				}
+			}
+		}
+	}
+
+	/**
+	 * Set the value of value.
+	 * 
+	 * @param v
+	 *            Value to assign to value.
+	 */
+	public void setValue(String v) {
+		beginRecording(this, DTDPlugin.getDTDString("_UI_LABEL_ENTITY_VALUE_CHG")); //$NON-NLS-1$
+		setValue(this, v);
+		endRecording(this);
+	}
+
+}
diff --git a/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/ExternalNode.java b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/ExternalNode.java
new file mode 100644
index 0000000..4fa8c5f
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/ExternalNode.java
@@ -0,0 +1,242 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+package org.eclipse.wst.dtd.core;
+
+import org.eclipse.wst.dtd.core.internal.text.RegionIterator;
+import org.eclipse.wst.dtd.core.parser.DTDRegionTypes;
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegion;
+import org.eclipse.wst.sse.core.text.ITextRegion;
+
+
+// base class for nodes that can contain external content
+public abstract class ExternalNode extends NamedTopLevelNode {
+
+	String publicID;
+
+	String systemID;
+
+	public ExternalNode(DTDFile file, IStructuredDocumentRegion flatNode, String tagType) {
+		super(file, flatNode, tagType);
+	}
+
+	public ITextRegion getNextQuotedLiteral(RegionIterator iter) {
+		while (iter.hasNext()) {
+			ITextRegion region = iter.next();
+			if (region.getType().equals(DTDRegionTypes.SINGLEQUOTED_LITERAL) || region.getType().equals(DTDRegionTypes.DOUBLEQUOTED_LITERAL)) {
+				return region;
+			}
+		}
+		return null;
+	}
+
+	/**
+	 * Get the value of publicID.
+	 * 
+	 * @return value of publicID.
+	 */
+	public String getPublicID() {
+		ITextRegion publicValue = getPublicValueRegion();
+		if (publicValue != null) {
+			return getValueFromQuotedRegion(publicValue);
+		}
+		return ""; //$NON-NLS-1$
+	}
+
+	public ITextRegion getPublicKeywordRegion(RegionIterator iter) {
+		return getNextRegion(iter, DTDRegionTypes.PUBLIC_KEYWORD);
+	}
+
+	public ITextRegion getPublicValueRegion() {
+		RegionIterator iter = iterator();
+
+		ITextRegion publicKeyword = getPublicKeywordRegion(iter);
+
+		if (publicKeyword != null && iter.hasNext()) {
+			ITextRegion quotedLiteral = getNextQuotedLiteral(iter);
+			if (quotedLiteral != null) {
+				return quotedLiteral;
+			}
+		}
+		return null;
+	}
+
+	/**
+	 * Get the value of systemID.
+	 * 
+	 * @return value of systemID.
+	 */
+	public String getSystemID() {
+		ITextRegion systemValue = getSystemValueRegion();
+		if (systemValue != null) {
+			return getValueFromQuotedRegion(systemValue);
+		}
+		return ""; //$NON-NLS-1$
+	}
+
+	public ITextRegion getSystemKeywordRegion(RegionIterator iter) {
+		return getNextRegion(iter, DTDRegionTypes.SYSTEM_KEYWORD);
+	}
+
+	public ITextRegion getSystemValueRegion() {
+		RegionIterator iter = iterator();
+
+		ITextRegion systemKeyword = getSystemKeywordRegion(iter);
+		if (systemKeyword != null && iter.hasNext()) {
+			ITextRegion quotedLiteral = getNextQuotedLiteral(iter);
+			if (quotedLiteral != null) {
+				return quotedLiteral;
+			}
+		} else {
+			// try and see if there is a second quoted literal after a public
+			// keyword
+			iter = iterator();
+			ITextRegion publicKeyword = getPublicKeywordRegion(iter);
+
+			if (publicKeyword != null && iter.hasNext()) {
+				ITextRegion quotedLiteral = getNextQuotedLiteral(iter);
+				if (quotedLiteral != null && iter.hasNext()) {
+					// now get the second quoted literal
+					quotedLiteral = getNextQuotedLiteral(iter);
+					if (quotedLiteral != null) {
+						// got it!
+						return quotedLiteral;
+					}
+				}
+			}
+		}
+		return null;
+	}
+
+	public String getValueFromQuotedRegion(ITextRegion region) {
+		String type = region.getType();
+		if (type.equals(DTDRegionTypes.SINGLEQUOTED_LITERAL) || type.equals(DTDRegionTypes.DOUBLEQUOTED_LITERAL)) {
+			String text = getStructuredDocumentRegion().getText(region);
+			return text.substring(1, text.length() - 1);
+		}
+		return ""; //$NON-NLS-1$
+	}
+
+	/**
+	 * Set the value of publicID.
+	 * 
+	 * @param v
+	 *            Value to assign to publicID.
+	 */
+	public void setPublicID(Object requestor, String v) {
+		if (!v.equals(publicID)) {
+			publicID = v;
+			ITextRegion publicValue = getPublicValueRegion();
+			ITextRegion publicKeyword = getPublicKeywordRegion(iterator());
+			ITextRegion systemKeyword = getSystemKeywordRegion(iterator());
+			ITextRegion systemValue = getSystemValueRegion();
+
+			if (v.equals("")) { //$NON-NLS-1$
+				if (publicKeyword != null) {
+					// time to get rid of the public keyword and value
+					// and replace it with the system one
+					int startOffset = getStructuredDocumentRegion().getStartOffset(publicKeyword);
+					String newString = "SYSTEM"; //$NON-NLS-1$
+					if (systemValue == null) {
+						newString += " \"\""; //$NON-NLS-1$
+					}
+					replaceText(requestor, startOffset, getStructuredDocumentRegion().getEndOffset(publicValue) - startOffset, newString);
+				}
+			} else {
+				// here were setting a non empty value
+				String quoteChar = v.indexOf("\"") == -1 ? "\"" : "'"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+				if (publicValue != null) {
+					replaceText(requestor, getStructuredDocumentRegion().getStartOffset(publicValue), publicValue.getLength(), quoteChar + publicID + quoteChar);
+				} else {
+					// time to create stuff
+					if (publicKeyword != null) {
+						// then just put our new value after the keyword
+						replaceText(requestor, getStructuredDocumentRegion().getEndOffset(publicKeyword), 0, " " + quoteChar + v + quoteChar); //$NON-NLS-1$
+					} else {
+						// we need the public keyword as well
+						if (systemKeyword != null) {
+							replaceText(requestor, getStructuredDocumentRegion().getStartOffset(systemKeyword), systemKeyword.getLength(), "PUBLIC " + quoteChar + v + quoteChar); //$NON-NLS-1$
+						} else {
+							ITextRegion nameRegion = getNameRegion();
+							replaceText(requestor, getStructuredDocumentRegion().getEndOffset(nameRegion), 0, " PUBLIC " + quoteChar + v + quoteChar); //$NON-NLS-1$
+						}
+					}
+				}
+			}
+		}
+	}
+
+
+	/**
+	 * Set the value of publicID.
+	 * 
+	 * @param v
+	 *            Value to assign to publicID.
+	 */
+	public void setPublicID(String v) {
+		beginRecording(this, DTDPlugin.getDTDString("_UI_LABEL_EXT_NODE_PUBLIC_ID_CHG")); //$NON-NLS-1$
+		setPublicID(this, v);
+		endRecording(this);
+	}
+
+	/**
+	 * Set the value of systemID.
+	 * 
+	 * @param v
+	 *            Value to assign to systemID.
+	 */
+	public void setSystemID(Object requestor, String v) {
+		if (!v.equals(systemID) || (getPublicKeywordRegion(iterator()) == null && getSystemKeywordRegion(iterator()) == null)) {
+			systemID = v;
+			String quoteChar = v.indexOf("\"") == -1 ? "\"" : "'"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+			ITextRegion systemValue = getSystemValueRegion();
+			if (systemValue != null) {
+				replaceText(requestor, getStructuredDocumentRegion().getStartOffset(systemValue), systemValue.getLength(), quoteChar + systemID + quoteChar);
+			} else {
+				ITextRegion systemKeyword = getSystemKeywordRegion(iterator());
+
+				// time to create stuff
+				if (systemKeyword != null) {
+					// then just put our new value after the keyword
+					replaceText(requestor, getStructuredDocumentRegion().getEndOffset(systemKeyword), 0, " " + quoteChar + v + quoteChar); //$NON-NLS-1$
+				} else {
+					// see if we have a public keyword
+					ITextRegion publicKeyword = getPublicKeywordRegion(iterator());
+					if (publicKeyword == null) {
+						ITextRegion nameRegion = getNameRegion();
+
+						replaceText(requestor, getStructuredDocumentRegion().getEndOffset(nameRegion), 0, " SYSTEM " + quoteChar + v + quoteChar); //$NON-NLS-1$
+					} else {
+						// put it after the public value region
+						ITextRegion publicValueRegion = getPublicValueRegion();
+						replaceText(requestor, getStructuredDocumentRegion().getEndOffset(publicValueRegion), 0, " " + quoteChar + v + quoteChar); //$NON-NLS-1$
+					}
+
+				}
+			}
+
+		}
+	}
+
+
+	/**
+	 * Set the value of systemID.
+	 * 
+	 * @param v
+	 *            Value to assign to systemID.
+	 */
+	public void setSystemID(String v) {
+		beginRecording(this, DTDPlugin.getDTDString("_UI_LABEL_EXT_NODE_SYSTEM_ID_CHG")); //$NON-NLS-1$
+		setSystemID(this, v);
+		endRecording(this);
+	}
+}
diff --git a/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/Logger.java b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/Logger.java
new file mode 100644
index 0000000..f2b58c3
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/Logger.java
@@ -0,0 +1,132 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+package org.eclipse.wst.dtd.core;
+
+import java.util.StringTokenizer;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.core.runtime.Status;
+
+/**
+ * Small convenience class to log messages to plugin's log file and also, if
+ * desired, the console. This class should only be used by classes in this
+ * plugin. Other plugins should make their own copy, with appropriate ID.
+ */
+public class Logger {
+	public static final int ERROR = IStatus.ERROR; // 4
+	public static final int ERROR_DEBUG = 200 + ERROR;
+	private static Plugin fPlugin = DTDPlugin.getInstance();
+	private static final String fPluginId = fPlugin.getDescriptor().getUniqueIdentifier();
+	public static final int INFO = IStatus.INFO; // 1
+	public static final int INFO_DEBUG = 200 + INFO;
+
+	public static final int OK = IStatus.OK; // 0
+
+	public static final int OK_DEBUG = 200 + OK;
+
+	private static final String TRACEFILTER_LOCATION = "/debug/tracefilter"; //$NON-NLS-1$
+	public static final int WARNING = IStatus.WARNING; // 2
+	public static final int WARNING_DEBUG = 200 + WARNING;
+
+	/**
+	 * Adds message to log.
+	 * 
+	 * @param level
+	 *            severity level of the message (OK, INFO, WARNING, ERROR,
+	 *            OK_DEBUG, INFO_DEBUG, WARNING_DEBUG, ERROR_DEBUG)
+	 * @param message
+	 *            text to add to the log
+	 * @param exception
+	 *            exception thrown
+	 */
+	protected static void _log(int level, String message, Throwable exception) {
+		if (level == OK_DEBUG || level == INFO_DEBUG || level == WARNING_DEBUG || level == ERROR_DEBUG) {
+			if (!fPlugin.isDebugging())
+				return;
+		}
+
+		int severity = IStatus.OK;
+		switch (level) {
+			case INFO_DEBUG :
+			case INFO :
+				severity = IStatus.INFO;
+				break;
+			case WARNING_DEBUG :
+			case WARNING :
+				severity = IStatus.WARNING;
+				break;
+			case ERROR_DEBUG :
+			case ERROR :
+				severity = IStatus.ERROR;
+		}
+		Status statusObj = new Status(severity, fPluginId, severity, message, exception);
+		fPlugin.getLog().log(statusObj);
+	}
+
+	/**
+	 * Prints message to log if category matches /debug/tracefilter option.
+	 * 
+	 * @param message
+	 *            text to print
+	 * @param category
+	 *            category of the message, to be compared with
+	 *            /debug/tracefilter
+	 */
+	protected static void _trace(String category, String message, Throwable exception) {
+		if (!fPlugin.isDebugging())
+			return;
+
+		String traceFilter = Platform.getDebugOption(fPluginId + TRACEFILTER_LOCATION);
+		if (traceFilter != null) {
+			StringTokenizer tokenizer = new StringTokenizer(traceFilter, ","); //$NON-NLS-1$
+			while (tokenizer.hasMoreTokens()) {
+				String cat = tokenizer.nextToken().trim();
+				if (category.equals(cat)) {
+					Status statusObj = new Status(IStatus.OK, fPluginId, IStatus.OK, message, exception);
+					fPlugin.getLog().log(statusObj);
+					return;
+				}
+			}
+		}
+	}
+
+	public static void log(int level, String message) {
+		_log(level, message, null);
+	}
+
+	public static void log(int level, String message, Throwable exception) {
+		_log(level, message, exception);
+	}
+
+	public static void logException(String message, Throwable exception) {
+		_log(ERROR, message, exception);
+	}
+
+	public static void logException(Throwable exception) {
+		_log(ERROR, exception.getMessage(), exception);
+	}
+
+	public static void trace(String category, String message) {
+		_trace(category, message, null);
+	}
+
+	public static void traceException(String category, String message, Throwable exception) {
+		_trace(category, message, exception);
+	}
+
+	public static void traceException(String category, Throwable exception) {
+		_trace(category, exception.getMessage(), exception);
+	}
+}
diff --git a/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/NamedTopLevelNode.java b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/NamedTopLevelNode.java
new file mode 100644
index 0000000..56ba63a
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/NamedTopLevelNode.java
@@ -0,0 +1,134 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+package org.eclipse.wst.dtd.core;
+
+import org.eclipse.wst.dtd.core.internal.text.RegionIterator;
+import org.eclipse.wst.dtd.core.parser.DTDRegionTypes;
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegion;
+import org.eclipse.wst.sse.core.text.ITextRegion;
+
+
+// interface for nodes that can exist at the top level in a dtdfile
+// eg. entity, notation, element, comment, attlist, or unrecognized stuff (ie
+// <junk dkfjdl>
+public abstract class NamedTopLevelNode extends TopLevelNode {
+
+	private String tagStartType;
+
+	public NamedTopLevelNode(DTDFile dtdFile, IStructuredDocumentRegion flatNode, String type) {
+		super(dtdFile, flatNode);
+		tagStartType = type;
+	}
+
+	public ITextRegion getNameRegion() {
+		// name region is located after the whitespace (which is after
+		// the elementtag
+		RegionIterator iter = iterator();
+		ITextRegion startTag = getNextRegion(iter, tagStartType);
+
+		if (!iter.hasNext()) {
+			return null;
+		}
+
+		ITextRegion region = iter.next();
+		if (!region.getType().equals(DTDRegionTypes.WHITESPACE)) {
+			return null;
+		}
+
+		if (!iter.hasNext()) {
+			return null;
+		}
+
+		region = iter.next();
+		if (region.getType().equals(DTDRegionTypes.NAME)) {
+			return region;
+		}
+
+		// we normally stop here, but for entities, we have to see if we are
+		// at a '%'. if so, we skip that and find the name after the
+		// whitespace again
+		if (tagStartType == DTDRegionTypes.ENTITY_TAG && region.getType().equals(DTDRegionTypes.PERCENT) && iter.hasNext()) {
+			region = iter.next();
+
+			if (!region.getType().equals(DTDRegionTypes.WHITESPACE)) {
+				return null;
+			}
+
+			if (!iter.hasNext()) {
+				return null;
+			}
+
+			region = iter.next();
+			if (region.getType().equals(DTDRegionTypes.NAME)) {
+				return region;
+			}
+		}
+
+		return null;
+	}
+
+	public ITextRegion getStartTag(RegionIterator iter) {
+		return getNextRegion(iter, tagStartType);
+	}
+
+	public ITextRegion getWhitespaceAfterName() {
+		ITextRegion nameRegion = getNameRegion();
+		RegionIterator iter = iterator();
+		// skip past the element tag region
+		ITextRegion elementTagRegion = getNextRegion(iter, tagStartType);
+		boolean foundName = false;
+		while (iter.hasNext()) {
+			ITextRegion region = iter.next();
+			if (!foundName && nameRegion != null && region == nameRegion) {
+				foundName = true;
+			}
+
+			if (region.getType().equals(DTDRegionTypes.WHITESPACE)) {
+				// there is no name region or we have already passed it
+				if (nameRegion == null || foundName) {
+					return region;
+				}
+			}
+		}
+		return null;
+	}
+
+	public void setName(Object requestor, String name) {
+		ITextRegion nameRegion = getNameRegion();
+		if (nameRegion != null) {
+			super.setName(requestor, name);
+		} else {
+			RegionIterator iter = iterator();
+			ITextRegion elementTagRegion = getNextRegion(iter, tagStartType);
+			int replaceLength = 0;
+			if (iter.hasNext()) {
+				ITextRegion region = iter.next();
+				if (region.getType().equals(DTDRegionTypes.WHITESPACE)) {
+					if (region.getLength() >= 2) {
+						// there are 2 spaces between 'ELEMENT' and the
+						// content
+						// Change replace length to 1 so that the new name and
+						// the content are separated by a single space
+						replaceLength = 1;
+					}
+				}
+			}
+
+			//      beginRecording(requestor, "Name Change");
+			String newText = " " + name; //$NON-NLS-1$
+			replaceText(requestor, getStructuredDocumentRegion().getEndOffset(elementTagRegion), replaceLength, newText);
+			//      endRecording(requestor);
+		}
+	}
+
+}
diff --git a/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/NodeList.java b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/NodeList.java
new file mode 100644
index 0000000..863dfb7
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/NodeList.java
@@ -0,0 +1,93 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+package org.eclipse.wst.dtd.core;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.wst.dtd.core.parser.DTDRegionTypes;
+
+
+public class NodeList {
+	protected DTDFile dtdFile;
+
+	ArrayList listNodes = new ArrayList();
+
+	protected String listType;
+
+	public NodeList(DTDFile dtdFile, String tokenType) {
+		listType = tokenType;
+		this.dtdFile = dtdFile;
+	}
+
+	public Image getImage() {
+		if (listType == DTDRegionTypes.ELEMENT_TAG) {
+			return DTDPlugin.getInstance().getImage(DTDResource.FLDR_EL);
+		} else if (listType == DTDRegionTypes.ENTITY_TAG) {
+			return DTDPlugin.getInstance().getImage(DTDResource.FLDR_ENT);
+		} else if (listType == DTDRegionTypes.NOTATION_TAG) {
+			return DTDPlugin.getInstance().getImage(DTDResource.FLDR_NOT);
+		} else if (listType == DTDRegionTypes.COMMENT_START) {
+			return DTDPlugin.getInstance().getImage(DTDResource.FLDR_COMM);
+		} else if (listType == DTDRegionTypes.ATTLIST_TAG) {
+			return DTDPlugin.getInstance().getImage(DTDResource.FLDR_ATTLIST);
+		} else if (listType == DTDRegionTypes.UNKNOWN_CONTENT) {
+			return DTDPlugin.getInstance().getImage(DTDResource.FLDR_UNREC);
+		} else
+			return null;
+	}
+
+	public String getListType() {
+		return listType;
+	}
+
+	public String getName() {
+		if (listType == DTDRegionTypes.ELEMENT_TAG) {
+			return DTDPlugin.getDTDString("_UI_LABEL_NODE_LIST_ELEMENTS"); //$NON-NLS-1$
+		} else if (listType == DTDRegionTypes.ENTITY_TAG) {
+			return DTDPlugin.getDTDString("_UI_LABEL_NODE_LIST_ENTITIES"); //$NON-NLS-1$
+		} else if (listType == DTDRegionTypes.NOTATION_TAG) {
+			return DTDPlugin.getDTDString("_UI_LABEL_NODE_LIST_NOTATIONS"); //$NON-NLS-1$
+		} else if (listType == DTDRegionTypes.COMMENT_START) {
+			return DTDPlugin.getDTDString("_UI_LABEL_NODE_LIST_COMMENTS"); //$NON-NLS-1$
+		} else if (listType == DTDRegionTypes.ATTLIST_TAG) {
+			return DTDPlugin.getDTDString("_UI_LABEL_NODE_LIST_ATTRIBUTES"); //$NON-NLS-1$
+		} else if (listType == DTDRegionTypes.UNKNOWN_CONTENT) {
+			return DTDPlugin.getDTDString("_UI_LABEL_NODE_LIST_OTHER"); //$NON-NLS-1$
+		}
+		return ""; //$NON-NLS-1$
+	}
+
+	public ArrayList getNodes() {
+		listNodes.clear();
+		Iterator iter = dtdFile.getNodes().iterator();
+		while (iter.hasNext()) {
+			DTDNode node = (DTDNode) iter.next();
+			if (listType == DTDRegionTypes.ELEMENT_TAG && (node instanceof Element || node instanceof ParameterEntityReference)) {
+				listNodes.add(node);
+			} else if (listType == DTDRegionTypes.ATTLIST_TAG && node instanceof AttributeList) {
+				listNodes.add(node);
+			} else if (listType == DTDRegionTypes.ENTITY_TAG && node instanceof Entity) {
+				listNodes.add(node);
+			} else if (listType == DTDRegionTypes.NOTATION_TAG && node instanceof Notation) {
+				listNodes.add(node);
+			} else if (listType == DTDRegionTypes.COMMENT_START && node instanceof Comment) {
+				listNodes.add(node);
+			} else if (listType == DTDRegionTypes.UNKNOWN_CONTENT && node instanceof Unrecognized) {
+				listNodes.add(node);
+			}
+		}
+		return listNodes;
+	}
+}
diff --git a/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/Notation.java b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/Notation.java
new file mode 100644
index 0000000..05d75df
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/Notation.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+package org.eclipse.wst.dtd.core;
+
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.wst.dtd.core.parser.DTDRegionTypes;
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegion;
+
+
+public class Notation extends ExternalNode {
+
+	public Notation(DTDFile file, IStructuredDocumentRegion flatNode) {
+		super(file, flatNode, DTDRegionTypes.NOTATION_TAG);
+	}
+
+	public Image getImage() {
+		return DTDPlugin.getInstance().getImage(DTDResource.NOTATIONICON);
+	}
+}
diff --git a/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/ParameterEntityReference.java b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/ParameterEntityReference.java
new file mode 100644
index 0000000..4af2336
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/ParameterEntityReference.java
@@ -0,0 +1,113 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+package org.eclipse.wst.dtd.core;
+
+import java.util.List;
+
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.wst.dtd.core.internal.text.RegionIterator;
+import org.eclipse.wst.dtd.core.parser.DTDRegionTypes;
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegion;
+import org.eclipse.wst.sse.core.text.ITextRegion;
+
+
+public class ParameterEntityReference extends NamedTopLevelNode {
+
+
+
+	public class StartEndPair {
+		public int startOffset, endOffset;
+	}
+
+	private Entity cachedEntity = null;
+
+	public ParameterEntityReference(DTDFile file, IStructuredDocumentRegion flatNode) {
+		super(file, flatNode, DTDRegionTypes.COMMENT_START);
+	}
+
+	public Entity getEntityObject() {
+		if (cachedEntity != null && !cachedEntity.getName().equals(getReferencedEntity())) {
+			// if we have a cached entity, but the name doesnt match,
+			// null it now, so we perform a lookup
+			cachedEntity = null;
+		}
+
+		if (cachedEntity == null) {
+			List nodes = getDTDFile().getNodes();
+			for (int i = 0; i < nodes.size(); i++) {
+				DTDNode node = (DTDNode) nodes.get(i);
+				if (node instanceof Entity) {
+					Entity entity = (Entity) node;
+					if (entity.isParameterEntity() && entity.getName().equals(getReferencedEntity())) {
+						cachedEntity = entity;
+					}
+				}
+			}
+		}
+		return cachedEntity;
+	}
+
+	public Image getImage() {
+		return DTDPlugin.getInstance().getImage(DTDResource.ENTITYREFERENCEICON);
+	}
+
+	public String getName() {
+		return getStructuredDocumentRegion().getText();
+	}
+
+	public String getReferencedEntity() {
+		String text = getName();
+		return getName().substring(1, text.length() - 1);
+	}
+
+	private void getStartAndEndOffsetForText(StartEndPair pair) {
+		RegionIterator iter = iterator();
+		ITextRegion commentStartTag = getStartTag(iter);
+		ITextRegion endCommentTag = getNextRegion(iter, DTDRegionTypes.COMMENT_END);
+		pair.endOffset = getStructuredDocumentRegion().getEndOffset();
+		if (commentStartTag != null) {
+			pair.startOffset = getStructuredDocumentRegion().getEndOffset(commentStartTag);
+		}
+		if (endCommentTag != null) {
+			pair.endOffset = getStructuredDocumentRegion().getEndOffset(endCommentTag);
+		}
+	}
+
+	public String getText() {
+		String text = getStructuredDocumentRegion().getText();
+		int flatNodeStart = getStructuredDocumentRegion().getStartOffset();
+		StartEndPair pair = new StartEndPair();
+		getStartAndEndOffsetForText(pair);
+		return text.substring(pair.startOffset - flatNodeStart, pair.endOffset - flatNodeStart);
+	}
+
+	public void setReferencedEntity(Object requestor, String name) {
+		replaceText(requestor, getStructuredDocumentRegion().getStartOffset(), getStructuredDocumentRegion().getLength(), "%" + name + ";"); //$NON-NLS-1$ //$NON-NLS-2$
+	}
+
+	public void setReferencedEntity(String name) {
+		beginRecording(this, DTDPlugin.getDTDString("_UI_LABEL_PARM_ENTITY_REF_CHG_ENTITY_REF")); //$NON-NLS-1$
+		setReferencedEntity(this, name);
+		endRecording(this);
+	}
+
+	public void setText(String newText) {
+		beginRecording(this, DTDPlugin.getDTDString("_UI_LABEL_PARM_ENTITY_REF_COMMENT_CHG")); //$NON-NLS-1$
+		int flatNodeStart = getStructuredDocumentRegion().getStartOffset();
+		StartEndPair pair = new StartEndPair();
+		getStartAndEndOffsetForText(pair);
+		replaceText(this, pair.startOffset, pair.endOffset - pair.startOffset, newText);
+		endRecording(this);
+	}
+
+}
diff --git a/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/TopLevelNode.java b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/TopLevelNode.java
new file mode 100644
index 0000000..44e67b4
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/TopLevelNode.java
@@ -0,0 +1,84 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+package org.eclipse.wst.dtd.core;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import org.eclipse.wst.dtd.core.internal.text.RegionIterator;
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegion;
+import org.eclipse.wst.sse.core.text.ITextRegion;
+
+
+// interface for nodes that can exist at the top level in a dtdfile
+// eg. entity, notation, element, comment, attlist, or unrecognized stuff (ie
+// <junk dkfjdl>
+public abstract class TopLevelNode extends DTDNode {
+
+	private ArrayList flatNodes = new ArrayList();
+
+	public TopLevelNode(DTDFile dtdFile, IStructuredDocumentRegion flatNode) {
+		super(dtdFile, flatNode);
+		flatNodes.add(flatNode);
+	}
+
+	public void addWhitespaceStructuredDocumentRegion(IStructuredDocumentRegion node) {
+		flatNodes.add(node);
+	}
+
+	// specialize this so we delete the objects flat node range
+	// AND any whitespace
+	public void delete() {
+		beginRecording(getDTDFile(), DTDPlugin.getDTDString("_UI_LABEL_TOP_LEVEL_NODE_DELETE")); //$NON-NLS-1$
+		IStructuredDocumentRegion first = (IStructuredDocumentRegion) flatNodes.get(0);
+		IStructuredDocumentRegion last = (IStructuredDocumentRegion) flatNodes.get(flatNodes.size() - 1);
+		int startOffset = first.getStartOffset();
+		int endOffset = last.getEndOffset();
+
+		replaceText(getDTDFile(), startOffset, endOffset - startOffset, ""); //$NON-NLS-1$
+		endRecording(getDTDFile());
+	}
+
+	public ITextRegion getEndRegion() {
+		int size = flatNode.getRegions().size();
+		if (size > 0) {
+			return flatNode.getRegions().get(size - 1);
+		}
+		return null;
+	}
+
+	// includes what gettext gives us plus any whitespace
+	// trailing it
+	public String getFullText() {
+		StringBuffer sb = new StringBuffer();
+		Iterator iter = flatNodes.iterator();
+		while (iter.hasNext()) {
+			IStructuredDocumentRegion fNode = (IStructuredDocumentRegion) iter.next();
+			sb.append(fNode.getText());
+		}
+		return sb.toString();
+	}
+
+	public ITextRegion getStartRegion() {
+		if (flatNode.getRegions().size() > 0) {
+			return flatNode.getRegions().get(0);
+		}
+		return null;
+	}
+
+	public RegionIterator iterator() {
+		//    System.out.println("create region iter " + this.getClass() + " with
+		// start , end = " + getStartOffset() + ", " +getEndOffset());
+		return new RegionIterator(flatNode, getStartOffset(), getEndOffset());
+	}
+}
diff --git a/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/Unrecognized.java b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/Unrecognized.java
new file mode 100644
index 0000000..0ca7997
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/Unrecognized.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+package org.eclipse.wst.dtd.core;
+
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegion;
+
+
+public class Unrecognized extends TopLevelNode {
+
+	public Unrecognized(DTDFile file, IStructuredDocumentRegion flatNode) {
+		super(file, flatNode);
+	}
+
+	public Image getImage() {
+		return DTDPlugin.getInstance().getImage(DTDResource.UNRECOGNIZEDICON);
+	}
+
+	public String getName() {
+		String text = getStructuredDocumentRegion().getText();
+		if (text.length() <= 30) {
+			return text;
+		} else {
+			return text.substring(0, 29) + "..."; //$NON-NLS-1$
+		}
+	}
+
+}
diff --git a/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/builder/delegates/DTDTaskTagSeeker.java b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/builder/delegates/DTDTaskTagSeeker.java
new file mode 100644
index 0000000..558534c
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/builder/delegates/DTDTaskTagSeeker.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+package org.eclipse.wst.dtd.core.builder.delegates;
+
+import org.eclipse.wst.dtd.core.parser.DTDRegionTypes;
+import org.eclipse.wst.sse.core.participants.TaskTagSeeker;
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegion;
+import org.eclipse.wst.sse.core.text.ITextRegion;
+
+
+public class DTDTaskTagSeeker extends TaskTagSeeker {
+	protected boolean isCommentRegion(IStructuredDocumentRegion region, ITextRegion textRegion) {
+		return textRegion.getType().equals(DTDRegionTypes.COMMENT_CONTENT);
+	}
+}
diff --git a/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/builder/participants/DTDTaskTagParticipant.java b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/builder/participants/DTDTaskTagParticipant.java
new file mode 100644
index 0000000..9daa805
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/builder/participants/DTDTaskTagParticipant.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+package org.eclipse.wst.dtd.core.builder.participants;
+
+import org.eclipse.wst.dtd.core.parser.DTDRegionTypes;
+import org.eclipse.wst.sse.core.participants.TaskTagParticipant;
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegion;
+import org.eclipse.wst.sse.core.text.ITextRegion;
+
+
+public class DTDTaskTagParticipant extends TaskTagParticipant {
+	protected boolean isCommentRegion(IStructuredDocumentRegion region, ITextRegion textRegion) {
+		return textRegion.getType().equals(DTDRegionTypes.COMMENT_CONTENT);
+	}
+}
diff --git a/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/content/ContentDescriberForDTD.java b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/content/ContentDescriberForDTD.java
new file mode 100644
index 0000000..fa4c731
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/content/ContentDescriberForDTD.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+package org.eclipse.wst.dtd.core.content;
+
+import org.eclipse.core.runtime.content.ITextContentDescriber;
+import org.eclipse.wst.common.encoding.AbstractContentDescriber;
+import org.eclipse.wst.common.encoding.IResourceCharsetDetector;
+import org.eclipse.wst.xml.core.contenttype.XMLResourceEncodingDetector;
+
+
+
+
+public class ContentDescriberForDTD extends AbstractContentDescriber implements ITextContentDescriber {
+
+	// same rules as for XML
+	protected IResourceCharsetDetector getDetector() {
+		return new XMLResourceEncodingDetector();
+	}
+
+}
diff --git a/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/document/DTDModel.java b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/document/DTDModel.java
new file mode 100644
index 0000000..b04cf2c
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/document/DTDModel.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+/*
+ * Created on 28-Aug-03
+ *
+ * To change the template for this generated file go to
+ * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
+ */
+package org.eclipse.wst.dtd.core.document;
+
+/**
+ * @author kboo
+ * 
+ * To change the template for this generated type comment go to
+ * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
+ */
+public interface DTDModel {
+
+}
diff --git a/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/document/DTDModelImpl.java b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/document/DTDModelImpl.java
new file mode 100644
index 0000000..287d51d
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/document/DTDModelImpl.java
@@ -0,0 +1,273 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+package org.eclipse.wst.dtd.core.document;
+
+import java.io.File;
+import java.util.Iterator;
+import java.util.Vector;
+
+import org.eclipse.wst.dtd.core.DTDFile;
+import org.eclipse.wst.dtd.core.DTDNode;
+import org.eclipse.wst.dtd.core.Entity;
+import org.eclipse.wst.dtd.core.NodeList;
+import org.eclipse.wst.dtd.core.event.IDTDFileListener;
+import org.eclipse.wst.dtd.core.event.NodesEvent;
+import org.eclipse.wst.dtd.core.util.DTDReferenceUpdater;
+import org.eclipse.wst.dtd.core.util.LabelValuePair;
+import org.eclipse.wst.sse.core.AbstractStructuredModel;
+import org.eclipse.wst.sse.core.IndexedRegion;
+import org.eclipse.wst.sse.core.events.IStructuredDocumentListener;
+import org.eclipse.wst.sse.core.events.NewDocumentEvent;
+import org.eclipse.wst.sse.core.events.NoChangeEvent;
+import org.eclipse.wst.sse.core.events.RegionChangedEvent;
+import org.eclipse.wst.sse.core.events.RegionsReplacedEvent;
+import org.eclipse.wst.sse.core.events.StructuredDocumentEvent;
+import org.eclipse.wst.sse.core.events.StructuredDocumentRegionsReplacedEvent;
+import org.eclipse.wst.sse.core.text.IStructuredDocument;
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegion;
+
+
+public final class DTDModelImpl extends AbstractStructuredModel implements IStructuredDocumentListener, DTDModel {
+
+	public static boolean deleteFile(String fileName) {
+		boolean result = false;
+
+		// create the temp File object
+		File file = new File(fileName);
+		if (file.exists())
+			result = file.delete();
+		return result;
+	}
+
+	private DTDFile document;
+
+	//private List errorMessages = new ArrayList();
+
+	// entity reference names found in the conditional IGNORE sections
+	private Vector ignoredEntityRefs;
+
+	private boolean refreshRequired = false;
+
+	protected DTDReferenceUpdater refUpdater = new DTDReferenceUpdater();
+
+	public DTDModelImpl() {
+		super();
+		document = new DTDFile(this);
+		document.addDTDFileListener(new IDTDFileListener() {
+
+			public void nodeChanged(DTDNode node) {
+				if (node instanceof Entity) {
+					Entity entity = (Entity) node;
+					if (entity.isParameterEntity() && entity.isExternalEntity()) {
+						// just say they have changed for now
+						setReferencedModelsChanged();
+					}
+				}
+			}
+
+			public void nodesAdded(NodesEvent event) {
+				checkIfExternalReferencesChanged(event);
+			}
+
+			public void nodesRemoved(NodesEvent event) {
+				checkIfExternalReferencesChanged(event);
+			}
+		});
+	}
+
+	public void beginRecording(Object requester, String label) {
+		super.beginRecording(requester, label);
+		// clear reference updater cache
+		getReferenceUpdater().clearCache();
+	}
+
+	private void checkIfExternalReferencesChanged(NodesEvent event) {
+		Iterator iter = event.getNodes().iterator();
+		while (iter.hasNext()) {
+			DTDNode node = (DTDNode) iter.next();
+			if (node instanceof Entity) {
+				Entity entity = (Entity) node;
+				if (entity.isParameterEntity() && entity.isExternalEntity()) {
+					// just say they have changed for now
+					setReferencedModelsChanged();
+				}
+			}
+		}
+	}
+
+	//
+	// The following function helps determine the list of things that
+	// can be used in a parameter entity reference content
+	// Optional parameter is to allow the currently used DTDEntity to
+	// be included in the combobox.
+	//
+	public LabelValuePair[] createParmEntityContentItems(Entity entity) {
+		NodeList entities = getDTDFile().getEntities();
+
+		Vector items = new Vector();
+
+		if (entity != null) {
+			String name = "%" + entity.getName() + ";"; //$NON-NLS-1$ //$NON-NLS-2$
+			items.addElement(new LabelValuePair(name, name));
+		}
+
+		for (Iterator i = entities.getNodes().iterator(); i.hasNext();) {
+			Entity entityAt = (Entity) i.next();
+			if (entityAt.isParameterEntity() && entityAt.isExternalEntity()) {
+				String name = "%" + entityAt.getName() + ";"; //$NON-NLS-1$ //$NON-NLS-2$
+				items.addElement(new LabelValuePair(name, name));
+			}
+		}
+		LabelValuePair[] comboArray = new LabelValuePair[items.size()];
+		items.copyInto(comboArray);
+		return comboArray;
+	}
+
+	public void endRecording(Object requester) {
+		super.endRecording(requester);
+		// clear reference updater cache
+		getReferenceUpdater().clearCache();
+	}
+
+
+	public DTDFile getDTDFile() {
+		return document;
+	}
+
+	// Returns entity reference names that are in
+	// the conditional IGNORE sections.
+	public Vector getIgnoredEntityRefs() {
+		if (ignoredEntityRefs == null)
+			ignoredEntityRefs = new Vector();
+		return ignoredEntityRefs;
+	}
+
+	public IndexedRegion getIndexedRegion(int offset) {
+		if (this.document == null)
+			return null;
+		//    System.out.println("getNode at " + offset + " returning = " +
+		// this.document.getNodeAt(offset));
+
+		return this.document.getNodeAt(offset);
+	}
+
+	public DTDReferenceUpdater getReferenceUpdater() {
+		return refUpdater;
+	}
+
+	public boolean isReferencedModelsChanged() {
+		return refreshRequired;
+	}
+
+	public boolean isRefreshRequired() {
+		return refreshRequired;
+	}
+
+	public void newModel(NewDocumentEvent flatModelEvent) {
+		document.newModel(flatModelEvent);
+		//    System.out.println("\nnewmodel");
+		outputStructuredDocument(flatModelEvent);
+	}
+
+	public void noChange(NoChangeEvent flatModelEvent) {
+		//    System.out.println("\nnochange");
+		outputStructuredDocument(flatModelEvent);
+
+	}
+
+	public void nodesReplaced(StructuredDocumentRegionsReplacedEvent flatModelEvent) {
+		//    System.out.println("\nnodesreplaced");
+		document.nodesReplaced(flatModelEvent);
+		outputStructuredDocument(flatModelEvent);
+
+	}
+
+	public void outputStructuredDocument(StructuredDocumentEvent flatModelEvent) {
+		//      System.out.println("structuredDocument source = '" +
+		// flatModelEvent.getStructuredDocument().getText() + "'");
+		//      System.out.println("new String = '" +
+		// flatModelEvent.getOriginalChanges() +"'");
+		//      System.out.println("deleted String = '" +
+		// flatModelEvent.getDeletedText() +"'");
+		//      Enumeration e =
+		// flatModelEvent.getStructuredDocument().getNodes().elements();
+		//      int i = 0;
+		//      for (; e.hasMoreElements(); i++)
+		//      {
+		//        BasicStructuredDocumentRegion node =
+		// (BasicStructuredDocumentRegion) e.nextElement();
+		//        outputStructuredDocumentRegion(node);
+		//        System.out.println(" " + i +". " + node.hashCode() + " '"
+		// +node.getText() + "'");
+		//        }
+	}
+
+	public void outputStructuredDocumentRegion(IStructuredDocumentRegion flatNode) {
+		//      int size = flatNode.getNumberOfRegions();
+		//      for (int i = 0; i < size; i++)
+		//      {
+		//        Region region = (Region) flatNode.getRegions().get(i);
+		//        System.out.println(i + ". " + region.getType());
+
+		//      } // end of for ()
+
+	}
+
+	public void regionChanged(RegionChangedEvent flatModelEvent) {
+		//    System.out.println("\nregion changed");
+		document.regionChanged(flatModelEvent);
+		//      System.out.println("= " +
+		// flatModelEvent.getStructuredDocumentRegion().getText());
+		//      System.out.println("region changed " +
+		// flatModelEvent.getRegion().hashCode() + " = " +
+		// flatModelEvent.getRegion());
+
+		outputStructuredDocument(flatModelEvent);
+	}
+
+	public void regionsReplaced(RegionsReplacedEvent flatModelEvent) {
+		//    System.out.println("\nregion replaced");
+		document.regionsReplaced(flatModelEvent);
+		outputStructuredDocument(flatModelEvent);
+	}
+
+	public void setReferencedModelsChanged() {
+		refreshRequired = true;
+	}
+
+	public void setRefreshRequired(boolean value) {
+		refreshRequired = value;
+	}
+
+
+	/**
+	 * @param newStructuredDocument
+	 *            com.ibm.sed.structured.text.IStructuredDocument
+	 */
+	public void setStructuredDocument(IStructuredDocument newStructuredDocument) {
+		IStructuredDocument oldStructuredDocument = super.getStructuredDocument();
+		if (newStructuredDocument == oldStructuredDocument)
+			return; // noting to do
+
+		if (oldStructuredDocument != null)
+			oldStructuredDocument.removeDocumentChangingListener(this);
+		super.setStructuredDocument(newStructuredDocument);
+		if (newStructuredDocument.getLength() > 0) {
+			newModel(new NewDocumentEvent(newStructuredDocument, this));
+		}
+		if (newStructuredDocument != null)
+			newStructuredDocument.addDocumentChangingListener(this);
+		document.setStructuredDocument(newStructuredDocument);
+	}
+
+}
diff --git a/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/encoding/DTDDocumentCharsetDetector.java b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/encoding/DTDDocumentCharsetDetector.java
new file mode 100644
index 0000000..9cd2207
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/encoding/DTDDocumentCharsetDetector.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+/*
+ * Created on 28-Aug-03
+ * 
+ * To change the template for this generated file go to
+ * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
+ */
+package org.eclipse.wst.dtd.core.encoding;
+
+import java.io.IOException;
+
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.wst.common.encoding.AbstractResourceEncodingDetector;
+import org.eclipse.wst.sse.core.document.DocumentReader;
+import org.eclipse.wst.sse.core.document.IDocumentCharsetDetector;
+import org.eclipse.wst.xml.core.encoding.XMLDocumentCharsetDetector;
+
+
+/**
+ * @author kboo
+ * 
+ * To change the template for this generated type comment go to
+ * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
+ */
+public final class DTDDocumentCharsetDetector extends AbstractResourceEncodingDetector implements IDocumentCharsetDetector {
+
+	public String getSpecDefaultEncoding() {
+		// by default, UTF-8 as per XML spec
+		final String enc = "UTF-8"; //$NON-NLS-1$
+		return enc;
+	}
+
+	/**
+	 *  
+	 */
+
+	protected void parseInput() throws IOException {
+		IDocumentCharsetDetector documentEncodingDetector = new XMLDocumentCharsetDetector();
+		documentEncodingDetector.set(fReader);
+		fEncodingMemento = documentEncodingDetector.getEncodingMemento();
+
+	}
+
+	public void set(IDocument document) {
+		set(new DocumentReader(document, 0));
+
+
+	}
+
+}
diff --git a/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/encoding/DTDDocumentLoader.java b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/encoding/DTDDocumentLoader.java
new file mode 100644
index 0000000..fff661c
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/encoding/DTDDocumentLoader.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+package org.eclipse.wst.dtd.core.encoding;
+
+import org.eclipse.jface.text.IDocumentPartitioner;
+import org.eclipse.wst.dtd.core.internal.text.DTDStructuredDocumentReParser;
+import org.eclipse.wst.dtd.core.parser.DTDRegionParser;
+import org.eclipse.wst.dtd.core.rules.StructuredTextPartitionerForDTD;
+import org.eclipse.wst.sse.core.document.AbstractDocumentLoader;
+import org.eclipse.wst.sse.core.document.IDocumentCharsetDetector;
+import org.eclipse.wst.sse.core.document.IEncodedDocument;
+import org.eclipse.wst.sse.core.document.StructuredDocumentFactory;
+import org.eclipse.wst.sse.core.internal.text.BasicStructuredDocument;
+import org.eclipse.wst.sse.core.parser.RegionParser;
+import org.eclipse.wst.sse.core.text.IStructuredDocument;
+
+
+public final class DTDDocumentLoader extends AbstractDocumentLoader {
+
+	public DTDDocumentLoader() {
+		super();
+	}
+
+	public IDocumentPartitioner getDefaultDocumentPartitioner() {
+		return new StructuredTextPartitionerForDTD();
+	}
+
+	public IDocumentCharsetDetector getDocumentEncodingDetector() {
+		if (fDocumentEncodingDetector == null) {
+			fDocumentEncodingDetector = new DTDDocumentCharsetDetector();
+		}
+		return fDocumentEncodingDetector;
+	}
+
+	public RegionParser getParser() {
+		return new DTDRegionParser();
+	}
+
+	protected String getSpecDefaultEncoding() {
+		String enc = "UTF-8"; //$NON-NLS-1$
+		return enc;
+	}
+
+	protected IEncodedDocument newEncodedDocument() {
+		// Copied from com.ibm.etools.dtd.sed.model.DTDLoader
+		IStructuredDocument document = StructuredDocumentFactory.getNewStructuredDocumentInstance(getParser());
+		DTDStructuredDocumentReParser reParser = new DTDStructuredDocumentReParser();
+		reParser.setStructuredDocument(document);
+		if (document instanceof BasicStructuredDocument) {
+			((BasicStructuredDocument) document).setReParser(reParser);
+		}
+		return document;
+	}
+
+}
diff --git a/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/event/IDTDFileListener.java b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/event/IDTDFileListener.java
new file mode 100644
index 0000000..235b60a
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/event/IDTDFileListener.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+package org.eclipse.wst.dtd.core.event;
+
+import org.eclipse.wst.dtd.core.DTDNode;
+
+public interface IDTDFileListener {
+
+	public void nodeChanged(DTDNode node);
+
+	public void nodesAdded(NodesEvent event);
+
+	public void nodesRemoved(NodesEvent event);
+}
diff --git a/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/event/NodesEvent.java b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/event/NodesEvent.java
new file mode 100644
index 0000000..ceaca1f
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/event/NodesEvent.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+package org.eclipse.wst.dtd.core.event;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.wst.dtd.core.DTDNode;
+
+
+public final class NodesEvent {
+	private ArrayList changedNodes = new ArrayList();
+
+	public void add(DTDNode changedNode) {
+		changedNodes.add(changedNode);
+	}
+
+	public List getNodes() {
+		return changedNodes;
+	}
+
+}
diff --git a/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/internal/text/DTDStructuredDocumentReParser.java b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/internal/text/DTDStructuredDocumentReParser.java
new file mode 100644
index 0000000..b4d24ea
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/internal/text/DTDStructuredDocumentReParser.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+package org.eclipse.wst.dtd.core.internal.text;
+
+import org.eclipse.wst.sse.core.events.StructuredDocumentEvent;
+import org.eclipse.wst.sse.core.internal.text.StructuredDocumentReParser;
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegion;
+import org.eclipse.wst.sse.core.text.IStructuredTextReParser;
+
+
+public class DTDStructuredDocumentReParser extends StructuredDocumentReParser {
+
+	public StructuredDocumentEvent checkForCrossStructuredDocumentRegionBoundryCases() {
+		IStructuredDocumentRegion startNode = fStructuredDocument.getRegionAtCharacterOffset(fStart);
+		IStructuredDocumentRegion endNode = fStructuredDocument.getRegionAtCharacterOffset(fStart + fLengthToReplace - 1);
+		return reparse(startNode.getStart(), endNode.getEnd());
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.wst.sse.core.internal.text.StructuredDocumentReParser#newInstance()
+	 */
+	public IStructuredTextReParser newInstance() {
+		return new DTDStructuredDocumentReParser();
+	}
+
+	protected StructuredDocumentEvent reparse(IStructuredDocumentRegion dirtyStart, IStructuredDocumentRegion dirtyEnd) {
+		return super.reparse(dirtyStart, dirtyEnd);
+	}
+}
diff --git a/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/internal/text/DTDStructuredDocumentRegionFactory.java b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/internal/text/DTDStructuredDocumentRegionFactory.java
new file mode 100644
index 0000000..816ffac
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/internal/text/DTDStructuredDocumentRegionFactory.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+package org.eclipse.wst.dtd.core.internal.text;
+
+import org.eclipse.wst.sse.core.internal.text.BasicStructuredDocumentRegion;
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegion;
+
+
+public class DTDStructuredDocumentRegionFactory {
+	public static final int DTD_GENERIC = 5;
+
+	public static IStructuredDocumentRegion createStructuredDocumentRegion(int type) {
+		IStructuredDocumentRegion instance = null;
+		switch (type) {
+			case DTD_GENERIC :
+				instance = new BasicStructuredDocumentRegion();
+				break;
+			default :
+				break;
+		}
+		return instance;
+	}
+}
diff --git a/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/internal/text/RegionIterator.java b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/internal/text/RegionIterator.java
new file mode 100644
index 0000000..c363a21
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/internal/text/RegionIterator.java
@@ -0,0 +1,84 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+package org.eclipse.wst.dtd.core.internal.text;
+
+import java.util.NoSuchElementException;
+
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegion;
+import org.eclipse.wst.sse.core.text.ITextRegion;
+import org.eclipse.wst.sse.core.text.ITextRegionList;
+
+
+public class RegionIterator {
+
+	private int currentIndex;
+
+	//private IStructuredDocumentRegion flatNode;
+	private ITextRegionList regions;
+	//private int startOffset, endOffset;
+	private ITextRegion startRegion, endRegion;
+
+	public RegionIterator(IStructuredDocumentRegion node) {
+		this(node, node.getStart(), node.getEnd());
+	}
+
+	public RegionIterator(IStructuredDocumentRegion node, int startOffset, int endOffset) {
+		regions = node.getRegions();
+		startRegion = node.getRegionAtCharacterOffset(startOffset);
+		endRegion = node.getRegionAtCharacterOffset(endOffset - 1);
+
+		for (int i = 0; i < regions.size(); i++) {
+			ITextRegion region = regions.get(i);
+			if (startRegion == region) {
+				currentIndex = i;
+				break;
+			}
+		}
+	}
+
+	public RegionIterator(ITextRegionList regions) {
+		this.regions = regions;
+		startRegion = regions.get(0);
+		endRegion = regions.get(regions.size() - 1);
+		currentIndex = 0;
+		//    this(node, node.getStart(), node.getEnd());
+	}
+
+	public boolean hasNext() {
+		if (currentIndex < regions.size()) {
+			return currentIndex <= regions.indexOf(endRegion);
+		}
+		return false;
+	}
+
+	public boolean hasPrevious() {
+		if (currentIndex >= 0) {
+			return currentIndex >= regions.indexOf(startRegion);
+		}
+		return false;
+	}
+
+	public ITextRegion next() {
+		if (hasNext()) {
+			return regions.get(currentIndex++);
+		}
+		throw new NoSuchElementException();
+	}
+
+	public ITextRegion previous() {
+		if (hasPrevious()) {
+			return regions.get(--currentIndex);
+		}
+		throw new NoSuchElementException();
+	}
+}
diff --git a/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/modelhandler/DTDModelDumper.java b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/modelhandler/DTDModelDumper.java
new file mode 100644
index 0000000..e047697
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/modelhandler/DTDModelDumper.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+package org.eclipse.wst.dtd.core.modelhandler;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.UnsupportedEncodingException;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.wst.common.encoding.EncodingRule;
+import org.eclipse.wst.sse.core.IStructuredModel;
+import org.eclipse.wst.sse.core.ModelDumper;
+
+
+public final class DTDModelDumper implements ModelDumper {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.wst.sse.core.ModelDumper#dump(org.eclipse.wst.sse.core.IStructuredModel,
+	 *      java.io.OutputStream, com.ibm.encoding.resource.EncodingRule,
+	 *      org.eclipse.core.resources.IFile)
+	 */
+	public void dump(IStructuredModel model, OutputStream outputStream, EncodingRule encodingRule, IFile iFile) throws UnsupportedEncodingException, IOException, CoreException {
+		// TODO Auto-generated method stub
+		System.out.println("Implement DTDModelDumper.dump()"); //$NON-NLS-1$
+
+	}
+}
diff --git a/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/modelhandler/DTDModelLoader.java b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/modelhandler/DTDModelLoader.java
new file mode 100644
index 0000000..896c24d
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/modelhandler/DTDModelLoader.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+package org.eclipse.wst.dtd.core.modelhandler;
+
+import org.eclipse.wst.dtd.core.document.DTDModelImpl;
+import org.eclipse.wst.dtd.core.encoding.DTDDocumentLoader;
+import org.eclipse.wst.sse.core.AbstractModelLoader;
+import org.eclipse.wst.sse.core.IStructuredModel;
+import org.eclipse.wst.sse.core.ModelLoader;
+import org.eclipse.wst.sse.core.document.IDocumentLoader;
+
+
+
+public final class DTDModelLoader extends AbstractModelLoader {
+	public DTDModelLoader() {
+		super();
+	}
+
+	public IDocumentLoader getDocumentLoader() {
+		if (documentLoaderInstance == null) {
+			documentLoaderInstance = new DTDDocumentLoader();
+		}
+		return documentLoaderInstance;
+	}
+
+	public ModelLoader newInstance() {
+		return new DTDModelLoader();
+	}
+
+	public IStructuredModel newModel() {
+		IStructuredModel model = new DTDModelImpl();
+		// now done in create
+		//model.setStructuredDocument(createNewStructuredDocument());
+		//model.setFactoryRegistry(defaultFactoryRegistry());
+		return model;
+	}
+}
diff --git a/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/modelhandler/ModelHandlerForDTD.java b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/modelhandler/ModelHandlerForDTD.java
new file mode 100644
index 0000000..2c50a0d
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/modelhandler/ModelHandlerForDTD.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+package org.eclipse.wst.dtd.core.modelhandler;
+
+import org.eclipse.wst.dtd.core.encoding.DTDDocumentCharsetDetector;
+import org.eclipse.wst.dtd.core.encoding.DTDDocumentLoader;
+import org.eclipse.wst.sse.core.ModelLoader;
+import org.eclipse.wst.sse.core.document.IDocumentCharsetDetector;
+import org.eclipse.wst.sse.core.document.IDocumentLoader;
+import org.eclipse.wst.sse.core.modelhandler.AbstractModelHandler;
+import org.eclipse.wst.sse.core.modelhandler.IModelHandler;
+
+
+public final class ModelHandlerForDTD extends AbstractModelHandler implements IModelHandler {
+	private static String AssociatedContentTypeId = "org.eclipse.wst.dtd.core.dtdsource"; //$NON-NLS-1$
+	private static String ModelHandlerID = "org.eclipse.wst.sse.core.handler.dtd"; //$NON-NLS-1$
+
+	public ModelHandlerForDTD() {
+		super();
+		setId(ModelHandlerID);
+		setAssociatedContentTypeId(AssociatedContentTypeId);
+	}
+
+	public IDocumentLoader getDocumentLoader() {
+		return new DTDDocumentLoader();
+	}
+
+	public IDocumentCharsetDetector getEncodingDetector() {
+		return new DTDDocumentCharsetDetector();
+	}
+
+	public ModelLoader getModelLoader() {
+		return new DTDModelLoader();
+	}
+
+}
diff --git a/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/parser/DTDRegion.java b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/parser/DTDRegion.java
new file mode 100644
index 0000000..69efada
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/parser/DTDRegion.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+package org.eclipse.wst.dtd.core.parser;
+
+import org.eclipse.wst.sse.core.events.StructuredDocumentEvent;
+import org.eclipse.wst.sse.core.internal.parser.ContextRegion;
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegion;
+
+
+
+public class DTDRegion extends ContextRegion {
+
+
+	public DTDRegion(String newContext, int newStart, int newLength) {
+		super(newContext, newStart, newLength, newLength);
+	}
+
+
+	public StructuredDocumentEvent updateModel(Object requester, IStructuredDocumentRegion flatnode, String changes, int requestStart, int requestLength) {
+		return null;
+	}
+}
diff --git a/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/parser/DTDRegionFactory.java b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/parser/DTDRegionFactory.java
new file mode 100644
index 0000000..fbcdef4
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/parser/DTDRegionFactory.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+package org.eclipse.wst.dtd.core.parser;
+
+import org.eclipse.wst.sse.core.text.ITextRegion;
+
+public class DTDRegionFactory implements DTDRegionTypes {
+	public static ITextRegion createRegion(String tokenKind, int start, int length) {
+		ITextRegion region = null;
+		if (tokenKind != null) {
+			region = new DTDRegion(tokenKind, start, length);
+		}
+		return region;
+	}
+
+}
diff --git a/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/parser/DTDRegionParser.java b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/parser/DTDRegionParser.java
new file mode 100644
index 0000000..c6a2b99
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/parser/DTDRegionParser.java
@@ -0,0 +1,262 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+package org.eclipse.wst.dtd.core.parser;
+
+import java.io.Reader;
+import java.io.StringReader;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Vector;
+
+import org.eclipse.wst.dtd.core.internal.text.DTDStructuredDocumentRegionFactory;
+import org.eclipse.wst.dtd.core.tokenizer.DTDTokenizer;
+import org.eclipse.wst.dtd.core.tokenizer.Token;
+import org.eclipse.wst.sse.core.parser.RegionParser;
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegion;
+import org.eclipse.wst.sse.core.text.ITextRegion;
+
+
+public class DTDRegionParser implements RegionParser {
+	private Vector cachedRegions = null;
+	private DTDTokenizer tokenizer = null;
+	private IStructuredDocumentRegion cachedNode = null; // top of node chain
+
+	public RegionParser newInstance() {
+		return new DTDRegionParser();
+	}
+
+	private IStructuredDocumentRegion addNewNodes(IStructuredDocumentRegion lastNode, Vector regions) {
+		IStructuredDocumentRegion leadingSpaceNode = null;
+		IStructuredDocumentRegion contentNode = null;
+		IStructuredDocumentRegion trailingSpaceNode = null;
+		LinkedList nodeSeeds = new LinkedList();
+		int nRegions = regions.size();
+		int leadingSpaceEnd = -1;
+		int trailingSpaceBegin = nRegions;
+
+		// find leading space
+		nodeSeeds.clear();
+		for (int i = 0; i < nRegions; i++) {
+			ITextRegion region = (ITextRegion) regions.get(i);
+			String type = region.getType();
+			if (isBlankRegion(type)) {
+				leadingSpaceEnd = i;
+				nodeSeeds.addLast(region);
+			} else {
+				break;
+			}
+		}
+		if (!nodeSeeds.isEmpty()) {
+			leadingSpaceNode = createNode(nodeSeeds);
+			if (lastNode != null) {
+				lastNode.setNext(leadingSpaceNode);
+				leadingSpaceNode.setPrevious(lastNode);
+			}
+			lastNode = leadingSpaceNode;
+		}
+
+		// find trailing space
+		if (leadingSpaceEnd < nRegions - 1) {
+			nodeSeeds.clear();
+			for (int i = nRegions - 1; 0 <= i; i--) {
+				ITextRegion region = (ITextRegion) regions.get(i);
+				String type = ((ITextRegion) regions.get(i)).getType();
+				if (isBlankRegion(type)) {
+					trailingSpaceBegin = i;
+					nodeSeeds.addFirst(region);
+				} else {
+					break;
+				}
+			}
+			if (!nodeSeeds.isEmpty()) {
+				trailingSpaceNode = createNode(nodeSeeds);
+			}
+
+			nodeSeeds.clear();
+			for (int i = leadingSpaceEnd + 1; i < trailingSpaceBegin; i++) {
+				nodeSeeds.addLast(regions.get(i));
+			}
+			if (!nodeSeeds.isEmpty()) {
+				contentNode = createNode(nodeSeeds);
+				if (lastNode != null) {
+					lastNode.setNext(contentNode);
+					contentNode.setPrevious(lastNode);
+				}
+				lastNode = contentNode;
+			}
+			if (trailingSpaceNode != null) {
+				lastNode.setNext(trailingSpaceNode);
+				trailingSpaceNode.setPrevious(lastNode);
+				lastNode = trailingSpaceNode;
+			}
+		}
+
+		return lastNode;
+	}
+
+	private IStructuredDocumentRegion createNode(LinkedList regions) {
+		if (regions.size() == 0) {
+			return null;
+		}
+
+		IStructuredDocumentRegion node = DTDStructuredDocumentRegionFactory.createStructuredDocumentRegion(DTDStructuredDocumentRegionFactory.DTD_GENERIC);
+		int start = ((ITextRegion) regions.getFirst()).getStart();
+		int length = ((ITextRegion) regions.getLast()).getEnd() - start;
+		node.setStart(start);
+		node.setLength(length);
+		for (ListIterator i = regions.listIterator(0); i.hasNext();) {
+			ITextRegion region = (ITextRegion) i.next();
+			node.addRegion(region);
+			region.adjustStart(-start);
+		}
+		node.setEnded(true);
+
+		return node;
+	}
+
+	private IStructuredDocumentRegion createNodeChain(List regions) {
+		IStructuredDocumentRegion headNode = null;
+		IStructuredDocumentRegion lastNode = null;
+		Vector nodeSeeds = new Vector();
+
+		for (Iterator e = regions.iterator(); e.hasNext();) {
+			ITextRegion region = (ITextRegion) e.next();
+			String type = region.getType();
+			// If the following regions appear,
+			// a previous node is closed in front of it.
+			if (!nodeSeeds.isEmpty() && isBeginningRegion(type)) {
+				lastNode = addNewNodes(lastNode, nodeSeeds);
+				nodeSeeds.clear();
+			}
+			nodeSeeds.addElement(region);
+
+			// The following regions close the current node.
+			if (!nodeSeeds.isEmpty() && isEndingRegion(type)) {
+				lastNode = addNewNodes(lastNode, nodeSeeds);
+				nodeSeeds.clear();
+			}
+
+			if (headNode == null && lastNode != null) {
+				headNode = findFirstNode(lastNode);
+			}
+		}
+
+		// close current node forcibly.
+		if (!nodeSeeds.isEmpty()) {
+			lastNode = addNewNodes(lastNode, nodeSeeds);
+			if (headNode == null && lastNode != null) {
+				headNode = findFirstNode(lastNode);
+			}
+		}
+		return headNode;
+	}
+
+	private IStructuredDocumentRegion findFirstNode(IStructuredDocumentRegion node) {
+		IStructuredDocumentRegion firstNode = node;
+		IStructuredDocumentRegion prevNode = null;
+		while ((prevNode = firstNode.getPrevious()) != null) {
+			firstNode = prevNode;
+		}
+		return firstNode;
+	}
+
+	public IStructuredDocumentRegion getDocumentRegions() {
+		if (cachedNode != null) {
+			return cachedNode;
+		}
+
+		List regions = getRegions();
+		IStructuredDocumentRegion headNode = createNodeChain(regions);
+		cachedNode = headNode;
+
+		return headNode;
+	}
+
+	public List getRegions() {
+		if (cachedRegions != null) {
+			return cachedRegions;
+		}
+
+		Vector regions = new Vector();
+		Token currentToken = null;
+		do {
+			try {
+				currentToken = (Token) tokenizer.yylex();
+				if (currentToken != null) {
+					ITextRegion region = DTDRegionFactory.createRegion(currentToken.getType(), currentToken.getStartOffset(), currentToken.getLength());
+					regions.add(region);
+				}
+			} catch (java.io.FileNotFoundException e) {
+				System.out.println("File not found"); //$NON-NLS-1$
+			} catch (java.io.IOException e) {
+				System.out.println("Error opening file"); //$NON-NLS-1$
+			}
+		} while (currentToken != null);
+
+		cachedRegions = regions;
+		return regions;
+	}
+
+	public void reset(Reader reader) {
+		if (tokenizer == null) {
+			try {
+				tokenizer = new DTDTokenizer(reader);
+			} catch (ArrayIndexOutOfBoundsException e) {
+				System.out.println("Usage : java DTDTokenizer <inputfile>"); //$NON-NLS-1$
+			}
+		} else {
+			try {
+				tokenizer.yyreset(reader);
+			} catch (java.io.IOException e) {
+				System.out.println("Error opening file"); //$NON-NLS-1$
+			}
+		}
+
+		cachedNode = null;
+		cachedRegions = null;
+	}
+
+	/**
+	 * An additional offset for use with any position-dependant parsing rules
+	 */
+	public void reset(Reader reader, int offset) {
+		reset(reader);
+	}
+
+	public void reset(String input) {
+		reset(new StringReader(input));
+	}
+
+	public void reset(String input, int offset) {
+		reset(input);
+	}
+
+	// never used
+	 DTDTokenizer getTokenizer() {
+		return tokenizer;
+	}
+
+	private boolean isBeginningRegion(String type) {
+		return (type == DTDRegionTypes.START_TAG) || (type == DTDRegionTypes.ENTITY_PARM);
+	}
+
+	private boolean isBlankRegion(String type) {
+		return (type == DTDRegionTypes.WHITESPACE);
+	}
+
+	private boolean isEndingRegion(String type) {
+		return (type == DTDRegionTypes.END_TAG) || (type == DTDRegionTypes.ENTITY_PARM) || (type == DTDRegionTypes.COMMENT_END);
+	}
+}
diff --git a/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/parser/DTDRegionTypes.java b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/parser/DTDRegionTypes.java
new file mode 100644
index 0000000..f65e56b
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/parser/DTDRegionTypes.java
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+package org.eclipse.wst.dtd.core.parser;
+
+public interface DTDRegionTypes {
+	public static final String regionPrefix = "org.eclipse.wst.dtd.core.util.parser.DTDRegionTypes."; //$NON-NLS-1$
+
+	public static final String NAME = regionPrefix + "NAME"; //$NON-NLS-1$
+	public static final String START_TAG = regionPrefix + "START_TAG"; //$NON-NLS-1$
+	public static final String END_TAG = regionPrefix + "END_TAG"; //$NON-NLS-1$
+	public static final String LEFT_PAREN = regionPrefix + "LEFT_PAREN"; //$NON-NLS-1$
+	public static final String RIGHT_PAREN = regionPrefix + "RIGHT_PAREN"; //$NON-NLS-1$
+	public static final String WHITESPACE = regionPrefix + "WHITESPACE"; //$NON-NLS-1$
+	public static final String CONNECTOR = regionPrefix + "CONNECTOR"; //$NON-NLS-1$
+
+	public static final String OCCUR_TYPE = regionPrefix + "OCCUR_TYPE"; //$NON-NLS-1$
+	public static final String EXCLAMATION = regionPrefix + "EXCLAMATION"; //$NON-NLS-1$
+	public static final String PERCENT = regionPrefix + "PERCENT"; //$NON-NLS-1$
+	public static final String SEMICOLON = regionPrefix + "SEMICOLON"; //$NON-NLS-1$
+	public static final String COMMENT_START = regionPrefix + "COMMENT"; //$NON-NLS-1$
+	public static final String COMMENT_CONTENT = regionPrefix + "COMMENT_CONTENT"; //$NON-NLS-1$
+	public static final String COMMENT_END = regionPrefix + "COMMENT_END"; //$NON-NLS-1$
+
+	public static final String NOTATION_TAG = regionPrefix + "NOTATION_TAG"; //$NON-NLS-1$
+	public static final String NOTATION_CONTENT = regionPrefix + "NOTATION_CONTENT"; //$NON-NLS-1$
+
+	public static final String ENTITY_TAG = regionPrefix + "ENTITY_TAG"; //$NON-NLS-1$
+	public static final String ENTITY_PARM = regionPrefix + "ENTITY_PARM"; //$NON-NLS-1$
+	public static final String ENTITY_CONTENT = regionPrefix + "ENTITY_CONTENT"; //$NON-NLS-1$
+	public static final String NDATA_VALUE = regionPrefix + "NDATA_VALUE"; //$NON-NLS-1$
+
+	public static final String ELEMENT_TAG = regionPrefix + "ELEMENT_TAG"; //$NON-NLS-1$
+	public static final String ELEMENT_CONTENT = regionPrefix + "ELEMENT_CONTENT"; //$NON-NLS-1$
+	public static final String CONTENT_EMPTY = regionPrefix + "CONTENT_EMPTY"; //$NON-NLS-1$
+	public static final String CONTENT_ANY = regionPrefix + "CONTENT_ANY"; //$NON-NLS-1$
+	public static final String CONTENT_PCDATA = regionPrefix + "CONTENT_PCDATA"; //$NON-NLS-1$
+
+	public static final String ATTLIST_TAG = regionPrefix + "ATTLIST_TAG"; //$NON-NLS-1$
+
+	public static final String SYSTEM_KEYWORD = regionPrefix + "SYSTEM_KEYWORD"; //$NON-NLS-1$
+	public static final String PUBLIC_KEYWORD = regionPrefix + "PUBLIC_KEYWORD"; //$NON-NLS-1$
+	public static final String NDATA_KEYWORD = regionPrefix + "NDATA_KEYWORD"; //$NON-NLS-1$
+	public static final String SINGLEQUOTED_LITERAL = regionPrefix + "SINGLEQUOTED_LITERAL"; //$NON-NLS-1$
+	public static final String DOUBLEQUOTED_LITERAL = regionPrefix + "DOUBLEQUOTED_LITERAL"; //$NON-NLS-1$
+	public static final String UNKNOWN_CONTENT = regionPrefix + "UNKNOWN_CONTENT"; //$NON-NLS-1$
+
+	public static final String ATTRIBUTE_NAME = regionPrefix + "ATTRIBUTE_NAME"; //$NON-NLS-1$
+
+	// attribute type keywords
+	public static final String CDATA_KEYWORD = regionPrefix + "CDATA_KEYWORD"; //$NON-NLS-1$
+	public static final String ID_KEYWORD = regionPrefix + "ID_KEYWORD"; //$NON-NLS-1$
+	public static final String IDREF_KEYWORD = regionPrefix + "IDREF_KEYWORD"; //$NON-NLS-1$
+	public static final String IDREFS_KEYWORD = regionPrefix + "IDREFS_KEYWORD"; //$NON-NLS-1$
+	public static final String ENTITY_KEYWORD = regionPrefix + "ENTITY_KEYWORD"; //$NON-NLS-1$
+	public static final String ENTITIES_KEYWORD = regionPrefix + "ENTITIES_KEYWORD"; //$NON-NLS-1$
+	public static final String NMTOKEN_KEYWORD = regionPrefix + "NMTOKEN_KEYWORD"; //$NON-NLS-1$
+	public static final String NMTOKENS_KEYWORD = regionPrefix + "NMTOKENS_KEYWORD"; //$NON-NLS-1$
+	public static final String NOTATION_KEYWORD = regionPrefix + "NOTATION_KEYWORD"; //$NON-NLS-1$
+	public static final String ENUM_CHOICE = regionPrefix + "ENUM_CHOICE"; //$NON-NLS-1$
+	public static final String PARM_ENTITY_TYPE = regionPrefix + "PARM_ENTITY_TYPE"; //$NON-NLS-1$
+
+	// attribute defaults keywords
+	public static final String REQUIRED_KEYWORD = regionPrefix + "REQUIRED_KEYWORD"; //$NON-NLS-1$
+	public static final String IMPLIED_KEYWORD = regionPrefix + "IMPLIED_KEYWORD"; //$NON-NLS-1$
+	public static final String FIXED_KEYWORD = regionPrefix + "FIXED_KEYWORD"; //$NON-NLS-1$
+}// DTDRegionTypes
diff --git a/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/rules/StructuredTextPartitionerForDTD.java b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/rules/StructuredTextPartitionerForDTD.java
new file mode 100644
index 0000000..4785a1b
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/rules/StructuredTextPartitionerForDTD.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+package org.eclipse.wst.dtd.core.rules;
+
+import org.eclipse.wst.sse.core.text.rules.StructuredTextPartitioner;
+
+public class StructuredTextPartitionerForDTD extends StructuredTextPartitioner {
+
+	public static final String ST_DTD_DEFAULT = "org.eclipse.wst.dtd.default"; //$NON-NLS-1$
+
+	public StructuredTextPartitionerForDTD() {
+		super();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.wst.sse.core.text.rules.StructuredTextPartitioner#getDefault()
+	 */
+	public String getDefault() {
+		return ST_DTD_DEFAULT;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.wst.sse.core.text.rules.StructuredTextPartitioner#initLegalContentTypes()
+	 */
+	protected void initLegalContentTypes() {
+		fSupportedTypes = new String[]{ST_DTD_DEFAULT, ST_UNKNOWN_PARTITION};
+	}
+}
diff --git a/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/tokenizer/DTDTokenizer.java b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/tokenizer/DTDTokenizer.java
new file mode 100644
index 0000000..6bdc39e
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/tokenizer/DTDTokenizer.java
@@ -0,0 +1,1430 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+package org.eclipse.wst.dtd.core.tokenizer;
+
+import java.io.IOException;
+
+import org.eclipse.wst.dtd.core.parser.DTDRegionTypes;
+
+
+
+/**
+ * This class is a scanner generated by <a href="http://www.jflex.de/">JFlex
+ * </a> 1.3.5 on 05/04/02 11:38 AM from the specification file
+ * <tt>file:/E:/wsad5/eclipse/plugins/com.ibm.etools.dtdmodel/src/com/ibm/etools/dtd/sed/parser/tokenizer/dtd.flex</tt>
+ */
+public class DTDTokenizer {
+
+	/** This character denotes the end of file */
+	final public static int YYEOF = -1;
+
+	/** initial size of the lookahead buffer */
+	final private static int YY_BUFFERSIZE = 16384;
+	final  static String yy_NL = System.getProperty("line.separator");
+
+	/** lexical states */
+	final public static int ATTRIBUTE_ENUMERATION = 13;
+	final public static int NOTATION_NAME = 6;
+	final public static int ELEMENT_CHILD = 1;
+	final public static int ENTITY_CONTENT = 4;
+	final public static int COMMENT_CONTENT = 8;
+	final public static int ATTLIST_NAME = 9;
+	final public static int EXTERNALID_CONTENT = 7;
+	final public static int ELEMENT_CONTENT = 1;
+	final public static int ELEMENT_MIXED = 1;
+	final public static int ELEMENT_MIXED_OR_CHILD = 1;
+	final public static int ATTRIBUTE_CONTENT = 11;
+	final public static int ENTITY_NAME = 3;
+	final public static int ATTRIBUTE_DEFAULT = 12;
+	final public static int ELEMENT_NAME = 2;
+	final public static int YYINITIAL = 0;
+	final public static int NDATA_CONTENT = 5;
+	final public static int ATTLIST_CONTENT = 10;
+	final public static int NODE = 1;
+
+	/**
+	 * Translates characters to character classes
+	 */
+	final private static String yycmap_packed = "\10\0\1\0\1\5\1\3\1\0\1\0\1\2\22\0\1\5\1\6" + "\1\1\1\37\1\0\1\23\1\0\1\46\1\42\1\43\1\4\1\7" + "\1\45\1\12\1\0\1\0\12\0\1\0\1\10\1\11\1\0\1\13" + "\1\4\1\0\1\25\1\31\1\32\1\33\1\14\1\35\2\0\1\21" + "\1\0\1\36\1\15\1\16\1\17\1\24\1\27\1\40\1\34\1\26" + "\1\20\1\30\2\0\1\41\1\22\1\0\1\0\1\0\2\0\1\0" + "\1\0\32\0\1\0\1\44\uff83\0";
+
+	/**
+	 * Translates characters to character classes
+	 */
+	final private static char[] yycmap = yy_unpack_cmap(yycmap_packed);
+
+	/**
+	 * Translates a state to a row index in the transition table
+	 */
+	final private static int yy_rowMap[] = {0, 39, 78, 117, 156, 195, 234, 273, 312, 351, 390, 429, 468, 507, 546, 585, 624, 39, 39, 39, 663, 702, 741, 780, 819, 39, 39, 858, 897, 39, 39, 936, 936, 975, 1014, 1053, 1092, 1131, 1170, 1209, 1248, 1287, 1326, 1365, 1404, 1443, 39, 1482, 1521, 1560, 1599, 1638, 39, 1677, 1716, 1755, 1794, 1833, 1872, 39, 39, 1911, 1950, 1989, 2028, 2067, 2106, 39, 39, 39, 2145, 2184, 2223, 2262, 2301, 2340, 2379, 897, 2418, 975, 2457, 2496, 2535, 2574, 975, 2613, 2652, 2691, 2730, 1560, 2769, 2808, 2847, 2886, 2925, 2964, 3003, 3042, 3081, 3120, 1950, 3159, 3198, 3237, 3276, 3315, 1950, 39, 3354, 3393, 3432, 39, 3471, 3510, 3549, 39, 3588, 3627, 39, 3666, 3705, 3744, 39, 39, 3783, 3822, 3861, 3900, 3939, 3978, 4017, 4056, 39, 4095, 4134, 4173, 39, 4212, 4251, 4290, 4329, 4368, 4407, 4446, 4485, 4524, 4563, 4602, 4641, 4680, 4719, 4758, 4797, 4836, 4875, 4914, 4953, 4992, 5031, 5070, 5109, 5148, 5187, 5226, 5265, 5304, 5343, 975, 5382, 5421, 5460, 5499,
+				5538, 5577, 1560, 5616, 5655, 5694, 5733, 5772, 5811, 5850, 546, 5889, 5928, 5967, 6006, 975, 975, 975, 6045, 1560, 6084, 6123, 1560, 6162, 6201, 6240, 1950, 546, 6279, 546, 819, 6318, 6357, 6396, 6435, 6474, 6513, 546, 6552, 1560, 1560, 1560, 1950, 6591, 39, 1950};
+
+	/**
+	 * The packed transition table of the DFA (part 0)
+	 */
+	final private static String yy_packed0 = "\2\17\2\20\1\17\1\20\1\21\1\17\1\22\1\23" + "\1\17\1\24\1\25\2\17\1\26\3\17\1\27\1\17" + "\1\30\21\17\47\0\2\31\2\20\1\32\1\20\1\0" + "\1\32\1\31\1\33\1\31\1\33\23\31\1\34\2\31" + "\1\35\1\36\2\37\1\31\2\40\2\20\1\0\1\20" + "\3\40\1\33\1\40\1\33\7\40\1\41\16\40\4\0" + "\1\40\1\42\1\43\2\20\1\42\1\20\3\42\1\33" + "\1\42\1\33\12\42\1\44\1\45\16\42\1\46\2\47" + "\2\20\1\47\1\20\3\47\1\33\1\47\1\33\33\47" + "\2\50\2\20\1\0\1\20\2\0\1\50\1\33\1\50" + "\1\33\26\50\4\0\1\50\1\42\1\43\2\20\1\42" + "\1\20\3\42\1\33\1\42\1\33\3\42\1\51\6\42" + "\1\52\1\53\16\42\1\46\2\54\2\55\1\54\1\55" + "\4\54\1\56\1\57\33\54\2\60\2\20\1\42\1\20" + "\2\42\1\60\1\33\1\60\1\33\26\60\4\42\1\60" + "\2\61\2\20\1\42\1\20\2\42\1\61\1\33\1\61" + "\1\33\26\61\4\42\1\61\1\62\1\63\1\64\1\65" + "\1\62\1\66\3\62\1\33\1\62\1\33\1\67\2\62" + "\1\70\1\62\1\71\10\62\1\72\4\62\1\73\2\62" + "\1\74\2\75\1\62\1\76\1\77\1\100\2\20\1\77" + "\1\20\3\77\1\33\1\77\1\33\23\77\1\101\6\77"
+				+ "\1\102\2\103\2\20\1\103\1\20\3\103\1\33\1\103" + "\1\33\26\103\1\104\1\105\1\106\2\103\2\17\2\0" + "\1\17\2\0\1\17\2\0\1\17\1\0\7\17\1\0" + "\23\17\2\0\2\20\1\0\1\20\53\0\1\107\34\0" + "\2\17\2\0\1\17\2\0\1\17\2\0\1\17\1\0" + "\1\17\1\110\1\17\1\111\3\17\1\0\25\17\2\0" + "\1\17\2\0\1\17\2\0\1\17\1\0\7\17\1\0" + "\1\112\22\17\2\113\2\0\1\113\2\0\1\113\2\0" + "\1\113\1\0\7\113\1\0\23\113\2\17\2\0\1\17" + "\2\0\1\17\2\0\1\17\1\0\4\17\1\114\2\17" + "\1\0\23\17\2\31\6\0\1\31\1\0\1\31\1\0" + "\26\31\4\0\3\31\6\0\1\31\1\0\1\31\1\0" + "\13\31\1\115\12\31\4\0\1\31\2\0\2\116\1\0" + "\1\116\31\0\1\117\7\0\2\40\4\0\3\40\1\0" + "\1\40\1\0\26\40\4\0\1\40\2\42\2\0\1\42" + "\1\0\3\42\1\0\1\42\1\0\33\42\1\43\1\120" + "\2\121\1\43\1\121\3\43\1\121\1\43\1\121\33\43" + "\2\42\2\0\1\42\1\0\3\42\1\0\1\42\1\0" + "\6\42\1\122\26\42\2\0\1\42\1\0\3\42\1\0" + "\1\42\1\0\14\42\1\123\16\42\2\46\2\124\1\46" + "\1\124\3\46\1\124\1\46\1\124\32\46\1\125\2\47"
+				+ "\2\0\1\47\1\0\3\47\1\0\1\47\1\0\33\47" + "\2\50\6\0\1\50\1\0\1\50\1\0\26\50\4\0" + "\1\50\2\42\2\0\1\42\1\0\3\42\1\0\1\42" + "\1\0\17\42\1\126\15\42\2\0\1\42\1\0\3\42" + "\1\0\1\42\1\0\6\42\1\127\26\42\2\0\1\42" + "\1\0\3\42\1\0\1\42\1\0\14\42\1\130\16\42" + "\12\54\2\0\35\54\2\55\1\54\1\55\4\54\2\0" + "\33\54\12\0\1\131\34\0\2\60\2\0\1\42\1\0" + "\2\42\1\60\1\0\1\60\1\0\26\60\4\42\1\60" + "\2\61\2\0\1\42\1\0\2\42\1\61\1\0\1\61" + "\1\0\26\61\4\42\1\61\2\62\2\0\1\62\1\0" + "\3\62\1\0\1\62\1\0\26\62\3\0\2\62\1\63" + "\1\132\2\133\1\63\1\133\3\63\1\133\1\63\1\133" + "\26\63\3\133\2\63\3\0\1\65\50\0\1\66\41\0" + "\2\62\2\0\1\62\1\0\3\62\1\0\1\62\1\0" + "\3\62\1\134\22\62\3\0\4\62\2\0\1\62\1\0" + "\3\62\1\0\1\62\1\0\2\62\1\135\5\62\1\136" + "\15\62\3\0\4\62\2\0\1\62\1\0\3\62\1\0" + "\1\62\1\0\17\62\1\137\6\62\3\0\4\62\2\0" + "\1\62\1\0\3\62\1\0\1\62\1\0\17\62\1\140" + "\6\62\3\0\4\62\2\0\1\62\1\0\3\62\1\0" + "\1\62\1\0\5\62\1\141\12\62\1\142\1\143\4\62"
+				+ "\3\0\2\62\2\76\2\144\1\76\1\144\3\76\1\144" + "\1\76\1\144\26\76\3\144\1\76\1\132\2\77\2\0" + "\1\77\1\0\3\77\1\0\1\77\1\0\33\77\1\100" + "\1\145\2\146\1\100\1\146\3\100\1\146\1\100\1\146" + "\33\100\2\77\2\0\1\77\1\0\3\77\1\0\1\77" + "\1\0\5\77\1\147\12\77\1\150\1\151\11\77\2\102" + "\2\152\1\102\1\152\3\102\1\152\1\102\1\152\32\102" + "\1\153\2\103\2\0\1\103\1\0\3\103\1\0\1\103" + "\1\0\26\103\3\0\2\103\12\0\1\154\34\0\2\17" + "\2\0\1\17\2\0\1\17\2\0\1\17\1\0\1\155" + "\6\17\1\0\25\17\2\0\1\17\2\0\1\17\2\0" + "\1\17\1\0\4\17\1\156\2\17\1\0\25\17\2\0" + "\1\17\2\0\1\17\2\0\1\17\1\0\4\17\1\157" + "\2\17\1\0\23\17\2\113\2\0\1\113\2\0\1\113" + "\1\160\1\0\1\113\1\0\7\113\1\0\23\113\2\17" + "\2\0\1\17\2\0\1\17\2\0\1\17\1\0\4\17" + "\1\161\2\17\1\0\23\17\2\31\6\0\1\31\1\0" + "\1\31\1\0\16\31\1\162\7\31\4\0\1\31\27\0" + "\1\163\17\0\1\121\1\164\45\121\2\42\2\0\1\42" + "\1\0\3\42\1\0\1\42\1\0\12\42\1\165\22\42" + "\2\0\1\42\1\0\3\42\1\0\1\42\1\0\15\42"
+				+ "\1\166\15\42\46\124\1\167\2\42\2\0\1\42\1\0" + "\3\42\1\0\1\42\1\0\11\42\1\170\23\42\2\0" + "\1\42\1\0\3\42\1\0\1\42\1\0\12\42\1\171" + "\22\42\2\0\1\42\1\0\3\42\1\0\1\42\1\0" + "\15\42\1\172\15\42\13\0\1\173\33\0\1\133\1\174" + "\45\133\2\62\2\0\1\62\1\0\3\62\1\0\1\62" + "\1\0\4\62\1\175\21\62\3\0\4\62\2\0\1\62" + "\1\0\3\62\1\0\1\62\1\0\4\62\1\176\21\62" + "\3\0\4\62\2\0\1\62\1\0\3\62\1\0\1\62" + "\1\0\4\62\1\177\21\62\3\0\4\62\2\0\1\62" + "\1\0\3\62\1\0\1\62\1\0\20\62\1\200\5\62" + "\3\0\4\62\2\0\1\62\1\0\3\62\1\0\1\62" + "\1\0\11\62\1\201\14\62\3\0\4\62\2\0\1\62" + "\1\0\3\62\1\0\1\62\1\0\2\62\1\202\23\62" + "\3\0\4\62\2\0\1\62\1\0\3\62\1\0\1\62" + "\1\0\1\203\25\62\3\0\4\62\2\0\1\62\1\0" + "\3\62\1\0\1\62\1\0\5\62\1\204\20\62\3\0" + "\2\62\46\144\1\174\1\146\1\205\45\146\2\77\2\0" + "\1\77\1\0\3\77\1\0\1\77\1\0\2\77\1\206" + "\32\77\2\0\1\77\1\0\3\77\1\0\1\77\1\0" + "\1\207\34\77\2\0\1\77\1\0\3\77\1\0\1\77" + "\1\0\5\77\1\210\25\77\46\152\1\211\2\17\2\0"
+				+ "\1\17\2\0\1\17\2\0\1\17\1\0\2\17\1\212" + "\4\17\1\0\25\17\2\0\1\17\2\0\1\17\2\0" + "\1\17\1\0\5\17\1\213\1\17\1\0\25\17\2\0" + "\1\17\2\0\1\17\2\0\1\17\1\0\7\17\1\0" + "\1\17\1\214\23\17\2\0\1\17\2\0\1\17\2\0" + "\1\17\1\0\1\17\1\215\5\17\1\0\23\17\2\31" + "\6\0\1\31\1\0\1\31\1\0\17\31\1\216\6\31" + "\4\0\1\31\32\0\1\217\14\0\2\42\2\0\1\42" + "\1\0\3\42\1\0\1\42\1\0\4\42\1\220\30\42" + "\2\0\1\42\1\0\3\42\1\0\1\42\1\0\1\42" + "\1\221\33\42\2\0\1\42\1\0\3\42\1\0\1\42" + "\1\0\4\42\1\222\30\42\2\0\1\42\1\0\3\42" + "\1\0\1\42\1\0\4\42\1\223\30\42\2\0\1\42" + "\1\0\3\42\1\0\1\42\1\0\1\42\1\224\31\42" + "\2\62\2\0\1\62\1\0\3\62\1\0\1\62\1\0" + "\5\62\1\225\20\62\3\0\4\62\2\0\1\62\1\0" + "\3\62\1\0\1\62\1\0\10\62\1\226\15\62\3\0" + "\4\62\2\0\1\62\1\0\3\62\1\0\1\62\1\0" + "\11\62\1\227\14\62\3\0\4\62\2\0\1\62\1\0" + "\3\62\1\0\1\62\1\0\1\230\25\62\3\0\4\62" + "\2\0\1\62\1\0\3\62\1\0\1\62\1\0\4\62" + "\1\231\21\62\3\0\4\62\2\0\1\62\1\0\3\62"
+				+ "\1\0\1\62\1\0\13\62\1\232\12\62\3\0\4\62" + "\2\0\1\62\1\0\3\62\1\0\1\62\1\0\24\62" + "\1\233\1\62\3\0\4\62\2\0\1\62\1\0\3\62" + "\1\0\1\62\1\0\25\62\1\234\3\0\2\62\2\77" + "\2\0\1\77\1\0\3\77\1\0\1\77\1\0\13\77" + "\1\235\21\77\2\0\1\77\1\0\3\77\1\0\1\77" + "\1\0\24\77\1\236\10\77\2\0\1\77\1\0\3\77" + "\1\0\1\77\1\0\25\77\1\237\5\77\2\17\2\0" + "\1\17\2\0\1\17\2\0\1\17\1\0\1\240\6\17" + "\1\0\25\17\2\0\1\17\2\0\1\17\2\0\1\17" + "\1\0\4\17\1\241\2\17\1\0\25\17\2\0\1\17" + "\2\0\1\17\2\0\1\17\1\0\4\17\1\242\2\17" + "\1\0\25\17\2\0\1\17\2\0\1\17\2\0\1\17" + "\1\0\5\17\1\243\1\17\1\0\23\17\2\31\6\0" + "\1\31\1\0\1\31\1\0\11\31\1\244\14\31\4\0" + "\1\31\33\0\1\245\13\0\2\42\2\0\1\42\1\0" + "\3\42\1\0\1\42\1\0\1\246\34\42\2\0\1\42" + "\1\0\3\42\1\0\1\42\1\0\5\42\1\247\27\42" + "\2\0\1\42\1\0\3\42\1\0\1\42\1\0\11\42" + "\1\250\23\42\2\0\1\42\1\0\3\42\1\0\1\42" + "\1\0\1\251\34\42\2\0\1\42\1\0\3\42\1\0" + "\1\42\1\0\5\42\1\252\25\42\2\62\2\0\1\62"
+				+ "\1\0\3\62\1\0\1\62\1\0\4\62\1\253\21\62" + "\3\0\4\62\2\0\1\62\1\0\3\62\1\0\1\62" + "\1\0\22\62\1\254\3\62\3\0\4\62\2\0\1\62" + "\1\0\3\62\1\0\1\62\1\0\4\62\1\255\21\62" + "\3\0\4\62\2\0\1\62\1\0\3\62\1\0\1\62" + "\1\0\21\62\1\256\4\62\3\0\4\62\2\0\1\62" + "\1\0\3\62\1\0\1\62\1\0\11\62\1\257\14\62" + "\3\0\4\62\2\0\1\62\1\0\3\62\1\0\1\62" + "\1\0\1\62\1\260\24\62\3\0\4\62\2\0\1\62" + "\1\0\3\62\1\0\1\62\1\0\14\62\1\261\11\62" + "\3\0\4\62\2\0\1\62\1\0\3\62\1\0\1\62" + "\1\0\1\262\25\62\3\0\2\62\2\77\2\0\1\77" + "\1\0\3\77\1\0\1\77\1\0\1\77\1\263\33\77" + "\2\0\1\77\1\0\3\77\1\0\1\77\1\0\14\77" + "\1\264\20\77\2\0\1\77\1\0\3\77\1\0\1\77" + "\1\0\1\265\32\77\2\17\2\0\1\17\2\0\1\17" + "\2\0\1\17\1\0\3\17\1\266\3\17\1\0\25\17" + "\2\0\1\17\2\0\1\17\2\0\1\17\1\0\6\17" + "\1\267\1\0\25\17\2\0\1\17\2\0\1\17\2\0" + "\1\17\1\0\5\17\1\270\1\17\1\0\25\17\2\0" + "\1\17\2\0\1\17\2\0\1\17\1\0\7\17\1\0" + "\2\17\1\271\20\17\2\31\6\0\1\31\1\0\1\31"
+				+ "\1\0\4\31\1\272\21\31\4\0\1\31\25\0\1\273" + "\21\0\2\42\2\0\1\42\1\0\3\42\1\0\1\42" + "\1\0\2\42\1\274\32\42\2\0\1\42\1\0\3\42" + "\1\0\1\42\1\0\16\42\1\274\16\42\2\0\1\42" + "\1\0\3\42\1\0\1\42\1\0\2\42\1\275\32\42" + "\2\0\1\42\1\0\3\42\1\0\1\42\1\0\16\42" + "\1\276\14\42\2\62\2\0\1\62\1\0\3\62\1\0" + "\1\62\1\0\5\62\1\277\1\300\17\62\3\0\4\62" + "\2\0\1\62\1\0\3\62\1\0\1\62\1\0\1\301" + "\25\62\3\0\4\62\2\0\1\62\1\0\3\62\1\0" + "\1\62\1\0\5\62\1\302\20\62\3\0\4\62\2\0" + "\1\62\1\0\3\62\1\0\1\62\1\0\12\62\1\303" + "\13\62\3\0\4\62\2\0\1\62\1\0\3\62\1\0" + "\1\62\1\0\5\62\1\234\20\62\3\0\4\62\2\0" + "\1\62\1\0\3\62\1\0\1\62\1\0\5\62\1\304" + "\20\62\3\0\4\62\2\0\1\62\1\0\3\62\1\0" + "\1\62\1\0\17\62\1\132\6\62\3\0\2\62\2\77" + "\2\0\1\77\1\0\3\77\1\0\1\77\1\0\5\77" + "\1\305\27\77\2\0\1\77\1\0\3\77\1\0\1\77" + "\1\0\5\77\1\306\27\77\2\0\1\77\1\0\3\77" + "\1\0\1\77\1\0\17\77\1\307\13\77\2\17\2\0" + "\1\17\2\0\1\17\2\0\1\17\1\0\4\17\1\310"
+				+ "\2\17\1\0\25\17\2\0\1\17\2\0\1\17\2\0" + "\1\17\1\0\7\17\1\0\1\311\24\17\2\0\1\17" + "\2\0\1\17\2\0\1\17\1\0\4\17\1\312\2\17" + "\1\0\23\17\2\31\6\0\1\31\1\0\1\31\1\0" + "\11\31\1\313\14\31\4\0\1\31\20\0\1\314\26\0" + "\2\62\2\0\1\62\1\0\3\62\1\0\1\62\1\0" + "\1\315\25\62\3\0\4\62\2\0\1\62\1\0\3\62" + "\1\0\1\62\1\0\3\62\1\316\22\62\3\0\4\62" + "\2\0\1\62\1\0\3\62\1\0\1\62\1\0\10\62" + "\1\317\15\62\3\0\4\62\2\0\1\62\1\0\3\62" + "\1\0\1\62\1\0\20\62\1\234\5\62\3\0\2\62" + "\2\77\2\0\1\77\1\0\3\77\1\0\1\77\1\0" + "\1\320\34\77\2\0\1\77\1\0\3\77\1\0\1\77" + "\1\0\20\77\1\321\12\77\2\17\2\0\1\17\2\0" + "\1\17\2\0\1\17\1\0\3\17\1\322\3\17\1\0" + "\23\17\25\0\1\323\21\0\2\62\2\0\1\62\1\0" + "\3\62\1\0\1\62\1\0\12\62\1\324\13\62\3\0" + "\4\62\2\0\1\62\1\0\3\62\1\0\1\62\1\0" + "\12\62\1\325\13\62\3\0\4\62\2\0\1\62\1\0" + "\3\62\1\0\1\62\1\0\3\62\1\326\22\62\3\0" + "\2\62\2\77\2\0\1\77\1\0\3\77\1\0\1\77" + "\1\0\17\77\1\327\15\77\2\0\1\77\1\0\3\77"
+				+ "\1\0\1\77\1\0\1\330\32\77\2\0\2\323\1\0" + "\1\323\35\0\1\331\3\0\2\77\2\0\1\77\1\0" + "\3\77\1\0\1\77\1\0\17\77\1\332\13\77";
+
+	/**
+	 * The transition table of the DFA
+	 */
+	final private static int yytrans[] = yy_unpack();
+
+
+	/* error codes */
+	final private static int YY_UNKNOWN_ERROR = 0;
+	final  static int YY_ILLEGAL_STATE = 1;
+	final private static int YY_NO_MATCH = 2;
+	final private static int YY_PUSHBACK_2BIG = 3;
+
+	/* error messages for the codes above */
+	final private static String YY_ERROR_MSG[] = {"Unkown internal scanner error", "Internal error: unknown state", "Error: could not match input", "Error: pushback value was too large"};
+
+	/**
+	 * YY_ATTRIBUTE[aState] contains the attributes of state
+	 * <code>aState</code>
+	 */
+	private final static byte YY_ATTRIBUTE[] = {0, 8, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 9, 9, 9, 1, 1, 1, 1, 1, 9, 9, 1, 1, 9, 9, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 9, 1, 1, 1, 1, 1, 9, 1, 1, 1, 1, 1, 1, 9, 9, 1, 1, 1, 1, 1, 1, 9, 9, 9, 0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 9, 1, 1, 1, 9, 1, 1, 0, 9, 1, 1, 9, 1, 1, 1, 9, 9, 1, 1, 1, 1, 1, 1, 1, 1, 9, 1, 1, 1, 9, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 9, 1};
+
+	/** the input device */
+	private java.io.Reader yy_reader;
+
+	/** the current state of the DFA */
+	private int yy_state;
+
+	/** the current lexical state */
+	private int yy_lexical_state = YYINITIAL;
+
+	/**
+	 * this buffer contains the current text to be matched and is the source
+	 * of the yytext() string
+	 */
+	private char yy_buffer[] = new char[YY_BUFFERSIZE];
+
+	/** the textposition at the last accepting state */
+	private int yy_markedPos;
+
+	/** the textposition at the last state to be included in yytext */
+	private int yy_pushbackPos;
+
+	/** the current text position in the buffer */
+	private int yy_currentPos;
+
+	/** startRead marks the beginning of the yytext() string in the buffer */
+	private int yy_startRead;
+
+	/**
+	 * endRead marks the last character in the buffer, that has been read from
+	 * input
+	 */
+	private int yy_endRead;
+
+	/** number of newlines encountered up to the start of the matched text */
+	private int yyline;
+
+	/** the number of characters up to the start of the matched text */
+	private int yychar;
+
+	/**
+	 * the number of characters from the last newline up to the start of the
+	 * matched text
+	 */
+	 int yycolumn;
+
+	/**
+	 * yy_atBOL == true <=>the scanner is currently at the beginning of a
+	 * line
+	 */
+	 boolean yy_atBOL = true;
+
+	/** yy_atEOF == true <=>the scanner is at the EOF */
+	private boolean yy_atEOF;
+
+	/* user code: */
+	 int node_count = 0;
+	 String currentString;
+
+	private Token createToken(String type) {
+		return new Token(type, yytext(), yyline, yychar + startOffset, yylength());
+	}
+
+	private int startOffset = 0;
+
+	public void setStartOffset(int startOffset) {
+		this.startOffset = startOffset;
+	}
+
+	public void setLine(int line) {
+		this.yyline = line;
+	}
+
+
+	/**
+	 * Creates a new scanner There is also a java.io.InputStream version of
+	 * this constructor.
+	 * 
+	 * @param in
+	 *            the java.io.Reader to read input from.
+	 */
+	public DTDTokenizer(java.io.Reader in) {
+		this.yy_reader = in;
+	}
+
+	/**
+	 * Creates a new scanner. There is also java.io.Reader version of this
+	 * constructor.
+	 * 
+	 * @param in
+	 *            the java.io.Inputstream to read input from.
+	 */
+	public DTDTokenizer(java.io.InputStream in) {
+		this(new java.io.InputStreamReader(in));
+	}
+
+	/**
+	 * Unpacks the split, compressed DFA transition table.
+	 * 
+	 * @return the unpacked transition table
+	 */
+	private static int[] yy_unpack() {
+		int[] trans = new int[6630];
+		int offset = 0;
+		offset = yy_unpack(yy_packed0, offset, trans);
+		return trans;
+	}
+
+	/**
+	 * Unpacks the compressed DFA transition table.
+	 * 
+	 * @param packed
+	 *            the packed transition table
+	 * @return the index of the last entry
+	 */
+	private static int yy_unpack(String packed, int offset, int[] trans) {
+		int i = 0; /* index in packed string */
+		int j = offset; /* index in unpacked array */
+		int l = packed.length();
+		while (i < l) {
+			int count = packed.charAt(i++);
+			int value = packed.charAt(i++);
+			value--;
+			do
+				trans[j++] = value;
+			while (--count > 0);
+		}
+		return j;
+	}
+
+	/**
+	 * Unpacks the compressed character translation table.
+	 * 
+	 * @param packed
+	 *            the packed character translation table
+	 * @return the unpacked character translation table
+	 */
+	private static char[] yy_unpack_cmap(String packed) {
+		char[] map = new char[0x10000];
+		int i = 0; /* index in packed string */
+		int j = 0; /* index in unpacked array */
+		while (i < 130) {
+			int count = packed.charAt(i++);
+			char value = packed.charAt(i++);
+			do
+				map[j++] = value;
+			while (--count > 0);
+		}
+		return map;
+	}
+
+
+	/**
+	 * Refills the input buffer.
+	 * 
+	 * @return <code>false</code>, iff there was new input.
+	 * 
+	 * @exception IOException
+	 *                if any I/O-Error occurs
+	 */
+	private boolean yy_refill() throws java.io.IOException {
+
+		/* first: make room (if you can) */
+		if (yy_startRead > 0) {
+			System.arraycopy(yy_buffer, yy_startRead, yy_buffer, 0, yy_endRead - yy_startRead);
+
+			/* translate stored positions */
+			yy_endRead -= yy_startRead;
+			yy_currentPos -= yy_startRead;
+			yy_markedPos -= yy_startRead;
+			yy_pushbackPos -= yy_startRead;
+			yy_startRead = 0;
+		}
+
+		/* is the buffer big enough? */
+		if (yy_currentPos >= yy_buffer.length) {
+			/* if not: blow it up */
+			char newBuffer[] = new char[yy_currentPos * 2];
+			System.arraycopy(yy_buffer, 0, newBuffer, 0, yy_buffer.length);
+			yy_buffer = newBuffer;
+		}
+
+		/* finally: fill the buffer with new input */
+		int numRead = yy_reader.read(yy_buffer, yy_endRead, yy_buffer.length - yy_endRead);
+
+		if (numRead < 0) {
+			return true;
+		} else {
+			yy_endRead += numRead;
+			return false;
+		}
+	}
+
+
+	/**
+	 * Closes the input stream.
+	 */
+	final public void yyclose() throws java.io.IOException {
+		yy_atEOF = true; /* indicate end of file */
+		yy_endRead = yy_startRead; /* invalidate buffer */
+
+		if (yy_reader != null)
+			yy_reader.close();
+	}
+
+
+	/**
+	 * Closes the current stream, and resets the scanner to read from a new
+	 * input stream.
+	 * 
+	 * All internal variables are reset, the old input stream <b>cannot </b>
+	 * be reused (internal buffer is discarded and lost). Lexical state is set
+	 * to <tt>YY_INITIAL</tt>.
+	 * 
+	 * @param reader
+	 *            the new input stream
+	 */
+	final public void yyreset(java.io.Reader reader) throws java.io.IOException {
+		yyclose();
+		yy_reader = reader;
+		yy_atBOL = true;
+		yy_atEOF = false;
+		yy_endRead = yy_startRead = 0;
+		yy_currentPos = yy_markedPos = yy_pushbackPos = 0;
+		yyline = yychar = yycolumn = 0;
+		yy_lexical_state = YYINITIAL;
+	}
+
+
+	/**
+	 * Returns the current lexical state.
+	 */
+	final public int yystate() {
+		return yy_lexical_state;
+	}
+
+
+	/**
+	 * Enters a new lexical state
+	 * 
+	 * @param newState
+	 *            the new lexical state
+	 */
+	final public void yybegin(int newState) {
+		yy_lexical_state = newState;
+	}
+
+
+	/**
+	 * Returns the text matched by the current regular expression.
+	 */
+	final public String yytext() {
+		return new String(yy_buffer, yy_startRead, yy_markedPos - yy_startRead);
+	}
+
+
+	/**
+	 * Returns the character at position <tt>pos</tt> from the matched text.
+	 * 
+	 * It is equivalent to yytext().charAt(pos), but faster
+	 * 
+	 * @param pos
+	 *            the position of the character to fetch. A value from 0 to
+	 *            yylength()-1.
+	 * 
+	 * @return the character at position pos
+	 */
+	final public char yycharat(int pos) {
+		return yy_buffer[yy_startRead + pos];
+	}
+
+
+	/**
+	 * Returns the length of the matched text region.
+	 */
+	final public int yylength() {
+		return yy_markedPos - yy_startRead;
+	}
+
+
+	/**
+	 * Reports an error that occured while scanning.
+	 * 
+	 * In a wellformed scanner (no or only correct usage of yypushback(int)
+	 * and a match-all fallback rule) this method will only be called with
+	 * things that "Can't Possibly Happen". If this method is called,
+	 * something is seriously wrong (e.g. a JFlex bug producing a faulty
+	 * scanner etc.).
+	 * 
+	 * Usual syntax/scanner level error handling should be done in error
+	 * fallback rules.
+	 * 
+	 * @param errorCode
+	 *            the code of the errormessage to display
+	 */
+	private void yy_ScanError(int errorCode) {
+		String message;
+		try {
+			message = YY_ERROR_MSG[errorCode];
+		} catch (ArrayIndexOutOfBoundsException e) {
+			message = YY_ERROR_MSG[YY_UNKNOWN_ERROR];
+		}
+
+		throw new Error(message);
+	}
+
+
+	/**
+	 * Pushes the specified amount of characters back into the input stream.
+	 * 
+	 * They will be read again by then next call of the scanning method
+	 * 
+	 * @param number
+	 *            the number of characters to be read again. This number must
+	 *            not be greater than yylength()!
+	 */
+	private void yypushback(int number) {
+		if (number > yylength())
+			yy_ScanError(YY_PUSHBACK_2BIG);
+
+		yy_markedPos -= number;
+	}
+
+
+	/**
+	 * Resumes scanning until the next regular expression is matched, the end
+	 * of input is encountered or an I/O-Error occurs.
+	 * 
+	 * @return the next token
+	 * @exception IOException
+	 *                if any I/O-Error occurs
+	 */
+	public Yytoken yylex() throws java.io.IOException {
+		int yy_input;
+		int yy_action;
+
+		// cached fields:
+		int yy_currentPos_l;
+		int yy_startRead_l;
+		int yy_markedPos_l;
+		int yy_endRead_l = yy_endRead;
+		char[] yy_buffer_l = yy_buffer;
+		char[] yycmap_l = yycmap;
+
+		int[] yytrans_l = yytrans;
+		int[] yy_rowMap_l = yy_rowMap;
+		byte[] yy_attr_l = YY_ATTRIBUTE;
+
+		while (true) {
+			yy_markedPos_l = yy_markedPos;
+
+			yychar += yy_markedPos_l - yy_startRead;
+
+			boolean yy_r = false;
+			for (yy_currentPos_l = yy_startRead; yy_currentPos_l < yy_markedPos_l; yy_currentPos_l++) {
+				switch (yy_buffer_l[yy_currentPos_l]) {
+					case '\u000B' :
+					case '\u000C' :
+					case '\u0085' :
+					case '\u2028' :
+					case '\u2029' :
+						yyline++;
+						yy_r = false;
+						break;
+					case '\r' :
+						yyline++;
+						yy_r = true;
+						break;
+					case '\n' :
+						if (yy_r)
+							yy_r = false;
+						else {
+							yyline++;
+						}
+						break;
+					default :
+						yy_r = false;
+				}
+			}
+
+			if (yy_r) {
+				// peek one character ahead if it is \n (if we have counted
+				// one line too much)
+				boolean yy_peek;
+				if (yy_markedPos_l < yy_endRead_l)
+					yy_peek = yy_buffer_l[yy_markedPos_l] == '\n';
+				else if (yy_atEOF)
+					yy_peek = false;
+				else {
+					boolean eof = yy_refill();
+					yy_markedPos_l = yy_markedPos;
+					yy_buffer_l = yy_buffer;
+					if (eof)
+						yy_peek = false;
+					else
+						yy_peek = yy_buffer_l[yy_markedPos_l] == '\n';
+				}
+				if (yy_peek)
+					yyline--;
+			}
+			yy_action = -1;
+
+			yy_startRead_l = yy_currentPos_l = yy_currentPos = yy_startRead = yy_markedPos_l;
+
+			yy_state = yy_lexical_state;
+
+
+			yy_forAction : {
+				while (true) {
+
+					if (yy_currentPos_l < yy_endRead_l)
+						yy_input = yy_buffer_l[yy_currentPos_l++];
+					else if (yy_atEOF) {
+						yy_input = YYEOF;
+						break yy_forAction;
+					} else {
+						// store back cached positions
+						yy_currentPos = yy_currentPos_l;
+						yy_markedPos = yy_markedPos_l;
+						boolean eof = yy_refill();
+						// get translated positions and possibly new buffer
+						yy_currentPos_l = yy_currentPos;
+						yy_markedPos_l = yy_markedPos;
+						yy_buffer_l = yy_buffer;
+						yy_endRead_l = yy_endRead;
+						if (eof) {
+							yy_input = YYEOF;
+							break yy_forAction;
+						} else {
+							yy_input = yy_buffer_l[yy_currentPos_l++];
+						}
+					}
+					int yy_next = yytrans_l[yy_rowMap_l[yy_state] + yycmap_l[yy_input]];
+					if (yy_next == -1)
+						break yy_forAction;
+					yy_state = yy_next;
+
+					int yy_attributes = yy_attr_l[yy_state];
+					if ((yy_attributes & 1) == 1) {
+						yy_action = yy_state;
+						yy_markedPos_l = yy_currentPos_l;
+						if ((yy_attributes & 8) == 8)
+							break yy_forAction;
+					}
+
+				}
+			}
+
+			// store back cached position
+			yy_markedPos = yy_markedPos_l;
+
+			switch (yy_action) {
+
+				case 26 :
+				//System.out.println("line: "+(yyline+1)+" "+"match:
+				// --"+yytext()+"--");
+				//System.out.println("action [197] { yypushback(yylength());
+				// yybegin(YYINITIAL); }");
+				{
+					yypushback(yylength());
+					yybegin(YYINITIAL);
+				}
+				case 219 :
+					break;
+				case 89 :
+				case 123 :
+				//System.out.println("line: "+(yyline+1)+" "+"match:
+				// --"+yytext()+"--");
+				//System.out.println("action [231] { yypushback(yylength());
+				// yybegin(ATTRIBUTE_DEFAULT); }");
+				{
+					yypushback(yylength());
+					yybegin(ATTRIBUTE_DEFAULT);
+				}
+				case 220 :
+					break;
+				case 12 :
+				case 62 :
+				case 63 :
+				case 64 :
+				case 65 :
+				case 102 :
+				case 103 :
+				case 104 :
+				case 133 :
+				case 134 :
+				case 135 :
+				case 156 :
+				case 157 :
+				case 158 :
+				case 178 :
+				case 179 :
+				case 180 :
+				case 196 :
+				case 197 :
+				case 207 :
+				case 208 :
+				case 215 :
+				//System.out.println("line: "+(yyline+1)+" "+"match:
+				// --"+yytext()+"--");
+				//System.out.println("action [247] { yypushback(yylength());
+				// yybegin(ATTLIST_CONTENT); }");
+				{
+					yypushback(yylength());
+					yybegin(ATTLIST_CONTENT);
+				}
+				case 221 :
+					break;
+				case 51 :
+				case 52 :
+				//System.out.println("line: "+(yyline+1)+" "+"match:
+				// --"+yytext()+"--");
+				//System.out.println("action [217] { yypushback(yylength());
+				// yybegin(ATTLIST_CONTENT); }");
+				{
+					yypushback(yylength());
+					yybegin(ATTLIST_CONTENT);
+				}
+				case 222 :
+					break;
+				case 205 :
+				//System.out.println("line: "+(yyline+1)+" "+"match:
+				// --"+yytext()+"--");
+				//System.out.println("action [227] {
+				// yybegin(ATTRIBUTE_DEFAULT); return
+				// createToken(DTDRegionTypes.NMTOKEN_KEYWORD); }");
+				{
+					yybegin(ATTRIBUTE_DEFAULT);
+					return createToken(DTDRegionTypes.NMTOKEN_KEYWORD);
+				}
+				case 223 :
+					break;
+				case 194 :
+				//System.out.println("line: "+(yyline+1)+" "+"match:
+				// --"+yytext()+"--");
+				//System.out.println("action [224] {
+				// yybegin(ATTRIBUTE_DEFAULT); return
+				// createToken(DTDRegionTypes.IDREFS_KEYWORD); }");
+				{
+					yybegin(ATTRIBUTE_DEFAULT);
+					return createToken(DTDRegionTypes.IDREFS_KEYWORD);
+				}
+				case 224 :
+					break;
+				case 191 :
+				//System.out.println("line: "+(yyline+1)+" "+"match:
+				// --"+yytext()+"--");
+				//System.out.println("action [225] {
+				// yybegin(ATTRIBUTE_DEFAULT); return
+				// createToken(DTDRegionTypes.ENTITY_KEYWORD); }");
+				{
+					yybegin(ATTRIBUTE_DEFAULT);
+					return createToken(DTDRegionTypes.ENTITY_KEYWORD);
+				}
+				case 225 :
+					break;
+				case 107 :
+				//System.out.println("line: "+(yyline+1)+" "+"match:
+				// --"+yytext()+"--");
+				//System.out.println("action [174] {
+				// yybegin(COMMENT_CONTENT); return
+				// createToken(DTDRegionTypes.COMMENT_START); }");
+				{
+					yybegin(COMMENT_CONTENT);
+					return createToken(DTDRegionTypes.COMMENT_START);
+				}
+				case 226 :
+					break;
+				case 48 :
+				//System.out.println("line: "+(yyline+1)+" "+"match:
+				// --"+yytext()+"--");
+				//System.out.println("action [211] {
+				// yybegin(ATTRIBUTE_CONTENT); return
+				// createToken(DTDRegionTypes.ATTRIBUTE_NAME); }");
+				{
+					yybegin(ATTRIBUTE_CONTENT);
+					return createToken(DTDRegionTypes.ATTRIBUTE_NAME);
+				}
+				case 227 :
+					break;
+				case 39 :
+				//System.out.println("line: "+(yyline+1)+" "+"match:
+				// --"+yytext()+"--");
+				//System.out.println("action [283] {
+				// yybegin(EXTERNALID_CONTENT); return
+				// createToken(DTDRegionTypes.NAME); }");
+				{
+					yybegin(EXTERNALID_CONTENT);
+					return createToken(DTDRegionTypes.NAME);
+				}
+				case 228 :
+					break;
+				case 106 :
+				case 136 :
+				//System.out.println("line: "+(yyline+1)+" "+"match:
+				// --"+yytext()+"--");
+				//System.out.println("action [245] {
+				// yybegin(ATTLIST_CONTENT); return
+				// createToken(DTDRegionTypes.SINGLEQUOTED_LITERAL); }");
+				{
+					yybegin(ATTLIST_CONTENT);
+					return createToken(DTDRegionTypes.SINGLEQUOTED_LITERAL);
+				}
+				case 229 :
+					break;
+				case 100 :
+				case 132 :
+				//System.out.println("line: "+(yyline+1)+" "+"match:
+				// --"+yytext()+"--");
+				//System.out.println("action [246] {
+				// yybegin(ATTLIST_CONTENT); return
+				// createToken(DTDRegionTypes.DOUBLEQUOTED_LITERAL); }");
+				{
+					yybegin(ATTLIST_CONTENT);
+					return createToken(DTDRegionTypes.DOUBLEQUOTED_LITERAL);
+				}
+				case 230 :
+					break;
+				case 202 :
+				case 216 :
+				//System.out.println("line: "+(yyline+1)+" "+"match:
+				// --"+yytext()+"--");
+				//System.out.println("action [189] { return
+				// createToken(DTDRegionTypes.CONTENT_PCDATA); }");
+				{
+					return createToken(DTDRegionTypes.CONTENT_PCDATA);
+				}
+				case 231 :
+					break;
+				case 189 :
+				//System.out.println("line: "+(yyline+1)+" "+"match:
+				// --"+yytext()+"--");
+				//System.out.println("action [290] { return
+				// createToken(DTDRegionTypes.PUBLIC_KEYWORD); }");
+				{
+					return createToken(DTDRegionTypes.PUBLIC_KEYWORD);
+				}
+				case 232 :
+					break;
+				case 188 :
+				//System.out.println("line: "+(yyline+1)+" "+"match:
+				// --"+yytext()+"--");
+				//System.out.println("action [289] { return
+				// createToken(DTDRegionTypes.SYSTEM_KEYWORD); }");
+				{
+					return createToken(DTDRegionTypes.SYSTEM_KEYWORD);
+				}
+				case 233 :
+					break;
+				case 14 :
+				case 20 :
+				case 21 :
+				case 23 :
+				case 71 :
+				case 72 :
+				case 73 :
+				case 75 :
+				case 108 :
+				case 109 :
+				case 110 :
+				case 112 :
+				case 137 :
+				case 138 :
+				case 139 :
+				case 140 :
+				case 159 :
+				case 160 :
+				case 161 :
+				case 162 :
+				case 181 :
+				case 183 :
+				case 184 :
+				case 200 :
+				//System.out.println("line: "+(yyline+1)+" "+"match:
+				// --"+yytext()+"--");
+				//System.out.println("action [182] { return
+				// createToken(DTDRegionTypes.UNKNOWN_CONTENT); }");
+				{
+					return createToken(DTDRegionTypes.UNKNOWN_CONTENT);
+				}
+				case 234 :
+					break;
+				case 4 :
+				case 33 :
+				case 34 :
+				case 35 :
+				case 36 :
+				case 37 :
+				case 81 :
+				case 82 :
+				case 116 :
+				case 117 :
+				case 143 :
+				case 144 :
+				case 165 :
+				case 166 :
+				//System.out.println("line: "+(yyline+1)+" "+"match:
+				// --"+yytext()+"--");
+				//System.out.println("action [275] { return
+				// createToken(DTDRegionTypes.UNKNOWN_CONTENT); }");
+				{
+					return createToken(DTDRegionTypes.UNKNOWN_CONTENT);
+				}
+				case 235 :
+					break;
+				case 7 :
+				case 40 :
+				case 41 :
+				case 42 :
+				case 85 :
+				case 86 :
+				case 87 :
+				case 119 :
+				case 120 :
+				case 121 :
+				case 145 :
+				case 146 :
+				case 147 :
+				case 168 :
+				case 169 :
+				//System.out.println("line: "+(yyline+1)+" "+"match:
+				// --"+yytext()+"--");
+				//System.out.println("action [294] { return
+				// createToken(DTDRegionTypes.UNKNOWN_CONTENT); }");
+				{
+					return createToken(DTDRegionTypes.UNKNOWN_CONTENT);
+				}
+				case 236 :
+					break;
+				case 9 :
+				//System.out.println("line: "+(yyline+1)+" "+"match:
+				// --"+yytext()+"--");
+				//System.out.println("action [205] { return
+				// createToken(DTDRegionTypes.UNKNOWN_CONTENT); }");
+				{
+					return createToken(DTDRegionTypes.UNKNOWN_CONTENT);
+				}
+				case 237 :
+					break;
+				case 10 :
+				//System.out.println("line: "+(yyline+1)+" "+"match:
+				// --"+yytext()+"--");
+				//System.out.println("action [212] { return
+				// createToken(DTDRegionTypes.UNKNOWN_CONTENT); }");
+				{
+					return createToken(DTDRegionTypes.UNKNOWN_CONTENT);
+				}
+				case 238 :
+					break;
+				case 43 :
+				case 45 :
+				case 46 :
+				//System.out.println("line: "+(yyline+1)+" "+"match:
+				// --"+yytext()+"--");
+				//System.out.println("action [309] { return
+				// createToken(DTDRegionTypes.COMMENT_CONTENT); }");
+				{
+					return createToken(DTDRegionTypes.COMMENT_CONTENT);
+				}
+				case 239 :
+					break;
+				case 60 :
+				//System.out.println("line: "+(yyline+1)+" "+"match:
+				// --"+yytext()+"--");
+				//System.out.println("action [236] { return
+				// createToken(DTDRegionTypes.UNKNOWN_CONTENT); }");
+				{
+					return createToken(DTDRegionTypes.UNKNOWN_CONTENT);
+				}
+				case 240 :
+					break;
+				case 198 :
+				//System.out.println("line: "+(yyline+1)+" "+"match:
+				// --"+yytext()+"--");
+				//System.out.println("action [244] { return
+				// createToken(DTDRegionTypes.FIXED_KEYWORD); }");
+				{
+					return createToken(DTDRegionTypes.FIXED_KEYWORD);
+				}
+				case 241 :
+					break;
+				case 214 :
+				//System.out.println("line: "+(yyline+1)+" "+"match:
+				// --"+yytext()+"--");
+				//System.out.println("action [243] {
+				// yybegin(ATTLIST_CONTENT); return
+				// createToken(DTDRegionTypes.IMPLIED_KEYWORD); }");
+				{
+					yybegin(ATTLIST_CONTENT);
+					return createToken(DTDRegionTypes.IMPLIED_KEYWORD);
+				}
+				case 242 :
+					break;
+				case 212 :
+				//System.out.println("line: "+(yyline+1)+" "+"match:
+				// --"+yytext()+"--");
+				//System.out.println("action [228] {
+				// yybegin(ATTRIBUTE_DEFAULT); return
+				// createToken(DTDRegionTypes.NMTOKENS_KEYWORD); }");
+				{
+					yybegin(ATTRIBUTE_DEFAULT);
+					return createToken(DTDRegionTypes.NMTOKENS_KEYWORD);
+				}
+				case 243 :
+					break;
+				case 211 :
+				//System.out.println("line: "+(yyline+1)+" "+"match:
+				// --"+yytext()+"--");
+				//System.out.println("action [226] {
+				// yybegin(ATTRIBUTE_DEFAULT); return
+				// createToken(DTDRegionTypes.ENTITIES_KEYWORD); }");
+				{
+					yybegin(ATTRIBUTE_DEFAULT);
+					return createToken(DTDRegionTypes.ENTITIES_KEYWORD);
+				}
+				case 244 :
+					break;
+				case 209 :
+				//System.out.println("line: "+(yyline+1)+" "+"match:
+				// --"+yytext()+"--");
+				//System.out.println("action [176] { yybegin(NOTATION_NAME);
+				// return createToken(DTDRegionTypes.NOTATION_TAG); }");
+				{
+					yybegin(NOTATION_NAME);
+					return createToken(DTDRegionTypes.NOTATION_TAG);
+				}
+				case 245 :
+					break;
+				case 201 :
+				//System.out.println("line: "+(yyline+1)+" "+"match:
+				// --"+yytext()+"--");
+				//System.out.println("action [177] { yybegin(ATTLIST_NAME);
+				// return createToken(DTDRegionTypes.ATTLIST_TAG); }");
+				{
+					yybegin(ATTLIST_NAME);
+					return createToken(DTDRegionTypes.ATTLIST_TAG);
+				}
+				case 246 :
+					break;
+				case 199 :
+				//System.out.println("line: "+(yyline+1)+" "+"match:
+				// --"+yytext()+"--");
+				//System.out.println("action [173] { yybegin(ELEMENT_NAME);
+				// return createToken(DTDRegionTypes.ELEMENT_TAG); }");
+				{
+					yybegin(ELEMENT_NAME);
+					return createToken(DTDRegionTypes.ELEMENT_TAG);
+				}
+				case 247 :
+					break;
+				case 182 :
+				//System.out.println("line: "+(yyline+1)+" "+"match:
+				// --"+yytext()+"--");
+				//System.out.println("action [175] { yybegin(ENTITY_NAME);
+				// return createToken(DTDRegionTypes.ENTITY_TAG); }");
+				{
+					yybegin(ENTITY_NAME);
+					return createToken(DTDRegionTypes.ENTITY_TAG);
+				}
+				case 248 :
+					break;
+				case 167 :
+				//System.out.println("line: "+(yyline+1)+" "+"match:
+				// --"+yytext()+"--");
+				//System.out.println("action [293] { yybegin(NDATA_CONTENT);
+				// return createToken(DTDRegionTypes.NDATA_KEYWORD); }");
+				{
+					yybegin(NDATA_CONTENT);
+					return createToken(DTDRegionTypes.NDATA_KEYWORD);
+				}
+				case 249 :
+					break;
+				case 111 :
+				//System.out.println("line: "+(yyline+1)+" "+"match:
+				// --"+yytext()+"--");
+				//System.out.println("action [179] { return
+				// createToken(DTDRegionTypes.ENTITY_PARM); }");
+				{
+					return createToken(DTDRegionTypes.ENTITY_PARM);
+				}
+				case 250 :
+					break;
+				case 94 :
+				//System.out.println("line: "+(yyline+1)+" "+"match:
+				// --"+yytext()+"--");
+				//System.out.println("action [222] {
+				// yybegin(ATTRIBUTE_DEFAULT); return
+				// createToken(DTDRegionTypes.ID_KEYWORD); }");
+				{
+					yybegin(ATTRIBUTE_DEFAULT);
+					return createToken(DTDRegionTypes.ID_KEYWORD);
+				}
+				case 251 :
+					break;
+				case 25 :
+				//System.out.println("line: "+(yyline+1)+" "+"match:
+				// --"+yytext()+"--");
+				//System.out.println("action [194] { return
+				// createToken(DTDRegionTypes.OCCUR_TYPE); }");
+				{
+					return createToken(DTDRegionTypes.OCCUR_TYPE);
+				}
+				case 252 :
+					break;
+				case 16 :
+				//System.out.println("line: "+(yyline+1)+" "+"match:
+				// --"+yytext()+"--");
+				//System.out.println("action [169] { return
+				// createToken(DTDRegionTypes.EXCLAMATION); }");
+				{
+					return createToken(DTDRegionTypes.EXCLAMATION);
+				}
+				case 253 :
+					break;
+				case 15 :
+				//System.out.println("line: "+(yyline+1)+" "+"match:
+				// --"+yytext()+"--");
+				//System.out.println("action [184] { return
+				// createToken(DTDRegionTypes.WHITESPACE); }");
+				{
+					return createToken(DTDRegionTypes.WHITESPACE);
+				}
+				case 254 :
+					break;
+				case 11 :
+				case 49 :
+				case 50 :
+				case 54 :
+				case 55 :
+				case 56 :
+				case 57 :
+				case 58 :
+				case 61 :
+				case 91 :
+				case 92 :
+				case 93 :
+				case 95 :
+				case 96 :
+				case 97 :
+				case 98 :
+				case 124 :
+				case 125 :
+				case 126 :
+				case 127 :
+				case 128 :
+				case 129 :
+				case 130 :
+				case 131 :
+				case 148 :
+				case 149 :
+				case 150 :
+				case 151 :
+				case 152 :
+				case 153 :
+				case 154 :
+				case 155 :
+				case 170 :
+				case 171 :
+				case 172 :
+				case 175 :
+				case 176 :
+				case 177 :
+				case 190 :
+				case 192 :
+				case 193 :
+				case 195 :
+				case 204 :
+				case 206 :
+				//System.out.println("line: "+(yyline+1)+" "+"match:
+				// --"+yytext()+"--");
+				//System.out.println("action [235] {
+				// yybegin(ATTRIBUTE_DEFAULT); return
+				// createToken(DTDRegionTypes.PARM_ENTITY_TYPE); }");
+				{
+					yybegin(ATTRIBUTE_DEFAULT);
+					return createToken(DTDRegionTypes.PARM_ENTITY_TYPE);
+				}
+				case 255 :
+					break;
+				case 28 :
+				//System.out.println("line: "+(yyline+1)+" "+"match:
+				// --"+yytext()+"--");
+				//System.out.println("action [192] { return
+				// createToken(DTDRegionTypes.LEFT_PAREN); }");
+				{
+					return createToken(DTDRegionTypes.LEFT_PAREN);
+				}
+				case 256 :
+					break;
+				case 29 :
+				//System.out.println("line: "+(yyline+1)+" "+"match:
+				// --"+yytext()+"--");
+				//System.out.println("action [195] { return
+				// createToken(DTDRegionTypes.RIGHT_PAREN); }");
+				{
+					return createToken(DTDRegionTypes.RIGHT_PAREN);
+				}
+				case 257 :
+					break;
+				case 44 :
+				//System.out.println("line: "+(yyline+1)+" "+"match:
+				// --"+yytext()+"--");
+				//System.out.println("action [308] { return
+				// createToken(DTDRegionTypes.WHITESPACE); }");
+				{
+					return createToken(DTDRegionTypes.WHITESPACE);
+				}
+				case 258 :
+					break;
+				case 53 :
+				//System.out.println("line: "+(yyline+1)+" "+"match:
+				// --"+yytext()+"--");
+				//System.out.println("action [218] { return
+				// createToken(DTDRegionTypes.WHITESPACE); }");
+				{
+					return createToken(DTDRegionTypes.WHITESPACE);
+				}
+				case 259 :
+					break;
+				case 59 :
+				//System.out.println("line: "+(yyline+1)+" "+"match:
+				// --"+yytext()+"--");
+				//System.out.println("action [234] { yypushback(yylength());
+				// yybegin(ATTRIBUTE_ENUMERATION); }");
+				{
+					yypushback(yylength());
+					yybegin(ATTRIBUTE_ENUMERATION);
+				}
+				case 260 :
+					break;
+				case 67 :
+				//System.out.println("line: "+(yyline+1)+" "+"match:
+				// --"+yytext()+"--");
+				//System.out.println("action [253] { return
+				// createToken(DTDRegionTypes.LEFT_PAREN); }");
+				{
+					return createToken(DTDRegionTypes.LEFT_PAREN);
+				}
+				case 261 :
+					break;
+				case 68 :
+				//System.out.println("line: "+(yyline+1)+" "+"match:
+				// --"+yytext()+"--");
+				//System.out.println("action [255] {
+				// yybegin(ATTRIBUTE_DEFAULT); return
+				// createToken(DTDRegionTypes.RIGHT_PAREN); }");
+				{
+					yybegin(ATTRIBUTE_DEFAULT);
+					return createToken(DTDRegionTypes.RIGHT_PAREN);
+				}
+				case 262 :
+					break;
+				case 69 :
+				//System.out.println("line: "+(yyline+1)+" "+"match:
+				// --"+yytext()+"--");
+				//System.out.println("action [254] { return
+				// createToken(DTDRegionTypes.ENUM_CHOICE); }");
+				{
+					return createToken(DTDRegionTypes.ENUM_CHOICE);
+				}
+				case 263 :
+					break;
+				case 31 :
+				//System.out.println("line: "+(yyline+1)+" "+"match:
+				// --"+yytext()+"--");
+				//System.out.println("action [265] { yybegin(ENTITY_CONTENT);
+				// return createToken(DTDRegionTypes.NAME); }");
+				{
+					yybegin(ENTITY_CONTENT);
+					return createToken(DTDRegionTypes.NAME);
+				}
+				case 264 :
+					break;
+				case 47 :
+				//System.out.println("line: "+(yyline+1)+" "+"match:
+				// --"+yytext()+"--");
+				//System.out.println("action [204] {
+				// yybegin(ATTLIST_CONTENT); return
+				// createToken(DTDRegionTypes.NAME); }");
+				{
+					yybegin(ATTLIST_CONTENT);
+					return createToken(DTDRegionTypes.NAME);
+				}
+				case 265 :
+					break;
+				case 187 :
+				//System.out.println("line: "+(yyline+1)+" "+"match:
+				// --"+yytext()+"--");
+				//System.out.println("action [272] { yypushback(yylength());
+				// yybegin(EXTERNALID_CONTENT); }");
+				{
+					yypushback(yylength());
+					yybegin(EXTERNALID_CONTENT);
+				}
+				case 266 :
+					break;
+				case 213 :
+				//System.out.println("line: "+(yyline+1)+" "+"match:
+				// --"+yytext()+"--");
+				//System.out.println("action [229] {
+				// yybegin(ATTRIBUTE_ENUMERATION); return
+				// createToken(DTDRegionTypes.NOTATION_KEYWORD); }");
+				{
+					yybegin(ATTRIBUTE_ENUMERATION);
+					return createToken(DTDRegionTypes.NOTATION_KEYWORD);
+				}
+				case 267 :
+					break;
+				case 174 :
+				//System.out.println("line: "+(yyline+1)+" "+"match:
+				// --"+yytext()+"--");
+				//System.out.println("action [220] {
+				// yybegin(ATTRIBUTE_DEFAULT); return
+				// createToken(DTDRegionTypes.CDATA_KEYWORD); }");
+				{
+					yybegin(ATTRIBUTE_DEFAULT);
+					return createToken(DTDRegionTypes.CDATA_KEYWORD);
+				}
+				case 268 :
+					break;
+				case 173 :
+				//System.out.println("line: "+(yyline+1)+" "+"match:
+				// --"+yytext()+"--");
+				//System.out.println("action [223] {
+				// yybegin(ATTRIBUTE_DEFAULT); return
+				// createToken(DTDRegionTypes.IDREF_KEYWORD); }");
+				{
+					yybegin(ATTRIBUTE_DEFAULT);
+					return createToken(DTDRegionTypes.IDREF_KEYWORD);
+				}
+				case 269 :
+					break;
+				case 217 :
+				//System.out.println("line: "+(yyline+1)+" "+"match:
+				// --"+yytext()+"--");
+				//System.out.println("action [242] {
+				// yybegin(ATTLIST_CONTENT); return
+				// createToken(DTDRegionTypes.REQUIRED_KEYWORD); }");
+				{
+					yybegin(ATTLIST_CONTENT);
+					return createToken(DTDRegionTypes.REQUIRED_KEYWORD);
+				}
+				case 270 :
+					break;
+				case 122 :
+				//System.out.println("line: "+(yyline+1)+" "+"match:
+				// --"+yytext()+"--");
+				//System.out.println("action [307] { yybegin(YYINITIAL);
+				// return createToken(DTDRegionTypes.COMMENT_END); }");
+				{
+					yybegin(YYINITIAL);
+					return createToken(DTDRegionTypes.COMMENT_END);
+				}
+				case 271 :
+					break;
+				case 84 :
+				case 118 :
+				//System.out.println("line: "+(yyline+1)+" "+"match:
+				// --"+yytext()+"--");
+				//System.out.println("action [273] { return
+				// createToken(DTDRegionTypes.SINGLEQUOTED_LITERAL); }");
+				{
+					return createToken(DTDRegionTypes.SINGLEQUOTED_LITERAL);
+				}
+				case 272 :
+					break;
+				case 79 :
+				case 115 :
+				//System.out.println("line: "+(yyline+1)+" "+"match:
+				// --"+yytext()+"--");
+				//System.out.println("action [274] { return
+				// createToken(DTDRegionTypes.DOUBLEQUOTED_LITERAL); }");
+				{
+					return createToken(DTDRegionTypes.DOUBLEQUOTED_LITERAL);
+				}
+				case 273 :
+					break;
+				case 24 :
+				case 27 :
+				case 76 :
+				case 113 :
+				case 141 :
+				case 163 :
+				case 185 :
+				//System.out.println("line: "+(yyline+1)+" "+"match:
+				// --"+yytext()+"--");
+				//System.out.println("action [190] { return
+				// createToken(DTDRegionTypes.NAME); }");
+				{
+					return createToken(DTDRegionTypes.NAME);
+				}
+				case 274 :
+					break;
+				case 5 :
+				case 38 :
+				//System.out.println("line: "+(yyline+1)+" "+"match:
+				// --"+yytext()+"--");
+				//System.out.println("action [300] { yybegin(YYINITIAL);
+				// return createToken(DTDRegionTypes.NDATA_VALUE); }");
+				{
+					yybegin(YYINITIAL);
+					return createToken(DTDRegionTypes.NDATA_VALUE);
+				}
+				case 275 :
+					break;
+				case 13 :
+				case 66 :
+				//System.out.println("line: "+(yyline+1)+" "+"match:
+				// --"+yytext()+"--");
+				//System.out.println("action [256] { return
+				// createToken(DTDRegionTypes.NAME); }");
+				{
+					return createToken(DTDRegionTypes.NAME);
+				}
+				case 276 :
+					break;
+				case 18 :
+				//System.out.println("line: "+(yyline+1)+" "+"match:
+				// --"+yytext()+"--");
+				//System.out.println("action [167] { return
+				// createToken(DTDRegionTypes.START_TAG); }");
+				{
+					return createToken(DTDRegionTypes.START_TAG);
+				}
+				case 277 :
+					break;
+				case 17 :
+				//System.out.println("line: "+(yyline+1)+" "+"match:
+				// --"+yytext()+"--");
+				//System.out.println("action [171] { return
+				// createToken(DTDRegionTypes.SEMICOLON); }");
+				{
+					return createToken(DTDRegionTypes.SEMICOLON);
+				}
+				case 278 :
+					break;
+				case 30 :
+				//System.out.println("line: "+(yyline+1)+" "+"match:
+				// --"+yytext()+"--");
+				//System.out.println("action [193] { return
+				// createToken(DTDRegionTypes.CONNECTOR); }");
+				{
+					return createToken(DTDRegionTypes.CONNECTOR);
+				}
+				case 279 :
+					break;
+				case 22 :
+				//System.out.println("line: "+(yyline+1)+" "+"match:
+				// --"+yytext()+"--");
+				//System.out.println("action [170] { return
+				// createToken(DTDRegionTypes.PERCENT); }");
+				{
+					return createToken(DTDRegionTypes.PERCENT);
+				}
+				case 280 :
+					break;
+				case 19 :
+				//System.out.println("line: "+(yyline+1)+" "+"match:
+				// --"+yytext()+"--");
+				//System.out.println("action [168] { return
+				// createToken(DTDRegionTypes.END_TAG); }");
+				{
+					return createToken(DTDRegionTypes.END_TAG);
+				}
+				case 281 :
+					break;
+				case 32 :
+				//System.out.println("line: "+(yyline+1)+" "+"match:
+				// --"+yytext()+"--");
+				//System.out.println("action [264] { return
+				// createToken(DTDRegionTypes.PERCENT); }");
+				{
+					return createToken(DTDRegionTypes.PERCENT);
+				}
+				case 282 :
+					break;
+				default :
+					if (yy_input == YYEOF && yy_startRead == yy_currentPos) {
+						yy_atEOF = true;
+						return null;
+					} else {
+						yy_ScanError(YY_NO_MATCH);
+					}
+			}
+		}
+	}
+
+	/**
+	 * Runs the scanner on input files.
+	 * 
+	 * This main method is the debugging routine for the scanner. It prints
+	 * debugging information about each returned token to System.out until the
+	 * end of file is reached, or an error occured.
+	 * 
+	 * @param argv
+	 *            the command line, contains the filenames to run the scanner
+	 *            on.
+	 */
+	public static void main(String argv[]) {
+		if (argv.length == 0) {
+			System.out.println("Usage : java DTDTokenizer <inputfile>");
+		} else {
+			for (int i = 0; i < argv.length; i++) {
+				DTDTokenizer scanner = null;
+				try {
+					scanner = new DTDTokenizer(new java.io.FileReader(argv[i]));
+					do {
+						System.out.println(scanner.yylex());
+					} while (!scanner.yy_atEOF);
+
+				} catch (java.io.FileNotFoundException e) {
+					System.out.println("File not found : \"" + argv[i] + "\"");
+				} catch (java.io.IOException e) {
+					System.out.println("IO error scanning file \"" + argv[i] + "\"");
+					System.out.println(e);
+				} catch (Exception e) {
+					System.out.println("Unexpected exception:");
+					e.printStackTrace();
+				}
+			}
+		}
+	}
+
+
+}
diff --git a/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/tokenizer/Token.java b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/tokenizer/Token.java
new file mode 100644
index 0000000..4c8072d
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/tokenizer/Token.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+package org.eclipse.wst.dtd.core.tokenizer;
+
+public class Token extends Yytoken {
+	public static final int COMMENT_START = 9;
+	public static final int CONNECTOR = 6;
+	public static final int CONTENT_ANY = 43;
+	public static final int CONTENT_EMPTY = 42;
+	public static final int CONTENT_PCDATA = 44;
+	public static final int ELEMENT_CONTENT = 41;
+
+	public static final int ELEMENT_TAG = 40;
+	public static final int END_TAG = 2;
+	public static final int ENTITY_CONTENT = 32;
+	public static final int ENTITY_PARM = 31;
+
+	public static final int ENTITY_TAG = 30;
+	public static final int EXCLAMATION = 8;
+	public static final int LEFT_PAREN = 3;
+	public static final int NAME = 0;
+	public static final int NOTATION_CONTENT = 21;
+
+
+	public static final int NOTATION_TAG = 20;
+
+	//    public static final int CONNECT_CHOICE = 5;
+	//    public static final int CONNECT_SEQUENCE = 6;
+	//    public static final int OCCUR_OPTIONAL = 7;
+	//    public static final int OCCUR_ONE_OR_MORE = 8;
+	//    public static final int OCCUR_ZERO_OR_MORE = 9;
+	public static final int OCCUR_TYPE = 7;
+	public static final int RIGHT_PAREN = 4;
+	public static final int START_TAG = 1;
+	public static final int WHITESPACE = 5;
+
+
+	public Token(String type) {
+		super(type);
+	}
+
+	public Token(String type, String text, int line, int charBegin, int length) {
+		super(type, text, line, charBegin, length);
+	}
+
+	public Token createCopy() {
+		Token copy = new Token(getType(), getText(), getStartLine(), getStartOffset(), getLength());
+		return copy;
+	}
+
+}
diff --git a/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/tokenizer/Yytoken.java b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/tokenizer/Yytoken.java
new file mode 100644
index 0000000..ceead5f
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/tokenizer/Yytoken.java
@@ -0,0 +1,90 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+package org.eclipse.wst.dtd.core.tokenizer;
+
+class Yytoken {
+	public int m_charBegin;
+	public int m_length;
+	public int m_line;
+	public String m_text;
+	public String m_type;
+
+	Yytoken(String type) {
+		m_type = type;
+	}
+
+	Yytoken(String type, String text, int line, int charBegin, int length) {
+		m_type = type;
+		m_text = new String(text);
+		m_line = line;
+		m_charBegin = charBegin;
+		m_length = length;
+	}
+
+	public void delete(int start, int length) {
+		int stringStart = start - m_charBegin;
+		String oldString = m_text;
+		m_text = oldString.substring(0, stringStart);
+		m_text += oldString.substring(stringStart + length);
+
+		m_length = m_text.length();
+		System.out.println("new string = " + m_text); //$NON-NLS-1$
+
+	}
+
+	public boolean equals(Yytoken other) {
+		return m_type == other.getType() && m_text.equals(other.getText()) && m_line == other.getStartLine() && m_charBegin == other.getStartOffset() && m_length == other.getLength();
+	}
+
+	public int getEndOffset() {
+		return m_charBegin + m_length;
+	}
+
+	public int getLength() {
+		return m_length;
+	}
+
+	public int getStartLine() {
+		return m_line;
+	}
+
+	public int getStartOffset() {
+		return m_charBegin;
+	}
+
+	public String getText() {
+		return m_text;
+	}
+
+	public String getType() {
+		return m_type;
+	}
+
+	public void setStartOffset(int startOffset) {
+		m_charBegin = startOffset;
+	}
+
+	public String toString() {
+		return "Text   : " + m_text + "\ntype : " + m_type + "\nline  : " + m_line + "\ncBeg. : " + m_charBegin + "\ncEnd. : " + getEndOffset() + "\ncLength. : " + m_length; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
+	}
+
+	public void updateOffset(int delta) {
+		m_charBegin += delta;
+	}
+
+	public void updateText(String newText) {
+		m_text = newText;
+		m_length = newText.length();
+	}
+}
+
diff --git a/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/tokenizer/dtd.flex b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/tokenizer/dtd.flex
new file mode 100644
index 0000000..1b47d5a
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/tokenizer/dtd.flex
@@ -0,0 +1,312 @@
+/* this is a scanner for DTD files */

+package com.ibm.etools.dtd.sed.parser.tokenizer;

+

+import com.ibm.etools.dtd.sed.parser.DTDRegionTypes;

+

+%%

+

+%{

+  private int node_count = 0;

+  private String currentString;

+

+  private Token createToken(String type)

+  {

+    return new Token(type, yytext(), yyline, yychar + startOffset, yylength());

+  }

+

+  private int startOffset = 0;

+  public void setStartOffset(int startOffset)

+  {

+    this.startOffset = startOffset;

+  }

+

+  public void setLine(int line)

+  {

+    this.yyline = line;

+  }

+%} 

+

+%class DTDTokenizer

+%public

+%unicode

+%debug

+%line

+%char

+%state NODE

+%state ELEMENT_NAME

+%state ELEMENT_CONTENT

+%state ELEMENT_MIXED_OR_CHILD

+%state ELEMENT_MIXED

+%state ELEMENT_CHILD

+%state ENTITY_NAME

+%state ENTITY_CONTENT

+%state NDATA_CONTENT

+

+%state NOTATION_NAME

+%state EXTERNALID_CONTENT

+

+%state COMMENT_CONTENT

+%state ATTLIST_NAME

+%state ATTLIST_CONTENT

+%state ATTRIBUTE_CONTENT

+%state ATTRIBUTE_DEFAULT

+%state ATTRIBUTE_ENUMERATION

+

+

+ALPHA=[A-Za-z]

+DIGIT=[0-9]

+NONNEWLINE_WHITE_SPACE_CHAR=[\ \t\b\012]

+STRING_TEXT=(\\\"|[^\n\r\"]|\\{WHITE_SPACE_CHAR}+\\)*

+COMMENT_TEXT=([^*/\n]|[^*\n]"/"[^*\n]|[^/\n]"*"[^/\n]|"*"[^/\n]|"/"[^*\n])*

+Ident = {ALPHA}({ALPHA}|{DIGIT}|_)*

+InputCharacter = [^\r\n]

+

+LineTerminator = \r|\n|\r\n

+

+/* 3 - White Space */

+S              =    (\x20 | \x09 | \x0D | \x0A)+

+NonLineTerminatorWhitespace = (\x20 | \x09)+

+

+WhiteSpace     = {LineTerminator} | [ \t\f]

+

+/* 84 */

+/*Letter         =    {BaseChar} | {Ideographic}

+

+/* 85 */

+BaseChar       =    [\u0041-\u005A] | [\u0061-\u007A] | [\u00C0-\u00D6] | [\u00D8-\u00F6] | [\u00F8-\u00FF] | [\u0100-\u0131] | [\u0134-\u013E] | [\u0141-\u0148] | [\u014A-\u017E] | [\u0180-\u01C3] | [\u01CD-\u01F0] | [\u01F4-\u01F5] | [\u01FA-\u0217] | [\u0250-\u02A8] | [\u02BB-\u02C1] | \u0386 | [\u0388-\u038A] | \u038C | [\u038E-\u03A1] | [\u03A3-\u03CE] | [\u03D0-\u03D6] | \u03DA | \u03DC | \u03DE | \u03E0 | [\u03E2-\u03F3] | [\u0401-\u040C] | [\u040E-\u044F] | [\u0451-\u045C] | [\u045E-\u0481] | [\u0490-\u04C4] | [\u04C7-\u04C8] | [\u04CB-\u04CC] | [\u04D0-\u04EB] | [\u04EE-\u04F5] | [\u04F8-\u04F9] | [\u0531-\u0556] | \u0559 | [\u0561-\u0586] | [\u05D0-\u05EA] | [\u05F0-\u05F2] | [\u0621-\u063A] | [\u0641-\u064A] | [\u0671-\u06B7] | [\u06BA-\u06BE] | [\u06C0-\u06CE] | [\u06D0-\u06D3] | \u06D5 | [\u06E5-\u06E6] | [\u0905-\u0939] | \u093D | [\u0958-\u0961] | [\u0985-\u098C] | [\u098F-\u0990] | [\u0993-\u09A8] | [\u09AA-\u09B0] | \u09B2 | [\u09B6-\u09B9] | [\u09DC-\u09DD] | [\u09DF-\u09E1] | [\u09F0-\u09F1] | [\u0A05-\u0A0A] | [\u0A0F-\u0A10] | [\u0A13-\u0A28] | [\u0A2A-\u0A30] | [\u0A32-\u0A33] | [\u0A35-\u0A36] | [\u0A38-\u0A39] | [\u0A59-\u0A5C] | \u0A5E | [\u0A72-\u0A74] | [\u0A85-\u0A8B] | \u0A8D | [\u0A8F-\u0A91] | [\u0A93-\u0AA8] | [\u0AAA-\u0AB0] | [\u0AB2-\u0AB3] | [\u0AB5-\u0AB9] | \u0ABD | \u0AE0 | [\u0B05-\u0B0C] | [\u0B0F-\u0B10] | [\u0B13-\u0B28] | [\u0B2A-\u0B30] | [\u0B32-\u0B33] | [\u0B36-\u0B39] | \u0B3D | [\u0B5C-\u0B5D] | [\u0B5F-\u0B61] | [\u0B85-\u0B8A] | [\u0B8E-\u0B90] | [\u0B92-\u0B95] | [\u0B99-\u0B9A] | \u0B9C | [\u0B9E-\u0B9F] | [\u0BA3-\u0BA4] | [\u0BA8-\u0BAA] | [\u0BAE-\u0BB5] | [\u0BB7-\u0BB9] | [\u0C05-\u0C0C] | [\u0C0E-\u0C10] | [\u0C12-\u0C28] | [\u0C2A-\u0C33] | [\u0C35-\u0C39] | [\u0C60-\u0C61] | [\u0C85-\u0C8C] | [\u0C8E-\u0C90] | [\u0C92-\u0CA8] | [\u0CAA-\u0CB3] | [\u0CB5-\u0CB9] | \u0CDE | [\u0CE0-\u0CE1] | [\u0D05-\u0D0C] | [\u0D0E-\u0D10] | [\u0D12-\u0D28] | [\u0D2A-\u0D39] | [\u0D60-\u0D61] | [\u0E01-\u0E2E] | \u0E30 | [\u0E32-\u0E33] | [\u0E40-\u0E45] | [\u0E81-\u0E82] | \u0E84 | [\u0E87-\u0E88] | \u0E8A | \u0E8D | [\u0E94-\u0E97] | [\u0E99-\u0E9F] | [\u0EA1-\u0EA3] | \u0EA5 | \u0EA7 | [\u0EAA-\u0EAB] | [\u0EAD-\u0EAE] | \u0EB0 | [\u0EB2-\u0EB3] | \u0EBD | [\u0EC0-\u0EC4] | [\u0F40-\u0F47] | [\u0F49-\u0F69] | [\u10A0-\u10C5] | [\u10D0-\u10F6] | \u1100 | [\u1102-\u1103] | [\u1105-\u1107] | \u1109 | [\u110B-\u110C] | [\u110E-\u1112] | \u113C | \u113E | \u1140 | \u114C | \u114E | \u1150 | [\u1154-\u1155] | \u1159 | [\u115F-\u1161] | \u1163 | \u1165 | \u1167 | \u1169 | [\u116D-\u116E] | [\u1172-\u1173] | \u1175 | \u119E | \u11A8 | \u11AB | [\u11AE-\u11AF] | [\u11B7-\u11B8] | \u11BA | [\u11BC-\u11C2] | \u11EB | \u11F0 | \u11F9 | [\u1E00-\u1E9B] | [\u1EA0-\u1EF9] | [\u1F00-\u1F15] | [\u1F18-\u1F1D] | [\u1F20-\u1F45] | [\u1F48-\u1F4D] | [\u1F50-\u1F57] | \u1F59 | \u1F5B | \u1F5D | [\u1F5F-\u1F7D] | [\u1F80-\u1FB4] | [\u1FB6-\u1FBC] | \u1FBE | [\u1FC2-\u1FC4] | [\u1FC6-\u1FCC] | [\u1FD0-\u1FD3] | [\u1FD6-\u1FDB] | [\u1FE0-\u1FEC] | [\u1FF2-\u1FF4] | [\u1FF6-\u1FFC] | \u2126 | [\u212A-\u212B] | \u212E | [\u2180-\u2182] | [\u3041-\u3094] | [\u30A1-\u30FA] | [\u3105-\u312C] | [\uAC00-\uD7A3]  

+

+/* 86 */

+Ideographic    =    [\u4E00-\u9FA5] | \u3007 | [\u3021-\u3029]  

+

+/* 4 */  /* is '.' to be escaped?? */

+NameChar       =    {Letter} | {Digit} | . | - | _ | : | {CombiningChar} | {Extender}

+

+/* 5 */

+Name           = ({Letter} | _ | :) {NameChar}* 

+

+/* 87 */

+CombiningChar  =    [\u0300-\u0345] | [\u0360-\u0361] | [\u0483-\u0486] | [\u0591-\u05A1] | [\u05A3-\u05B9] | [\u05BB-\u05BD] | \u05BF | [\u05C1-\u05C2] | \u05C4 | [\u064B-\u0652] | \u0670 | [\u06D6-\u06DC] | [\u06DD-\u06DF] | [\u06E0-\u06E4] | [\u06E7-\u06E8] | [\u06EA-\u06ED] | [\u0901-\u0903] | \u093C | [\u093E-\u094C] | \u094D | [\u0951-\u0954] | [\u0962-\u0963] | [\u0981-\u0983] | \u09BC | \u09BE | \u09BF | [\u09C0-\u09C4] | [\u09C7-\u09C8] | [\u09CB-\u09CD] | \u09D7 | [\u09E2-\u09E3] | \u0A02 | \u0A3C | \u0A3E | \u0A3F | [\u0A40-\u0A42] | [\u0A47-\u0A48] | [\u0A4B-\u0A4D] | [\u0A70-\u0A71] | [\u0A81-\u0A83] | \u0ABC | [\u0ABE-\u0AC5] | [\u0AC7-\u0AC9] | [\u0ACB-\u0ACD] | [\u0B01-\u0B03] | \u0B3C | [\u0B3E-\u0B43] | [\u0B47-\u0B48] | [\u0B4B-\u0B4D] | [\u0B56-\u0B57] | [\u0B82-\u0B83] | [\u0BBE-\u0BC2] | [\u0BC6-\u0BC8] | [\u0BCA-\u0BCD] | \u0BD7 | [\u0C01-\u0C03] | [\u0C3E-\u0C44] | [\u0C46-\u0C48] | [\u0C4A-\u0C4D] | [\u0C55-\u0C56] | [\u0C82-\u0C83] | [\u0CBE-\u0CC4] | [\u0CC6-\u0CC8] | [\u0CCA-\u0CCD] | [\u0CD5-\u0CD6] | [\u0D02-\u0D03] | [\u0D3E-\u0D43] | [\u0D46-\u0D48] | [\u0D4A-\u0D4D] | \u0D57 | \u0E31 | [\u0E34-\u0E3A] | [\u0E47-\u0E4E] | \u0EB1 | [\u0EB4-\u0EB9] | [\u0EBB-\u0EBC] | [\u0EC8-\u0ECD] | [\u0F18-\u0F19] | \u0F35 | \u0F37 | \u0F39 | \u0F3E | \u0F3F | [\u0F71-\u0F84] | [\u0F86-\u0F8B] | [\u0F90-\u0F95] | \u0F97 | [\u0F99-\u0FAD] | [\u0FB1-\u0FB7] | \u0FB9 | [\u20D0-\u20DC] | \u20E1 | [\u302A-\u302F] | \u3099 | \u309A  

+

+/* 88 */

+Digit          =    [\u0030-\u0039] | [\u0660-\u0669] | [\u06F0-\u06F9] | [\u0966-\u096F] | [\u09E6-\u09EF] | [\u0A66-\u0A6F] | [\u0AE6-\u0AEF] | [\u0B66-\u0B6F] | [\u0BE7-\u0BEF] | [\u0C66-\u0C6F] | [\u0CE6-\u0CEF] | [\u0D66-\u0D6F] | [\u0E50-\u0E59] | [\u0ED0-\u0ED9] | [\u0F20-\u0F29]  

+

+/* 89 */

+Extender       =    \u00B7 | \u02D0 | \u02D1 | \u0387 | \u0640 | \u0E46 | \u0EC6 | \u3005 | [\u3031-\u3035] | [\u309D-\u309E] | [\u30FC-\u30FE]  

+*/

+

+Letter         = [a-zA-Z]

+NameChar       = {Letter} | [0-9]

+//Name           = ({Letter} | _ | :) {NameChar}* 

+//Name           = [^\x20\x09\x0D\x0A]+

+Name           = [^\x20\x09\x0D\x0A\|,\!\?\+\*\(\)<>]+

+ElementRefName = [^\x20\x09\x0D\x0A\|,\?\+\*\(\)<>]+

+EntityName     = [^\x20\x09\x0D\x0A\|,\?\*\(\)<>]+

+ParmEntityName = [^\x20\x09\x0D\x0A\!%;<>]+

+

+CommentStart   = \!--

+CommentContent = [^->]+

+CommentEnd     = -->

+ElementStart   = ELEMENT

+ElementContent = [^<>]*

+

+EntityStart    = ENTITY

+Entity_Parm    = %{S}

+EntityContent  = {S}[^<>]*

+

+NotationStart  = NOTATION

+NotationContent = {S}[^<>]*

+AttList        = ATTLIST

+ExternalParmEntityRef = %{ParmEntityName};

+EndTag         = >

+StartTag       = <

+System         = SYSTEM

+Public         = PUBLIC

+NData          = NDATA

+

+// these are attribute type keywords

+//   we reuse NOTATION from NotationStart

+//   we reuse ENTITY from EntityStart

+CData          = CDATA

+ID             = ID

+IDRef          = IDREF

+IDRefs         = IDREFS

+Entities       = ENTITIES

+NMToken        = NMTOKEN

+NMTokens       = NMTOKENS

+

+// these are attribute defaults keywords

+Required       = #REQUIRED

+Implied        = #IMPLIED

+Fixed          = #FIXED

+

+

+Empty          = EMPTY

+Any            = ANY

+PcData         = #PCDATA

+LeftParen      = \(

+RightParen     = \)

+

+Percent        = %

+Semicolon      = ;

+Plus           = \+

+Choice  = \|

+Sequence = ,

+Connector      = {Choice}|{Sequence}

+OccurOptional  = \?

+OccurOneOrMore = \+

+OccurZeroOrMore = \*

+OccurType      = {OccurOptional}|{OccurOneOrMore}|{OccurZeroOrMore}

+Exclamation   = \!

+SingleQuotedLiteral = '[^']*'

+DoubleQuotedLiteral = \"[^\"]*\"

+NonTagContent = [^\x20\x09\x0D\x0A<>]*

+NonEnumContent = [^\x20\x09\x0D\x0A<>\(\)\|]*

+%% 

+

+<YYINITIAL> {

+  {StartTag}       { return createToken(DTDRegionTypes.START_TAG); }

+  {EndTag}         { return createToken(DTDRegionTypes.END_TAG); }

+  {Exclamation}    { return createToken(DTDRegionTypes.EXCLAMATION); }

+  {Percent}        { return createToken(DTDRegionTypes.PERCENT); }

+  {Semicolon}      { return createToken(DTDRegionTypes.SEMICOLON); }

+

+  {ElementStart}   { yybegin(ELEMENT_NAME); return createToken(DTDRegionTypes.ELEMENT_TAG); }

+  {CommentStart}   { yybegin(COMMENT_CONTENT); return createToken(DTDRegionTypes.COMMENT_START); }

+  {EntityStart}    { yybegin(ENTITY_NAME); return createToken(DTDRegionTypes.ENTITY_TAG); }

+  {NotationStart}  { yybegin(NOTATION_NAME); return createToken(DTDRegionTypes.NOTATION_TAG); }

+  {AttList}        { yybegin(ATTLIST_NAME); return createToken(DTDRegionTypes.ATTLIST_TAG); }

+

+  {ExternalParmEntityRef}   { return createToken(DTDRegionTypes.ENTITY_PARM); }

+// just a parmentityname by itself is no good.  we use this

+// to capture garbage content at the top level

+  {ParmEntityName}          { return createToken(DTDRegionTypes.UNKNOWN_CONTENT); }

+

+  {S}              { return createToken(DTDRegionTypes.WHITESPACE); }

+}

+

+<ELEMENT_NAME> {

+  {S}              { return createToken(DTDRegionTypes.WHITESPACE); }

+  {PcData}|\({S}*{PcData}{S}*\) { return createToken(DTDRegionTypes.CONTENT_PCDATA); }

+  {Name}           { return createToken(DTDRegionTypes.NAME); }

+

+  {LeftParen}      { return createToken(DTDRegionTypes.LEFT_PAREN); }

+  {Connector}      { return createToken(DTDRegionTypes.CONNECTOR); }    

+  {OccurType}      { return createToken(DTDRegionTypes.OCCUR_TYPE); }

+  {RightParen}     { return createToken(DTDRegionTypes.RIGHT_PAREN); }

+

+  {StartTag}       { yypushback(yylength()); yybegin(YYINITIAL); }

+  {EndTag}         { yypushback(yylength()); yybegin(YYINITIAL); }

+}

+

+// ******** <!ATTLIST...>

+<ATTLIST_NAME> {

+  {S}              { return createToken(DTDRegionTypes.WHITESPACE); }

+  {Name}           { yybegin(ATTLIST_CONTENT); return createToken(DTDRegionTypes.NAME); }

+  {NonTagContent}  { return createToken(DTDRegionTypes.UNKNOWN_CONTENT); }

+  {StartTag} | {EndTag} { yypushback(yylength()); yybegin(YYINITIAL); }

+}

+

+<ATTLIST_CONTENT> {

+  {S}              { return createToken(DTDRegionTypes.WHITESPACE); }

+  {Name}           { yybegin(ATTRIBUTE_CONTENT); return createToken(DTDRegionTypes.ATTRIBUTE_NAME); }

+  {NonTagContent}  { return createToken(DTDRegionTypes.UNKNOWN_CONTENT); }

+  {StartTag} | {EndTag} { yypushback(yylength()); yybegin(YYINITIAL); }

+}

+

+<ATTRIBUTE_CONTENT> {

+  {LineTerminator} { yypushback(yylength()); yybegin(ATTLIST_CONTENT); }

+  {NonLineTerminatorWhitespace}

+                   { return createToken(DTDRegionTypes.WHITESPACE); }

+  {CData}          { yybegin(ATTRIBUTE_DEFAULT); return createToken(DTDRegionTypes.CDATA_KEYWORD); }  

+

+  {ID}             { yybegin(ATTRIBUTE_DEFAULT); return createToken(DTDRegionTypes.ID_KEYWORD); }       

+  {IDRef}          { yybegin(ATTRIBUTE_DEFAULT); return createToken(DTDRegionTypes.IDREF_KEYWORD); }  

+  {IDRefs}         { yybegin(ATTRIBUTE_DEFAULT); return createToken(DTDRegionTypes.IDREFS_KEYWORD); }  

+  {EntityStart}    { yybegin(ATTRIBUTE_DEFAULT); return createToken(DTDRegionTypes.ENTITY_KEYWORD); }  

+  {Entities}       { yybegin(ATTRIBUTE_DEFAULT); return createToken(DTDRegionTypes.ENTITIES_KEYWORD); }  

+  {NMToken}        { yybegin(ATTRIBUTE_DEFAULT); return createToken(DTDRegionTypes.NMTOKEN_KEYWORD); }  

+  {NMTokens}       { yybegin(ATTRIBUTE_DEFAULT); return createToken(DTDRegionTypes.NMTOKENS_KEYWORD); }  

+  {NotationStart}  { yybegin(ATTRIBUTE_ENUMERATION); return createToken(DTDRegionTypes.NOTATION_KEYWORD); }  

+

+  {Required} | {Implied} | {Fixed} | {SingleQuotedLiteral} | { DoubleQuotedLiteral}

+                   { yypushback(yylength()); yybegin(ATTRIBUTE_DEFAULT); }

+

+  {LeftParen}      { yypushback(yylength()); yybegin(ATTRIBUTE_ENUMERATION); }  

+  {NonEnumContent} { yybegin(ATTRIBUTE_DEFAULT); return createToken(DTDRegionTypes.PARM_ENTITY_TYPE); }

+  {NonEnumContent}|{RightParen}|{Choice}  { return createToken(DTDRegionTypes.UNKNOWN_CONTENT); }

+  {StartTag} | {EndTag} { yypushback(yylength()); yybegin(YYINITIAL); }

+}

+

+<ATTRIBUTE_DEFAULT> {

+  {S}              { return createToken(DTDRegionTypes.WHITESPACE); }

+  {Required}       { yybegin(ATTLIST_CONTENT); return createToken(DTDRegionTypes.REQUIRED_KEYWORD); }

+  {Implied}        { yybegin(ATTLIST_CONTENT); return createToken(DTDRegionTypes.IMPLIED_KEYWORD); }

+  {Fixed}          { return createToken(DTDRegionTypes.FIXED_KEYWORD); }

+  {SingleQuotedLiteral}  { yybegin(ATTLIST_CONTENT); return createToken(DTDRegionTypes.SINGLEQUOTED_LITERAL); }

+  {DoubleQuotedLiteral}  { yybegin(ATTLIST_CONTENT); return createToken(DTDRegionTypes.DOUBLEQUOTED_LITERAL); }

+  {NonTagContent}   { yypushback(yylength()); yybegin(ATTLIST_CONTENT); } //return createToken(DTDRegionTypes.UNKNOWN_CONTENT); }

+  {StartTag} | {EndTag} { yypushback(yylength()); yybegin(YYINITIAL); }

+}

+

+<ATTRIBUTE_ENUMERATION> {

+  {S}              { return createToken(DTDRegionTypes.WHITESPACE); }

+  {LeftParen}      { return createToken(DTDRegionTypes.LEFT_PAREN); }

+  {Choice}         { return createToken(DTDRegionTypes.ENUM_CHOICE); }

+  {RightParen}     { yybegin(ATTRIBUTE_DEFAULT); return createToken(DTDRegionTypes.RIGHT_PAREN); }

+  {NonEnumContent}   { return createToken(DTDRegionTypes.NAME); }

+  {StartTag} | {EndTag} { yypushback(yylength()); yybegin(YYINITIAL); }

+}

+

+

+// ******** <!ENTITY...>

+<ENTITY_NAME> {

+  {S}              { return createToken(DTDRegionTypes.WHITESPACE); }

+  {Percent}        { return createToken(DTDRegionTypes.PERCENT); }

+  {EntityName}     { yybegin(ENTITY_CONTENT); return createToken(DTDRegionTypes.NAME); }

+  {StartTag} | {EndTag} { yypushback(yylength()); yybegin(YYINITIAL); }

+}

+

+<ENTITY_CONTENT> {

+//  {EntityContent} { yybegin(YYINITIAL); return createToken(DTDRegionTypes.ENTITY_CONTENT); }

+  {S}              { return createToken(DTDRegionTypes.WHITESPACE); }

+  {System} | {Public} { yypushback(yylength()); yybegin(EXTERNALID_CONTENT); }

+  {SingleQuotedLiteral}  { return createToken(DTDRegionTypes.SINGLEQUOTED_LITERAL); }

+  {DoubleQuotedLiteral}  { return createToken(DTDRegionTypes.DOUBLEQUOTED_LITERAL); }

+  {NonTagContent}   { return createToken(DTDRegionTypes.UNKNOWN_CONTENT); }

+  {StartTag} | {EndTag} { yypushback(yylength()); yybegin(YYINITIAL); }

+}

+

+

+// ******** <!NOTATION...>

+<NOTATION_NAME> {

+  {S}              { return createToken(DTDRegionTypes.WHITESPACE); }

+  {Name}           { yybegin(EXTERNALID_CONTENT); return createToken(DTDRegionTypes.NAME); }

+  {StartTag} | {EndTag} { yypushback(yylength()); yybegin(YYINITIAL); }

+}

+

+<EXTERNALID_CONTENT> {

+  {S}              { return createToken(DTDRegionTypes.WHITESPACE); }

+  {System}         { return createToken(DTDRegionTypes.SYSTEM_KEYWORD); }  

+  {Public}         { return createToken(DTDRegionTypes.PUBLIC_KEYWORD); }  

+  {SingleQuotedLiteral}  { return createToken(DTDRegionTypes.SINGLEQUOTED_LITERAL); }

+  {DoubleQuotedLiteral}  { return createToken(DTDRegionTypes.DOUBLEQUOTED_LITERAL); }

+  {NData}          { yybegin(NDATA_CONTENT); return createToken(DTDRegionTypes.NDATA_KEYWORD); }

+  {NonTagContent}   { return createToken(DTDRegionTypes.UNKNOWN_CONTENT); }

+  {StartTag} | {EndTag} { yypushback(yylength()); yybegin(YYINITIAL); }

+}

+

+<NDATA_CONTENT> {

+  {S}              { return createToken(DTDRegionTypes.WHITESPACE); }

+  {NonTagContent}  { yybegin(YYINITIAL); return createToken(DTDRegionTypes.NDATA_VALUE); }

+  {StartTag} | {EndTag} { yypushback(yylength()); yybegin(YYINITIAL); }

+}

+  

+

+// ******** <!-- ...>

+<COMMENT_CONTENT> {

+  {CommentEnd}  { yybegin(YYINITIAL); return createToken(DTDRegionTypes.COMMENT_END); }

+  {S}              { return createToken(DTDRegionTypes.WHITESPACE); }

+  {CommentContent} | "-" | ">"  { return createToken(DTDRegionTypes.COMMENT_CONTENT); }

+}

+

+

diff --git a/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/util/DTDBatchNodeDelete.java b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/util/DTDBatchNodeDelete.java
new file mode 100644
index 0000000..9f7109d
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/util/DTDBatchNodeDelete.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+package org.eclipse.wst.dtd.core.util;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.wst.dtd.core.DTDFile;
+import org.eclipse.wst.dtd.core.DTDNode;
+
+
+public class DTDBatchNodeDelete {
+	protected DTDFile dtdFile;
+
+	protected List nodes = new ArrayList();
+
+	public DTDBatchNodeDelete(DTDFile dtdFile) {
+		this.dtdFile = dtdFile;
+	}
+
+	public void addNode(DTDNode node) {
+		// first check if the node is contained by anyone
+		for (int i = 0; i < nodes.size(); i++) {
+			DTDNode currentNode = (DTDNode) nodes.get(i);
+
+			if (currentNode.containsRange(node.getStartOffset(), node.getEndOffset())) {
+				// then no need to add the node to the list to be deleted
+				return;
+			}
+
+			if (node.getStartOffset() < currentNode.getStartOffset() && node.getEndOffset() <= currentNode.getStartOffset()) {
+				nodes.add(i, node);
+				return;
+			}
+		}
+		// if we get here, then add it to the end
+		nodes.add(node);
+	}
+
+	public void deleteNodes(Object requestor) {
+		for (int i = nodes.size() - 1; i >= 0; i--) {
+			DTDNode node = (DTDNode) nodes.get(i);
+			dtdFile.deleteNode(requestor, (DTDNode) nodes.get(i));
+		}
+		nodes.clear();
+	}
+}
diff --git a/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/util/DTDExternalReferenceRemover.java b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/util/DTDExternalReferenceRemover.java
new file mode 100644
index 0000000..168cc09
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/util/DTDExternalReferenceRemover.java
@@ -0,0 +1,145 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+package org.eclipse.wst.dtd.core.util;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.wst.dtd.core.Attribute;
+import org.eclipse.wst.dtd.core.AttributeList;
+import org.eclipse.wst.dtd.core.CMBasicNode;
+import org.eclipse.wst.dtd.core.DTDFile;
+import org.eclipse.wst.dtd.core.DTDNode;
+import org.eclipse.wst.dtd.core.Element;
+import org.eclipse.wst.dtd.core.Entity;
+
+
+/*
+ * This class is responsible for updating the model when items are deleted or
+ * so that items referenced by it are cleaned up note that top level nodes are
+ * queued up for deletion so that iteration over the list of nodes from the
+ * dtdfile is not messed up. Note that when an external parmeter entity
+ * changes, the client of the model (e.g. editor) must be a DTDFileListener
+ * implementing the listener's interface to keep the model's referential
+ * integrity (See DTDModelImpl for example).
+ */
+
+public class DTDExternalReferenceRemover extends DTDVisitor {
+
+	protected DTDBatchNodeDelete batchDelete;
+	protected List externalElementsAndParmEntities = new ArrayList();
+
+	protected boolean isParmEntity = false;
+
+	protected boolean isUpdating = false;
+	protected DTDNode nodeToDelete;
+	protected String oldRefName = ""; //$NON-NLS-1$
+	protected Object requestor;
+
+	public DTDExternalReferenceRemover() {
+
+	}
+
+	public synchronized void externalReferenceAboutToChange(Object requestor, Entity entity) {
+		if (isUpdating) {
+			return;
+		}
+		if (!entity.isParameterEntity() || !entity.isExternalEntity()) {
+			// if it is not an external parameter entity, ignore as well
+			return;
+		}
+
+		isUpdating = true;
+		this.requestor = requestor;
+
+		DTDFile dtdFile = entity.getDTDFile();
+		if (batchDelete == null) {
+			batchDelete = new DTDBatchNodeDelete(dtdFile);
+		}
+
+		// See the comment at the head of this file regarding
+		// external parameter entities.
+		//externalElementsAndParmEntities =
+		// dtdFile.getDTDModel().getExternalModels().getElementContentNames(entity.getPublicID(),
+		// dtdFile.getDTDModel().resolveID(entity.getPublicID(),
+		// entity.getSystemID()));
+
+		visit(dtdFile);
+
+		batchDelete.deleteNodes(requestor);
+
+		isUpdating = false;
+	}
+
+	public boolean isMatchingName(String name) {
+		return externalElementsAndParmEntities.contains(name);
+	}
+
+	public void visitAttribute(Attribute attr) {
+		super.visitAttribute(attr);
+		String attrName = attr.getName();
+		String attrType = attr.getType();
+
+		if (isParameterEntityRef(attrName)) {
+			if (isMatchingName(attrName)) {
+				attr.setName(requestor, "TempName"); //$NON-NLS-1$
+			}
+		}
+		if (isParameterEntityRef(attrType)) {
+			if (isMatchingName(attrType)) {
+				attr.setType(requestor, Attribute.CDATA);
+			}
+		}
+	}
+
+	public void visitAttributeList(AttributeList attList) {
+		super.visitAttributeList(attList);
+		String attListName = attList.getName();
+		if (isParameterEntityRef(attListName)) {
+			if (isMatchingName(attListName)) {
+				attList.setName(requestor, "TempName"); //$NON-NLS-1$
+			}
+		}
+	}
+
+	public void visitElement(Element element) {
+		String elementName = element.getName();
+		if (isParameterEntityRef(elementName)) {
+			if (isMatchingName(elementName)) {
+				element.setName(requestor, "TempName"); //$NON-NLS-1$
+			}
+		}
+		super.visitElement(element);
+	}
+
+	public void visitReference(CMBasicNode node) {
+		super.visitReference(node);
+		String refName = node.getName();
+		if (isMatchingName(refName)) {
+			DTDNode parent = (DTDNode) node.getParentNode();
+			batchDelete.addNode(node);
+			//      parent.delete(requestor, node);
+		}
+	}
+
+	//    public void
+	// visitExternalParameterEntityReference(ParameterEntityReference
+	// parmEntityRef)
+	//    {
+	//      super.visitExternalParameterEntityReference(parmEntityRef);
+	//      if (isParmEntity && parmEntityRef.getName().equals(oldRefName))
+	//      {
+	//        nodesToDelete.add(parmEntityRef);
+	//      }
+	//    }
+}
diff --git a/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/util/DTDModelUpdater.java b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/util/DTDModelUpdater.java
new file mode 100644
index 0000000..fa2d0f9
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/util/DTDModelUpdater.java
@@ -0,0 +1,135 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+package org.eclipse.wst.dtd.core.util;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.wst.dtd.core.Attribute;
+import org.eclipse.wst.dtd.core.AttributeList;
+import org.eclipse.wst.dtd.core.CMBasicNode;
+import org.eclipse.wst.dtd.core.DTDFile;
+import org.eclipse.wst.dtd.core.DTDNode;
+import org.eclipse.wst.dtd.core.Element;
+import org.eclipse.wst.dtd.core.Entity;
+import org.eclipse.wst.dtd.core.ParameterEntityReference;
+
+
+// this class is responsible for updating the model when items
+// are deleted or a external parm entity changes so that
+// items referenced by it are cleaned up
+// note that top level nodes are queued up for deletion so that
+// iteration over the list of nodes from the dtdfile is not messed up
+public class DTDModelUpdater extends DTDVisitor {
+
+	protected boolean isParmEntity = false;
+
+	protected boolean isUpdating = false;
+
+	protected List nodesToDelete = new ArrayList();
+	protected DTDNode nodeToDelete;
+	protected String oldRefName = ""; //$NON-NLS-1$
+	protected Object requestor;
+
+	public DTDModelUpdater() {
+
+	}
+
+	public synchronized void objectAboutToBeDeleted(Object requestor, DTDNode node) {
+		if (isUpdating) {
+			return;
+		}
+		if (!(node instanceof Entity || node instanceof Element)) {
+			// just ignore if it is not one of these
+			return;
+		}
+		if (node instanceof Entity && !((Entity) node).isParameterEntity()) {
+			// if it is not a parameter entity, ignore as well
+			return;
+		}
+
+
+		isUpdating = true;
+		this.requestor = requestor;
+		this.nodeToDelete = node;
+		oldRefName = node.getName();
+		isParmEntity = false;
+		nodesToDelete.clear();
+
+		if (node instanceof Entity) {
+			Entity entity = (Entity) node;
+			isParmEntity = true;
+			oldRefName = "%" + oldRefName + ";"; //$NON-NLS-1$ //$NON-NLS-2$
+		}
+
+		DTDFile dtdFile = node.getDTDFile();
+		visit(dtdFile);
+
+		for (int i = 0; i < nodesToDelete.size(); i++) {
+			dtdFile.deleteNode(requestor, (DTDNode) nodesToDelete.get(i));
+		}
+
+		isUpdating = false;
+	}
+
+	public void visitAttribute(Attribute attr) {
+		super.visitAttribute(attr);
+		if (isParmEntity) {
+			if (attr.getName().equals(oldRefName)) {
+				attr.setName(requestor, "TempName"); //$NON-NLS-1$
+			}
+			if (attr.getType().equals(oldRefName)) {
+				attr.setType(requestor, Attribute.CDATA);
+			}
+		}
+		// check the attr name and the attr type to see if it
+		// needs updating
+	}
+
+	public void visitAttributeList(AttributeList attList) {
+		super.visitAttributeList(attList);
+		if (attList.getName().equals(oldRefName)) {
+			if (isParmEntity) {
+				attList.setName(requestor, "TempName"); //$NON-NLS-1$
+			} else {
+				// save up for later deletion
+				nodesToDelete.add(attList);
+			}
+		}
+	}
+
+	public void visitElement(Element element) {
+		if (isParmEntity) {
+			if (element.getName().equals(oldRefName)) {
+				element.setName(requestor, "TempName"); //$NON-NLS-1$
+			}
+		}
+		super.visitElement(element);
+	}
+
+	public void visitExternalParameterEntityReference(ParameterEntityReference parmEntityRef) {
+		super.visitExternalParameterEntityReference(parmEntityRef);
+		if (isParmEntity && parmEntityRef.getName().equals(oldRefName)) {
+			nodesToDelete.add(parmEntityRef);
+		}
+	}
+
+	public void visitReference(CMBasicNode node) {
+		super.visitReference(node);
+
+		if (node.getName().equals(oldRefName)) {
+			DTDNode parent = (DTDNode) node.getParentNode();
+			parent.delete(requestor, node);
+		}
+	}
+}
diff --git a/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/util/DTDNotationReferenceRemover.java b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/util/DTDNotationReferenceRemover.java
new file mode 100644
index 0000000..cbcb9ed
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/util/DTDNotationReferenceRemover.java
@@ -0,0 +1,92 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+package org.eclipse.wst.dtd.core.util;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.wst.dtd.core.Attribute;
+import org.eclipse.wst.dtd.core.AttributeEnumList;
+import org.eclipse.wst.dtd.core.AttributeList;
+import org.eclipse.wst.dtd.core.DTDFile;
+import org.eclipse.wst.dtd.core.DTDNode;
+import org.eclipse.wst.dtd.core.Entity;
+import org.eclipse.wst.dtd.core.Notation;
+
+
+public class DTDNotationReferenceRemover {
+	protected Notation notation;
+	protected String notationName;
+
+	protected Object requestor;
+
+	public DTDNotationReferenceRemover() {
+
+	}
+
+	public void notationAboutToBeDeleted(Object requestor, Notation notation) {
+		this.requestor = requestor;
+		this.notation = notation;
+		notationName = notation.getName();
+
+		visit(notation.getDTDFile());
+	}
+
+	public void visit(DTDFile file) {
+		List nodes = file.getNodes();
+		for (int i = 0; i < nodes.size(); i++) {
+			DTDNode currentNode = (DTDNode) nodes.get(i);
+			if (currentNode instanceof Entity) {
+				visitEntity((Entity) currentNode);
+			} else if (currentNode instanceof AttributeList) {
+				visitAttributeList((AttributeList) currentNode);
+			}
+		}
+	}
+
+	public void visitAttribute(Attribute attr) {
+		if (attr.getType().equals(Attribute.ENUMERATED_NOTATION)) {
+			AttributeEnumList enumList = attr.getEnumList();
+			List notationNames = enumList.getItems();
+			Iterator iter = notationNames.iterator();
+			boolean updateRequired = false;
+			while (iter.hasNext()) {
+				String notation = (String) iter.next();
+				if (notation.equals(notationName)) {
+					updateRequired = true;
+					iter.remove();
+				}
+			}
+			if (updateRequired) {
+				String[] newItems = new String[notationNames.size()];
+				notationNames.toArray(newItems);
+				enumList.setItems(requestor, newItems);
+			}
+		}
+	}
+
+	public void visitAttributeList(AttributeList attList) {
+		Attribute attr = (Attribute) attList.getFirstChild();
+		while (attr != null) {
+			visitAttribute(attr);
+			attr = (Attribute) attr.getNextSibling();
+		}
+	}
+
+	public void visitEntity(Entity entity) {
+		if (entity.getNotationName().equals(notationName)) {
+			entity.setNotationName(requestor, ""); //$NON-NLS-1$
+		}
+	}
+
+}// DTDNotationRemover
diff --git a/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/util/DTDReferenceUpdater.java b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/util/DTDReferenceUpdater.java
new file mode 100644
index 0000000..79bfcf2
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/util/DTDReferenceUpdater.java
@@ -0,0 +1,192 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+package org.eclipse.wst.dtd.core.util;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.wst.dtd.core.Attribute;
+import org.eclipse.wst.dtd.core.AttributeEnumList;
+import org.eclipse.wst.dtd.core.AttributeList;
+import org.eclipse.wst.dtd.core.CMBasicNode;
+import org.eclipse.wst.dtd.core.DTDFile;
+import org.eclipse.wst.dtd.core.DTDNode;
+import org.eclipse.wst.dtd.core.Element;
+import org.eclipse.wst.dtd.core.Entity;
+import org.eclipse.wst.dtd.core.Notation;
+import org.eclipse.wst.dtd.core.ParameterEntityReference;
+
+
+// this class is responsible for updating any dtd node in
+// response to a change in the node that they reference
+public class DTDReferenceUpdater extends DTDVisitor {
+	protected boolean isNotation = false;
+
+	protected boolean isParmEntity = false;
+
+	protected boolean isUpdating = false;
+	protected String newName = ""; //$NON-NLS-1$
+	protected String oldRefName = "", newRefName = ""; //$NON-NLS-1$ //$NON-NLS-2$
+	protected DTDNode referencedNode = null;
+
+	// the references List is a cache of the DTDNodes that are changed
+	// as a result of a call to nameAboutToChange(). The idea is that
+	// if a subsequent call comes in that changes the name of the same
+	// object for which this cache exists for, then we optimize the
+	// path by just walking the cache
+	private List references = new ArrayList();
+	protected Object requestor;
+
+	public DTDReferenceUpdater() {
+
+	}
+
+	public void clearCache() {
+		referencedNode = null;
+		references.clear();
+	}
+
+	public synchronized void nameAboutToChange(Object requestor, DTDNode referencedNode, String newName) {
+		if (isUpdating) {
+			return;
+		}
+		if (!(referencedNode instanceof Entity || referencedNode instanceof Element || referencedNode instanceof Notation)) {
+			// just ignore if it is not one of these
+			return;
+		}
+		if (referencedNode instanceof Entity && !((Entity) referencedNode).isParameterEntity()) {
+			// if it is not a parameter entity, ignore as well
+			return;
+		}
+
+		isUpdating = true;
+		this.requestor = requestor;
+		oldRefName = referencedNode.getName();
+		this.newName = newRefName = newName;
+		isParmEntity = false;
+		isNotation = referencedNode instanceof Notation;
+
+		if (referencedNode instanceof Entity) {
+			Entity entity = (Entity) referencedNode;
+			isParmEntity = true;
+			oldRefName = "%" + oldRefName + ";"; //$NON-NLS-1$ //$NON-NLS-2$
+			newRefName = "%" + newRefName + ";"; //$NON-NLS-1$ //$NON-NLS-2$
+		}
+
+		if (this.referencedNode != null) {
+			// check if the previous referenced node that was changed
+			// is the same as the one that is coming in. if so, just
+			// change the previous regions
+			if (this.referencedNode == referencedNode) {
+				quickUpdate();
+				isUpdating = false;
+				return;
+			}
+		}
+
+		// clear the cache if we get here
+		this.referencedNode = referencedNode;
+		references.clear();
+		DTDFile dtdFile = referencedNode.getDTDFile();
+		visit(dtdFile);
+		isUpdating = false;
+	}
+
+	protected void quickUpdate() {
+		for (int i = 0; i < references.size(); i++) {
+			DTDNode node = (DTDNode) references.get(i);
+			if (node instanceof Element) {
+				visitElement((Element) node);
+			} else if (node instanceof AttributeList) {
+				visitAttributeList((AttributeList) node);
+			} else if (node instanceof Attribute) {
+				visitAttribute((Attribute) node);
+			} else if (node instanceof CMBasicNode) {
+				visitReference((CMBasicNode) node);
+			} else if (node instanceof ParameterEntityReference) {
+				visitExternalParameterEntityReference((ParameterEntityReference) node);
+			}
+		}
+	}
+
+	public void visitAttribute(Attribute attr) {
+		super.visitAttribute(attr);
+		if (isParmEntity) {
+			// check the attr name and the attr type to see if it
+			// needs updating
+			if (attr.getName().equals(oldRefName)) {
+				attr.setName(requestor, newRefName);
+				references.add(attr);
+			}
+			if (attr.getType().equals(oldRefName)) {
+				attr.setType(requestor, newRefName);
+				references.add(attr);
+			}
+		} else if (isNotation && attr.getType().equals(Attribute.ENUMERATED_NOTATION)) {
+			AttributeEnumList enumList = attr.getEnumList();
+			List items = enumList.getItems();
+			boolean updateNeeded = false;
+			for (int i = 0; i < items.size(); i++) {
+				String notationName = (String) items.get(i);
+				if (notationName.equals(oldRefName)) {
+					updateNeeded = true;
+					items.set(i, newName);
+				}
+			}
+			if (updateNeeded) {
+				String[] newItems = new String[items.size()];
+
+				enumList.setItems((String[]) items.toArray(newItems));
+			}
+		}
+
+	}
+
+	public void visitAttributeList(AttributeList attList) {
+		if (!isNotation && attList.getName().equals(oldRefName)) {
+			attList.setName(requestor, newRefName);
+			references.add(attList);
+		}
+		super.visitAttributeList(attList);
+	}
+
+	public void visitElement(Element element) {
+		if (isParmEntity) {
+			if (element.getName().equals(oldRefName)) {
+				element.setName(requestor, newRefName);
+				references.add(element);
+			}
+		}
+		super.visitElement(element);
+	}
+
+	public void visitExternalParameterEntityReference(ParameterEntityReference parmEntityRef) {
+		super.visitExternalParameterEntityReference(parmEntityRef);
+		if (parmEntityRef.getName().equals(oldRefName)) {
+			parmEntityRef.setReferencedEntity(requestor, newName);
+			references.add(parmEntityRef);
+		}
+	}
+
+	public void visitReference(CMBasicNode node) {
+		super.visitReference(node);
+		if (isParameterEntityRef(oldRefName) && !isParmEntity) {
+			return;
+		}
+
+		if (node.getName().equals(oldRefName)) {
+			node.setName(requestor, newRefName);
+			references.add(node);
+		}
+	}
+}
diff --git a/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/util/DTDSAXParser.java b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/util/DTDSAXParser.java
new file mode 100644
index 0000000..04f0971
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/util/DTDSAXParser.java
@@ -0,0 +1,170 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+package org.eclipse.wst.dtd.core.util;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.parsers.SAXParser;
+
+import org.xml.sax.Parser;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXNotRecognizedException;
+import org.xml.sax.SAXNotSupportedException;
+import org.xml.sax.XMLReader;
+
+/**
+ * TODO: Kihup and Nitin, reevaluate the use and implementation of this class
+ */
+
+//import org.apache.xerces.parsers.SAXParser;
+//import org.apache.xerces.xni.Augmentations;
+//import org.apache.xerces.xni.XMLLocator;
+//import org.apache.xerces.xni.XMLString;
+//import org.apache.xerces.xni.XNIException;
+public class DTDSAXParser extends SAXParser {
+
+	private List ignoredEntityRefs = new ArrayList();
+
+	//  private XMLLocator locator;
+	//
+	public List getIgnoredEntityRefs() {
+		return ignoredEntityRefs;
+	}
+
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.xml.parsers.SAXParser#getParser()
+	 */
+	public Parser getParser() throws SAXException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.xml.parsers.SAXParser#getProperty(java.lang.String)
+	 */
+	public Object getProperty(String name) throws SAXNotRecognizedException, SAXNotSupportedException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.xml.parsers.SAXParser#getXMLReader()
+	 */
+	public XMLReader getXMLReader() throws SAXException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	//
+	//  public XMLLocator getLocator()
+	//  {
+	//    return locator;
+	//  }
+	//
+	//  public void startDocument
+	//    (XMLLocator locator,
+	//     String encoding,
+	//     Augmentations augs)
+	//  {
+	//    this.locator = locator;
+	//    super.startDocument(locator,encoding,augs);
+	//  }
+	//
+	//  public void ignoredCharacters(XMLString text, Augmentations augs)
+	//    throws XNIException
+	//  {
+	//    String s =
+	//      text.length > 0 ? new String(text.ch,text.offset,text.length) : "";
+	//    //System.out.println("ignoredCharacters: " + s);
+	//
+	//    StringTokenizer tokenizer = new StringTokenizer(s,";");
+	//    try
+	//    {
+	//      String token = null;
+	//      while (tokenizer.hasMoreTokens())
+	//      {
+	//        token = tokenizer.nextToken();
+	//        if (isEntityRef(token))
+	//          registerEntityRef(token);
+	//      }
+	//    }
+	//    catch (NoSuchElementException e)
+	//    {
+	//      e.printStackTrace();
+	//    }
+	//  }
+	//
+	// TODO: never used
+	 boolean isEntityRef(String token) {
+		// Looking for the pattern "nnnn%nnnnn".
+		if (token.indexOf('%') != -1)
+			return true; // candidate for entity reference
+		else
+			return false;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.xml.parsers.SAXParser#isNamespaceAware()
+	 */
+	public boolean isNamespaceAware() {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.xml.parsers.SAXParser#isValidating()
+	 */
+	public boolean isValidating() {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	// TODO: never used
+	 void registerEntityRef(String token) {
+		int index = token.lastIndexOf('%');
+		if (index == -1)
+			return;
+
+		String refName = token.substring(index, token.length());
+		//System.out.println("entity ref name is: " + refName);
+		if (refName.indexOf(' ') != -1 || refName.indexOf('\t') != -1 || refName.indexOf('\n') != -1)
+			return;
+		else
+			// we found entity reference
+			ignoredEntityRefs.add(refName + ";"); //$NON-NLS-1$
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.xml.parsers.SAXParser#setProperty(java.lang.String,
+	 *      java.lang.Object)
+	 */
+	public void setProperty(String name, Object value) throws SAXNotRecognizedException, SAXNotSupportedException {
+		// TODO Auto-generated method stub
+
+	}
+
+}
diff --git a/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/util/DTDUniqueNameHelper.java b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/util/DTDUniqueNameHelper.java
new file mode 100644
index 0000000..1555c24
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/util/DTDUniqueNameHelper.java
@@ -0,0 +1,91 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+package org.eclipse.wst.dtd.core.util;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.wst.dtd.core.Attribute;
+import org.eclipse.wst.dtd.core.CMBasicNode;
+import org.eclipse.wst.dtd.core.DTDFile;
+import org.eclipse.wst.dtd.core.Element;
+import org.eclipse.wst.dtd.core.Entity;
+import org.eclipse.wst.dtd.core.Notation;
+
+
+public class DTDUniqueNameHelper {
+
+	static public String getName(Object obj) {
+		if (obj instanceof Element) {
+			return ((Element) obj).getName();
+		} else if (obj instanceof Entity) {
+			return ((Entity) obj).getName();
+		} else if (obj instanceof Notation) {
+			return ((Notation) obj).getName();
+		} else if (obj instanceof Attribute) {
+			return ((Attribute) obj).getName();
+		} else if (obj instanceof CMBasicNode) // Model Group Content
+		{
+			return ((CMBasicNode) obj).getName();
+		}
+		return ""; //$NON-NLS-1$
+	}
+
+	static public String getUniqueAttributeName(Element element) {
+		List attrs = element.getElementAttributes();
+		return getUniqueName(attrs, "NewAttribute"); //$NON-NLS-1$
+	}
+
+	static public String getUniqueElementName(DTDFile dtdFile) {
+		List elements = dtdFile.getElementsAndParameterEntityReferences().getNodes();
+		return getUniqueName(elements, "NewElement"); //$NON-NLS-1$
+	}
+
+	static public String getUniqueEntityName(DTDFile dtdFile) {
+		List entities = dtdFile.getEntities().getNodes();
+		return getUniqueName(entities, "NewEntity"); //$NON-NLS-1$
+	}
+
+	static public String getUniqueName(List objs, String token) {
+		int counter = 1;
+
+		boolean uniqueName = false;
+		while (!uniqueName) {
+			String newName = token + new Integer(counter++);
+			uniqueName = true;
+			Iterator iter = objs.iterator();
+			while (iter.hasNext()) {
+				Object obj = iter.next();
+				String objName = getName(obj);
+				if (objName.equals(newName)) {
+					uniqueName = false;
+					break;
+				}
+			}
+			if (uniqueName) {
+				return newName;
+			}
+		}
+		// we shouldn't get here
+		return "No Name found"; //$NON-NLS-1$
+	}
+
+	static public String getUniqueNotationName(DTDFile dtdFile) {
+		List notations = dtdFile.getNotations().getNodes();
+		return getUniqueName(notations, "NewNotation"); //$NON-NLS-1$
+	}
+
+	public DTDUniqueNameHelper() {
+	}
+
+} // DTDUniqueNameHelper
diff --git a/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/util/DTDVisitor.java b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/util/DTDVisitor.java
new file mode 100644
index 0000000..2544de7
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/util/DTDVisitor.java
@@ -0,0 +1,105 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+package org.eclipse.wst.dtd.core.util;
+
+import java.util.List;
+
+import org.eclipse.wst.dtd.core.Attribute;
+import org.eclipse.wst.dtd.core.AttributeList;
+import org.eclipse.wst.dtd.core.CMBasicNode;
+import org.eclipse.wst.dtd.core.CMGroupNode;
+import org.eclipse.wst.dtd.core.CMNode;
+import org.eclipse.wst.dtd.core.DTDFile;
+import org.eclipse.wst.dtd.core.DTDNode;
+import org.eclipse.wst.dtd.core.Element;
+import org.eclipse.wst.dtd.core.ParameterEntityReference;
+
+
+public class DTDVisitor {
+
+	public DTDVisitor() {
+
+	}
+
+	// utility method
+	public boolean isParameterEntityRef(String reference) {
+		if (reference.length() > 0) {
+			return reference.charAt(0) == '%' && reference.charAt(reference.length() - 1) == ';';
+		}
+		return false;
+	}
+
+	public void visit(DTDFile file) {
+		List nodes = file.getNodes();
+		for (int i = 0; i < nodes.size(); i++) {
+			DTDNode currentNode = (DTDNode) nodes.get(i);
+			if (currentNode instanceof Element) {
+				visitElement((Element) currentNode);
+			} else if (currentNode instanceof AttributeList) {
+				visitAttributeList((AttributeList) currentNode);
+			} else if (currentNode instanceof ParameterEntityReference) {
+				visitExternalParameterEntityReference((ParameterEntityReference) currentNode);
+			}
+		}
+	}
+
+	public void visitAttribute(Attribute attr) {
+	}
+
+	public void visitAttributeList(AttributeList attList) {
+		// note that we don't visit attributes here because we
+		// want the element to visit them with it's consolidated list
+		// that it creates by gathering all attribute lists together
+	}
+
+	public void visitAttributes(List attributes) {
+		int size = attributes.size();
+		for (int i = 0; i < size; i++) {
+			Attribute attr = (Attribute) attributes.get(i);
+			visitAttribute(attr);
+		}
+	}
+
+	public void visitContentNode(CMNode content) {
+		if (content instanceof CMBasicNode) {
+			CMBasicNode basicNode = (CMBasicNode) content;
+			if (basicNode.isReference()) {
+				visitReference(basicNode);
+			}
+		} else if (content instanceof CMGroupNode) {
+			visitGroupNode((CMGroupNode) content);
+		}
+	}
+
+	public void visitElement(Element element) {
+		CMNode content = element.getContentModel();
+		visitContentNode(content);
+		visitAttributes(element.getElementAttributes());
+	}
+
+	public void visitExternalParameterEntityReference(ParameterEntityReference parmEntityRef) {
+	}
+
+	public void visitGroupNode(CMGroupNode group) {
+		List children = group.getChildrenList();
+		int size = children.size();
+		for (int i = 0; i < size; i++) {
+			visitContentNode((CMNode) children.get(i));
+		}
+	}
+
+	public void visitReference(CMBasicNode node) {
+	}
+
+
+}
diff --git a/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/util/LabelValuePair.java b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/util/LabelValuePair.java
new file mode 100644
index 0000000..5f04ceb
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/util/LabelValuePair.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+package org.eclipse.wst.dtd.core.util;
+
+import org.eclipse.jface.util.Assert;
+
+public class LabelValuePair {
+
+	public String fLabel;
+	public Object fValue;
+
+	/**
+	 * Creates a new name/value item
+	 */
+	public LabelValuePair(String label, Object value) {
+		Assert.isTrue(label != null);
+		fLabel = label;
+		fValue = value;
+	}
+}
diff --git a/bundles/org.eclipse.wst.dtd.ui/.classpath b/bundles/org.eclipse.wst.dtd.ui/.classpath
index 065ac06..df094ee 100644
--- a/bundles/org.eclipse.wst.dtd.ui/.classpath
+++ b/bundles/org.eclipse.wst.dtd.ui/.classpath
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
-	<classpathentry kind="src" path="src"/>
-	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
-	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
-	<classpathentry kind="output" path="bin"/>
+    <classpathentry kind="src" path="src"/>
+    <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+    <classpathentry kind="output" path="bin"/>
 </classpath>
diff --git a/bundles/org.eclipse.wst.dtd.ui/.compatibility b/bundles/org.eclipse.wst.dtd.ui/.compatibility
new file mode 100644
index 0000000..3ea4f29
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/.compatibility
@@ -0,0 +1,2 @@
+#Wed Mar 24 13:53:52 EST 2004

+.project=4140

diff --git a/bundles/org.eclipse.wst.dtd.ui/.cvsignore b/bundles/org.eclipse.wst.dtd.ui/.cvsignore
index ba077a4..08378e7 100644
--- a/bundles/org.eclipse.wst.dtd.ui/.cvsignore
+++ b/bundles/org.eclipse.wst.dtd.ui/.cvsignore
@@ -1 +1,8 @@
 bin
+doc
+power.jpage
+temp.folder
+dtdeditor.jar
+.project
+org.eclipse.wst.dtd.ui_6.0.0.jar
+build.xml
diff --git a/bundles/org.eclipse.wst.dtd.ui/.project b/bundles/org.eclipse.wst.dtd.ui/.project
index 1d02da4..2d58bc5 100644
--- a/bundles/org.eclipse.wst.dtd.ui/.project
+++ b/bundles/org.eclipse.wst.dtd.ui/.project
@@ -3,6 +3,22 @@
 	<name>org.eclipse.wst.dtd.ui</name>
 	<comment></comment>
 	<projects>
+		<project>com.ibm.base.extensions.ui</project>
+		<project>org.eclipse.wst.sse.ui</project>
+		<project>org.eclipse.wst.sse.ui.extensions</project>
+		<project>org.eclipse.wst.sse.core</project>
+		<project>org.eclipse.wst.dtd.core</project>
+		<project>org.eclipse.wst.xml.core</project>
+		<project>org.eclipse.core.resources</project>
+		<project>org.eclipse.core.runtime</project>
+		<project>org.eclipse.core.runtime.compatibility</project>
+		<project>org.eclipse.jface.text</project>
+		<project>org.eclipse.ui</project>
+		<project>org.eclipse.ui.editors</project>
+		<project>org.eclipse.ui.ide</project>
+		<project>org.eclipse.ui.views</project>
+		<project>org.eclipse.ui.workbench</project>
+		<project>org.eclipse.ui.workbench.texteditor</project>
 	</projects>
 	<buildSpec>
 		<buildCommand>
@@ -22,7 +38,7 @@
 		</buildCommand>
 	</buildSpec>
 	<natures>
-		<nature>org.eclipse.jdt.core.javanature</nature>
 		<nature>org.eclipse.pde.PluginNature</nature>
+		<nature>org.eclipse.jdt.core.javanature</nature>
 	</natures>
 </projectDescription>
diff --git a/bundles/org.eclipse.wst.dtd.ui/build.properties b/bundles/org.eclipse.wst.dtd.ui/build.properties
new file mode 100644
index 0000000..88b9844
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/build.properties
@@ -0,0 +1,22 @@
+###############################################################################
+# Copyright (c) 2001, 2004 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+# 
+# Contributors:
+#     IBM Corporation - initial API and implementation
+#     Jens Lukowski/Innoopract - initial renaming/restructuring
+#     
+###############################################################################
+bin.includes = plugin.xml,\
+               *.jar,\
+               dtd.jar,\
+               icons/,\
+               plugin.properties
+source.dtdeditor.jar = src/
+src.includes = plugin.xml,\
+               icons/,\
+               build.xml,\
+               plugin.properties
diff --git a/bundles/org.eclipse.wst.dtd.ui/icons/DTDFile.gif b/bundles/org.eclipse.wst.dtd.ui/icons/DTDFile.gif
new file mode 100644
index 0000000..211c437
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/icons/DTDFile.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.dtd.ui/icons/full/ctool16/ADD_Attribute.gif b/bundles/org.eclipse.wst.dtd.ui/icons/full/ctool16/ADD_Attribute.gif
new file mode 100644
index 0000000..00bb7b4
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/icons/full/ctool16/ADD_Attribute.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.dtd.ui/icons/full/ctool16/ADD_Element.gif b/bundles/org.eclipse.wst.dtd.ui/icons/full/ctool16/ADD_Element.gif
new file mode 100644
index 0000000..01f4889
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/icons/full/ctool16/ADD_Element.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.dtd.ui/icons/full/ctool16/ADD_ElementToConModel.gif b/bundles/org.eclipse.wst.dtd.ui/icons/full/ctool16/ADD_ElementToConModel.gif
new file mode 100644
index 0000000..1a8236b
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/icons/full/ctool16/ADD_ElementToConModel.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.dtd.ui/icons/full/ctool16/ADD_GroupToConModel.gif b/bundles/org.eclipse.wst.dtd.ui/icons/full/ctool16/ADD_GroupToConModel.gif
new file mode 100644
index 0000000..8168fb3
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/icons/full/ctool16/ADD_GroupToConModel.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.dtd.ui/icons/full/dtool16/ADD_Attribute.gif b/bundles/org.eclipse.wst.dtd.ui/icons/full/dtool16/ADD_Attribute.gif
new file mode 100644
index 0000000..a7fb780
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/icons/full/dtool16/ADD_Attribute.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.dtd.ui/icons/full/dtool16/ADD_Element.gif b/bundles/org.eclipse.wst.dtd.ui/icons/full/dtool16/ADD_Element.gif
new file mode 100644
index 0000000..3755e5e
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/icons/full/dtool16/ADD_Element.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.dtd.ui/icons/full/dtool16/ADD_ElementToConModel.gif b/bundles/org.eclipse.wst.dtd.ui/icons/full/dtool16/ADD_ElementToConModel.gif
new file mode 100644
index 0000000..1a58e11
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/icons/full/dtool16/ADD_ElementToConModel.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.dtd.ui/icons/full/dtool16/ADD_GroupToConModel.gif b/bundles/org.eclipse.wst.dtd.ui/icons/full/dtool16/ADD_GroupToConModel.gif
new file mode 100644
index 0000000..d525a21
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/icons/full/dtool16/ADD_GroupToConModel.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.dtd.ui/icons/full/etool16/ADD_Attribute.gif b/bundles/org.eclipse.wst.dtd.ui/icons/full/etool16/ADD_Attribute.gif
new file mode 100644
index 0000000..00bb7b4
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/icons/full/etool16/ADD_Attribute.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.dtd.ui/icons/full/etool16/ADD_Element.gif b/bundles/org.eclipse.wst.dtd.ui/icons/full/etool16/ADD_Element.gif
new file mode 100644
index 0000000..01f4889
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/icons/full/etool16/ADD_Element.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.dtd.ui/icons/full/etool16/ADD_ElementToConModel.gif b/bundles/org.eclipse.wst.dtd.ui/icons/full/etool16/ADD_ElementToConModel.gif
new file mode 100644
index 0000000..1a8236b
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/icons/full/etool16/ADD_ElementToConModel.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.dtd.ui/icons/full/etool16/ADD_GroupToConModel.gif b/bundles/org.eclipse.wst.dtd.ui/icons/full/etool16/ADD_GroupToConModel.gif
new file mode 100644
index 0000000..8168fb3
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/icons/full/etool16/ADD_GroupToConModel.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.dtd.ui/icons/full/obj16/ADD_Comment.gif b/bundles/org.eclipse.wst.dtd.ui/icons/full/obj16/ADD_Comment.gif
new file mode 100644
index 0000000..39611d6
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/icons/full/obj16/ADD_Comment.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.dtd.ui/icons/full/obj16/ADD_Entity.gif b/bundles/org.eclipse.wst.dtd.ui/icons/full/obj16/ADD_Entity.gif
new file mode 100644
index 0000000..cb41506
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/icons/full/obj16/ADD_Entity.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.dtd.ui/icons/full/obj16/ADD_Entity_Reference.gif b/bundles/org.eclipse.wst.dtd.ui/icons/full/obj16/ADD_Entity_Reference.gif
new file mode 100644
index 0000000..5efa9b9
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/icons/full/obj16/ADD_Entity_Reference.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.dtd.ui/icons/full/obj16/ADD_Notation.gif b/bundles/org.eclipse.wst.dtd.ui/icons/full/obj16/ADD_Notation.gif
new file mode 100644
index 0000000..57ad089
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/icons/full/obj16/ADD_Notation.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.dtd.ui/icons/full/obj16/organize_dtd_logically.gif b/bundles/org.eclipse.wst.dtd.ui/icons/full/obj16/organize_dtd_logically.gif
new file mode 100644
index 0000000..093c6ba
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/icons/full/obj16/organize_dtd_logically.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.dtd.ui/icons/full/obj16/sort.gif b/bundles/org.eclipse.wst.dtd.ui/icons/full/obj16/sort.gif
new file mode 100644
index 0000000..23c5d0b
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/icons/full/obj16/sort.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.dtd.ui/icons/full/obj16/validate.gif b/bundles/org.eclipse.wst.dtd.ui/icons/full/obj16/validate.gif
new file mode 100644
index 0000000..86196e9
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/icons/full/obj16/validate.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.dtd.ui/icons/sourceEditor.gif b/bundles/org.eclipse.wst.dtd.ui/icons/sourceEditor.gif
new file mode 100644
index 0000000..75ebdb8
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/icons/sourceEditor.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.dtd.ui/plugin.properties b/bundles/org.eclipse.wst.dtd.ui/plugin.properties
new file mode 100644
index 0000000..1a48cf9
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/plugin.properties
@@ -0,0 +1,350 @@
+###############################################################################
+# Copyright (c) 2001, 2004 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+# 
+# Contributors:
+#     IBM Corporation - initial API and implementation
+#     Jens Lukowski/Innoopract - initial renaming/restructuring
+#     
+###############################################################################
+SSE_DTD_Source_Editor.name=SSE DTD Source Editor
+SSE_DTD_Source_Editor_NL_Support.name=SSE DTD Source Editor NL Support
+DTD_Source_Page_Editor.name=DTD Source Page Editor
+! Properties file for component: XMDTD - XML Tools DTD Editor
+! Packaged for translation in:  xml.zip
+
+!plugin.xml
+_UI_PLUGIN_NAME=DTD Editor
+_UI_EDITOR_NAME=DTD Editor
+_UI_WIZARD_NEW_DTD=DTD File
+_UI_CREATE_NEW_DTD_FILE=Create a new DTD file
+_UI_XML_TOOLS_PREFERENCE_PAGE=XML
+_UI_DTD_EDITOR_PREFERENCE=DTD
+
+! GenerateDTDActionDelegate - XML validation check
+_UI_DIALOG_TITLE_XML_ERROR=Invalid XML
+_UI_DIALOG_INFO_XML_INVALID=IWAK0090I The XML file contains errors. Open it in the XML editor and validate it for details.
+
+!
+! Preference Page
+!
+_UI_SEPARATE_DESIGN_AND_SOURCE_VIEW=Separate design and source view
+_UI_COMBINED_DESIGN_AND_SOURCE_VIEW=Combined design and source view
+_UI_LABEL_EDITOR_LAYOUT=Editor Layout
+_UI_LABEL_DTD_FILES=DTD Files
+_UI_LABEL_DTD_STYLES=DTD Styles
+
+!AddAttributeAction
+_UI_DEFAULT_NEW_ATTRIBUTE=Attribute
+_UI_ACTION_DTD_ADD_ATTRIBUTE=Add Attribute
+_UI_ACTION_DTD_ADD_ELEMENT=Add Element
+
+!actions/AddGroupToContentModelAction.java
+_UI_ACTION_ADD_GROUP=Add &Group
+
+!AddEntityAction
+_UI_ACTION_ADD_ENTITY=Add &Entity
+
+
+! Flat Page Header Text
+_UI_PAGE_HEADING_ELEMENT=Element
+_UI_PAGE_HEADING_ATTRIBUTE=Attribute
+_UI_PAGE_HEADING_NOTATION=Notation
+_UI_PAGE_HEADING_PARAM_ENTITY_REF=External Parameter Entity Reference
+_UI_PAGE_HEADING_ENTITY=Entity
+_UI_PAGE_HEADING_COMMENT=Comment
+_UI_PAGE_HEADING_ATTLIST=Attribute List
+_UI_PAGE_HEADING_CONTENT_MODEL=Content Model
+_UI_PAGE_HEADING_CONTENT_MODEL_GROUP=Content Model Group
+
+!BlankWindow
+_UI_LABEL_VIEW_NOT_AVAILABLE=View is not available for selected object.
+
+!AttributeWindow
+_UI_ACTION_NOTATION_INFO=Attribute Information
+_UI_LABEL_ATTRIBUTE_NAME=Name:
+_UI_LABEL_ATTRIBUTE_TYPE=Type:
+_UI_RADIO_DEFAULT=Default
+_UI_GROUP_ENUMERATED_DEFAULTS=Enumerated defaults
+_UI_BUTTON_ADD=Add  >>
+_UI_BUTTON_REMOVE=<< Remove
+_UI_CHKBOX_DEFAULT=Default
+_UI_GROUP_ELEMENT_COMMENT=Comment
+_UI_CHKBOX_ENUMERATED_DEFAULT=Default
+_UI_CHKBOX_NOTATION_COMBO=Default
+_UI_GROUP_ATTRIBUTE=Attribute default value
+
+!ContentWindow  & ElementWindow
+_UI_LABEL_DTD_NAME=Name
+_UI_GROUP_OCCURRENCE=Occurrence
+
+!the following four symbols are also used in dtdeditor/presentation/GroupContentWindow.java
+!! NOTE TO TRANSLATOR: Please keep the characters in parentheses in translated text i.e. (1)
+_UI_RADIO_JUST_ONCE=Just once (1)
+_UI_RADIO_ONE_OR_MORE=One or more (+)
+_UI_RADIO_OPTIONAL=Optional (?)
+_UI_RADIO_ZERO_OR_MORE=Zero or more (*)
+
+!context menu for .dtd files
+_UI_MENU_GENERATE=&Generate
+_UI_MENU_JAVA=&Java Beans...
+_UI_MENU_XML_SCHEMA=XML &Schema...
+_UI_MENU_HTML_FORM=&HTML Form...
+
+!presentation/DTDContextContributor.java
+_UI_MENU_GENERATE_JAVA=Generate &Java Beans...
+_UI_MENU_GENERATE_XML_SCHEMA=Generate &XML Schema...
+_UI_MENU_GENERATE_HTML_FORM=Generate &HTML Form...
+_UI_MENU_GENERATE_SAMPLE_XML=Generate XM&L...
+_UI_MENU_VALIDATE_DTD=&Validate DTD
+_UI_TOOLTIP_VALIDATE_DTD=Validate the current state of the DTD
+_UI_TOOLTIP_GENERATE_HTML=Generate an HTML form for the DTD
+_UI_TOOLTIP_GENERATE_SAMPLE_XML=Generate an XML from the DTD
+_UI_TOOLTIP_GENERATE_XML_SCHEMA=Generate an XML Schema from the DTD
+_UI_TOOLTIP_GENERATE_JAVA=Generate Java Beans for the DTD
+
+_UI_ACTION_DELETE=Delete
+_UI_ACTION_CONTEXT_ADD_NOTATION=Add &Notation
+_UI_TOOLTIP_ADD_NOTATION=Add a notation to the DTD.
+_UI_ACTION_CONTEXT_ADD_ENTITY=Add &Entity
+_UI_TOOLTIP_ADD_ENTITY=Add an entity to the DTD.
+_UI_ACTION_CONTEXT_ADD_ELEMENT=Add Ele&ment
+_UI_TOOLTIP_ADD_ELEMENT=Add an element to the DTD.
+_UI_ACTION_CONTEXT_ADD_ATTRIBUTE=Add Attribute
+_UI_TOOLTIP_ADD_ATTRIBUTE_SELECTED=Add an attribute to the selected element.
+_UI_ACTION_ADD_ATTRIBUTELIST=Add Attribute &List
+_UI_TOOLTIP_ADD_ATTRIBUTELIST_SELECTED=Add an attribute list to the selected element.
+_UI_ACTION_ADD_GROUP_CONTENT=Add Group To Con&tent Model
+_UI_TOOLTIP_ADD_GROUP=Add a group to the content model of the selected group or element.
+_UI_ACTION_ADD_ELEMENT_CONTENT=Add Element To C&ontent Model
+_UI_TOOLTIP_ADD_ELEMENT_CONTENT=Add an element to the content model.
+_UI_MENU_DTD_EDITOR=&DTD
+_UI_TOOLTIP_ADD_COMMENT=Add a comment to the DTD.
+
+!presentation/DTDEditor.java
+_UI_WORKBOOKPAGE_SOURCE=Source
+_UI_WORKBOOKPAGE_DESIGN=Design
+
+!the following is used: _UI_MENU_UNDO_1 + _UI_MENU_UNDO_2
+_UI_MENU_UNDO_1=&Undo
+!! NOTE TO TRANSLATOR: Do not translate following line - shortcut key
+_UI_MENU_UNDO_2=@Ctrl+Z
+
+!the following is used: _UI_MENU_UNDO_DESC + a description of the command to be undone
+_UI_MENU_UNDO_DESC=Undo:
+
+!the following is used: _UI_MENU_REDO_1 + _UI_MENU_REDO_2
+_UI_MENU_REDO_1=&Redo
+!! NOTE TO TRANSLATOR: Do not translate following line - shortcut key
+_UI_MENU_REDO_2=@Ctrl+Y
+
+!the following is used: _UI_MENU_REDO_DESC + a description of the command to be done again
+_UI_MENU_REDO_DESC=Redo:
+
+!presentation/ElementWindow
+_UI_ELEMENT_NAME=Name
+_UI_ELEMENT_COMMENT=Comment
+
+!DTDOutliner
+_UI_ACTION_ADD_DTD_NOTATION=Add &Notation
+_UI_ACTION_ADD_DTD_ENTITY=Add &Entity
+_UI_ACTION_ADD_DTD_ELEMENT=Add Ele&ment
+_UI_ACTION_ADD_DTD_COMMENT=Add &Comment
+_UI_ACTION_DTD_DELETE=&Delete
+_UI_ACTION_ADD_ATTRIBUTE=Add &Attribute
+_UI_ACTION_GROUP_ADD_GROUP=Add Group to Con&tent Model
+_UI_ACTION_ADD_ELEMENT=Add Element to C&ontent Model
+
+!DTDContentOutlinePage
+_UI_BUTTON_GROUP_ITEMS_LOGICALLY=Group items logically.
+_UI_BUTTON_UNGROUP_ITEMS_LOGICALLY=Do not group items logically.
+_UI_BUTTON_SORT_ITEMS=Sort items alphabetically.
+_UI_BUTTON_UNSORT_ITEMS=Do not sort items alphabetically.
+
+!provider/EntityItemProvider.java
+_UI_COLUMN_PARAMETER=Parameter
+_UI_COLUMN_GENERAL=General
+
+!provider/FolderItemProvider.java
+_UI_LABEL_ELEMENTS_FOLDER=Elements
+_UI_LABEL_NOTATIONS_FOLDER=Notations
+_UI_LABEL_ENITIES_FOLDER=Entities
+
+!Wizards/InputSelectionPage.java
+_UI_BUTTON_SELECT_ALL=&Select All
+_UI_BUTTON_UNSELECT_ALL=&Clear All
+
+!Wizards/HTMLFormWizard.java
+_UI_HTML_WIZARD_NEW_FILE_TITLE=Generate HTML Form
+_UI_HTML_WIZARD_NEW_FILE_DESC=Generate an HTML form from the selected DTD file.
+
+!Wizards/NewDTDWizard.java
+_UI_WIZARD_NEW_DTD_TITLE=Create DTD
+_UI_WIZARD_CREATE_DTD_HEADING=Create DTD File
+_UI_WIZARD_CREATE_DTD_EXPL=Select how you would like to create your DTD file.
+_UI_RADIO_CREATE_DTD=Create DTD file from scratch
+_UI_RADIO_CREATE_DTD_FROM_XML=Create DTD file from an XML file
+
+_UI_WIZARD_NEW_DTD_HEADING=New DTD
+_UI_WIZARD_NEW_DTD_EXPL=Create a new DTD file. Specify the folder and name for the file.
+
+_UI_WIZARD_NEW_XSD_HEADING=New XML Schema
+_UI_WIZARD_NEW_XSD_EXPL=Create a new XML Schema file from the XML file.
+
+_UI_WIZARD_XML_FILE_HEADING=XML Files
+_UI_WIZARD_XML_FILE_EXPL=Select the XML files to create the DTD file from.
+_UI_LABEL_XML_FILES=XML Files:
+
+_UI_STATUS_XML_CONTAINS_ERRORS=XML files specified contained errors.
+_UI_BUTTON_ADD_XML=Add...
+_UI_BUTTON_REMOVE_XML=Remove
+
+!wizards/ServletNamePage
+_UI_WIZARD_SERVLET_NAME_HEADING=Servlet Name
+_UI_LABEL_SERVLET_NAME=&Enter the servlet name:
+_UI_LABEL_MISSING_SERVLET_NAME=Provide a servlet name
+_UI_LABEL_DEFAULT_SERVLET_NAME=http://localhost/servlet/testServlet
+
+!wizards/GenerateXMLSchemaHelper.java & DTD2XSDWizard.java
+_UI_WIZARD_DTD2XSD_TITLE=Generate
+_UI_GENERATE_XSD_TITLE=Generate XML Schema
+_UI_GENERATE_XSD_DESCRIPTION=Generate an XML schema from the selected DTD file.
+_UI_PAGE_GEN_OPTIONS_TITLE=XML Schema Generation Options
+_UI_PAGE_GEN_OPTIONS_DESC=Select how you want your XML schema generated
+_UI_GENERATE_XSD_LONG_DESC=You can create one XML schema file that includes the selected DTD and any of the DTDs it references.  Alternatively, you can create individual schema files that correspond to the selected DTD and any of the DTDs it references.
+
+
+_UI_GROUP_OPTIONS=Options
+_UI_BUTTON_GEN_ONE_SCHEMA=&Create one XML schema that includes all the DTD files
+_UI_BUTTON_GEN_MULTI_SCHEMAS=Create an &XML schema for each DTD file
+
+!EntityWindow
+_UI_GROUP_ENTITY_INFORMATION=Entity information
+_UI_LABEL_NAME=Name:
+_UI_LABLE_TYPE=Type:
+_UI_RADIO_GENERAL=General
+_UI_RADIO_PARAMETER=Parameter
+_UI_CHKBOX_EXTERNAL=External
+_UI_GROUP_INTERNAL=Internal Entity
+_UI_DIALOG_SELECT_DTD=Select System ID File
+_UI_DIALOG_SELECT_DTD_DESC=Please select a resource to be used for the System ID.
+_UI_GROUP_INTERNAL_ENTITY=Internal entity
+_UI_LABEL_VALUE_INTERNAL=Value:
+_UI_GROUP_EXTERNAL_ENTITY=External entity
+_UI_LABEL_VALUE=Value
+_UI_GROUP_COMMENT=Comment
+_UI_LABEL_SYSTEM_ID=System ID:
+_UI_BUTTON_SELECT=Select...
+_UI_LABEL_PUBLIC_ID=Public ID:
+_UI_LABEL_NOTATION_NAME=Notation name
+_UI_LABEL_UNPARSE_ENTITY=(Unparsed entity)
+_UI_TOOLTIP_GENERAL=Use entity in XML documents.
+_UI_TOOLTIP_PARAMETER=Use entity in a DTD.
+_UI_TOOLTIP_EXTERNAL=Refer to an external DTD.
+_UI_LABEL_BROWSE=Browse...
+
+!presentation/NotationsTable.java
+_UI_COLUMN_NOTATION_NAME=Notation Name
+_UI_COLUMN_DECLARATION=Declaration
+
+!GroupContentWindow
+_UI_GROUP_MODEL_GROUP=Model group
+_UI_GROUP_CONNECTOR=Connector
+_UI_GROUP_MODEL_GROUP_OCCURRENCE=Occurrence
+_UI_RADIO_SEQUENCE=Sequence (,)
+_UI_RADIO_CHOICE=Choice (|)
+_UI_LABEL_CONTENT_MODEL_TYPE=Content model type:
+
+!EntitiesTable
+_UI_COLUMN_ENTITY_NAME=Entity Name
+_UI_COLUMN_TYPE=Type
+_UI_COLUMN_DECLARATION=Declaration
+
+!AddNotationAction
+_UI_DEFAULT_NOTATION=Notation
+_UI_ACTION_ADD_NOTATION=Add &Notation
+
+!ElementsTable
+_UI_COLUMN_ELEMENT_NAME=Element Name
+_UI_COLUMN_CONTENT_MODEL=Content Model
+_UI_COLUMN_ATTRIBUTES=Attributes
+
+!ValidateDTDAction
+_UI_MSGBOX_DTD_VALID_TITLE=Validation Successful
+_UI_MSGBOX_DTD_VALID_TEXT=The DTD file is valid.
+
+!NotationWindow
+_UI_LABEL_NOTATION_INFORMATION=Notation information
+_UI_LABEL_NOTATION_NAME=Name:
+_UI_LABEL_NOTATION_SYSTEM_ID=System ID:
+_UI_LABEL_NOTATION_PUBLIC_ID=Public ID:
+_UI_LABEL_NOTATION_COMMENT=Comment
+
+!ParameterEntityReferenceWindow
+_UI_GROUP_EXTERNAL_PARM_ENTITY_REF=External parameter entity reference
+_UI_LABEL_ENTITY_NAME=Entity name:
+_UI_LABEL_REFERENCED_FILE=Referenced file:
+
+!InputSelectionPage (HTMLFormWizard)
+_UI_INPUT_SEL_PAGE_TITLE=Form Input Selection
+_UI_INPUT_SEL_PAGE_DESC=Select the form input fields to be generated
+
+!HTMLFormWizard (HTMLFormWizard)
+_UI_HTML_WIZARD_TITLE=HTML Form Creation Wizard
+
+! ParameterEntityReferenceWindow
+_UI_BUTTON_DETAILS=Details...
+
+!DTDContextContributer
+_UI_ACTION_ADD_PARAM_ENTITY_REF=Add &Parameter Entity Reference
+
+!DragAttributeCommand
+_UI_MOVE_ATTRIBUTE=Move Attribute
+
+!DragContentModelCommand
+_UI_MOVE_CONTENT=Move Content
+
+!DragTopLevelNodesCommand
+_UI_MOVE_NODE=Move Node
+_UI_MOVE_NODES=Move Nodes
+
+!DTDValidator
+_UI_DTD_VALIDATOR=DTD Validator
+
+!======================================================================================
+!
+! Here is the list of Error strings that have message IDs - make sure they are unique
+!  Range for DTDEditor messageIDs: IWAX0201 - IWAX0400
+!
+!======================================================================================
+_ERROR_MIN_ONE_XML_FILE=IWAK0091E At least one XML File must be added
+_ERROR_MIN_ONE_XML_FILE_FOR_OP=IWAK0092E At least one XML file is required to perform the operation.
+_ERROR_NO_FILENAME=IWAK0093E Enter a file name
+_ERROR_FILE_DOES_NOT_EXIST=IWAK0094E File does not exist
+_ERROR_FILENAME_INVALID=IWAK0095E Invalid file name
+_ERROR_FILENAME_MUST_END_DTD=IWAK0096E The file name must end in .dtd
+_ERROR_TITLE_GENERATE_DTD_FAILED=IWAK0097E Generate DTD failed
+_ERROR_MSG_GENERATE_DTD_FAILED=IWAK0098E Errors were encountered while generating the DTD.
+
+_ERROR_INVALID_NAME_SPACE=IWAK0099E Name field cannot contain a space
+_ERROR_VALIDATE_FAILED=IWAK0100E Validation failed
+_ERROR_DTD_INVALID=IWAK0101E The DTD file is invalid.  Please check the Tasks view for more details.
+_ERROR_LIMITE_EXCEEDED=IWAK0102E The DTD file is not valid.  The message limit for the Tasks view has been exceeded.  Please increase the limit and try again.
+
+_ERROR_TITLE_GENERATE_JAVABEAN_FAILED=IWAK0103E Generate Java Beans failed
+_ERROR_MSG_GENERATE_JAVABEAN_FAILED=IWAK0104E Errors were encountered while generating the Java Beans.
+DTDColorPage.0=<\!ELEMENT Main (One,Two+)>\r\n<\!ELEMENT One (Three,Four)>\r\n<\!ATTLIST One\r\n oneone CDATA \#REQUIRED\r\n>\r\n<\!-- You need this -->\r\n<\!ELEMENT Two (moremore*)>\r\n<\!ATTLIST Two\r\n twotwo CDATA \#REQUIRED\r\n twothree (aaa | bbb) "aaa"\r\n>\r\n
+DTDColorPage.1=Comments
+DTDColorPage.2=Data
+DTDColorPage.3=Default
+DTDColorPage.4=Keywords
+DTDColorPage.5=Strings
+DTDColorPage.6=Symbols
+DTDColorPage.7=Tag Delimiters
+DTDColorPage.8=Tag Names
+DTDPropertySourceAdapter.0=Name
+DTDPropertySourceAdapter.1=Contents
+DTDPropertySourceAdapter.2=Attributes
diff --git a/bundles/org.eclipse.wst.dtd.ui/plugin.xml b/bundles/org.eclipse.wst.dtd.ui/plugin.xml
new file mode 100644
index 0000000..07dd097
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/plugin.xml
@@ -0,0 +1,111 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+<plugin
+   id="org.eclipse.wst.dtd.ui"
+   name="%SSE_DTD_Source_Editor.name"
+   version="1.0.0"
+   provider-name="IBM"
+   class="org.eclipse.wst.dtd.ui.DTDEditorPlugin">
+
+   <runtime>
+      <library name="dtdeditor.jar">
+         <export name="*"/>
+      </library>
+   </runtime>
+   <requires>
+      <import plugin="org.eclipse.core.runtime.compatibility"/>
+      <import plugin="org.eclipse.ui.ide"/>
+      <import plugin="org.eclipse.ui.views"/>
+      <import plugin="org.eclipse.jface.text"/>
+      <import plugin="org.eclipse.ui.workbench.texteditor"/>
+      <import plugin="org.eclipse.ui.editors"/>
+      <import plugin="org.eclipse.wst.sse.ui"/>
+      <import plugin="org.eclipse.wst.xml.core"/>
+      <import plugin="org.eclipse.wst.dtd.core"/>
+      <import plugin="org.eclipse.wst.sse.core"/>
+      <import plugin="org.eclipse.ui"/>
+      <import plugin="org.eclipse.ui.workbench"/>
+      <import plugin="org.eclipse.core.resources"/>
+      <import plugin="org.eclipse.core.runtime"/>
+      <import plugin="org.eclipse.wst.common.encoding"/>
+      <import plugin="org.eclipse.wst.ui"/>
+   </requires>
+
+
+   <extension
+         point="org.eclipse.ui.editors">
+      <editor
+            name="%DTD_Source_Page_Editor.name"
+            icon="icons/DTDFile.gif"
+            extensions="dtd,ent,mod"
+            contributorClass="org.eclipse.wst.dtd.ui.ActionContributorDTD"
+            class="org.eclipse.wst.dtd.ui.StructuredTextEditorDTD"
+            symbolicFontName="org.eclipse.wst.sse.ui.textfont"
+            id="org.eclipse.wst.dtd.ui.StructuredTextEditorDTD">
+      </editor>
+   </extension>
+   <extension
+         point="org.eclipse.wst.sse.ui.extendedconfiguration">
+      <contentoutlineconfiguration
+            class="org.eclipse.wst.dtd.ui.views.contentoutline.DTDContentOutlineConfiguration"
+            target="org.eclipse.wst.dtd.core.dtdsource">
+      </contentoutlineconfiguration>
+      <textviewerconfiguration
+            class="org.eclipse.wst.dtd.ui.StructuredTextViewerConfigurationDTD"
+            target="org.eclipse.wst.dtd.core.dtdsource">
+      </textviewerconfiguration>
+      <characterpairmatcher
+            class="org.eclipse.wst.dtd.ui.text.DTDDocumentRegionEdgeMatcher"
+            target="org.eclipse.wst.dtd.core.dtdsource">
+      </characterpairmatcher>
+      <preferencepages
+            preferenceids="org.eclipse.wst.sse.ui.preferences/org.eclipse.wst.sse.ui.preferences.dtd"
+            target="org.eclipse.wst.dtd.core.dtdsource">
+      </preferencepages>
+   </extension>
+   <extension
+      point="org.eclipse.core.filebuffers.annotationModelCreation">
+      <factory
+            contentTypeId="org.eclipse.wst.dtd.core.dtdsource"
+            class="org.eclipse.wst.sse.ui.StructuredResourceMarkerAnnotationModelFactory"/>
+   </extension>
+   <extension
+         point="org.eclipse.wst.sse.ui.adapterFactoryDescription">
+      <adapterFactoryDescription
+            class="org.eclipse.wst.dtd.ui.registry.AdapterFactoryProviderForDTD">
+            <contentType id="org.eclipse.wst.dtd.core.dtdsource"/>
+      </adapterFactoryDescription>
+   </extension>
+<!-- Editor actionsets -->
+   <extension
+         point="org.eclipse.ui.actionSetPartAssociations">
+      <actionSetPartAssociation
+            targetID="org.eclipse.ui.edit.text.actionSet.annotationNavigation">
+         <part
+               id="org.eclipse.wst.dtd.ui.StructuredTextEditorDTD">
+         </part>
+      </actionSetPartAssociation>
+      <actionSetPartAssociation
+            targetID="org.eclipse.ui.NavigateActionSet">
+         <part
+               id="org.eclipse.wst.dtd.ui.StructuredTextEditorDTD">
+         </part>
+      </actionSetPartAssociation>
+   </extension>
+   <extension
+         point="org.eclipse.ui.preferencePages">
+      <page
+            name="%_UI_LABEL_DTD_FILES"
+            category="org.eclipse.wst.sse.ui.preferences"
+            class="org.eclipse.wst.dtd.ui.preferences.DTDFilesPreferencePage"
+            id="org.eclipse.wst.sse.ui.preferences.dtd">
+      </page>
+      <page
+            name="%_UI_LABEL_DTD_STYLES"
+            category="org.eclipse.wst.sse.ui.preferences.dtd"
+            class="org.eclipse.wst.dtd.ui.preferences.DTDColorPage"
+            id="org.eclipse.wst.sse.ui.preferences.dtd.styles">
+      </page>
+   </extension>
+
+</plugin>
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/ActionContributorDTD.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/ActionContributorDTD.java
new file mode 100644
index 0000000..b09a082
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/ActionContributorDTD.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+package org.eclipse.wst.dtd.ui;
+
+import org.eclipse.wst.sse.ui.edit.util.ActionContributor;
+
+/**
+ * XMLEditorActionContributor
+ * 
+ * This class should not be used inside multi page editor's
+ * ActionBarContributor, since cascaded init() call from the
+ * ActionBarContributor will causes exception and it leads to lose whole
+ * toolbars.
+ * 
+ * Instead, use SourcePageActionContributor for source page contributor of
+ * multi page editor.
+ * 
+ * Note that this class is still valid for single page editor.
+ */
+public class ActionContributorDTD extends ActionContributor {
+	protected static final String[] EDITOR_IDS = {"org.eclipse.wst.dtd.ui.StructuredTextEditorDTD", "org.eclipse.wst.sse.ui.StructuredTextEditor"}; //$NON-NLS-1$ //$NON-NLS-2$
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.wst.sse.ui.edit.util.ActionContributor#getExtensionIDs()
+	 */
+	protected String[] getExtensionIDs() {
+		return EDITOR_IDS;
+	}
+}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/DTDEditorPlugin.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/DTDEditorPlugin.java
new file mode 100644
index 0000000..a7e5ade
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/DTDEditorPlugin.java
@@ -0,0 +1,155 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+package org.eclipse.wst.dtd.ui;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPluginDescriptor;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.eclipse.wst.common.encoding.content.IContentTypeIdentifier;
+import org.eclipse.wst.dtd.ui.style.IStyleConstantsDTD;
+import org.eclipse.wst.sse.ui.EditorPlugin;
+import org.eclipse.wst.sse.ui.preferences.PreferenceKeyGenerator;
+import org.eclipse.wst.sse.ui.preferences.ui.ColorHelper;
+
+
+/**
+ * The main plugin class to be used in the desktop.
+ */
+public class DTDEditorPlugin extends AbstractUIPlugin {
+	//The shared instance.
+	private static DTDEditorPlugin plugin;
+
+	/**
+	 * Returns the shared instance.
+	 */
+	public static DTDEditorPlugin getDefault() {
+		return plugin;
+	}
+
+	/**
+	 * Returns the string from the plugin's resource bundle, or 'key' if not
+	 * found.
+	 */
+	public static String getResourceString(String key) {
+		ResourceBundle bundle = DTDEditorPlugin.getDefault().getResourceBundle();
+		try {
+			if (bundle != null)
+				return bundle.getString(key);
+			else
+				return key;
+		} catch (MissingResourceException e) {
+			return key;
+		}
+	}
+
+	/**
+	 * Returns the workspace instance.
+	 */
+	public static IWorkspace getWorkspace() {
+		return ResourcesPlugin.getWorkspace();
+	}
+
+	/**
+	 * true if editor preference store has been initialized with default
+	 * values false otherwise
+	 */
+	private boolean preferencesInitd = false;
+
+	//Resource bundle.
+	private ResourceBundle resourceBundle;
+
+	/**
+	 * The constructor.
+	 */
+	public DTDEditorPlugin(IPluginDescriptor descriptor) {
+		super(descriptor);
+		plugin = this;
+		try {
+			//resourceBundle =
+			// ResourceBundle.getBundle("org.eclipse.wst.dtd.ui.DTDPluginResources");
+			resourceBundle = descriptor.getResourceBundle();
+		} catch (MissingResourceException x) {
+			resourceBundle = null;
+		}
+
+		// reference the preference store so
+		// initializeDefaultPreferences(IPreferenceStore preferenceStore) is
+		// called
+		IPreferenceStore store = getPreferenceStore();
+		// for some reason initializeDefaultPreferences is not always called,
+		// so
+		// just add an extra check to see if not initialized, then call init
+		if (!preferencesInitd) {
+			initializeDefaultPreferences(store);
+		}
+	}
+
+	/**
+	 * Returns the plugin's resource bundle,
+	 */
+	public ResourceBundle getResourceBundle() {
+		return resourceBundle;
+	}
+
+	private void initializeDefaultDTDPreferences(IPreferenceStore store) {
+		String ctId = IContentTypeIdentifier.ContentTypeID_DTD;
+
+		// DTD Style Preferences
+		String NOBACKGROUNDBOLD = " | null | false"; //$NON-NLS-1$
+		String styleValue = ColorHelper.getColorString(0, 0, 0) + NOBACKGROUNDBOLD;
+		store.setDefault(PreferenceKeyGenerator.generateKey(IStyleConstantsDTD.DTD_DEFAULT, ctId), styleValue); //black
+
+		styleValue = ColorHelper.getColorString(63, 63, 191) + NOBACKGROUNDBOLD;
+		store.setDefault(PreferenceKeyGenerator.generateKey(IStyleConstantsDTD.DTD_TAG, ctId), styleValue); // blue
+		store.setDefault(PreferenceKeyGenerator.generateKey(IStyleConstantsDTD.DTD_TAGNAME, ctId), styleValue); // blue
+
+		styleValue = ColorHelper.getColorString(127, 127, 127) + NOBACKGROUNDBOLD;
+		store.setDefault(PreferenceKeyGenerator.generateKey(IStyleConstantsDTD.DTD_COMMENT, ctId), styleValue); // grey
+
+		styleValue = ColorHelper.getColorString(128, 0, 0) + NOBACKGROUNDBOLD;
+		store.setDefault(PreferenceKeyGenerator.generateKey(IStyleConstantsDTD.DTD_KEYWORD, ctId), styleValue); // dark
+		// red
+
+		styleValue = ColorHelper.getColorString(63, 159, 95) + NOBACKGROUNDBOLD;
+		store.setDefault(PreferenceKeyGenerator.generateKey(IStyleConstantsDTD.DTD_STRING, ctId), styleValue); //green
+
+		styleValue = ColorHelper.getColorString(191, 95, 95) + NOBACKGROUNDBOLD;
+		store.setDefault(PreferenceKeyGenerator.generateKey(IStyleConstantsDTD.DTD_DATA, ctId), styleValue); // light
+		// red
+
+		styleValue = ColorHelper.getColorString(128, 0, 0) + NOBACKGROUNDBOLD;
+		store.setDefault(PreferenceKeyGenerator.generateKey(IStyleConstantsDTD.DTD_SYMBOL, ctId), styleValue); // dark
+		// red
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.ui.plugin.AbstractUIPlugin#initializeDefaultPluginPreferences()
+	 */
+	protected void initializeDefaultPreferences(IPreferenceStore store) {
+
+		// ignore this preference store
+		// use EditorPlugin preference store
+		IPreferenceStore editorStore = ((AbstractUIPlugin) Platform.getPlugin(EditorPlugin.ID)).getPreferenceStore();
+		EditorPlugin.initializeDefaultEditorPreferences(editorStore);
+		initializeDefaultDTDPreferences(editorStore);
+		preferencesInitd = true;
+	}
+}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/StructuredTextEditorDTD.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/StructuredTextEditorDTD.java
new file mode 100644
index 0000000..59e8671
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/StructuredTextEditorDTD.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+package org.eclipse.wst.dtd.ui;
+
+import org.eclipse.wst.dtd.ui.internal.editor.IHelpContextIds;
+import org.eclipse.wst.sse.ui.StructuredTextEditor;
+
+
+public class StructuredTextEditorDTD extends StructuredTextEditor {
+	protected void initializeEditor() {
+		super.initializeEditor();
+		setHelpContextId(IHelpContextIds.DTD_SOURCEVIEW_HELPID);
+	}
+}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/StructuredTextViewerConfigurationDTD.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/StructuredTextViewerConfigurationDTD.java
new file mode 100644
index 0000000..d2267b3
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/StructuredTextViewerConfigurationDTD.java
@@ -0,0 +1,98 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+package org.eclipse.wst.dtd.ui;
+
+import org.eclipse.jface.text.ITextHover;
+import org.eclipse.jface.text.source.ISourceViewer;
+import org.eclipse.wst.dtd.core.rules.StructuredTextPartitionerForDTD;
+import org.eclipse.wst.dtd.ui.style.LineStyleProviderForDTD;
+import org.eclipse.wst.dtd.ui.taginfo.DTDBestMatchHoverProcessor;
+import org.eclipse.wst.sse.core.text.IStructuredDocument;
+import org.eclipse.wst.sse.core.text.rules.StructuredTextPartitioner;
+import org.eclipse.wst.sse.ui.EditorPlugin;
+import org.eclipse.wst.sse.ui.StructuredTextViewerConfiguration;
+import org.eclipse.wst.sse.ui.style.Highlighter;
+import org.eclipse.wst.sse.ui.style.IHighlighter;
+import org.eclipse.wst.sse.ui.style.LineStyleProvider;
+import org.eclipse.wst.sse.ui.style.LineStyleProviderForNoOp;
+import org.eclipse.wst.sse.ui.taginfo.AnnotationHoverProcessor;
+import org.eclipse.wst.sse.ui.taginfo.ProblemAnnotationHoverProcessor;
+import org.eclipse.wst.sse.ui.taginfo.TextHoverManager;
+import org.eclipse.wst.sse.ui.util.EditorUtility;
+
+
+/**
+ * Provides the best dtd hover help documentation (by using other hover help
+ * processors) Priority of hover help processors is: ProblemHoverProcessor,
+ * AnnotationHoverProcessor
+ */
+public class StructuredTextViewerConfigurationDTD extends StructuredTextViewerConfiguration {
+	public String[] getConfiguredContentTypes(ISourceViewer sourceViewer) {
+		if (configuredContentTypes == null) {
+			configuredContentTypes = new String[]{StructuredTextPartitionerForDTD.ST_DTD_DEFAULT, StructuredTextPartitioner.ST_DEFAULT_PARTITION, StructuredTextPartitioner.ST_UNKNOWN_PARTITION};
+		}
+		return configuredContentTypes;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.ibm.sed.editor.StructuredTextViewerConfiguration#getHighlighter(org.eclipse.jface.text.source.ISourceViewer)
+	 */
+	public IHighlighter getHighlighter(ISourceViewer viewer) {
+		if (fHighlighter == null) {
+			fHighlighter = new Highlighter();
+		}
+
+		// We need to add the providers each time this method is called.
+		// See StructuredTextViewer.configure() method (defect#246727)
+		LineStyleProvider dtdProvider = new LineStyleProviderForDTD();
+		LineStyleProvider noopProvider = new LineStyleProviderForNoOp();
+
+		// com.ibm.sed.editor.ST_DEFAULT
+		fHighlighter.addProvider(StructuredTextPartitionerForDTD.ST_DTD_DEFAULT, dtdProvider);
+		fHighlighter.addProvider(StructuredTextPartitioner.ST_DEFAULT_PARTITION, dtdProvider);
+		fHighlighter.addProvider(StructuredTextPartitioner.ST_UNKNOWN_PARTITION, noopProvider);
+
+		//fHighlighter.setModel(((StructuredTextViewer) viewer).getModel());
+		fHighlighter.setDocument((IStructuredDocument) viewer.getDocument());
+
+		return fHighlighter;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getTextHover(org.eclipse.jface.text.source.ISourceViewer,
+	 *      java.lang.String, int)
+	 */
+	public ITextHover getTextHover(ISourceViewer sourceViewer, String contentType, int stateMask) {
+		// content type does not really matter since only combo, problem,
+		// annotation hover is available
+		TextHoverManager.TextHoverDescriptor[] hoverDescs = EditorPlugin.getDefault().getTextHoverManager().getTextHovers();
+		int i = 0;
+		while (i < hoverDescs.length) {
+			if (hoverDescs[i].isEnabled() && EditorUtility.computeStateMask(hoverDescs[i].getModifierString()) == stateMask) {
+				String hoverType = hoverDescs[i].getId();
+				if (TextHoverManager.COMBINATION_HOVER.equalsIgnoreCase(hoverType))
+					return new DTDBestMatchHoverProcessor();
+				else if (TextHoverManager.PROBLEM_HOVER.equalsIgnoreCase(hoverType))
+					return new ProblemAnnotationHoverProcessor();
+				else if (TextHoverManager.ANNOTATION_HOVER.equalsIgnoreCase(hoverType))
+					return new AnnotationHoverProcessor();
+			}
+			i++;
+		}
+		return super.getTextHover(sourceViewer, contentType, stateMask);
+	}
+}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/dnd/DTDDragAndDropManager.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/dnd/DTDDragAndDropManager.java
new file mode 100644
index 0000000..74a5975
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/dnd/DTDDragAndDropManager.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+
+
+package org.eclipse.wst.dtd.ui.dnd;
+
+import java.util.Collection;
+
+import org.eclipse.wst.dtd.core.Attribute;
+import org.eclipse.wst.dtd.core.CMNode;
+import org.eclipse.wst.dtd.core.DTDNode;
+import org.eclipse.wst.dtd.core.TopLevelNode;
+import org.eclipse.wst.ui.dnd.DragAndDropCommand;
+import org.eclipse.wst.ui.dnd.DragAndDropManager;
+
+public class DTDDragAndDropManager implements DragAndDropManager {
+
+	public DragAndDropCommand createCommand(Object target, float location, int operations, int operation, Collection source) {
+		if (target instanceof DTDNode) {
+			DTDNode node = (DTDNode) target;
+
+			if (node instanceof TopLevelNode) {
+				return new DragTopLevelNodesCommand(target, location, operations, operation, source);
+			}
+			if (node instanceof Attribute) {
+				return new DragAttributeCommand(target, location, operations, operation, source);
+			}
+			if (node instanceof CMNode) {
+				return new DragContentModelCommand(target, location, operations, operation, source);
+			}
+
+		}
+		return null;
+	}
+
+}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/dnd/DragAttributeCommand.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/dnd/DragAttributeCommand.java
new file mode 100644
index 0000000..3459fed
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/dnd/DragAttributeCommand.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+package org.eclipse.wst.dtd.ui.dnd;
+
+import java.util.Collection;
+import java.util.Iterator;
+
+import org.eclipse.wst.dtd.core.Attribute;
+import org.eclipse.wst.dtd.core.AttributeList;
+import org.eclipse.wst.dtd.core.DTDFile;
+import org.eclipse.wst.dtd.core.DTDNode;
+import org.eclipse.wst.dtd.ui.DTDEditorPlugin;
+import org.eclipse.wst.ui.dnd.DefaultDragAndDropCommand;
+
+
+
+public class DragAttributeCommand extends DefaultDragAndDropCommand {
+
+	public DragAttributeCommand(Object target, float location, int operations, int operation, Collection sources) {
+		super(target, location, operations, operation, sources);
+	}
+
+	public boolean canExecute() {
+		Iterator iter = sources.iterator();
+		while (iter.hasNext()) {
+			Object source = iter.next();
+			if (!(source instanceof Attribute)) {
+				return false;
+			}
+		}
+		return true;
+	}
+
+	public void execute() {
+		DTDNode referenceNode = (DTDNode) target;
+		DTDFile dtdFile = referenceNode.getDTDFile();
+		if (referenceNode instanceof Attribute) {
+			dtdFile.getDTDModel().beginRecording(this, DTDEditorPlugin.getResourceString("_UI_MOVE_ATTRIBUTE")); //$NON-NLS-1$
+			AttributeList attList = (AttributeList) referenceNode.getParentNode();
+			Iterator iter = sources.iterator();
+			while (iter.hasNext()) {
+				DTDNode node = (DTDNode) iter.next();
+				if (node instanceof Attribute) {
+					attList.insertIntoModel(this, (Attribute) referenceNode, (Attribute) node, isAfter());
+					dtdFile.deleteNode(this, node);
+				}
+			}
+			dtdFile.getDTDModel().endRecording(this);
+		}
+	}
+}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/dnd/DragContentModelCommand.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/dnd/DragContentModelCommand.java
new file mode 100644
index 0000000..af32026
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/dnd/DragContentModelCommand.java
@@ -0,0 +1,111 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+
+
+package org.eclipse.wst.dtd.ui.dnd;
+
+import java.util.Collection;
+import java.util.Iterator;
+
+import org.eclipse.swt.dnd.DND;
+import org.eclipse.wst.dtd.core.CMBasicNode;
+import org.eclipse.wst.dtd.core.CMGroupNode;
+import org.eclipse.wst.dtd.core.CMNode;
+import org.eclipse.wst.dtd.core.DTDFile;
+import org.eclipse.wst.dtd.core.DTDNode;
+import org.eclipse.wst.dtd.core.Element;
+import org.eclipse.wst.dtd.ui.DTDEditorPlugin;
+import org.eclipse.wst.ui.dnd.DefaultDragAndDropCommand;
+
+
+public class DragContentModelCommand extends DefaultDragAndDropCommand {
+
+	public DragContentModelCommand(Object target, float location, int operations, int operation, Collection sources) {
+		super(target, location, operations, operation, sources);
+	}
+
+	public boolean canExecute() {
+		if (!(target instanceof CMNode)) {
+			return false;
+		}
+
+		Iterator iter = sources.iterator();
+		while (iter.hasNext()) {
+			Object source = iter.next();
+			if (!(source instanceof CMNode)) {
+				return false;
+			}
+		}
+		return true;
+	}
+
+	public void execute() {
+		DTDNode referenceNode = (DTDNode) target;
+
+		if (referenceNode instanceof CMNode) {
+			DTDFile dtdFile = referenceNode.getDTDFile();
+
+			DTDNode parent = (DTDNode) referenceNode.getParentNode();
+			dtdFile.getDTDModel().beginRecording(this, DTDEditorPlugin.getResourceString("_UI_MOVE_CONTENT")); //$NON-NLS-1$
+			boolean parentIsElement = false;
+			Element element = null;
+			CMGroupNode group = null;
+			if (parent instanceof Element) {
+				parentIsElement = true;
+				element = (Element) parent;
+			} else {
+				group = (CMGroupNode) parent;
+			}
+
+			if (element == null && group == null) {
+				// no parent to add to
+				return;
+			}
+
+			Iterator iter = sources.iterator();
+			while (iter.hasNext()) {
+				DTDNode node = (DTDNode) iter.next();
+				if (node instanceof CMNode) {
+					if (parentIsElement) {
+						if (element.getContentModel() == node) {
+							continue;
+						}
+						element.replaceContentModel(this, (CMNode) node);
+					} else {
+						if (referenceNode == node || (isAfter() && referenceNode.getNextSibling() == node) || (!isAfter() && node.getNextSibling() == referenceNode)) {
+							continue;
+						}
+
+						group.insertIntoModel(this, (CMNode) referenceNode, (CMNode) node, isAfter());
+
+					}
+					DTDNode nodeParent = (DTDNode) node.getParentNode();
+					nodeParent.delete(this, node);
+				}
+			}
+			dtdFile.getDTDModel().endRecording(this);
+		}
+	}
+
+	public int getFeedback() {
+		DTDNode referenceNode = (DTDNode) target;
+		if (referenceNode instanceof CMNode) {
+			CMNode cmNode = (CMNode) referenceNode;
+			if (cmNode.isRootElementContent() && cmNode instanceof CMBasicNode) {
+				return DND.FEEDBACK_SELECT;
+			}
+		}
+
+		return super.getFeedback();
+	}
+}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/dnd/DragTopLevelNodesCommand.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/dnd/DragTopLevelNodesCommand.java
new file mode 100644
index 0000000..6f3a69f
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/dnd/DragTopLevelNodesCommand.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+
+
+package org.eclipse.wst.dtd.ui.dnd;
+
+import java.util.Collection;
+import java.util.Iterator;
+
+import org.eclipse.wst.dtd.core.DTDFile;
+import org.eclipse.wst.dtd.core.DTDNode;
+import org.eclipse.wst.dtd.core.TopLevelNode;
+import org.eclipse.wst.dtd.ui.DTDEditorPlugin;
+import org.eclipse.wst.ui.dnd.DefaultDragAndDropCommand;
+
+public class DragTopLevelNodesCommand extends DefaultDragAndDropCommand {
+
+	static private final String moveNode = DTDEditorPlugin.getResourceString("_UI_MOVE_NODE"); //$NON-NLS-1$
+	static private final String moveNodes = DTDEditorPlugin.getResourceString("_UI_MOVE_NODES"); //$NON-NLS-1$
+
+	public DragTopLevelNodesCommand(Object target, float location, int operations, int operation, Collection sources) {
+		super(target, location, operations, operation, sources);
+	}
+
+	public boolean canExecute() {
+		if (!(target instanceof TopLevelNode)) {
+			return false;
+		}
+
+		Iterator iter = sources.iterator();
+		while (iter.hasNext()) {
+			Object source = iter.next();
+			if (!(source instanceof TopLevelNode)) {
+				return false;
+			}
+		}
+		return true;
+	}
+
+	public void execute() {
+		DTDNode referenceNode = (DTDNode) target;
+
+		DTDFile dtdFile = referenceNode.getDTDFile();
+		dtdFile.getDTDModel().beginRecording(this, sources.size() > 1 ? moveNodes : moveNode);
+		Iterator iter = sources.iterator();
+		while (iter.hasNext()) {
+			DTDNode node = (DTDNode) iter.next();
+			if (node instanceof TopLevelNode) {
+				dtdFile.moveNode(this, referenceNode, node, isAfter());
+			}
+		}
+		dtdFile.getDTDModel().endRecording(this);
+	}
+}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/editor/DTDEditorPluginImageHelper.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/editor/DTDEditorPluginImageHelper.java
new file mode 100644
index 0000000..7a7e9ae
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/editor/DTDEditorPluginImageHelper.java
@@ -0,0 +1,155 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+package org.eclipse.wst.dtd.ui.internal.editor;
+
+import java.util.HashMap;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.eclipse.wst.dtd.ui.DTDEditorPlugin;
+
+
+/**
+ * Helper class to handle images provided by this plug-in.
+ * 
+ * NOTE: For internal use only. For images used externally, please use the
+ * Shared***ImageHelper class instead.
+ * 
+ * @author amywu
+ */
+public class DTDEditorPluginImageHelper {
+	private static DTDEditorPluginImageHelper instance = null;
+
+	/**
+	 * Gets the instance.
+	 * 
+	 * @return Returns a DTDEditorPluginImageHelper
+	 */
+	public synchronized static DTDEditorPluginImageHelper getInstance() {
+		if (instance == null)
+			instance = new DTDEditorPluginImageHelper();
+		return instance;
+	}
+
+	//	 save a descriptor for each image
+	private HashMap fImageDescRegistry = null;
+	private final String PLUGINID = DTDEditorPlugin.getDefault().getBundle().getSymbolicName();
+
+	/**
+	 * Creates an image from the given resource and adds the image to the
+	 * image registry.
+	 * 
+	 * @param resource
+	 * @return Image
+	 */
+	private Image createImage(String resource) {
+		ImageDescriptor desc = getImageDescriptor(resource);
+		Image image = null;
+
+		if (desc != null) {
+			image = desc.createImage();
+			// dont add the missing image descriptor image to the image
+			// registry
+			if (!desc.equals(ImageDescriptor.getMissingImageDescriptor()))
+				getImageRegistry().put(resource, image);
+		}
+		return image;
+	}
+
+	/**
+	 * Creates an image descriptor from the given imageFilePath and adds the
+	 * image descriptor to the image descriptor registry. If an image
+	 * descriptor could not be created, the default "missing" image descriptor
+	 * is returned but not added to the image descriptor registry.
+	 * 
+	 * @param imageFilePath
+	 * @return ImageDescriptor image descriptor for imageFilePath or default
+	 *         "missing" image descriptor if resource could not be found
+	 */
+	private ImageDescriptor createImageDescriptor(String imageFilePath) {
+		ImageDescriptor imageDescriptor = AbstractUIPlugin.imageDescriptorFromPlugin(PLUGINID, imageFilePath);
+		if (imageDescriptor != null) {
+			getImageDescriptorRegistry().put(imageFilePath, imageDescriptor);
+		} else {
+			imageDescriptor = ImageDescriptor.getMissingImageDescriptor();
+		}
+
+		return imageDescriptor;
+	}
+
+	/**
+	 * Retrieves the image associated with resource from the image registry.
+	 * If the image cannot be retrieved, attempt to find and load the image at
+	 * the location specified in resource.
+	 * 
+	 * @param resource
+	 *            the image to retrieve
+	 * @return Image the image associated with resource or null if one could
+	 *         not be found
+	 */
+	public Image getImage(String resource) {
+		Image image = getImageRegistry().get(resource);
+		if (image == null) {
+			// create an image
+			image = createImage(resource);
+		}
+		return image;
+	}
+
+	/**
+	 * Retrieves the image descriptor associated with resource from the image
+	 * descriptor registry. If the image descriptor cannot be retrieved,
+	 * attempt to find and load the image descriptor at the location specified
+	 * in resource.
+	 * 
+	 * @param resource
+	 *            the image descriptor to retrieve
+	 * @return ImageDescriptor the image descriptor assocated with resource or
+	 *         the default "missing" image descriptor if one could not be
+	 *         found
+	 */
+	public ImageDescriptor getImageDescriptor(String resource) {
+		ImageDescriptor imageDescriptor = null;
+		Object o = getImageDescriptorRegistry().get(resource);
+		if (o == null) {
+			//create a descriptor
+			imageDescriptor = createImageDescriptor(resource);
+		} else {
+			imageDescriptor = (ImageDescriptor) o;
+		}
+		return imageDescriptor;
+	}
+
+	/**
+	 * Returns the image descriptor registry for this plugin.
+	 * 
+	 * @return HashMap - image descriptor registry for this plugin
+	 */
+	private HashMap getImageDescriptorRegistry() {
+		if (fImageDescRegistry == null)
+			fImageDescRegistry = new HashMap();
+		return fImageDescRegistry;
+	}
+
+	/**
+	 * Returns the image registry for this plugin.
+	 * 
+	 * @return ImageRegistry - image registry for this plugin
+	 */
+	private ImageRegistry getImageRegistry() {
+		return JFaceResources.getImageRegistry();
+	}
+}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/editor/DTDEditorPluginImages.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/editor/DTDEditorPluginImages.java
new file mode 100644
index 0000000..3f0a780
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/editor/DTDEditorPluginImages.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+package org.eclipse.wst.dtd.ui.internal.editor;
+
+/**
+ * Bundle of most images used by the DTD Source Editor plug-in.
+ */
+public class DTDEditorPluginImages {
+	public static final String IMG_CTOOL_ADD_ATTRIBUTE = "icons/full/ctool16/ADD_Attribute.gif"; //$NON-NLS-1$
+
+	public static final String IMG_CTOOL_ADD_ELEMENT = "icons/full/ctool16/ADD_Element.gif"; //$NON-NLS-1$
+
+	public static final String IMG_CTOOL_ADD_ELEMENTTOCONMODEL = "icons/full/ctool16/ADD_ElementToConModel.gif"; //$NON-NLS-1$
+
+	public static final String IMG_CTOOL_ADD_GROUPTOCONMODEL = "icons/full/ctool16/ADD_GroupToConModel.gif"; //$NON-NLS-1$
+	public static final String IMG_DTOOL_ADD_ATTRIBUTE = "icons/full/dtool16/ADD_Attribute.gif"; //$NON-NLS-1$
+	public static final String IMG_DTOOL_ADD_ELEMENT = "icons/full/dtool16/ADD_Element.gif"; //$NON-NLS-1$
+	public static final String IMG_DTOOL_ADD_ELEMENTTOCONMODEL = "icons/full/dtool16/ADD_ElementToConModel.gif"; //$NON-NLS-1$
+	public static final String IMG_DTOOL_ADD_GROUPTOCONMODEL = "icons/full/dtool16/ADD_GroupToConModel.gif"; //$NON-NLS-1$
+	public static final String IMG_ETOOL_ADD_ATTRIBUTE = "icons/full/etool16/ADD_Attribute.gif"; //$NON-NLS-1$
+	public static final String IMG_ETOOL_ADD_ELEMENT = "icons/full/etool16/ADD_Element.gif"; //$NON-NLS-1$
+	public static final String IMG_ETOOL_ADD_ELEMENTTOCONMODEL = "icons/full/etool16/ADD_ElementToConModel.gif"; //$NON-NLS-1$
+	public static final String IMG_ETOOL_ADD_GROUPTOCONMODEL = "icons/full/etool16/ADD_GroupToConModel.gif"; //$NON-NLS-1$
+
+	public static final String IMG_OBJ_ADD_COMMENT = "icons/full/obj16/ADD_Comment.gif"; //$NON-NLS-1$
+	public static final String IMG_OBJ_ADD_ENTITY = "icons/full/obj16/ADD_Entity.gif"; //$NON-NLS-1$
+	public static final String IMG_OBJ_ADD_ENTITY_REFERENCE = "icons/full/obj16/ADD_Entity_Reference.gif"; //$NON-NLS-1$
+	public static final String IMG_OBJ_ADD_NOTATION = "icons/full/obj16/ADD_Notation.gif"; //$NON-NLS-1$
+	public static final String IMG_OBJ_ORGANIZE_DTD_LOGICALLY = "icons/full/obj16/organize_dtd_logically.gif"; //$NON-NLS-1$
+	public static final String IMG_OBJ_SORT = "icons/full/obj16/sort.gif"; //$NON-NLS-1$
+	public static final String IMG_OBJ_VALIDATE = "icons/full/obj16/validate.gif"; //$NON-NLS-1$
+}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/editor/IHelpContextIds.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/editor/IHelpContextIds.java
new file mode 100644
index 0000000..ffce903
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/editor/IHelpContextIds.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+package org.eclipse.wst.dtd.ui.internal.editor;
+
+import org.eclipse.wst.dtd.ui.DTDEditorPlugin;
+
+/**
+ * Help context ids for the DTD Source Editor.
+ * <p>
+ * This interface contains constants only; it is not intended to be
+ * implemented.
+ * </p>
+ *  
+ */
+public interface IHelpContextIds {
+
+	// org.eclipse.wst.dtd.ui.
+	public static final String PREFIX = DTDEditorPlugin.getDefault().getBundle().getSymbolicName() + "."; //$NON-NLS-1$
+	// DTD Files Preference page
+	public static final String DTD_PREFWEBX_FILES_HELPID = PREFIX + "webx0020"; //$NON-NLS-1$
+	// DTD Styles Preference page
+	public static final String DTD_PREFWEBX_STYLES_HELPID = PREFIX + "webx0021"; //$NON-NLS-1$
+
+	// DTD Source page editor
+	public static final String DTD_SOURCEVIEW_HELPID = PREFIX + "edtd0000"; //$NON-NLS-1$
+}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/preferences/DTDColorPage.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/preferences/DTDColorPage.java
new file mode 100644
index 0000000..c3ad60e
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/preferences/DTDColorPage.java
@@ -0,0 +1,180 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+package org.eclipse.wst.dtd.ui.preferences;
+
+import java.util.ArrayList;
+import java.util.Dictionary;
+import java.util.Hashtable;
+import java.util.Iterator;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.help.WorkbenchHelp;
+import org.eclipse.wst.common.encoding.content.IContentTypeIdentifier;
+import org.eclipse.wst.dtd.core.parser.DTDRegionParser;
+import org.eclipse.wst.dtd.core.parser.DTDRegionTypes;
+import org.eclipse.wst.dtd.ui.DTDEditorPlugin;
+import org.eclipse.wst.dtd.ui.internal.editor.IHelpContextIds;
+import org.eclipse.wst.dtd.ui.style.IStyleConstantsDTD;
+import org.eclipse.wst.sse.core.IModelManager;
+import org.eclipse.wst.sse.core.IModelManagerPlugin;
+import org.eclipse.wst.sse.ui.EditorPlugin;
+import org.eclipse.wst.sse.ui.internal.preferences.OverlayPreferenceStore;
+import org.eclipse.wst.sse.ui.internal.preferences.OverlayPreferenceStore.OverlayKey;
+import org.eclipse.wst.sse.ui.preferences.PreferenceKeyGenerator;
+import org.eclipse.wst.sse.ui.preferences.ui.AbstractColorPage;
+import org.eclipse.wst.sse.ui.preferences.ui.StyledTextColorPicker;
+
+
+
+public class DTDColorPage extends AbstractColorPage {
+
+	protected Control createContents(Composite parent) {
+		Composite pageComponent = createComposite(parent, 1);
+		((GridData) pageComponent.getLayoutData()).horizontalAlignment = GridData.HORIZONTAL_ALIGN_FILL;
+
+		super.createContents(pageComponent);
+		WorkbenchHelp.setHelp(pageComponent, IHelpContextIds.DTD_PREFWEBX_STYLES_HELPID);
+
+		return pageComponent;
+	}
+
+	/**
+	 * Set up all the style preference keys in the overlay store
+	 */
+	protected OverlayKey[] createOverlayStoreKeys() {
+		ArrayList overlayKeys = new ArrayList();
+
+		ArrayList styleList = new ArrayList();
+		initStyleList(styleList);
+		Iterator i = styleList.iterator();
+		while (i.hasNext()) {
+			overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceKeyGenerator.generateKey((String) i.next(), IContentTypeIdentifier.ContentTypeID_DTD)));
+		}
+
+		OverlayPreferenceStore.OverlayKey[] keys = new OverlayPreferenceStore.OverlayKey[overlayKeys.size()];
+		overlayKeys.toArray(keys);
+		return keys;
+	}
+
+	protected IPreferenceStore doGetPreferenceStore() {
+		return EditorPlugin.getDefault().getPreferenceStore();
+	}
+
+	public String getSampleText() {
+		return DTDEditorPlugin.getResourceString("DTDColorPage.0"); //$NON-NLS-1$
+	}
+
+	protected void initContextStyleMap(Dictionary contextStyleMap) {
+		contextStyleMap.put(DTDRegionTypes.CONTENT_EMPTY, IStyleConstantsDTD.DTD_DATA);
+		contextStyleMap.put(DTDRegionTypes.CONTENT_ANY, IStyleConstantsDTD.DTD_DATA);
+		contextStyleMap.put(DTDRegionTypes.CONTENT_PCDATA, IStyleConstantsDTD.DTD_DATA);
+		contextStyleMap.put(DTDRegionTypes.NDATA_VALUE, IStyleConstantsDTD.DTD_DATA);
+		contextStyleMap.put(DTDRegionTypes.NAME, IStyleConstantsDTD.DTD_DATA);
+		contextStyleMap.put(DTDRegionTypes.ENTITY_PARM, IStyleConstantsDTD.DTD_DATA);
+
+		contextStyleMap.put(DTDRegionTypes.ELEMENT_TAG, IStyleConstantsDTD.DTD_TAGNAME);
+		contextStyleMap.put(DTDRegionTypes.ENTITY_TAG, IStyleConstantsDTD.DTD_TAGNAME);
+		contextStyleMap.put(DTDRegionTypes.ATTLIST_TAG, IStyleConstantsDTD.DTD_TAGNAME);
+		contextStyleMap.put(DTDRegionTypes.NOTATION_TAG, IStyleConstantsDTD.DTD_TAGNAME);
+
+		contextStyleMap.put(DTDRegionTypes.CONNECTOR, IStyleConstantsDTD.DTD_SYMBOL);
+		contextStyleMap.put(DTDRegionTypes.OCCUR_TYPE, IStyleConstantsDTD.DTD_SYMBOL);
+
+		contextStyleMap.put(DTDRegionTypes.START_TAG, IStyleConstantsDTD.DTD_TAG);
+		contextStyleMap.put(DTDRegionTypes.END_TAG, IStyleConstantsDTD.DTD_TAG);
+		contextStyleMap.put(DTDRegionTypes.EXCLAMATION, IStyleConstantsDTD.DTD_TAG);
+
+		contextStyleMap.put(DTDRegionTypes.COMMENT_START, IStyleConstantsDTD.DTD_COMMENT);
+		contextStyleMap.put(DTDRegionTypes.COMMENT_CONTENT, IStyleConstantsDTD.DTD_COMMENT);
+		contextStyleMap.put(DTDRegionTypes.COMMENT_END, IStyleConstantsDTD.DTD_COMMENT);
+
+		contextStyleMap.put(DTDRegionTypes.SINGLEQUOTED_LITERAL, IStyleConstantsDTD.DTD_STRING);
+		contextStyleMap.put(DTDRegionTypes.DOUBLEQUOTED_LITERAL, IStyleConstantsDTD.DTD_STRING);
+
+		contextStyleMap.put(DTDRegionTypes.SYSTEM_KEYWORD, IStyleConstantsDTD.DTD_KEYWORD);
+		contextStyleMap.put(DTDRegionTypes.PUBLIC_KEYWORD, IStyleConstantsDTD.DTD_KEYWORD);
+		contextStyleMap.put(DTDRegionTypes.NDATA_KEYWORD, IStyleConstantsDTD.DTD_KEYWORD);
+		contextStyleMap.put(DTDRegionTypes.CDATA_KEYWORD, IStyleConstantsDTD.DTD_KEYWORD);
+		contextStyleMap.put(DTDRegionTypes.ID_KEYWORD, IStyleConstantsDTD.DTD_KEYWORD);
+		contextStyleMap.put(DTDRegionTypes.IDREF_KEYWORD, IStyleConstantsDTD.DTD_KEYWORD);
+		contextStyleMap.put(DTDRegionTypes.IDREFS_KEYWORD, IStyleConstantsDTD.DTD_KEYWORD);
+		contextStyleMap.put(DTDRegionTypes.ENTITY_KEYWORD, IStyleConstantsDTD.DTD_KEYWORD);
+		contextStyleMap.put(DTDRegionTypes.ENTITIES_KEYWORD, IStyleConstantsDTD.DTD_KEYWORD);
+		contextStyleMap.put(DTDRegionTypes.NMTOKEN_KEYWORD, IStyleConstantsDTD.DTD_KEYWORD);
+		contextStyleMap.put(DTDRegionTypes.NMTOKENS_KEYWORD, IStyleConstantsDTD.DTD_KEYWORD);
+		contextStyleMap.put(DTDRegionTypes.NOTATION_KEYWORD, IStyleConstantsDTD.DTD_KEYWORD);
+		contextStyleMap.put(DTDRegionTypes.REQUIRED_KEYWORD, IStyleConstantsDTD.DTD_KEYWORD);
+		contextStyleMap.put(DTDRegionTypes.IMPLIED_KEYWORD, IStyleConstantsDTD.DTD_KEYWORD);
+		contextStyleMap.put(DTDRegionTypes.FIXED_KEYWORD, IStyleConstantsDTD.DTD_KEYWORD);
+	}
+
+	protected void initDescriptions(Dictionary descriptions) {
+		descriptions.put(IStyleConstantsDTD.DTD_COMMENT, DTDEditorPlugin.getResourceString("DTDColorPage.1")); //$NON-NLS-1$
+		descriptions.put(IStyleConstantsDTD.DTD_DATA, DTDEditorPlugin.getResourceString("DTDColorPage.2")); //$NON-NLS-1$
+		descriptions.put(IStyleConstantsDTD.DTD_DEFAULT, DTDEditorPlugin.getResourceString("DTDColorPage.3")); //$NON-NLS-1$
+		descriptions.put(IStyleConstantsDTD.DTD_KEYWORD, DTDEditorPlugin.getResourceString("DTDColorPage.4")); //$NON-NLS-1$
+		descriptions.put(IStyleConstantsDTD.DTD_STRING, DTDEditorPlugin.getResourceString("DTDColorPage.5")); //$NON-NLS-1$
+		descriptions.put(IStyleConstantsDTD.DTD_SYMBOL, DTDEditorPlugin.getResourceString("DTDColorPage.6")); //$NON-NLS-1$
+		descriptions.put(IStyleConstantsDTD.DTD_TAG, DTDEditorPlugin.getResourceString("DTDColorPage.7")); //$NON-NLS-1$
+		descriptions.put(IStyleConstantsDTD.DTD_TAGNAME, DTDEditorPlugin.getResourceString("DTDColorPage.8")); //$NON-NLS-1$
+	}
+
+	protected void initStyleList(ArrayList list) {
+		list.add(IStyleConstantsDTD.DTD_COMMENT);
+		list.add(IStyleConstantsDTD.DTD_DATA);
+		list.add(IStyleConstantsDTD.DTD_DEFAULT);
+		list.add(IStyleConstantsDTD.DTD_KEYWORD);
+		list.add(IStyleConstantsDTD.DTD_STRING);
+		list.add(IStyleConstantsDTD.DTD_SYMBOL);
+		list.add(IStyleConstantsDTD.DTD_TAG);
+		list.add(IStyleConstantsDTD.DTD_TAGNAME);
+	}
+
+	public boolean performOk() {
+		// required since the superclass *removes* existing preferences before
+		// saving its own
+		super.performOk();
+
+		EditorPlugin.getDefault().savePluginPreferences();
+		return true;
+	}
+
+	protected void setupPicker(StyledTextColorPicker picker) {
+
+		IModelManagerPlugin plugin = (IModelManagerPlugin) Platform.getPlugin(IModelManagerPlugin.ID);
+		if (plugin != null) {
+			IModelManager mmanager = plugin.getModelManager();
+			picker.setParser(mmanager.createStructuredDocumentFor(IContentTypeIdentifier.ContentTypeID_DTD).getParser());
+		} else
+			picker.setParser(new DTDRegionParser());
+
+		Dictionary descriptions = new Hashtable();
+		initDescriptions(descriptions);
+
+		Dictionary contextStyleMap = new Hashtable();
+		initContextStyleMap(contextStyleMap);
+
+		ArrayList styleList = new ArrayList();
+		initStyleList(styleList);
+
+		picker.setContextStyleMap(contextStyleMap);
+		picker.setDescriptions(descriptions);
+		picker.setStyleList(styleList);
+
+		picker.setGeneratorKey(IContentTypeIdentifier.ContentTypeID_DTD);
+	}
+}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/preferences/DTDFilesPreferencePage.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/preferences/DTDFilesPreferencePage.java
new file mode 100644
index 0000000..e7f075d
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/preferences/DTDFilesPreferencePage.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+package org.eclipse.wst.dtd.ui.preferences;
+
+import org.eclipse.core.runtime.Preferences;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.help.WorkbenchHelp;
+import org.eclipse.wst.dtd.core.DTDPlugin;
+import org.eclipse.wst.dtd.ui.DTDEditorPlugin;
+import org.eclipse.wst.dtd.ui.internal.editor.IHelpContextIds;
+import org.eclipse.wst.sse.ui.preferences.ui.AbstractPreferencePage;
+
+
+public class DTDFilesPreferencePage extends AbstractPreferencePage {
+
+	protected Control createContents(Composite parent) {
+		Composite composite = (Composite) super.createContents(parent);
+		WorkbenchHelp.setHelp(composite, IHelpContextIds.DTD_PREFWEBX_FILES_HELPID);
+
+		setSize(composite);
+		loadPreferences();
+
+		return composite;
+	}
+
+	protected IPreferenceStore doGetPreferenceStore() {
+		return DTDEditorPlugin.getDefault().getPreferenceStore();
+	}
+
+	protected void doSavePreferenceStore() {
+		DTDPlugin.getInstance().savePluginPreferences(); // model
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.wst.sse.ui.preferences.ui.AbstractPreferencePage#getModelPreferences()
+	 */
+	protected Preferences getModelPreferences() {
+		return DTDPlugin.getInstance().getPluginPreferences();
+	}
+
+	public boolean performOk() {
+		boolean result = super.performOk();
+
+		doSavePreferenceStore();
+
+		return result;
+	}
+}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/registry/AdapterFactoryProviderForDTD.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/registry/AdapterFactoryProviderForDTD.java
new file mode 100644
index 0000000..1af4340
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/registry/AdapterFactoryProviderForDTD.java
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+package org.eclipse.wst.dtd.ui.registry;
+
+import org.eclipse.ui.views.properties.IPropertySource;
+import org.eclipse.wst.dtd.core.modelhandler.ModelHandlerForDTD;
+import org.eclipse.wst.dtd.ui.views.properties.DTDPropertySourceAdapterFactory;
+import org.eclipse.wst.sse.core.AdapterFactory;
+import org.eclipse.wst.sse.core.IFactoryRegistry;
+import org.eclipse.wst.sse.core.IStructuredModel;
+import org.eclipse.wst.sse.core.modelhandler.IDocumentTypeHandler;
+import org.eclipse.wst.sse.ui.registry.AdapterFactoryProvider;
+import org.eclipse.wst.sse.ui.util.Assert;
+
+
+/**
+ * @author nitin
+ * 
+ * To change the template for this generated type comment go to
+ * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
+ */
+public class AdapterFactoryProviderForDTD implements AdapterFactoryProvider {
+
+	/**
+	 *  
+	 */
+	public AdapterFactoryProviderForDTD() {
+		super();
+		// TODO Auto-generated constructor stub
+	}
+
+	/*
+	 * @see AdapterFactoryProvider#addAdapterFactories(IStructuredModel)
+	 */
+	public void addAdapterFactories(IStructuredModel structuredModel) {
+		IFactoryRegistry factoryRegistry = structuredModel.getFactoryRegistry();
+		Assert.isNotNull(factoryRegistry, "Program Error: client caller must ensure model has factory registry"); //$NON-NLS-1$
+		AdapterFactory factory = null;
+
+		factory = factoryRegistry.getFactoryFor(IPropertySource.class);
+		if (factory == null) {
+			factory = new DTDPropertySourceAdapterFactory();
+			factoryRegistry.addFactory(factory);
+		}
+
+		//		factory = factoryRegistry.getFactoryFor(JFaceNodeAdapter.class);
+		//		if (factory == null) {
+		//			factory = new JFaceNodeAdapterFactory(JFaceNodeAdapter.class,
+		// true);
+		//			factoryRegistry.addFactory(factory);
+		//		}
+	}
+
+	/*
+	 * @see AdapterFactoryProvider#isFor(ContentTypeDescription)
+	 */
+	public boolean isFor(IDocumentTypeHandler contentTypeDescription) {
+		return (contentTypeDescription instanceof ModelHandlerForDTD);
+	}
+
+	public void reinitializeFactories(IStructuredModel structuredModel) {
+		// nothing to do, since no embedded type
+	}
+}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/style/IStyleConstantsDTD.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/style/IStyleConstantsDTD.java
new file mode 100644
index 0000000..393cbf1
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/style/IStyleConstantsDTD.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+package org.eclipse.wst.dtd.ui.style;
+
+/**
+ * Contains the symbolic name of styles used by LineStyleProvider,
+ * ColorManager, and any others who may be interested
+ */
+public interface IStyleConstantsDTD {
+
+	public static final String DTD_COMMENT = "dtdComment"; //$NON-NLS-1$
+
+	// Data are variables
+	public static final String DTD_DATA = "dtdData"; //$NON-NLS-1$
+	public static final String DTD_DEFAULT = "dtdDefault"; //$NON-NLS-1$
+
+	// keywords are constants like IMPLIED or PCDATA
+	public static final String DTD_KEYWORD = "dtdKeyword"; //$NON-NLS-1$
+
+	// strings are anything in quotes
+	public static final String DTD_STRING = "dtdString"; //$NON-NLS-1$
+
+	// All the remaining symbols
+	public static final String DTD_SYMBOL = "dtdSymbol"; //$NON-NLS-1$
+
+	// tags are '<', '!', or '>'
+	public static final String DTD_TAG = "dtdTag"; //$NON-NLS-1$
+
+	// tagnames are like ELEMENT, ATTLIST, etc.
+	public static final String DTD_TAGNAME = "dtdTagName"; //$NON-NLS-1$
+}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/style/LineStyleProviderForDTD.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/style/LineStyleProviderForDTD.java
new file mode 100644
index 0000000..be41e5e
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/style/LineStyleProviderForDTD.java
@@ -0,0 +1,135 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+
+
+package org.eclipse.wst.dtd.ui.style;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.text.TextAttribute;
+import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.wst.common.encoding.content.IContentTypeIdentifier;
+import org.eclipse.wst.dtd.core.parser.DTDRegionTypes;
+import org.eclipse.wst.sse.core.text.ITextRegion;
+import org.eclipse.wst.sse.ui.EditorPlugin;
+import org.eclipse.wst.sse.ui.preferences.PreferenceKeyGenerator;
+import org.eclipse.wst.sse.ui.style.AbstractLineStyleProvider;
+import org.eclipse.wst.sse.ui.style.LineStyleProvider;
+
+
+public class LineStyleProviderForDTD extends AbstractLineStyleProvider implements LineStyleProvider {
+	public LineStyleProviderForDTD() {
+		super();
+		loadColors();
+	}
+
+	protected void clearColors() {
+		getTextAttributes().clear();
+	}
+
+	protected TextAttribute getAttributeFor(ITextRegion region) {
+		/**
+		 * a method to centralize all the "format rules" for regions
+		 * specifically associated for how to "open" the region.
+		 */
+		// not sure why this is coming through null, but just to catch it
+		if (region == null) {
+			return (TextAttribute) getTextAttributes().get(IStyleConstantsDTD.DTD_DEFAULT);
+		}
+		String type = region.getType();
+		if (type == DTDRegionTypes.CONTENT_EMPTY || type == DTDRegionTypes.CONTENT_ANY || type == DTDRegionTypes.CONTENT_PCDATA) {
+			return (TextAttribute) getTextAttributes().get(IStyleConstantsDTD.DTD_DATA);
+		} else if (type == DTDRegionTypes.ELEMENT_TAG || type == DTDRegionTypes.ENTITY_TAG || type == DTDRegionTypes.ATTLIST_TAG || type == DTDRegionTypes.NOTATION_TAG) {
+			return (TextAttribute) getTextAttributes().get(IStyleConstantsDTD.DTD_TAGNAME);
+		} else if (type == DTDRegionTypes.CONNECTOR || type == DTDRegionTypes.OCCUR_TYPE) {
+			return (TextAttribute) getTextAttributes().get(IStyleConstantsDTD.DTD_SYMBOL);
+		} else if (type == DTDRegionTypes.NDATA_VALUE) {
+			return (TextAttribute) getTextAttributes().get(IStyleConstantsDTD.DTD_DATA);
+		} else if (type == DTDRegionTypes.START_TAG || type == DTDRegionTypes.END_TAG || type == DTDRegionTypes.EXCLAMATION) {
+			return (TextAttribute) getTextAttributes().get(IStyleConstantsDTD.DTD_TAG);
+		} else if (type == DTDRegionTypes.COMMENT_START || type == DTDRegionTypes.COMMENT_CONTENT || type == DTDRegionTypes.COMMENT_END) {
+			return (TextAttribute) getTextAttributes().get(IStyleConstantsDTD.DTD_COMMENT);
+		} else if (type == DTDRegionTypes.SINGLEQUOTED_LITERAL || type == DTDRegionTypes.DOUBLEQUOTED_LITERAL) {
+			return (TextAttribute) getTextAttributes().get(IStyleConstantsDTD.DTD_STRING);
+		} else if (type == DTDRegionTypes.SYSTEM_KEYWORD || type == DTDRegionTypes.PUBLIC_KEYWORD || type == DTDRegionTypes.NDATA_KEYWORD || type == DTDRegionTypes.CDATA_KEYWORD || type == DTDRegionTypes.ID_KEYWORD || type == DTDRegionTypes.IDREF_KEYWORD || type == DTDRegionTypes.IDREFS_KEYWORD || type == DTDRegionTypes.ENTITY_KEYWORD || type == DTDRegionTypes.ENTITIES_KEYWORD || type == DTDRegionTypes.NMTOKEN_KEYWORD || type == DTDRegionTypes.NMTOKENS_KEYWORD || type == DTDRegionTypes.NOTATION_KEYWORD || type == DTDRegionTypes.REQUIRED_KEYWORD || type == DTDRegionTypes.IMPLIED_KEYWORD || type == DTDRegionTypes.FIXED_KEYWORD) {
+			return (TextAttribute) getTextAttributes().get(IStyleConstantsDTD.DTD_KEYWORD);
+		} else if (type == DTDRegionTypes.NAME || type == DTDRegionTypes.ENTITY_PARM) {
+			//			if (region instanceof DTDRegion) {
+			//				DTDRegion dtdRegion = (DTDRegion) region;
+			//				IStructuredDocumentRegion flatNode = dtdRegion.getParent();
+			//				String regionText = flatNode.getText(dtdRegion);
+			//				if (regionText.equals("ANY") || regionText.equals("EMPTY")) {
+			//					return new TextAttribute(DTDColors.DTD_KEYWORD);
+			//				}
+			//			}
+			return (TextAttribute) getTextAttributes().get(IStyleConstantsDTD.DTD_DATA);
+		}
+
+		// default, return null to signal "not handled"
+		// in which case, other factories should be tried
+		return null;
+	}
+
+	protected IPreferenceStore getColorPreferences() {
+		return EditorPlugin.getDefault().getPreferenceStore();
+	}
+
+	protected String getPreferenceKey(String key) {
+		String contentTypeId = IContentTypeIdentifier.ContentTypeID_DTD;
+		return PreferenceKeyGenerator.generateKey(key, contentTypeId);
+	}
+
+	protected void handlePropertyChange(PropertyChangeEvent event) {
+		String styleKey = null;
+
+		if (event != null) {
+			String prefKey = event.getProperty();
+			// check if preference changed is a style preference
+			if (getPreferenceKey(IStyleConstantsDTD.DTD_DEFAULT).equals(prefKey)) {
+				styleKey = IStyleConstantsDTD.DTD_DEFAULT;
+			} else if (getPreferenceKey(IStyleConstantsDTD.DTD_TAG).equals(prefKey)) {
+				styleKey = IStyleConstantsDTD.DTD_TAG;
+			} else if (getPreferenceKey(IStyleConstantsDTD.DTD_TAGNAME).equals(prefKey)) {
+				styleKey = IStyleConstantsDTD.DTD_TAGNAME;
+			} else if (getPreferenceKey(IStyleConstantsDTD.DTD_COMMENT).equals(prefKey)) {
+				styleKey = IStyleConstantsDTD.DTD_COMMENT;
+			} else if (getPreferenceKey(IStyleConstantsDTD.DTD_KEYWORD).equals(prefKey)) {
+				styleKey = IStyleConstantsDTD.DTD_KEYWORD;
+			} else if (getPreferenceKey(IStyleConstantsDTD.DTD_STRING).equals(prefKey)) {
+				styleKey = IStyleConstantsDTD.DTD_STRING;
+			} else if (getPreferenceKey(IStyleConstantsDTD.DTD_DATA).equals(prefKey)) {
+				styleKey = IStyleConstantsDTD.DTD_DATA;
+			} else if (getPreferenceKey(IStyleConstantsDTD.DTD_SYMBOL).equals(prefKey)) {
+				styleKey = IStyleConstantsDTD.DTD_SYMBOL;
+			}
+		}
+
+		if (styleKey != null) {
+			// overwrite style preference with new value
+			addTextAttribute(styleKey);
+			super.handlePropertyChange(event);
+		}
+	}
+
+	protected void loadColors() {
+		clearColors();
+
+		addTextAttribute(IStyleConstantsDTD.DTD_DEFAULT);
+		addTextAttribute(IStyleConstantsDTD.DTD_TAG);
+		addTextAttribute(IStyleConstantsDTD.DTD_TAGNAME);
+		addTextAttribute(IStyleConstantsDTD.DTD_COMMENT);
+		addTextAttribute(IStyleConstantsDTD.DTD_KEYWORD);
+		addTextAttribute(IStyleConstantsDTD.DTD_STRING);
+		addTextAttribute(IStyleConstantsDTD.DTD_DATA);
+		addTextAttribute(IStyleConstantsDTD.DTD_SYMBOL);
+	}
+}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/style/LineStyleProviderForDTDSubSet.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/style/LineStyleProviderForDTDSubSet.java
new file mode 100644
index 0000000..8f4048e
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/style/LineStyleProviderForDTDSubSet.java
@@ -0,0 +1,156 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+package org.eclipse.wst.dtd.ui.style;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.ITypedRegion;
+import org.eclipse.jface.text.TextAttribute;
+import org.eclipse.swt.custom.StyleRange;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.wst.common.encoding.content.IContentTypeIdentifier;
+import org.eclipse.wst.dtd.core.rules.StructuredTextPartitionerForDTD;
+import org.eclipse.wst.sse.core.IModelManager;
+import org.eclipse.wst.sse.core.IModelManagerPlugin;
+import org.eclipse.wst.sse.core.IStructuredModel;
+import org.eclipse.wst.sse.core.text.IStructuredDocument;
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegion;
+import org.eclipse.wst.sse.core.text.ITextRegion;
+import org.eclipse.wst.sse.ui.EditorPlugin;
+import org.eclipse.wst.sse.ui.preferences.PreferenceKeyGenerator;
+import org.eclipse.wst.sse.ui.preferences.ui.ColorHelper;
+import org.eclipse.wst.sse.ui.style.AbstractLineStyleProvider;
+import org.eclipse.wst.sse.ui.style.LineStyleProvider;
+
+
+public class LineStyleProviderForDTDSubSet extends AbstractLineStyleProvider implements LineStyleProvider {
+	private int fInternalAdjustment;
+
+	private IStructuredModel fInternalModel = null;
+	private LineStyleProviderForDTD fInternalProvider = null;
+	private StyleRange[] fInternalRanges;
+
+	public LineStyleProviderForDTDSubSet() {
+
+		super();
+		fInternalProvider = new LineStyleProviderForDTD();
+		fInternalRanges = new StyleRange[0];
+		fInternalAdjustment = 0;
+	}
+
+	/**
+	 * @param lineRequestStart
+	 * @param lineRequestLength
+	 * @param holdResults
+	 */
+	private void addStyleRanges(int lineRequestStart, int lineRequestLength, Collection holdResults) {
+
+	}
+
+	protected TextAttribute getAttributeFor(ITextRegion region) {
+		TextAttribute ta = null;
+
+		String prefString = getColorPreferences().getString(getPreferenceKey(IStyleConstantsDTD.DTD_DEFAULT));
+		String[] stylePrefs = ColorHelper.unpackStylePreferences(prefString);
+		if (stylePrefs != null) {
+			RGB foreground = ColorHelper.toRGB(stylePrefs[0]);
+			RGB background = ColorHelper.toRGB(stylePrefs[1]);
+			boolean bold = Boolean.valueOf(stylePrefs[2]).booleanValue();
+			ta = createTextAttribute(foreground, background, bold);
+		}
+		return ta;
+	}
+
+	protected IPreferenceStore getColorPreferences() {
+		return EditorPlugin.getDefault().getPreferenceStore();
+	}
+
+	/**
+	 * @return
+	 */
+	private IStructuredDocument getInternalDocument() {
+		if (fInternalModel == null) {
+			fInternalModel = getModelManager().createUnManagedStructuredModelFor(IContentTypeIdentifier.ContentTypeID_DTD);
+		}
+		return fInternalModel.getStructuredDocument();
+	}
+
+	private IModelManager getModelManager() {
+
+		IModelManagerPlugin plugin = (IModelManagerPlugin) Platform.getPlugin(IModelManagerPlugin.ID);
+		return plugin.getModelManager();
+	}
+
+	protected String getPreferenceKey(String key) {
+		String contentTypeId = IContentTypeIdentifier.ContentTypeID_DTD;
+		return PreferenceKeyGenerator.generateKey(key, contentTypeId);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.wst.sse.ui.structured.style.AbstractLineStyleProvider#prepareRegions(org.eclipse.jface.text.ITypedRegion,
+	 *      int, int, java.util.Collection)
+	 */
+	public boolean prepareRegions(ITypedRegion typedRegion, int lineRequestStart, int lineRequestLength, Collection holdResults) {
+
+		if (!StructuredTextPartitionerForDTD.ST_DTD_DEFAULT.equals(typedRegion.getType())) {
+			// compute an internal DTD model and return linestyles for it
+			ITextRegion dtdContentRegion = null;
+			IStructuredDocumentRegion doctype = getDocument().getRegionAtCharacterOffset(typedRegion.getOffset());
+			if (doctype != null)
+				dtdContentRegion = doctype.getRegionAtCharacterOffset(typedRegion.getOffset());
+			String contents = dtdContentRegion != null ? doctype.getFullText(dtdContentRegion) : null;
+			IStructuredDocument document = getInternalDocument();
+			if (document == null)
+				return false;
+			updateStyleRanges(document, contents, typedRegion.getOffset());
+			addStyleRanges(lineRequestStart, lineRequestLength, holdResults);
+			return true;
+		}
+		return false;
+	}
+
+	public void release() {
+		if (fInternalProvider != null) {
+			fInternalProvider.release();
+		}
+		super.release();
+	}
+
+	private void updateStyleRanges(IStructuredDocument document, String contents, int adjustment) {
+
+		if (!document.get().equals(contents) || fInternalAdjustment != adjustment) {
+			document.set(contents);
+			try {
+				ITypedRegion regions[] = getInternalDocument().computePartitioning(0, document.getLength());
+				List ranges = new ArrayList();
+				fInternalProvider.init(getInternalDocument(), getHighlighter());
+				for (int i = 0; i < regions.length; i++) {
+					fInternalProvider.prepareRegions(regions[i], regions[i].getOffset(), regions[i].getLength(), ranges);
+				}
+				fInternalAdjustment = adjustment;
+				fInternalRanges = (StyleRange[]) ranges.toArray(new StyleRange[0]);
+				for (int i = 0; i < fInternalRanges.length; i++)
+					fInternalRanges[i].start += fInternalAdjustment;
+			} catch (BadLocationException e) {
+				fInternalRanges = new StyleRange[0];
+			}
+		}
+	}
+}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/taginfo/DTDBestMatchHoverProcessor.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/taginfo/DTDBestMatchHoverProcessor.java
new file mode 100644
index 0000000..0ed9370
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/taginfo/DTDBestMatchHoverProcessor.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+package org.eclipse.wst.dtd.ui.taginfo;
+
+import org.eclipse.jface.text.ITextHover;
+import org.eclipse.wst.sse.ui.taginfo.AbstractBestMatchHoverProcessor;
+
+
+/**
+ * @author amywu
+ */
+public class DTDBestMatchHoverProcessor extends AbstractBestMatchHoverProcessor {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.wst.dtd.ui.taginfo.AbstractBestMatchHoverProcessor#getTagInfoHover()
+	 */
+	protected ITextHover getTagInfoHover() {
+		// DTD has no taginfo hover
+		return null;
+	}
+
+}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/text/DTDDocumentRegionEdgeMatcher.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/text/DTDDocumentRegionEdgeMatcher.java
new file mode 100644
index 0000000..7b58e19
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/text/DTDDocumentRegionEdgeMatcher.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+package org.eclipse.wst.dtd.ui.text;
+
+import org.eclipse.wst.dtd.core.parser.DTDRegionTypes;
+import org.eclipse.wst.sse.ui.text.DocumentRegionEdgeMatcher;
+
+
+public class DTDDocumentRegionEdgeMatcher extends DocumentRegionEdgeMatcher {
+
+	/**
+	 * @param validContexts
+	 * @param nextMatcher
+	 */
+	public DTDDocumentRegionEdgeMatcher() {
+		super(new String[]{DTDRegionTypes.START_TAG, DTDRegionTypes.COMMENT_START}, null);
+	}
+}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/DTDContentOutlineConfiguration.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/DTDContentOutlineConfiguration.java
new file mode 100644
index 0000000..e51444d
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/DTDContentOutlineConfiguration.java
@@ -0,0 +1,210 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+package org.eclipse.wst.dtd.ui.views.contentoutline;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.jface.action.IContributionItem;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.util.TransferDragSourceListener;
+import org.eclipse.jface.util.TransferDropTargetListener;
+import org.eclipse.jface.viewers.IContentProvider;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.swt.dnd.DragSourceEvent;
+import org.eclipse.swt.dnd.DropTargetEvent;
+import org.eclipse.swt.dnd.Transfer;
+import org.eclipse.wst.dtd.ui.DTDEditorPlugin;
+import org.eclipse.wst.dtd.ui.dnd.DTDDragAndDropManager;
+import org.eclipse.wst.sse.ui.StructuredTextEditor;
+import org.eclipse.wst.sse.ui.preferences.PreferenceKeyGenerator;
+import org.eclipse.wst.sse.ui.util.Assert;
+import org.eclipse.wst.sse.ui.views.contentoutline.PropertyChangeUpdateActionContributionItem;
+import org.eclipse.wst.sse.ui.views.contentoutline.StructuredContentOutlineConfiguration;
+import org.eclipse.wst.ui.dnd.ObjectTransfer;
+import org.eclipse.wst.ui.dnd.ViewerDragAdapter;
+import org.eclipse.wst.ui.dnd.ViewerDropAdapter;
+
+/**
+ * @author nitin
+ *  
+ */
+public class DTDContentOutlineConfiguration extends StructuredContentOutlineConfiguration {
+
+	private DTDContextMenuHelper fMenuHelper;
+	private TransferDragSourceListener[] fTransferDragSourceListeners;
+	private TransferDropTargetListener[] fTransferDropTargetListeners;
+	private Map fViewerContributions;
+	private final String OUTLINE_ORDER_PREF = "outline-order"; //$NON-NLS-1$
+	private final String OUTLINE_SORT_PREF = "outline-sort"; //$NON-NLS-1$
+
+	/**
+	 * @param editor
+	 */
+	public DTDContentOutlineConfiguration() {
+		super();
+		fViewerContributions = new HashMap(2);
+	}
+
+	public IContributionItem[] createToolbarContributions(TreeViewer viewer) {
+		Assert.isTrue(getContentProvider(viewer) instanceof DTDTreeContentProvider);
+		IContributionItem[] items = super.createToolbarContributions(viewer);
+
+		SortAction sortAction = new SortAction(viewer, DTDEditorPlugin.getDefault().getPreferenceStore(), getSortPreferenceKey());
+		OrderAction orderAction = new OrderAction(viewer, (DTDTreeContentProvider) getContentProvider(viewer), DTDEditorPlugin.getDefault().getPreferenceStore(), getOrderPreferenceKey());
+		IContributionItem sortItem = new PropertyChangeUpdateActionContributionItem(sortAction);
+		IContributionItem orderItem = new PropertyChangeUpdateActionContributionItem(orderAction);
+
+		if (items == null) {
+			items = new IContributionItem[2];
+			items[0] = sortItem;
+			items[1] = orderItem;
+		} else {
+			IContributionItem[] combinedItems = new IContributionItem[items.length + 2];
+			combinedItems[0] = sortItem;
+			combinedItems[1] = orderItem;
+			System.arraycopy(items, 0, combinedItems, 2, items.length);
+			items = combinedItems;
+		}
+		return items;
+	}
+
+	/**
+	 * @see org.eclipse.wst.sse.ui.views.contentoutline.ContentOutlineConfiguration#getContentProvider(org.eclipse.jface.viewers.TreeViewer)
+	 */
+	public IContentProvider getContentProvider(TreeViewer viewer) {
+		if (fContentProvider == null) {
+			fContentProvider = new DTDTreeContentProvider();
+		}
+		return super.getContentProvider(viewer);
+	}
+
+	/**
+	 * @see org.eclipse.wst.sse.ui.views.contentoutline.ContentOutlineConfiguration#getLabelProvider(org.eclipse.jface.viewers.TreeViewer)
+	 */
+	public ILabelProvider getLabelProvider(TreeViewer viewer) {
+		if (fLabelProvider == null) {
+			fLabelProvider = new DTDLabelProvider();
+		}
+		return super.getLabelProvider(viewer);
+	}
+
+	/**
+	 * @see org.eclipse.wst.sse.ui.views.contentoutline.ContentOutlineConfiguration#getMenuListener(org.eclipse.jface.viewers.TreeViewer)
+	 */
+	public IMenuListener getMenuListener(TreeViewer viewer) {
+		fMenuHelper.createMenuListenersFor(viewer);
+		return fMenuHelper.getMenuListener();
+	}
+
+	public String getOrderPreferenceKey() {
+		return PreferenceKeyGenerator.generateKey(OUTLINE_ORDER_PREF, getDeclaringID());
+	}
+
+	public String getSortPreferenceKey() {
+		return PreferenceKeyGenerator.generateKey(OUTLINE_SORT_PREF, getDeclaringID());
+	}
+
+	/**
+	 * @see org.eclipse.wst.sse.ui.views.contentoutline.ContentOutlineConfiguration#getTransferDragSourceListeners(org.eclipse.jface.viewers.TreeViewer)
+	 */
+	public TransferDragSourceListener[] getTransferDragSourceListeners(TreeViewer treeViewer) {
+		if (fTransferDragSourceListeners == null) {
+			// emulate the XMLDragAndDropManager
+			final ViewerDragAdapter dragAdapter = new ViewerDragAdapter(treeViewer);
+			fTransferDragSourceListeners = new TransferDragSourceListener[]{new TransferDragSourceListener() {
+				public void dragFinished(DragSourceEvent event) {
+					dragAdapter.dragFinished(event);
+				}
+
+				public void dragSetData(DragSourceEvent event) {
+					dragAdapter.dragSetData(event);
+				}
+
+				public void dragStart(DragSourceEvent event) {
+					dragAdapter.dragStart(event);
+				}
+
+				public Transfer getTransfer() {
+					return ObjectTransfer.getInstance();
+				}
+			}};
+		}
+
+		return fTransferDragSourceListeners;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.wst.sse.ui.views.contentoutline.ContentOutlineConfiguration#getTransferDropTargetListeners(org.eclipse.jface.viewers.TreeViewer)
+	 */
+	public TransferDropTargetListener[] getTransferDropTargetListeners(TreeViewer treeViewer) {
+		if (fTransferDropTargetListeners == null) {
+			// emulate the XMLDragAnDropManager
+			final ViewerDropAdapter dropAdapter = new ViewerDropAdapter(treeViewer, new DTDDragAndDropManager());
+			fTransferDropTargetListeners = new TransferDropTargetListener[]{new TransferDropTargetListener() {
+				public void dragEnter(DropTargetEvent event) {
+					dropAdapter.dragEnter(event);
+				}
+
+				public void dragLeave(DropTargetEvent event) {
+					dropAdapter.dragLeave(event);
+				}
+
+				public void dragOperationChanged(DropTargetEvent event) {
+					dropAdapter.dragOperationChanged(event);
+				}
+
+				public void dragOver(DropTargetEvent event) {
+					dropAdapter.dragOver(event);
+				}
+
+				public void drop(DropTargetEvent event) {
+					dropAdapter.drop(event);
+				}
+
+				public void dropAccept(DropTargetEvent event) {
+					dropAdapter.dropAccept(event);
+				}
+
+				public Transfer getTransfer() {
+					return ObjectTransfer.getInstance();
+				}
+
+				public boolean isEnabled(DropTargetEvent event) {
+					return getTransfer().isSupportedType(event.currentDataType);
+				}
+			}};
+		}
+		return fTransferDropTargetListeners;
+	}
+
+	public void setEditor(StructuredTextEditor editor) {
+		super.setEditor(editor);
+		fMenuHelper = new DTDContextMenuHelper(editor);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.wst.sse.ui.views.contentoutline.ContentOutlineConfiguration#unconfigure(org.eclipse.jface.viewers.TreeViewer)
+	 */
+	public void unconfigure(TreeViewer viewer) {
+		super.unconfigure(viewer);
+		fViewerContributions.remove(viewer);
+		fMenuHelper.removeMenuListenersFor(viewer);
+	}
+
+}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/DTDContextMenuHelper.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/DTDContextMenuHelper.java
new file mode 100644
index 0000000..2be2b85
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/DTDContextMenuHelper.java
@@ -0,0 +1,307 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+
+
+package org.eclipse.wst.dtd.ui.views.contentoutline;
+
+import java.util.List;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.actions.ActionFactory;
+import org.eclipse.wst.dtd.core.AttributeList;
+import org.eclipse.wst.dtd.core.CMGroupNode;
+import org.eclipse.wst.dtd.core.CMNode;
+import org.eclipse.wst.dtd.core.DTDFile;
+import org.eclipse.wst.dtd.core.DTDNode;
+import org.eclipse.wst.dtd.core.Element;
+import org.eclipse.wst.dtd.core.NodeList;
+import org.eclipse.wst.dtd.core.document.DTDModelImpl;
+import org.eclipse.wst.dtd.core.parser.DTDRegionTypes;
+import org.eclipse.wst.dtd.core.util.LabelValuePair;
+import org.eclipse.wst.dtd.ui.DTDEditorPlugin;
+import org.eclipse.wst.dtd.ui.internal.editor.DTDEditorPluginImageHelper;
+import org.eclipse.wst.dtd.ui.internal.editor.DTDEditorPluginImages;
+import org.eclipse.wst.dtd.ui.views.contentoutline.actions.AddAttributeAction;
+import org.eclipse.wst.dtd.ui.views.contentoutline.actions.AddAttributeListAction;
+import org.eclipse.wst.dtd.ui.views.contentoutline.actions.AddCommentAction;
+import org.eclipse.wst.dtd.ui.views.contentoutline.actions.AddElementAction;
+import org.eclipse.wst.dtd.ui.views.contentoutline.actions.AddElementToContentModelAction;
+import org.eclipse.wst.dtd.ui.views.contentoutline.actions.AddEntityAction;
+import org.eclipse.wst.dtd.ui.views.contentoutline.actions.AddGroupToContentModelAction;
+import org.eclipse.wst.dtd.ui.views.contentoutline.actions.AddNotationAction;
+import org.eclipse.wst.dtd.ui.views.contentoutline.actions.AddParameterEntityReferenceAction;
+import org.eclipse.wst.dtd.ui.views.contentoutline.actions.DeleteAction;
+import org.eclipse.wst.sse.ui.StructuredTextEditor;
+
+
+public class DTDContextMenuHelper //extends FocusAdapter
+{
+
+	private class DTDMenuListener implements IMenuListener {
+		/*
+		 * (non-Javadoc)
+		 * 
+		 * @see org.eclipse.jface.action.IMenuListener#menuAboutToShow(org.eclipse.jface.action.IMenuManager)
+		 */
+		public void menuAboutToShow(IMenuManager manager) {
+			updateActions();
+			List selection = DTDContextMenuHelper.this.editor.getSelectedNodes();
+			if (selection != null && selection.size() == 1)
+				addActionItemsForSelection(selection.get(0), manager);
+		}
+	}
+
+	protected AddAttributeAction addAttributeAction;
+	protected AddAttributeListAction addAttributeListAction;
+	protected AddCommentAction addCommentAction;
+	protected AddElementAction addElementAction;
+	protected AddElementToContentModelAction addElementToContentModelAction;
+	protected AddEntityAction addEntityAction;
+	protected AddGroupToContentModelAction addGroupToContentModelAction;
+	protected AddNotationAction addNotationAction;
+	protected AddParameterEntityReferenceAction addParameterEntityReferenceAction;
+	protected DeleteAction deleteAction;
+
+	private StructuredTextEditor editor;
+
+	private IMenuListener fMenuListener;
+	protected IAction redoAction;
+
+	//     protected CutAction cutAction;
+	//     protected CopyAction copyAction;
+	//     protected PasteAction pasteAction;
+	protected IAction undoAction;
+
+	//private List viewerList = new Vector();
+
+	public DTDContextMenuHelper(StructuredTextEditor editor) {
+		this.editor = editor;
+		fMenuListener = new DTDMenuListener();
+		addNotationAction = new AddNotationAction(editor, DTDEditorPlugin.getResourceString("_UI_ACTION_ADD_DTD_NOTATION")); //$NON-NLS-1$
+		addEntityAction = new AddEntityAction(editor, DTDEditorPlugin.getResourceString("_UI_ACTION_ADD_DTD_ENTITY")); //$NON-NLS-1$
+		addElementAction = new AddElementAction(editor, DTDEditorPlugin.getResourceString("_UI_ACTION_ADD_DTD_ELEMENT")); //$NON-NLS-1$
+		addCommentAction = new AddCommentAction(editor, DTDEditorPlugin.getResourceString("_UI_ACTION_ADD_DTD_COMMENT")); //$NON-NLS-1$
+
+		addParameterEntityReferenceAction = new AddParameterEntityReferenceAction(editor, DTDEditorPlugin.getResourceString("_UI_ACTION_ADD_PARAM_ENTITY_REF")); //$NON-NLS-1$
+		deleteAction = new DeleteAction(DTDEditorPlugin.getResourceString("_UI_ACTION_DTD_DELETE")); //$NON-NLS-1$
+		addAttributeAction = new AddAttributeAction(editor, DTDEditorPlugin.getResourceString("_UI_ACTION_ADD_ATTRIBUTE")); //$NON-NLS-1$
+		addAttributeListAction = new AddAttributeListAction(editor, DTDEditorPlugin.getResourceString("_UI_ACTION_ADD_ATTRIBUTELIST")); //$NON-NLS-1$
+
+		addGroupToContentModelAction = new AddGroupToContentModelAction(editor, DTDEditorPlugin.getResourceString("_UI_ACTION_GROUP_ADD_GROUP")); //$NON-NLS-1$
+		addElementToContentModelAction = new AddElementToContentModelAction(editor, DTDEditorPlugin.getResourceString("_UI_ACTION_ADD_ELEMENT")); //$NON-NLS-1$
+
+		addNotationAction.setImageDescriptor(DTDEditorPluginImageHelper.getInstance().getImageDescriptor(DTDEditorPluginImages.IMG_OBJ_ADD_NOTATION));
+		addEntityAction.setImageDescriptor(DTDEditorPluginImageHelper.getInstance().getImageDescriptor(DTDEditorPluginImages.IMG_OBJ_ADD_ENTITY));
+		addCommentAction.setImageDescriptor(DTDEditorPluginImageHelper.getInstance().getImageDescriptor(DTDEditorPluginImages.IMG_OBJ_ADD_COMMENT));
+		addParameterEntityReferenceAction.setImageDescriptor(DTDEditorPluginImageHelper.getInstance().getImageDescriptor(DTDEditorPluginImages.IMG_OBJ_ADD_ENTITY_REFERENCE));
+
+		// Tri-state images
+		addElementAction.setImageDescriptor(DTDEditorPluginImageHelper.getInstance().getImageDescriptor(DTDEditorPluginImages.IMG_ETOOL_ADD_ELEMENT));
+		addElementAction.setHoverImageDescriptor(DTDEditorPluginImageHelper.getInstance().getImageDescriptor(DTDEditorPluginImages.IMG_CTOOL_ADD_ELEMENT));
+		addElementAction.setDisabledImageDescriptor(DTDEditorPluginImageHelper.getInstance().getImageDescriptor(DTDEditorPluginImages.IMG_DTOOL_ADD_ELEMENT));
+
+		addAttributeAction.setImageDescriptor(DTDEditorPluginImageHelper.getInstance().getImageDescriptor(DTDEditorPluginImages.IMG_ETOOL_ADD_ATTRIBUTE));
+		addAttributeAction.setHoverImageDescriptor(DTDEditorPluginImageHelper.getInstance().getImageDescriptor(DTDEditorPluginImages.IMG_CTOOL_ADD_ATTRIBUTE));
+		addAttributeAction.setDisabledImageDescriptor(DTDEditorPluginImageHelper.getInstance().getImageDescriptor(DTDEditorPluginImages.IMG_DTOOL_ADD_ATTRIBUTE));
+
+		addAttributeListAction.setImageDescriptor(DTDEditorPluginImageHelper.getInstance().getImageDescriptor(DTDEditorPluginImages.IMG_ETOOL_ADD_ATTRIBUTE));
+		addAttributeListAction.setHoverImageDescriptor(DTDEditorPluginImageHelper.getInstance().getImageDescriptor(DTDEditorPluginImages.IMG_CTOOL_ADD_ATTRIBUTE));
+		addAttributeListAction.setDisabledImageDescriptor(DTDEditorPluginImageHelper.getInstance().getImageDescriptor(DTDEditorPluginImages.IMG_DTOOL_ADD_ATTRIBUTE));
+
+		addGroupToContentModelAction.setImageDescriptor(DTDEditorPluginImageHelper.getInstance().getImageDescriptor(DTDEditorPluginImages.IMG_ETOOL_ADD_GROUPTOCONMODEL));
+		addGroupToContentModelAction.setHoverImageDescriptor(DTDEditorPluginImageHelper.getInstance().getImageDescriptor(DTDEditorPluginImages.IMG_CTOOL_ADD_GROUPTOCONMODEL));
+		addGroupToContentModelAction.setDisabledImageDescriptor(DTDEditorPluginImageHelper.getInstance().getImageDescriptor(DTDEditorPluginImages.IMG_DTOOL_ADD_GROUPTOCONMODEL));
+
+		addElementToContentModelAction.setImageDescriptor(DTDEditorPluginImageHelper.getInstance().getImageDescriptor(DTDEditorPluginImages.IMG_ETOOL_ADD_ELEMENTTOCONMODEL));
+		addElementToContentModelAction.setHoverImageDescriptor(DTDEditorPluginImageHelper.getInstance().getImageDescriptor(DTDEditorPluginImages.IMG_CTOOL_ADD_ELEMENTTOCONMODEL));
+		addElementToContentModelAction.setDisabledImageDescriptor(DTDEditorPluginImageHelper.getInstance().getImageDescriptor(DTDEditorPluginImages.IMG_DTOOL_ADD_ELEMENTTOCONMODEL));
+	}
+
+	public void addActionItemsForSelection(Object selectedObject, IMenuManager menu) {
+		if (undoAction == null) {
+			undoAction = editor.getAction(ActionFactory.UNDO.getId());
+			redoAction = editor.getAction(ActionFactory.REDO.getId());
+		}
+
+		menu.add(undoAction);
+		menu.add(redoAction);
+		menu.add(new Separator());
+
+		if (selectedObject instanceof IndexedNodeList) {
+			// http://w3.opensource.ibm.com/bugzilla/show_bug.cgi?id=4201
+			// add appropriate menu to logical view
+			NodeList folder = ((IndexedNodeList) selectedObject).getTarget();
+			if (folder.getListType().equals(DTDRegionTypes.NOTATION_TAG)) {
+				menu.add(addNotationAction);
+			} else if (folder.getListType().equals(DTDRegionTypes.ENTITY_TAG)) {
+				menu.add(addEntityAction);
+			} else if (folder.getListType().equals(DTDRegionTypes.ELEMENT_TAG)) {
+				LabelValuePair[] availableEntities = ((DTDModelImpl) editor.getModel()).createParmEntityContentItems(null);
+				addParameterEntityReferenceAction.setEnabled(availableEntities.length > 0);
+
+				menu.add(addElementAction);
+				menu.add(addParameterEntityReferenceAction);
+			}
+		}
+		if (selectedObject instanceof DTDFile || selectedObject == null) {
+			LabelValuePair[] availableEntities = ((DTDModelImpl) editor.getModel()).createParmEntityContentItems(null);
+			addParameterEntityReferenceAction.setEnabled(availableEntities.length > 0);
+
+			menu.add(addElementAction);
+			menu.add(addEntityAction);
+			menu.add(addNotationAction);
+			menu.add(addParameterEntityReferenceAction);
+			menu.add(addCommentAction);
+			menu.add(addAttributeListAction);
+			menu.add(new Separator());
+		}
+
+		if (selectedObject instanceof Element) {
+			Element dtdElement = (Element) selectedObject;
+
+			if (dtdElement.getContentModel() == null) {
+				menu.add(addGroupToContentModelAction);
+				menu.add(addElementToContentModelAction);
+			}
+			//        if (!(((Element)selectedObject).getContentModel() instanceof
+			// CMGroupNode))
+			//        {
+			//        menu.add(addGroupToContentModelAction);
+			//        }
+			//      addAttributeAction.setElement(selectedObject);
+			menu.add(addAttributeAction);
+		} else if (selectedObject instanceof CMGroupNode) {
+			//      addElementToContentModelAction.setElement(selectedObject);
+			//      addGroupToContentModelAction.setElement(selectedObject);
+			menu.add(addElementToContentModelAction);
+			menu.add(addGroupToContentModelAction);
+		} else if (selectedObject instanceof AttributeList) {
+			menu.add(addAttributeAction);
+		}
+
+		menu.add(new Separator());
+		addEditActions(menu);
+		menu.add(new Separator());
+
+		if (selectedObject instanceof DTDNode && !(selectedObject instanceof CMNode && ((CMNode) selectedObject).isRootElementContent())) {
+			menu.add(deleteAction);
+			deleteAction.setEnabled(true);
+			//        if (selectedObject instanceof DTDElementContent)
+			//        {
+			//          DTDElementContent content = (DTDElementContent) selectedObject;
+			//          if (content.getElement() != null && (content instanceof
+			// DTDPCDataContent || content instanceof DTDEmptyContent))
+			//          {
+			//            deleteAction.setEnabled(false);
+			//          } // end of if ()
+			//        } // end of if ()
+		}
+	}
+
+	public void addEditActions(IMenuManager menu) {
+		//      menu.add(undoAction);
+		//      menu.add(redoAction);
+		//      menu.add(new Separator());
+		//      menu.add(cutAction);
+		//      menu.add(copyAction);
+		//      menu.add(pasteAction);
+	}
+
+	public void createMenuListenersFor(Viewer viewer) {
+		viewer.addSelectionChangedListener(addNotationAction);
+		viewer.addSelectionChangedListener(addEntityAction);
+		viewer.addSelectionChangedListener(addElementAction);
+		viewer.addSelectionChangedListener(addCommentAction);
+		viewer.addSelectionChangedListener(addParameterEntityReferenceAction);
+		viewer.addSelectionChangedListener(deleteAction);
+		viewer.addSelectionChangedListener(addAttributeAction);
+		viewer.addSelectionChangedListener(addAttributeListAction);
+		viewer.addSelectionChangedListener(addGroupToContentModelAction);
+		viewer.addSelectionChangedListener(addElementToContentModelAction);
+
+		IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
+		addNotationAction.selectionChanged(selection);
+		addEntityAction.selectionChanged(selection);
+		addElementAction.selectionChanged(selection);
+		addParameterEntityReferenceAction.selectionChanged(selection);
+		deleteAction.selectionChanged(selection);
+		addAttributeAction.selectionChanged(selection);
+		addAttributeListAction.selectionChanged(selection);
+		addGroupToContentModelAction.selectionChanged(selection);
+		addElementToContentModelAction.selectionChanged(selection);
+
+		//       viewer.addSelectionChangedListener(cutAction);
+		//       viewer.addSelectionChangedListener(copyAction);
+		//       viewer.addSelectionChangedListener(pasteAction);
+
+		//		viewerList.add(viewer);
+		//     viewer.getControl().addFocusListener(this);
+	}
+
+	public DeleteAction getDeleteAction() {
+		return deleteAction;
+	}
+
+	/**
+	 * @return Returns the menuListener.
+	 */
+	public IMenuListener getMenuListener() {
+		return fMenuListener;
+	}
+
+	//    public void focusGained(FocusEvent event)
+	//    {
+	//      updateSelection();
+	//    }
+
+	public void removeMenuListenersFor(Viewer viewer) {
+		viewer.removeSelectionChangedListener(addNotationAction);
+		viewer.removeSelectionChangedListener(addEntityAction);
+		viewer.removeSelectionChangedListener(addElementAction);
+		viewer.removeSelectionChangedListener(addCommentAction);
+		viewer.removeSelectionChangedListener(addParameterEntityReferenceAction);
+		viewer.removeSelectionChangedListener(deleteAction);
+		viewer.removeSelectionChangedListener(addAttributeAction);
+		viewer.removeSelectionChangedListener(addAttributeListAction);
+		viewer.removeSelectionChangedListener(addGroupToContentModelAction);
+		viewer.removeSelectionChangedListener(addElementToContentModelAction);
+	}
+
+	// Update all the actions for the viewer in focus
+	public void updateActions() {
+		//     undoAction.update();
+		//     redoAction.update();
+	}
+
+	public void updateEditActions(IActionBars actionBars) {
+		//      if (actionBars != null)
+		//      {
+		//        actionBars.setGlobalActionHandler(IWorkbenchActionConstants.CUT,
+		// cutAction);
+		//        actionBars.setGlobalActionHandler(IWorkbenchActionConstants.COPY,
+		// copyAction);
+		//        actionBars.setGlobalActionHandler(IWorkbenchActionConstants.PASTE,
+		// pasteAction);
+		//        actionBars.setGlobalActionHandler(IWorkbenchActionConstants.UNDO,
+		// undoAction);
+		//        actionBars.setGlobalActionHandler(IWorkbenchActionConstants.REDO,
+		// redoAction);
+		//      }
+	}
+}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/DTDLabelProvider.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/DTDLabelProvider.java
new file mode 100644
index 0000000..6ef7e52
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/DTDLabelProvider.java
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+package org.eclipse.wst.dtd.ui.views.contentoutline;
+
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.wst.dtd.core.DTDFile;
+import org.eclipse.wst.dtd.core.DTDNode;
+import org.eclipse.wst.dtd.core.NodeList;
+
+
+/**
+ * Based on com.ibm.etools.dtd.editor.viewers.DTDLabelProvider
+ */
+
+public class DTDLabelProvider extends LabelProvider {
+
+	public DTDLabelProvider() {
+		super();
+	}
+
+	/**
+	 * Returns the image for the label of the given element.
+	 * 
+	 * @param element
+	 *            the element for which to provide the label image
+	 * @return the image used to label the element, or <code>null</code> if
+	 *         these is no image for the given object
+	 */
+	public Image getImage(Object element) {
+		Image image = null;
+		if (element instanceof DTDNode) {
+			image = ((DTDNode) element).getImage();
+		} else if (element instanceof NodeList) {
+			image = ((NodeList) element).getImage();
+		} else if (element instanceof IndexedNodeList) {
+			return ((IndexedNodeList) element).getTarget().getImage();
+		} else if (element instanceof DTDFile) {
+			image = ((DTDFile) element).getImage();
+		} else {
+			image = super.getImage(element);
+		}
+		return image;
+	}
+
+	/**
+	 * Returns the text for the label of the given element.
+	 * 
+	 * @param element
+	 *            the element for which to provide the label text
+	 * @return the text string used to label the element, or <code>null</code>
+	 *         if these is no text label for the given object
+	 */
+	public String getText(Object element) {
+		if (element instanceof DTDNode) {
+			String name = ((DTDNode) element).getName();
+
+			// strip leading whitespace (useful for multi-line comments)
+			int i = 0;
+			for (i = 0; i < name.length(); i++) {
+				if (!Character.isWhitespace(name.charAt(i)))
+					break;
+			}
+			if (i > 0 && i < name.length() - 1)
+				name = name.substring(i);
+
+			return name;
+		} else if (element instanceof NodeList) {
+			return ((NodeList) element).getListType();
+		} else if (element instanceof IndexedNodeList) {
+			return ((IndexedNodeList) element).getTarget().getName();
+		} else if (element instanceof DTDFile) {
+			return ((DTDFile) element).getName();
+		}
+		return super.getText(element);
+	}
+}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/DTDTreeContentProvider.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/DTDTreeContentProvider.java
new file mode 100644
index 0000000..6c7c2bf
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/DTDTreeContentProvider.java
@@ -0,0 +1,288 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+package org.eclipse.wst.dtd.ui.views.contentoutline;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.jface.viewers.AbstractTreeViewer;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.StructuredViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.wst.dtd.core.Attribute;
+import org.eclipse.wst.dtd.core.AttributeList;
+import org.eclipse.wst.dtd.core.Comment;
+import org.eclipse.wst.dtd.core.DTDFile;
+import org.eclipse.wst.dtd.core.DTDNode;
+import org.eclipse.wst.dtd.core.Element;
+import org.eclipse.wst.dtd.core.Entity;
+import org.eclipse.wst.dtd.core.NodeList;
+import org.eclipse.wst.dtd.core.Notation;
+import org.eclipse.wst.dtd.core.ParameterEntityReference;
+import org.eclipse.wst.dtd.core.document.DTDModelImpl;
+import org.eclipse.wst.dtd.core.event.IDTDFileListener;
+import org.eclipse.wst.dtd.core.event.NodesEvent;
+
+
+/**
+ * Based on com.ibm.etools.dtd.editor.viewers.DTDTreeContentProvider
+ */
+
+public class DTDTreeContentProvider implements ITreeContentProvider, IDTDFileListener {
+
+	private Object fInputObject;
+	protected Viewer fViewer;
+
+	// A cached set of IndexedNodeLists, required for getParent to return the
+	// correct instances mapping to TreeItems
+	protected Object[] logicalNodeLists = null;
+
+	private boolean showLogicalOrder = false;
+
+	public DTDTreeContentProvider() {
+		super();
+	}
+
+	public void dispose() {
+		fViewer = null;
+	}
+
+	private void expandToNode(DTDNode node) {
+		DTDFile dtdFile = node.getDTDFile();
+		// first expand the root
+		AbstractTreeViewer viewer = (AbstractTreeViewer) fViewer;
+		viewer.expandToLevel(dtdFile, 1);
+		NodeList listToExpand = null;
+		if (node instanceof Element || node instanceof ParameterEntityReference) {
+			listToExpand = dtdFile.getElementsAndParameterEntityReferences();
+		} else if (node instanceof Notation) {
+			listToExpand = dtdFile.getNotations();
+		} else if (node instanceof Entity) {
+			listToExpand = dtdFile.getEntities();
+		} else if (node instanceof Comment) {
+			listToExpand = dtdFile.getComments();
+		}
+		if (listToExpand != null) {
+			viewer.expandToLevel(listToExpand, 1);
+		}
+		viewer.expandToLevel(node, 0);
+	}
+
+	public Object[] getChildren(Object parentElement) {
+		// return the lists of nodes when in logical order mode, all the Nodes
+		// otherwise
+		if (parentElement instanceof DTDFile) {
+			if (isShowLogicalOrder()) {
+				if (logicalNodeLists == null) {
+					DTDFile file = (DTDFile) parentElement;
+					Object[] children = file.getNodeLists().toArray();
+					for (int i = 0; i < children.length; i++) {
+						children[i] = new IndexedNodeList((NodeList) children[i]);
+					}
+					logicalNodeLists = children;
+				}
+				return logicalNodeLists;
+			} else {
+				return ((DTDFile) parentElement).getNodes().toArray();
+			}
+		} else if (parentElement instanceof NodeList) {
+			return ((NodeList) parentElement).getNodes().toArray();
+		} else if (parentElement instanceof IndexedNodeList) {
+			return ((IndexedNodeList) parentElement).getTarget().getNodes().toArray();
+		} else if (parentElement instanceof Element && isShowLogicalOrder()) {
+			// then group the attributes under the element
+			Object[] children = ((DTDNode) parentElement).getChildren();
+			List attributes = ((Element) parentElement).getElementAttributes();
+			Object[] logicalChildren = new Object[children.length + attributes.size()];
+			int index = 0;
+			for (index = 0; index < children.length; index++) {
+				logicalChildren[index] = children[index];
+			}
+			for (Iterator iter = attributes.iterator(); iter.hasNext();) {
+				logicalChildren[index++] = iter.next();
+			}
+			return logicalChildren;
+		} else if (parentElement instanceof DTDNode) {
+			return ((DTDNode) parentElement).getChildren();
+		}
+		return Collections.EMPTY_LIST.toArray();
+	}
+
+	public Object[] getElements(java.lang.Object inputElement) {
+		Object[] elements = null;
+		// Always show the DTDFile "node"
+		if (inputElement instanceof DTDModelImpl) {
+			elements = new Object[]{((DTDModelImpl) inputElement).getDTDFile()};
+		}
+		if (elements == null) {
+			elements = new Object[0];
+		}
+		return elements;
+	}
+
+	public Object getParent(Object element) {
+		Object parent = null;
+		if (element instanceof DTDNode) {
+			DTDNode node = (DTDNode) element;
+			if (element instanceof Attribute && isShowLogicalOrder()) {
+				// then we must say that the element with the same name
+				// as our attributelist is our parent
+				parent = node.getParentNode();
+				if (parent != null) {
+					String attListName = ((DTDNode) parent).getName();
+					Iterator iter = node.getDTDFile().getNodes().iterator();
+					while (iter.hasNext()) {
+						DTDNode currentNode = (DTDNode) iter.next();
+						if (currentNode instanceof AttributeList && currentNode.getName().equals(attListName)) {
+							parent = currentNode;
+						}
+					}
+				}
+			}
+
+			if (parent == null) {
+				parent = ((DTDNode) element).getParentNode();
+			}
+
+			// if showing in the logical order, return the IndexedNodeList
+			// acting as the parent in the tree
+			if (parent == null) {
+				if (isShowLogicalOrder()) {
+					Object[] indexedNodeLists = getChildren(((DTDModelImpl) fInputObject).getDTDFile());
+					for (int i = 0; i < indexedNodeLists.length && parent == null; i++) {
+						if (indexedNodeLists[i] instanceof IndexedNodeList) {
+							if (((IndexedNodeList) indexedNodeLists[i]).contains(element))
+								parent = indexedNodeLists[i];
+						}
+					}
+				} else {
+					parent = ((DTDModelImpl) fInputObject).getDTDFile();
+				}
+			}
+		} else if (element instanceof IndexedNodeList && fInputObject instanceof DTDModelImpl) {
+			parent = ((DTDModelImpl) fInputObject).getDTDFile();
+		}
+		return parent;
+	}
+
+	public boolean hasChildren(Object element) {
+		Object[] children = getChildren(element);
+		return children.length > 0;
+	}
+
+	public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+		fViewer = viewer;
+
+		if (fInputObject instanceof DTDModelImpl) {
+			((DTDModelImpl) fInputObject).getDTDFile().removeDTDFileListener(this);
+		}
+		fInputObject = newInput;
+		if (fInputObject instanceof DTDModelImpl) {
+			((DTDModelImpl) fInputObject).getDTDFile().addDTDFileListener(this);
+		}
+	}
+
+	/**
+	 * Get the value of showLogicalOrder.
+	 * 
+	 * @return value of showLogicalOrder.
+	 */
+	public boolean isShowLogicalOrder() {
+		return showLogicalOrder;
+	}
+
+	public void nodeChanged(DTDNode node) {
+		if (fViewer instanceof StructuredViewer) {
+			//      System.out.println("node changed notified");
+			//      System.out.println("selection before = " +
+			// ((StructuredViewer)view).getSelection());
+			if (node instanceof AttributeList && isShowLogicalOrder()) {
+				// in this case, we are showing attributes under the element.
+				// refresh the element object instead
+				Iterator iter = node.getDTDFile().getNodes().iterator();
+				while (iter.hasNext()) {
+					DTDNode currentNode = (DTDNode) iter.next();
+					if (currentNode.getName().equals(node.getName()) && currentNode instanceof Element) {
+						((StructuredViewer) fViewer).refresh(currentNode);
+					}
+				} // end of while ()
+			} else {
+				// do standard stuff
+				((StructuredViewer) fViewer).refresh(node);
+			}
+			//      System.out.println("selection after = " +
+			// ((StructuredViewer)view).getSelection());
+		}
+	}
+
+	public void nodesAdded(NodesEvent event) {
+		if (fViewer instanceof AbstractTreeViewer) {
+			StructuredViewer viewer = (StructuredViewer) fViewer;
+			ISelection selection = viewer.getSelection();
+
+			Object firstObj = (!selection.isEmpty() && selection instanceof IStructuredSelection) ? ((IStructuredSelection) selection).getFirstElement() : null;
+			DTDNode oldSelectedNode = null;
+			if (firstObj instanceof DTDNode) {
+				oldSelectedNode = (DTDNode) firstObj;
+			}
+
+			// for now just refresh the whole view
+			AbstractTreeViewer abstractTreeViewer = (AbstractTreeViewer) fViewer;
+			abstractTreeViewer.refresh();
+
+			Iterator iter = event.getNodes().iterator();
+			List newSelection = new ArrayList();
+			while (iter.hasNext()) {
+				DTDNode node = (DTDNode) iter.next();
+				if (oldSelectedNode == null || node.getStructuredDocumentRegion() != oldSelectedNode.getStructuredDocumentRegion() || node.getStartOffset() != oldSelectedNode.getStartOffset() || node.getEndOffset() != oldSelectedNode.getEndOffset()) {
+					// add to selection
+					newSelection.add(node);
+					expandToNode(node);
+				}
+			}
+			if (newSelection.size() > 0) {
+				viewer.setSelection(new StructuredSelection(newSelection));
+			}
+
+		}
+	}
+
+	public void nodesRemoved(NodesEvent event) {
+		if (fViewer instanceof AbstractTreeViewer) {
+			AbstractTreeViewer abstractTreeViewer = (AbstractTreeViewer) fViewer;
+			for (Iterator iter = event.getNodes().iterator(); iter.hasNext();) {
+				abstractTreeViewer.remove(iter.next());
+			}
+		}
+
+	}
+
+	/**
+	 * Set the value of showLogicalOrder.
+	 * 
+	 * @param v
+	 *            Value to assign to showLogicalOrder.
+	 */
+	public void setShowLogicalOrder(boolean v) {
+		this.showLogicalOrder = v;
+		if (!v) {
+			// if not using logical order, lose the cached lists
+			logicalNodeLists = null;
+		}
+	}
+}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/IndexedNodeList.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/IndexedNodeList.java
new file mode 100644
index 0000000..9225bac
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/IndexedNodeList.java
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+package org.eclipse.wst.dtd.ui.views.contentoutline;
+
+import java.util.List;
+
+import org.eclipse.wst.dtd.core.DTDNode;
+import org.eclipse.wst.dtd.core.NodeList;
+import org.eclipse.wst.sse.core.IndexedRegion;
+
+
+/* package */
+class IndexedNodeList implements IndexedRegion {
+	public NodeList fTarget;
+
+	public IndexedNodeList(NodeList target) {
+		fTarget = target;
+	}
+
+	/**
+	 * @see org.eclipse.wst.sse.core.IndexedRegion#contains(int)
+	 */
+	public boolean contains(int testPosition) {
+		return getStartOffset() <= testPosition && testPosition <= getEndOffset();
+	}
+
+	public boolean contains(Object child) {
+		return fTarget.getNodes().contains(child);
+	}
+
+	/**
+	 * @see org.eclipse.wst.sse.core.IndexedRegion#getEndOffset()
+	 */
+	public int getEndOffset() {
+		int end = 0;
+		List nodes = fTarget.getNodes();
+		for (int i = 0; i < nodes.size(); i++) {
+			int thisEnd = ((DTDNode) nodes.get(i)).getEndOffset();
+			if (end < thisEnd)
+				end = thisEnd;
+		}
+		return end;
+	}
+
+	/**
+	 * @see org.eclipse.wst.sse.core.IndexedRegion#getStartOffset()
+	 */
+	public int getStartOffset() {
+		int start = -1;
+		List nodes = fTarget.getNodes();
+		for (int i = 0; i < nodes.size(); i++) {
+			int thisStart = ((DTDNode) nodes.get(i)).getStartOffset();
+			if (start > thisStart || start < 0)
+				start = thisStart;
+		}
+		if (start < 0)
+			start = 0;
+		return start;
+	}
+
+	/**
+	 * @return
+	 */
+	public NodeList getTarget() {
+		return fTarget;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.lang.Object#toString()
+	 */
+	public String toString() {
+		return getClass().getName() + ":" + fTarget.toString(); //$NON-NLS-1$
+	}
+}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/OrderAction.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/OrderAction.java
new file mode 100644
index 0000000..c32c119
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/OrderAction.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+/*
+ * Created on Jan 22, 2004
+ *
+ * To change the template for this generated file go to
+ * Window - Preferences - Java - Code Generation - Code and Comments
+ */
+package org.eclipse.wst.dtd.ui.views.contentoutline;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.wst.dtd.ui.DTDEditorPlugin;
+import org.eclipse.wst.dtd.ui.internal.editor.DTDEditorPluginImageHelper;
+import org.eclipse.wst.dtd.ui.internal.editor.DTDEditorPluginImages;
+import org.eclipse.wst.sse.ui.views.contentoutline.PropertyChangeUpdateAction;
+
+
+/**
+ * Based on com.ibm.etools.dtd.editor.DTDContentOutlinePage#OrderAction
+ */
+class OrderAction extends PropertyChangeUpdateAction {
+	private DTDTreeContentProvider contentProvider;
+	private TreeViewer treeViewer;
+
+	public OrderAction(TreeViewer viewer, DTDTreeContentProvider provider, IPreferenceStore store, String preferenceKey) {
+		super(DTDEditorPlugin.getResourceString("_UI_BUTTON_GROUP_ITEMS_LOGICALLY"), store, preferenceKey, false); //$NON-NLS-1$
+		setImageDescriptor(DTDEditorPluginImageHelper.getInstance().getImageDescriptor(DTDEditorPluginImages.IMG_OBJ_ORGANIZE_DTD_LOGICALLY));
+		treeViewer = viewer;
+		contentProvider = provider;
+		setToolTipText(getText());
+		contentProvider.setShowLogicalOrder(isChecked());
+	}
+
+	public void update() {
+		super.update();
+		setChecked(getPreferenceStore().getBoolean(getPreferenceKey()));
+		//	treeViewer.getControl().setVisible(false);
+		//	treeViewer.getControl().setRedraw(false);
+		Object[] expandedElements = treeViewer.getExpandedElements();
+		ISelection selection = treeViewer.getSelection();
+		contentProvider.setShowLogicalOrder(isChecked());
+
+		//treeViewer.setInput(treeViewer.getInput());
+		treeViewer.refresh(treeViewer.getInput());
+
+		treeViewer.setExpandedElements(expandedElements);
+		treeViewer.setSelection(selection);
+		// treeViewer.getControl().setVisible(true);
+		//	treeViewer.getControl().setRedraw(true);
+
+	}
+}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/SortAction.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/SortAction.java
new file mode 100644
index 0000000..4a343df
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/SortAction.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+package org.eclipse.wst.dtd.ui.views.contentoutline;
+
+import java.text.Collator;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.ViewerSorter;
+import org.eclipse.wst.dtd.ui.DTDEditorPlugin;
+import org.eclipse.wst.dtd.ui.internal.editor.DTDEditorPluginImageHelper;
+import org.eclipse.wst.dtd.ui.internal.editor.DTDEditorPluginImages;
+import org.eclipse.wst.sse.ui.views.contentoutline.PropertyChangeUpdateAction;
+
+
+/**
+ * Based on com.ibm.etools.dtd.editor.DTDContentOutlinePage#SortAction
+ */
+class SortAction extends PropertyChangeUpdateAction {
+	private TreeViewer treeViewer;
+
+	public SortAction(TreeViewer viewer, IPreferenceStore store, String preferenceKey) {
+		super(DTDEditorPlugin.getResourceString("_UI_BUTTON_SORT_ITEMS"), store, preferenceKey, false); //$NON-NLS-1$
+		setImageDescriptor(DTDEditorPluginImageHelper.getInstance().getImageDescriptor(DTDEditorPluginImages.IMG_OBJ_SORT));
+		setToolTipText(getText());
+		treeViewer = viewer;
+		if (isChecked()) {
+			treeViewer.setSorter(new ViewerSorter(Collator.getInstance()));
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.ui.texteditor.IUpdate#update()
+	 */
+	public void update() {
+		super.update();
+		//treeViewer.getControl().setVisible(false);
+		treeViewer.getControl().setRedraw(false);
+		Object[] expandedElements = treeViewer.getExpandedElements();
+		if (isChecked()) {
+			treeViewer.setSorter(new ViewerSorter(Collator.getInstance()));
+		} else {
+			treeViewer.setSorter(null);
+		}
+		treeViewer.setInput(treeViewer.getInput());
+		treeViewer.setExpandedElements(expandedElements);
+		// treeViewer.getControl().setVisible(true);
+		treeViewer.getControl().setRedraw(true);
+
+	}
+}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/actions/AddAttributeAction.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/actions/AddAttributeAction.java
new file mode 100644
index 0000000..d63991d
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/actions/AddAttributeAction.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+
+
+package org.eclipse.wst.dtd.ui.views.contentoutline.actions;
+
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.wst.dtd.core.AttributeList;
+import org.eclipse.wst.dtd.core.DTDNode;
+import org.eclipse.wst.dtd.core.Element;
+import org.eclipse.wst.sse.ui.StructuredTextEditor;
+
+
+public class AddAttributeAction extends BaseAction {
+
+	public AddAttributeAction(StructuredTextEditor editor, String label) {
+		super(editor, label);
+	}
+
+	public void run() {
+		DTDNode selectedNode = getFirstNodeSelected();
+		String newName = "NewAttribute"; //$NON-NLS-1$
+		if (selectedNode instanceof AttributeList) {
+			((AttributeList) selectedNode).addAttribute(newName);
+		} else if (selectedNode instanceof Element) {
+			((Element) selectedNode).addAttribute(newName);
+		}
+	}
+
+	protected boolean updateSelection(IStructuredSelection selection) {
+		boolean rc = super.updateSelection(selection);
+		DTDNode node = getFirstNodeSelected(selection);
+		if (node instanceof Element) {
+			//      System.out.println("attribute set to true");
+			setEnabled(true);
+		} else {
+			//      System.out.println("attribute set to false");
+			setEnabled(false);
+		}
+
+		return rc;
+	}
+
+}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/actions/AddAttributeListAction.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/actions/AddAttributeListAction.java
new file mode 100644
index 0000000..d5491d8
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/actions/AddAttributeListAction.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+
+
+package org.eclipse.wst.dtd.ui.views.contentoutline.actions;
+
+import org.eclipse.wst.dtd.core.DTDFile;
+import org.eclipse.wst.dtd.core.DTDNode;
+import org.eclipse.wst.dtd.core.Element;
+import org.eclipse.wst.sse.ui.StructuredTextEditor;
+
+
+public class AddAttributeListAction extends BaseAction {
+
+	public AddAttributeListAction(StructuredTextEditor editor, String label) {
+		super(editor, label);
+	}
+
+	public void run() {
+		DTDNode selectedNode = getFirstNodeSelected();
+		DTDFile dtdFile = getModel().getDTDFile();
+		String attListName = "NewAttList"; //$NON-NLS-1$
+		if (selectedNode != null) {
+			DTDNode topLevelNode = dtdFile.getTopLevelNodeAt(selectedNode.getStartOffset());
+			if (topLevelNode instanceof Element) {
+				attListName = ((Element) topLevelNode).getName();
+			}
+		}
+
+		getModel().getDTDFile().createAttributeList(selectedNode, attListName, true);
+		//    newElement.setName(DTDUniqueNameHelper.getUniqueElementName(dtdFile));
+
+	}
+}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/actions/AddCommentAction.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/actions/AddCommentAction.java
new file mode 100644
index 0000000..62d1ebe
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/actions/AddCommentAction.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+
+
+package org.eclipse.wst.dtd.ui.views.contentoutline.actions;
+
+//import com.ibm.etools.dtd.util.DTDUniqueNameHelper;
+import org.eclipse.wst.dtd.core.DTDNode;
+import org.eclipse.wst.sse.ui.StructuredTextEditor;
+
+
+public class AddCommentAction extends BaseAction {
+
+	public AddCommentAction(StructuredTextEditor editor, String label) {
+		super(editor, label);
+	}
+
+	public void run() {
+		DTDNode selectedNode = getFirstNodeSelected();
+		getModel().getDTDFile().createComment(selectedNode, "NewComment", true); //$NON-NLS-1$
+	}
+}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/actions/AddElementAction.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/actions/AddElementAction.java
new file mode 100644
index 0000000..cb15e96
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/actions/AddElementAction.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+package org.eclipse.wst.dtd.ui.views.contentoutline.actions;
+
+import org.eclipse.wst.dtd.core.DTDFile;
+import org.eclipse.wst.dtd.core.DTDNode;
+import org.eclipse.wst.dtd.core.util.DTDUniqueNameHelper;
+import org.eclipse.wst.sse.ui.StructuredTextEditor;
+
+
+public class AddElementAction extends BaseAction {
+
+	public AddElementAction(StructuredTextEditor editor, String label) {
+		super(editor, label);
+	}
+
+	public void run() {
+		DTDNode selectedNode = getFirstNodeSelected();
+		DTDFile dtdFile = getModel().getDTDFile();
+		String elementName = DTDUniqueNameHelper.getUniqueElementName(dtdFile);
+		dtdFile.createElement(selectedNode, elementName, true); //$NON-NLS-1$
+	}
+}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/actions/AddElementToContentModelAction.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/actions/AddElementToContentModelAction.java
new file mode 100644
index 0000000..0e8bef3
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/actions/AddElementToContentModelAction.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+
+
+package org.eclipse.wst.dtd.ui.views.contentoutline.actions;
+
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.wst.dtd.core.CMGroupNode;
+import org.eclipse.wst.dtd.core.DTDNode;
+import org.eclipse.wst.dtd.core.Element;
+import org.eclipse.wst.sse.ui.StructuredTextEditor;
+
+
+public class AddElementToContentModelAction extends BaseAction {
+
+	public AddElementToContentModelAction(StructuredTextEditor editor, String label) {
+		super(editor, label);
+	}
+
+	public void run() {
+		DTDNode node = getFirstNodeSelected();
+
+		if (node instanceof CMGroupNode) {
+			((CMGroupNode) node).addChild();
+		} else if (node instanceof Element) {
+			((Element) node).addChild();
+		}
+	}
+
+	protected boolean updateSelection(IStructuredSelection selection) {
+		boolean rc = super.updateSelection(selection);
+		DTDNode node = getFirstNodeSelected(selection);
+		if (node instanceof CMGroupNode) {
+			setEnabled(true);
+		} else {
+			setEnabled(false);
+		}
+		return rc;
+	}
+}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/actions/AddEntityAction.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/actions/AddEntityAction.java
new file mode 100644
index 0000000..3760879
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/actions/AddEntityAction.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+
+
+package org.eclipse.wst.dtd.ui.views.contentoutline.actions;
+
+//import com.ibm.etools.dtd.util.DTDUniqueNameHelper;
+import org.eclipse.wst.dtd.core.DTDNode;
+import org.eclipse.wst.sse.ui.StructuredTextEditor;
+
+
+public class AddEntityAction extends BaseAction {
+
+	public AddEntityAction(StructuredTextEditor editor, String label) {
+		super(editor, label);
+	}
+
+	public void run() {
+		DTDNode selectedNode = getFirstNodeSelected();
+
+		getModel().getDTDFile().createEntity(selectedNode, "NewEntity", true); //$NON-NLS-1$
+		//    newElement.setName(DTDUniqueNameHelper.getUniqueElementName(dtdFile));
+
+	}
+}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/actions/AddGroupToContentModelAction.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/actions/AddGroupToContentModelAction.java
new file mode 100644
index 0000000..303cd57
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/actions/AddGroupToContentModelAction.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+
+
+package org.eclipse.wst.dtd.ui.views.contentoutline.actions;
+
+import org.eclipse.wst.dtd.core.CMGroupNode;
+import org.eclipse.wst.dtd.core.DTDNode;
+import org.eclipse.wst.dtd.core.Element;
+import org.eclipse.wst.sse.ui.StructuredTextEditor;
+
+
+public class AddGroupToContentModelAction extends BaseAction {
+
+	//    private Object element;
+
+	public AddGroupToContentModelAction(StructuredTextEditor editor, String label) {
+		super(editor, label);
+	}
+
+	public void run() {
+		DTDNode node = getFirstNodeSelected();
+
+		if (node instanceof CMGroupNode) {
+			((CMGroupNode) node).addGroup();
+		} else if (node instanceof Element) {
+			((Element) node).addGroup();
+		}
+	}
+}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/actions/AddNotationAction.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/actions/AddNotationAction.java
new file mode 100644
index 0000000..12bcefa
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/actions/AddNotationAction.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+
+
+package org.eclipse.wst.dtd.ui.views.contentoutline.actions;
+
+import org.eclipse.wst.dtd.core.DTDNode;
+import org.eclipse.wst.sse.ui.StructuredTextEditor;
+
+
+public class AddNotationAction extends BaseAction {
+
+	public AddNotationAction(StructuredTextEditor editor, String label) {
+		super(editor, label);
+	}
+
+	public void run() {
+		DTDNode selectedNode = getFirstNodeSelected();
+
+		getModel().getDTDFile().createNotation(selectedNode, "NewNotation", true); //$NON-NLS-1$
+
+		//      newNotation.setName(DTDUniqueNameHelper.getUniqueNotationName(dtdFile));
+	}
+}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/actions/AddParameterEntityReferenceAction.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/actions/AddParameterEntityReferenceAction.java
new file mode 100644
index 0000000..7ee2c08
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/actions/AddParameterEntityReferenceAction.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+
+
+package org.eclipse.wst.dtd.ui.views.contentoutline.actions;
+
+import org.eclipse.wst.dtd.core.DTDFile;
+import org.eclipse.wst.dtd.core.DTDNode;
+import org.eclipse.wst.dtd.core.util.LabelValuePair;
+import org.eclipse.wst.sse.ui.StructuredTextEditor;
+
+
+public class AddParameterEntityReferenceAction extends BaseAction {
+	public AddParameterEntityReferenceAction(StructuredTextEditor editor, String label) {
+		super(editor, label);
+	}
+
+	public String getFirstExternalParameterEntity(DTDFile dtdFile) {
+		LabelValuePair[] freeExternalEntities = dtdFile.getDTDModel().createParmEntityContentItems(null);
+
+		if (freeExternalEntities.length > 0) {
+			return (String) freeExternalEntities[0].fValue;
+			//      return (Entity) freeExternalEntities[0].fValue;
+		}
+		return null;
+	}
+
+	public void run() {
+		DTDFile dtdFile = getModel().getDTDFile();
+		String extEntity = getFirstExternalParameterEntity(dtdFile);
+		DTDNode selectedNode = getFirstNodeSelected();
+		if (extEntity != null) {
+			dtdFile.createParameterEntityReference(selectedNode, extEntity, true);
+		} else {
+			dtdFile.createParameterEntityReference(selectedNode, "%NewEntityReference;", true); //$NON-NLS-1$
+		}
+	}
+}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/actions/BaseAction.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/actions/BaseAction.java
new file mode 100644
index 0000000..110bbee
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/actions/BaseAction.java
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+
+
+package org.eclipse.wst.dtd.ui.views.contentoutline.actions;
+
+import java.util.Iterator;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.IEditorActionBarContributor;
+import org.eclipse.ui.actions.SelectionListenerAction;
+import org.eclipse.wst.dtd.core.DTDNode;
+import org.eclipse.wst.dtd.core.document.DTDModelImpl;
+import org.eclipse.wst.sse.ui.StructuredTextEditor;
+
+
+abstract public class BaseAction extends SelectionListenerAction {
+
+	protected IEditorActionBarContributor contextContributor;
+	private StructuredTextEditor fTextEditor;
+
+	public BaseAction(StructuredTextEditor editor, String text) {
+		this(editor, text, null);
+	}
+
+	public BaseAction(StructuredTextEditor editor, String text, ImageDescriptor imageDesc) {
+		super(text);
+		fTextEditor = editor;
+		setImageDescriptor(imageDesc);
+	}
+
+	public IEditorActionBarContributor getContextContributor() {
+		return contextContributor;
+	}
+
+	public DTDNode getFirstNodeSelected() {
+		return getFirstNodeSelected(getStructuredSelection());
+	}
+
+	public DTDNode getFirstNodeSelected(IStructuredSelection selection) {
+		Iterator iter = selection.iterator();
+		//DTDNode referencePoint = null;
+		while (iter.hasNext()) {
+			Object element = iter.next();
+			if (element instanceof DTDNode) {
+				return (DTDNode) element;
+			}
+		}
+		return null;
+	}
+
+	public DTDModelImpl getModel() {
+		return (DTDModelImpl) getTextEditor().getModel();
+	}
+
+	/**
+	 * @return Returns the textEditor.
+	 */
+	public StructuredTextEditor getTextEditor() {
+		return fTextEditor;
+	}
+
+	public void setContextContributor(IEditorActionBarContributor contributor) {
+		contextContributor = contributor;
+	}
+
+}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/actions/DeleteAction.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/actions/DeleteAction.java
new file mode 100644
index 0000000..0642c37
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/actions/DeleteAction.java
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+
+
+package org.eclipse.wst.dtd.ui.views.contentoutline.actions;
+
+import java.util.Iterator;
+
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.actions.SelectionListenerAction;
+import org.eclipse.wst.dtd.core.CMNode;
+import org.eclipse.wst.dtd.core.DTDFile;
+import org.eclipse.wst.dtd.core.DTDNode;
+import org.eclipse.wst.dtd.core.DTDPlugin;
+import org.eclipse.wst.dtd.core.util.DTDBatchNodeDelete;
+
+
+public class DeleteAction extends SelectionListenerAction {
+
+	public DeleteAction(String label) {
+		super(label);
+	}
+
+	public void run() {
+		IStructuredSelection selection = getStructuredSelection();
+
+		Iterator iter = selection.iterator();
+		DTDBatchNodeDelete batchDelete = null;
+		DTDFile dtdFile = null;
+		while (iter.hasNext()) {
+			Object element = iter.next();
+			if (element instanceof DTDNode) {
+				DTDNode node = (DTDNode) element;
+				dtdFile = node.getDTDFile();
+				if (batchDelete == null) {
+					batchDelete = new DTDBatchNodeDelete(dtdFile);
+				}
+				batchDelete.addNode((DTDNode) element);
+			}
+		}
+		dtdFile.getDTDModel().beginRecording(this, DTDPlugin.getDTDString("_UI_LABEL_DTD_FILE_DELETE")); //$NON-NLS-1$
+		batchDelete.deleteNodes(this);
+		dtdFile.getDTDModel().endRecording(this);
+	}
+
+	public boolean updateSelection(IStructuredSelection sel) {
+		if (!super.updateSelection(sel))
+			return false;
+
+		Object selectedObject = sel.getFirstElement();
+		if (selectedObject instanceof DTDNode && !(selectedObject instanceof CMNode && ((CMNode) selectedObject).isRootElementContent())) {
+			setEnabled(true);
+			return true; // enable delete menu item
+		} else {
+			setEnabled(false);
+			return false; // disable it - grey out
+		}
+	}
+}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/properties/DTDPropertySourceAdapter.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/properties/DTDPropertySourceAdapter.java
new file mode 100644
index 0000000..67a7d07
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/properties/DTDPropertySourceAdapter.java
@@ -0,0 +1,131 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+package org.eclipse.wst.dtd.ui.views.properties;
+
+
+
+import java.util.Stack;
+
+import org.eclipse.ui.views.properties.IPropertyDescriptor;
+import org.eclipse.ui.views.properties.IPropertySource;
+import org.eclipse.wst.dtd.core.DTDNode;
+import org.eclipse.wst.dtd.ui.DTDEditorPlugin;
+import org.eclipse.wst.sse.core.INodeAdapter;
+import org.eclipse.wst.sse.core.INodeNotifier;
+import org.eclipse.wst.sse.ui.views.properties.CustomPropertyDescriptor;
+
+
+/**
+ * An IPropertySource implementation for a JFace viewer used to display
+ * properties of DOM nodes. Requires an adapter factory to create JFace
+ * adapters for the nodes in the tree.
+ */
+public class DTDPropertySourceAdapter implements INodeAdapter, IPropertySource {
+	protected final static String CATEGORY_ATTRIBUTES = "Attributes"; //$NON-NLS-1$
+
+	private static final String ID_NAME = DTDEditorPlugin.getResourceString("DTDPropertySourceAdapter.0"); //$NON-NLS-1$
+	private static final String ID_TEXT = DTDEditorPlugin.getResourceString("DTDPropertySourceAdapter.1"); //$NON-NLS-1$
+
+	protected IPropertyDescriptor[] fDescriptors = null;
+	protected INodeNotifier fNode = null;
+
+	protected Stack fValuesBeingSet = new Stack();
+
+	public DTDPropertySourceAdapter(INodeNotifier target) {
+		super();
+		fNode = target;
+	}
+
+	/**
+	 * @return
+	 */
+	private IPropertyDescriptor[] createPropertyDescriptors() {
+		CustomPropertyDescriptor nameDescriptor = new CustomPropertyDescriptor(ID_NAME, ID_NAME, null);
+		nameDescriptor.setCategory(DTDEditorPlugin.getResourceString("DTDPropertySourceAdapter.2")); //$NON-NLS-1$
+		//		CustomPropertyDescriptor contentDescriptor = new
+		// CustomPropertyDescriptor(ID_TEXT, ID_TEXT, null);
+		//		contentDescriptor.setCategory("Attributes");
+		return new IPropertyDescriptor[]{nameDescriptor};
+	}
+
+	/**
+	 * Returns a value for this Node that can be editted in a property sheet.
+	 * 
+	 * @return a value that can be editted
+	 */
+	public Object getEditableValue() {
+		return null;
+	}
+
+	/**
+	 * Returns the current collection of property descriptors.
+	 * 
+	 * @return all valid descriptors.
+	 */
+	public IPropertyDescriptor[] getPropertyDescriptors() {
+		if (fDescriptors == null || fDescriptors.length == 0) {
+			fDescriptors = createPropertyDescriptors();
+		} else {
+			updatePropertyDescriptors();
+		}
+		return fDescriptors;
+	}
+
+	/**
+	 * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyValue(java.lang.Object)
+	 */
+	public Object getPropertyValue(Object id) {
+		Object value = null;
+		if (id.equals(ID_NAME) && fNode instanceof DTDNode) {
+			value = ((DTDNode) fNode).getName();
+		}
+		if (id.equals(ID_TEXT) && fNode instanceof DTDNode) {
+			value = ((DTDNode) fNode).getFullNodeText();
+		}
+		return value;
+	}
+
+	/**
+	 * Allowing the INodeAdapter to compare itself against the type allows it
+	 * to return true in more than one case.
+	 */
+	public boolean isAdapterForType(Object type) {
+		return type == IPropertySource.class;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.ui.views.properties.IPropertySource#isPropertySet(java.lang.Object)
+	 */
+	public boolean isPropertySet(Object id) {
+		return false;
+	}
+
+	public void notifyChanged(INodeNotifier notifier, int eventType, Object changedFeature, Object oldValue, Object newValue, int pos) {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.ui.views.properties.IPropertySource#resetPropertyValue(java.lang.Object)
+	 */
+	public void resetPropertyValue(Object id) {
+	}
+
+	public void setPropertyValue(Object nameObject, Object value) {
+	}
+
+	protected void updatePropertyDescriptors() {
+	}
+}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/properties/DTDPropertySourceAdapterFactory.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/properties/DTDPropertySourceAdapterFactory.java
new file mode 100644
index 0000000..900da6f
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/properties/DTDPropertySourceAdapterFactory.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+package org.eclipse.wst.dtd.ui.views.properties;
+
+
+
+import org.eclipse.ui.views.properties.IPropertySource;
+import org.eclipse.wst.sse.core.AbstractAdapterFactory;
+import org.eclipse.wst.sse.core.AdapterFactory;
+import org.eclipse.wst.sse.core.INodeAdapter;
+import org.eclipse.wst.sse.core.INodeNotifier;
+
+
+public class DTDPropertySourceAdapterFactory extends AbstractAdapterFactory {
+
+	public DTDPropertySourceAdapterFactory() {
+		super(IPropertySource.class, true);
+	}
+
+	public DTDPropertySourceAdapterFactory(Object adapterKey, boolean registerAdapters) {
+		super(adapterKey, registerAdapters);
+	}
+
+	public AdapterFactory copy() {
+		return new DTDPropertySourceAdapterFactory(this.adapterKey, this.shouldRegisterAdapter);
+	}
+
+	protected INodeAdapter createAdapter(INodeNotifier target) {
+		// at the moment, only one implementation exists
+		return new DTDPropertySourceAdapter(target);
+	}
+}
diff --git a/bundles/org.eclipse.wst.sse.core/.classpath b/bundles/org.eclipse.wst.sse.core/.classpath
index 065ac06..df094ee 100644
--- a/bundles/org.eclipse.wst.sse.core/.classpath
+++ b/bundles/org.eclipse.wst.sse.core/.classpath
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
-	<classpathentry kind="src" path="src"/>
-	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
-	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
-	<classpathentry kind="output" path="bin"/>
+    <classpathentry kind="src" path="src"/>
+    <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+    <classpathentry kind="output" path="bin"/>
 </classpath>
diff --git a/bundles/org.eclipse.wst.sse.core/.compatibility b/bundles/org.eclipse.wst.sse.core/.compatibility
new file mode 100644
index 0000000..b10de48
--- /dev/null
+++ b/bundles/org.eclipse.wst.sse.core/.compatibility
@@ -0,0 +1,2 @@
+#Wed Mar 24 13:53:52 EST 2004

+.project=7955

diff --git a/bundles/org.eclipse.wst.sse.core/.cvsignore b/bundles/org.eclipse.wst.sse.core/.cvsignore
index ba077a4..bbd3025 100644
--- a/bundles/org.eclipse.wst.sse.core/.cvsignore
+++ b/bundles/org.eclipse.wst.sse.core/.cvsignore
@@ -1 +1,8 @@
 bin
+temp.folder
+model.jar
+modelsrc.zip
+.project
+dev.properties
+build.xml
+org.eclipse.wst.sse.core_6.0.0.jar
diff --git a/bundles/org.eclipse.wst.sse.core/.options b/bundles/org.eclipse.wst.sse.core/.options
index 2b235ff..08bcfef 100644
--- a/bundles/org.eclipse.wst.sse.core/.options
+++ b/bundles/org.eclipse.wst.sse.core/.options
@@ -3,9 +3,13 @@
 org.eclipse.wst.sse.core/dom/adapter/notification/time=false
 org.eclipse.wst.sse.core/dom/adapter/notification/time/criteria=10
 org.eclipse.wst.sse.core/resourcechangehandling=false
+org.eclipse.wst.sse.core/structuredmodel/lifecycle=false
+org.eclipse.wst.sse.core/structuredmodel/state=false
 org.eclipse.wst.sse.core/builder=false
 org.eclipse.wst.sse.core/builder/detection=false
 org.eclipse.wst.sse.core/builder/time=false
 org.eclipse.wst.sse.core/participantregistry=false
 org.eclipse.wst.sse.core/builder/participant/tasktag=false
 org.eclipse.wst.sse.core/builder/modelprovider=false
+org.eclipse.wst.sse.core/filebuffers/modelmanagement=false
+org.eclipse.wst.sse.core/filebuffers/lifecycle=false
diff --git a/bundles/org.eclipse.wst.sse.core/.project b/bundles/org.eclipse.wst.sse.core/.project
index 383f02e..13fb18b 100644
--- a/bundles/org.eclipse.wst.sse.core/.project
+++ b/bundles/org.eclipse.wst.sse.core/.project
@@ -3,6 +3,15 @@
 	<name>org.eclipse.wst.sse.core</name>
 	<comment></comment>
 	<projects>
+		<project>org.eclipse.wst.common.encoding</project>
+		<project>org.eclipse.wst.common.contentmodel</project>
+		<project>org.eclipse.wst.xml.uriresolver.xmlutility</project>
+		<project>org.eclipse.core.filebuffers</project>
+		<project>org.eclipse.core.resources</project>
+		<project>org.eclipse.core.runtime</project>
+		<project>org.eclipse.core.runtime.compatibility</project>
+		<project>org.eclipse.emf.common</project>
+		<project>org.eclipse.jface.text</project>
 	</projects>
 	<buildSpec>
 		<buildCommand>
@@ -22,7 +31,7 @@
 		</buildCommand>
 	</buildSpec>
 	<natures>
-		<nature>org.eclipse.jdt.core.javanature</nature>
 		<nature>org.eclipse.pde.PluginNature</nature>
+		<nature>org.eclipse.jdt.core.javanature</nature>
 	</natures>
 </projectDescription>
diff --git a/bundles/org.eclipse.wst.sse.core/DevTimeSupport/HeadParsers/CSSHeadTokenizer/CSSHeadTokenizer.jFlex b/bundles/org.eclipse.wst.sse.core/DevTimeSupport/HeadParsers/CSSHeadTokenizer/CSSHeadTokenizer.jFlex
new file mode 100644
index 0000000..00c56b7b
--- /dev/null
+++ b/bundles/org.eclipse.wst.sse.core/DevTimeSupport/HeadParsers/CSSHeadTokenizer/CSSHeadTokenizer.jFlex
@@ -0,0 +1,286 @@
+/*******************************************************************************
+ * Copyright (c) 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+/*nlsXXX*/
+package org.eclipse.wst.common.encoding.contentspecific.css;
+import java.io.IOException;
+import java.io.Reader;
+
+import org.eclipse.wst.common.encoding.contentspecific.EncodingParserConstants;
+import org.eclipse.wst.common.encoding.contentspecific.HeadParserToken;
+import org.eclipse.wst.common.encoding.contentspecific.IntStack;
+import org.eclipse.wst.common.encoding.contentspecific.xml.XMLHeadTokenizerConstants;
+
+
+
+%%
+
+%{
+
+
+	private boolean hasMore = true;
+	private final static int MAX_TO_SCAN = 1000;
+	StringBuffer string = new StringBuffer();
+	// state stack for easier state handling
+	private IntStack fStateStack = new IntStack();
+	private String valueText = null;
+
+
+
+	public CSSHeadTokenizer() {
+		super();
+	}
+
+	  public void reset (Reader in) {
+	  	/* the input device */
+	  	yy_reader = in;
+
+  		/* the current state of the DFA */
+  		yy_state = 0;
+
+  		/* the current lexical state */
+  		yy_lexical_state = YYINITIAL;
+
+  		/* this buffer contains the current text to be matched and is
+  		 the source of the yytext() string */
+  		java.util.Arrays.fill(yy_buffer, (char)0);
+
+  		/* the textposition at the last accepting state */
+  		yy_markedPos = 0;
+
+  		/* the textposition at the last state to be included in yytext */
+  		yy_pushbackPos = 0;
+
+  		/* the current text position in the buffer */
+  		yy_currentPos = 0;
+
+  		/* startRead marks the beginning of the yytext() string in the buffer */
+  		yy_startRead = 0;
+
+  		/** 
+  		 * endRead marks the last character in the buffer, that has been read
+  		 * from input 
+  		 */
+  		yy_endRead = 0;
+
+  		/* number of newlines encountered up to the start of the matched text */
+  		yyline = 0;
+
+  		/* the number of characters up to the start of the matched text */
+  		yychar = 0;
+
+  		/**
+  		 * the number of characters from the last newline up to the start
+  		 * of the matched text
+  		 */
+  		yycolumn = 0; 
+
+  		/** 
+  		 * yy_atBOL == true <=> the scanner is currently at the beginning 
+  		 * of a line
+  		 */
+  		yy_atBOL = false;
+
+  		/* yy_atEOF == true <=> the scanner has returned a value for EOF */
+  		yy_atEOF = false;
+
+  		/* denotes if the user-EOF-code has already been executed */
+  		yy_eof_done = false;
+
+
+  		fStateStack.clear();
+  		
+  		hasMore = true;
+  		
+		// its a little wasteful to "throw away" first char array generated
+		// by class init (via auto generated code), but we really do want
+		// a small buffer for our head parsers.
+		if (yy_buffer.length != MAX_TO_SCAN) {
+			yy_buffer = new char[MAX_TO_SCAN];
+		}
+  		
+
+  	}
+
+
+	public final HeadParserToken getNextToken() throws IOException {
+		String context = null;
+		context = primGetNextToken();
+		HeadParserToken result = null;
+		if (valueText != null) {
+			result = createToken(context, yychar, valueText);
+			valueText = null;
+		} else {
+			result = createToken(context, yychar, yytext());
+		}
+		return result;
+	}
+
+	public final boolean hasMoreTokens() {
+		return hasMore && yychar < MAX_TO_SCAN;
+	}
+	private void pushCurrentState() {
+		fStateStack.push(yystate());
+
+	}
+
+	private void popState() {
+		yybegin(fStateStack.pop());
+	}
+	private HeadParserToken createToken(String context, int start, String text) {
+		return new HeadParserToken(context, start, text);
+	}
+	
+
+%}
+
+%eof{
+	hasMore=false;
+%eof}
+
+%public
+%class CSSHeadTokenizer
+%function primGetNextToken
+%type String
+%char
+%unicode
+%ignorecase 
+%debug
+%switch
+
+
+UTF16BE = \xFE\xFF
+UTF16LE = \xFF\xFE
+UTF83ByteBOM = \xEF\xBB\xBF
+
+//SpaceChar = [\x20\x09]
+
+
+
+// [3] S ::= (0x20 | 0x9 | 0xD | 0xA)+
+S = [\x20\x09\x0D\x0A]
+
+BeginAttribeValue = {S}* \= {S}*
+
+LineTerminator = \r|\n
+
+
+%state ST_XMLDecl
+%state CHARSET_RULE
+%state QuotedAttributeValue
+%state DQ_STRING
+%state SQ_STRING
+%state UnDelimitedString
+
+%%
+
+
+<YYINITIAL>  
+{
+	{UTF16BE}   		{hasMore = false; return EncodingParserConstants.UTF16BE;}
+	{UTF16LE}   		{hasMore = false; return EncodingParserConstants.UTF16LE;}
+	{UTF83ByteBOM}   	{hasMore = false; return EncodingParserConstants.UTF83ByteBOM;}
+
+	// force to be started on first line, but we do allow preceeding spaces
+	^ {S}* "<\?xml" {S}+ {if (yychar == 0 ) {yybegin(ST_XMLDecl); return XMLHeadTokenizerConstants.XMLDeclStart;}}
+	
+	^ {S}* "@charset"     {if (yychar == 0 )  {yybegin(CHARSET_RULE); return CSSHeadTokenizerConstants.CHARSET_RULE;}}
+	
+
+}	
+
+// I don't think there's really an XML form of CSS files ... but will leave here for consistency	
+<ST_XMLDecl> 
+{
+	//"version" {BeginAttribeValue} {pushCurrentState(); yybegin(QuotedAttributeValue); return XMLHeadTokenizerConstants.XMLDeclVersion;}
+	"encoding" {BeginAttribeValue} {pushCurrentState(); yybegin(QuotedAttributeValue); return XMLHeadTokenizerConstants.XMLDelEncoding;}
+	// note this "forced end" once end of XML Declaration found
+	"\?>"    {yybegin(YYINITIAL);  return XMLHeadTokenizerConstants.XMLDeclEnd;}
+}	
+
+<CHARSET_RULE> 
+{
+
+	{S}*  {pushCurrentState(); yybegin(QuotedAttributeValue);}
+	";"    { yybegin(YYINITIAL);  hasMore = false; return CSSHeadTokenizerConstants.RuleEnd;}
+}
+	
+
+<QuotedAttributeValue>
+{
+	\"                      { yybegin(DQ_STRING); string.setLength(0); }
+	\'			{ yybegin(SQ_STRING); string.setLength(0); }
+	// in this state, anything other than a space character can start an undelimited string
+	{S}*.           { yypushback(1); yybegin(UnDelimitedString); string.setLength(0);}
+
+}	
+
+
+<DQ_STRING>
+{
+
+	\"                      { popState(); valueText = string.toString(); return EncodingParserConstants.StringValue; }
+  	{LineTerminator}        { yypushback(1);popState(); valueText = string.toString(); return EncodingParserConstants.InvalidTerminatedStringValue;}
+	"\?>"			{ yypushback(2); popState(); valueText = string.toString(); return EncodingParserConstants.InvalidTerminatedStringValue;}
+	"<"			{ yypushback(1);popState(); valueText = string.toString(); return EncodingParserConstants.InvalidTerminatedStringValue;}
+	
+	">"			{ yypushback(1);popState(); valueText = string.toString(); return EncodingParserConstants.InvalidTerminatedStringValue;}
+	"\/>"			{ yypushback(2); popState(); valueText = string.toString(); return EncodingParserConstants.InvalidTerminatedStringValue;}
+	";"                      { yypushback(1); popState(); valueText = string.toString(); return EncodingParserConstants.InvalidTerminatedStringValue; }
+	
+	.			{ string.append( yytext() ); }
+
+
+}
+
+<SQ_STRING>
+{
+
+	\'                      { popState(); valueText = string.toString(); return EncodingParserConstants.StringValue;}
+  	{LineTerminator}        { yypushback(1);popState(); valueText = string.toString(); return EncodingParserConstants.InvalidTerminatedStringValue;}
+	"%>"			{ yypushback(2);popState(); valueText = string.toString(); return EncodingParserConstants.InvalidTerminatedStringValue;}
+	"<"			{ yypushback(1);popState(); valueText = string.toString(); return EncodingParserConstants.InvalidTerminatedStringValue;}
+	">"			{ yypushback(1);popState(); valueText = string.toString(); return EncodingParserConstants.InvalidTerminatedStringValue;}
+	"\/>"			{ yypushback(2); popState(); valueText = string.toString(); return EncodingParserConstants.InvalidTerminatedStringValue;}
+	";"                      { yypushback(1); popState(); valueText = string.toString(); return EncodingParserConstants.InvalidTerminatedStringValue; }
+	.			{ string.append( yytext() ); }
+
+
+}
+
+<UnDelimitedString>
+{
+
+
+	{S}                     { yypushback(1);popState(); valueText = string.toString(); return EncodingParserConstants.UnDelimitedStringValue; }
+  	{LineTerminator}        { yypushback(1);popState(); valueText = string.toString(); return EncodingParserConstants.InvalidTerminatedStringValue;}
+	"\?>"			{ yypushback(2);popState(); valueText = string.toString(); return EncodingParserConstants.InvalidTerminatedStringValue;}
+	"<"			{ yypushback(1);popState(); valueText = string.toString(); return EncodingParserConstants.InvalidTerminatedStringValue;}
+	// these are a bit special, since we started an undelimit string, but found a quote ... probably indicates a missing beginning quote
+	\'			{ yypushback(1);popState(); valueText = string.toString(); return EncodingParserConstants.InvalidTermintatedUnDelimitedStringValue;}
+	\"			{ yypushback(1);popState(); valueText = string.toString(); return EncodingParserConstants.InvalidTermintatedUnDelimitedStringValue;}
+	
+	">"			{ yypushback(1);popState(); valueText = string.toString(); return EncodingParserConstants.InvalidTerminatedStringValue;}
+	"\/>"			{ yypushback(2); popState(); valueText = string.toString(); return EncodingParserConstants.InvalidTerminatedStringValue;}
+	";"                      { yypushback(1); popState(); valueText = string.toString(); return EncodingParserConstants.UnDelimitedStringValue; }
+	.			{ string.append( yytext() ); }
+
+}
+
+// The "match anything" rule should always be in effect except for when looking for end of string
+// (That is, remember to update state list if/when new states added)
+<YYINITIAL, ST_XMLDecl, QuotedAttributeValue, CHARSET_RULE>
+{
+// this is the fallback (match "anything") rule  (for this scanner, input is ignored, and position advanced, if not recognized)
+.|\n              {if (yychar > MAX_TO_SCAN) {hasMore=false; return EncodingParserConstants.MAX_CHARS_REACHED;}}
+}
+
+// this rule always in effect
+<<EOF>>         {hasMore = false; return EncodingParserConstants.EOF;}
diff --git a/bundles/org.eclipse.wst.sse.core/DevTimeSupport/HeadParsers/CSSHeadTokenizer/CSSHeadTokenizer.java b/bundles/org.eclipse.wst.sse.core/DevTimeSupport/HeadParsers/CSSHeadTokenizer/CSSHeadTokenizer.java
new file mode 100644
index 0000000..4dfc385
--- /dev/null
+++ b/bundles/org.eclipse.wst.sse.core/DevTimeSupport/HeadParsers/CSSHeadTokenizer/CSSHeadTokenizer.java
@@ -0,0 +1,977 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Jens Lukowski/Innoopract - initial renaming/restructuring
+ *     
+ *******************************************************************************/
+/* The following code was generated by JFlex 1.2.2 on 1/27/04 6:42 PM */
+
+/*nlsXXX*/
+package org.eclipse.wst.common.encoding.contentspecific.css;
+import java.io.IOException;
+import java.io.Reader;
+
+import org.eclipse.wst.common.encoding.contentspecific.EncodingParserConstants;
+import org.eclipse.wst.common.encoding.contentspecific.HeadParserToken;
+import org.eclipse.wst.common.encoding.contentspecific.IntStack;
+import org.eclipse.wst.common.encoding.contentspecific.xml.XMLHeadTokenizerConstants;
+
+
+
+
+/**
+ * This class is a scanner generated by 
+ * <a href="http://www.informatik.tu-muenchen.de/~kleing/jflex/">JFlex</a> 1.2.2
+ * on 1/27/04 6:42 PM from the specification file
+ * <tt>file:/D:/DevTimeSupport/HeadParsers/CSSHeadTokenizer/CSSHeadTokenizer.jflex</tt>
+ */
+public class CSSHeadTokenizer {
+
+  /** this character denotes the end of file */
+  final public static int YYEOF = -1;
+
+  /** lexical states */
+  final public static int YYINITIAL = 0;
+  final public static int UnDelimitedString = 12;
+  final public static int DQ_STRING = 8;
+  final public static int SQ_STRING = 10;
+  final public static int ST_XMLDecl = 2;
+  final public static int QuotedAttributeValue = 6;
+  final public static int CHARSET_RULE = 4;
+
+  /**
+   * YY_LEXSTATE[l] is the state in the DFA for the lexical state l
+   * YY_LEXSTATE[l+1] is the state in the DFA for the lexical state l
+   *                  at the beginning of a line
+   * l is of the form l = 2*k, k a non negative integer
+   */
+  private final static int YY_LEXSTATE[] = { 
+     0,  1,  2,  2,  3,  3,  4,  4,  5,  5,  6,  6,  7, 7
+  };
+
+  /** 
+   * Translates characters to character classes
+   */
+  final private static String yycmap_packed = 
+    "\11\0\1\6\1\11\2\0\1\10\22\0\1\6\1\0\1\36\2\0"+
+    "\1\41\1\0\1\37\7\0\1\40\13\0\1\35\1\12\1\7\1\34"+
+    "\1\13\1\17\1\22\1\0\1\20\1\31\1\25\1\0\1\33\1\21"+
+    "\1\32\2\0\1\16\1\15\1\27\1\30\2\0\1\23\1\24\1\26"+
+    "\3\0\1\14\10\0\1\22\1\0\1\20\1\31\1\25\1\0\1\33"+
+    "\1\21\1\32\2\0\1\16\1\15\1\27\1\30\2\0\1\23\1\24"+
+    "\1\26\3\0\1\14\102\0\1\4\3\0\1\5\17\0\1\3\16\0"+
+    "\1\1\20\0\1\3\16\0\1\1\1\2\170\0\1\2\ufe87\0";
+
+  /** 
+   * Translates characters to character classes
+   */
+  final private static char [] yycmap = yy_unpack_cmap(yycmap_packed);
+
+
+  /* error codes */
+  final private static int YY_UNKNOWN_ERROR = 0;
+  final private static int YY_ILLEGAL_STATE = 1;
+  final private static int YY_NO_MATCH = 2;
+  final private static int YY_PUSHBACK_2BIG = 3;
+
+  /* error messages for the codes above */
+  final private static String YY_ERROR_MSG[] = {
+    "Unkown internal scanner error",
+    "Internal error: unknown state",
+    "Error: could not match input",
+    "Error: pushback value was too large"
+  };
+
+  /** the input device */
+  private java.io.Reader yy_reader;
+
+  /** the current state of the DFA */
+  private int yy_state;
+
+  /** the current lexical state */
+  private int yy_lexical_state = YYINITIAL;
+
+  /** this buffer contains the current text to be matched and is
+      the source of the yytext() string */
+  private char yy_buffer[] = new char[16384];
+
+  /** the textposition at the last accepting state */
+  private int yy_markedPos;
+
+  /** the textposition at the last state to be included in yytext */
+  private int yy_pushbackPos;
+
+  /** the current text position in the buffer */
+  private int yy_currentPos;
+
+  /** startRead marks the beginning of the yytext() string in the buffer */
+  private int yy_startRead;
+
+  /** endRead marks the last character in the buffer, that has been read
+      from input */
+  private int yy_endRead;
+
+  /** number of newlines encountered up to the start of the matched text */
+  private int yyline;
+
+  /** the number of characters up to the start of the matched text */
+  private int yychar;
+
+  /**
+   * the number of characters from the last newline up to the start of the 
+   * matched text
+   */
+  private int yycolumn; 
+
+  /** 
+   * yy_atBOL == true <=> the scanner is currently at the beginning of a line
+   */
+  private boolean yy_atBOL;
+
+  /** yy_atEOF == true <=> the scanner has returned a value for EOF */
+  private boolean yy_atEOF;
+
+  /** denotes if the user-EOF-code has already been executed */
+  private boolean yy_eof_done;
+
+  /* user code: */
+
+
+	private boolean hasMore = true;
+	private final static int MAX_TO_SCAN = 1000;
+	StringBuffer string = new StringBuffer();
+	// state stack for easier state handling
+	private IntStack fStateStack = new IntStack();
+	private String valueText = null;
+
+
+
+	public CSSHeadTokenizer() {
+		super();
+	}
+
+	  public void reset (Reader in) {
+	  	/* the input device */
+	  	yy_reader = in;
+
+  		/* the current state of the DFA */
+  		yy_state = 0;
+
+  		/* the current lexical state */
+  		yy_lexical_state = YYINITIAL;
+
+  		/* this buffer contains the current text to be matched and is
+  		 the source of the yytext() string */
+  		java.util.Arrays.fill(yy_buffer, (char)0);
+
+  		/* the textposition at the last accepting state */
+  		yy_markedPos = 0;
+
+  		/* the textposition at the last state to be included in yytext */
+  		yy_pushbackPos = 0;
+
+  		/* the current text position in the buffer */
+  		yy_currentPos = 0;
+
+  		/* startRead marks the beginning of the yytext() string in the buffer */
+  		yy_startRead = 0;
+
+  		/** 
+  		 * endRead marks the last character in the buffer, that has been read
+  		 * from input 
+  		 */
+  		yy_endRead = 0;
+
+  		/* number of newlines encountered up to the start of the matched text */
+  		yyline = 0;
+
+  		/* the number of characters up to the start of the matched text */
+  		yychar = 0;
+
+  		/**
+  		 * the number of characters from the last newline up to the start
+  		 * of the matched text
+  		 */
+  		yycolumn = 0; 
+
+  		/** 
+  		 * yy_atBOL == true <=> the scanner is currently at the beginning 
+  		 * of a line
+  		 */
+  		yy_atBOL = false;
+
+  		/* yy_atEOF == true <=> the scanner has returned a value for EOF */
+  		yy_atEOF = false;
+
+  		/* denotes if the user-EOF-code has already been executed */
+  		yy_eof_done = false;
+
+
+  		fStateStack.clear();
+  		
+  		hasMore = true;
+  		
+		// its a little wasteful to "throw away" first char array generated
+		// by class init (via auto generated code), but we really do want
+		// a small buffer for our head parsers.
+		if (yy_buffer.length != MAX_TO_SCAN) {
+			yy_buffer = new char[MAX_TO_SCAN];
+		}
+  		
+
+  	}
+
+
+	public final HeadParserToken getNextToken() throws IOException {
+		String context = null;
+		context = primGetNextToken();
+		HeadParserToken result = null;
+		if (valueText != null) {
+			result = createToken(context, yychar, valueText);
+			valueText = null;
+		} else {
+			result = createToken(context, yychar, yytext());
+		}
+		return result;
+	}
+
+	public final boolean hasMoreTokens() {
+		return hasMore && yychar < MAX_TO_SCAN;
+	}
+	private void pushCurrentState() {
+		fStateStack.push(yystate());
+
+	}
+
+	private void popState() {
+		yybegin(fStateStack.pop());
+	}
+	private HeadParserToken createToken(String context, int start, String text) {
+		return new HeadParserToken(context, start, text);
+	}
+	
+
+
+
+  /**
+   * Creates a new scanner
+   * There is also a java.io.InputStream version of this constructor.
+   *
+   * @param   in  the java.io.Reader to read input from.
+   */
+  public CSSHeadTokenizer(java.io.Reader in) {
+    this.yy_reader = in;
+  }
+
+  /**
+   * Creates a new scanner.
+   * There is also java.io.Reader version of this constructor.
+   *
+   * @param   in  the java.io.Inputstream to read input from.
+   */
+  public CSSHeadTokenizer(java.io.InputStream in) {
+    this(new java.io.InputStreamReader(in));
+  }
+
+  /** 
+   * Unpacks the compressed character translation table.
+   *
+   * @param packed   the packed character translation table
+   * @return         the unpacked character translation table
+   */
+  private static char [] yy_unpack_cmap(String packed) {
+    char [] map = new char[0x10000];
+    int i = 0;  /* index in packed string  */
+    int j = 0;  /* index in unpacked array */
+    while (i < 158) {
+      int  count = packed.charAt(i++);
+      char value = packed.charAt(i++);
+      do map[j++] = value; while (--count > 0);
+    }
+    return map;
+  }
+
+
+  /**
+   * Gets the next input character.
+   *
+   * @return      the next character of the input stream, EOF if the
+   *              end of the stream is reached.
+   * @exception   IOException  if any I/O-Error occurs
+   */
+  private int yy_advance() throws java.io.IOException {
+
+    /* standard case */
+    if (yy_currentPos < yy_endRead) return yy_buffer[yy_currentPos++];
+
+    /* if the eof is reached, we don't need to work hard */ 
+    if (yy_atEOF) return YYEOF;
+
+    /* otherwise: need to refill the buffer */
+
+    /* first: make room (if you can) */
+    if (yy_startRead > 0) {
+      System.arraycopy(yy_buffer, yy_startRead, 
+                       yy_buffer, 0, 
+                       yy_endRead-yy_startRead);
+
+      /* translate stored positions */
+      yy_endRead-= yy_startRead;
+      yy_currentPos-= yy_startRead;
+      yy_markedPos-= yy_startRead;
+      yy_pushbackPos-= yy_startRead;
+      yy_startRead = 0;
+    }
+
+    /* is the buffer big enough? */
+    if (yy_currentPos >= yy_buffer.length) {
+      /* if not: blow it up */
+      char newBuffer[] = new char[yy_currentPos*2];
+      System.arraycopy(yy_buffer, 0, newBuffer, 0, yy_buffer.length);
+      yy_buffer = newBuffer;
+    }
+
+    /* finally: fill the buffer with new input */
+    int numRead = yy_reader.read(yy_buffer, yy_endRead, 
+                                            yy_buffer.length-yy_endRead);
+
+    if ( numRead == -1 ) return YYEOF;
+
+    yy_endRead+= numRead;
+
+    return yy_buffer[yy_currentPos++];
+  }
+
+
+  /**
+   * Closes the input stream.
+   */
+  final public void yyclose() throws java.io.IOException {
+    yy_atEOF = true;            /* indicate end of file */
+    yy_endRead = yy_startRead;  /* invalidate buffer    */
+    yy_reader.close();
+  }
+
+
+  /**
+   * Returns the current lexical state.
+   */
+  final public int yystate() {
+    return yy_lexical_state;
+  }
+
+  /**
+   * Enters a new lexical state
+   *
+   * @param newState the new lexical state
+   */
+  final public void yybegin(int newState) {
+    yy_lexical_state = newState;
+  }
+
+
+  /**
+   * Returns the text matched by the current regular expression.
+   */
+  final public String yytext() {
+    return new String( yy_buffer, yy_startRead, yy_markedPos-yy_startRead );
+  }
+
+  /**
+   * Returns the length of the matched text region.
+   */
+  final public int yylength() {
+    return yy_markedPos-yy_startRead;
+  }
+
+
+  /**
+   * Reports an error that occured while scanning.
+   *
+   * @param   errorCode  the code of the errormessage to display
+   */
+  private void yy_ScanError(int errorCode) {
+    try {
+      System.out.println(YY_ERROR_MSG[errorCode]);
+    }
+    catch (ArrayIndexOutOfBoundsException e) {
+      System.out.println(YY_ERROR_MSG[YY_UNKNOWN_ERROR]);
+    }
+
+    System.exit(1);
+  } 
+
+
+  /**
+   * Pushes the specified amount of characters back into the input stream.
+   *
+   * They will be read again by then next call of the scanning method
+   *
+   * @param number  the number of characters to be read again.
+   *                This number must not be greater than yylength()!
+   */
+  private void yypushback(int number) {
+    if ( number > yylength() )
+      yy_ScanError(YY_PUSHBACK_2BIG);
+
+    yy_markedPos -= number;
+  }
+
+
+  /**
+   * Contains user EOF-code, which will be executed exactly once,
+   * when the end of file is reached
+   */
+  private void yy_do_eof() {
+    if (!yy_eof_done) {
+      yy_eof_done = true;
+    	hasMore=false;
+
+    }
+  }
+
+
+  /**
+   * Resumes scanning until the next regular expression is matched,
+   * the end of input is encountered or an I/O-Error occurs.
+   *
+   * @return      the next token
+   * @exception   IOException  if any I/O-Error occurs
+   */
+  public String primGetNextToken() throws java.io.IOException {
+    int yy_input;
+    int yy_action;
+
+
+    while (true) {
+
+      yychar+= yylength();
+
+      yy_atBOL = yy_markedPos <= 0 || yy_buffer[yy_markedPos-1] == '\n';
+      if (!yy_atBOL && yy_buffer[yy_markedPos-1] == '\r') {
+        yy_atBOL = yy_advance() != '\n';
+        if (!yy_atEOF) yy_currentPos--;
+      }
+
+      yy_action = -1;
+
+      yy_currentPos = yy_startRead = yy_markedPos;
+
+      if (yy_atBOL)
+        yy_state = YY_LEXSTATE[yy_lexical_state+1];
+      else
+        yy_state = YY_LEXSTATE[yy_lexical_state];
+
+
+      yy_forAction: {
+        while (true) {
+
+          yy_input = yy_advance();
+
+          if ( yy_input == YYEOF ) break yy_forAction;
+
+          yy_input = yycmap[yy_input];
+
+          boolean yy_isFinal = false;
+          boolean yy_noLookAhead = false;
+
+          yy_forNext: { switch (yy_state) {
+            case 0:
+              switch (yy_input) {
+                case 1: yy_isFinal = true; yy_state = 9; break yy_forNext;
+                case 2: yy_isFinal = true; yy_state = 10; break yy_forNext;
+                case 3: yy_isFinal = true; yy_state = 11; break yy_forNext;
+                default: yy_isFinal = true; yy_noLookAhead = true; yy_state = 8; break yy_forNext;
+              }
+
+            case 1:
+              switch (yy_input) {
+                case 1: yy_isFinal = true; yy_state = 9; break yy_forNext;
+                case 2: yy_isFinal = true; yy_state = 10; break yy_forNext;
+                case 3: yy_isFinal = true; yy_state = 11; break yy_forNext;
+                case 6: 
+                case 8: 
+                case 9: yy_isFinal = true; yy_state = 12; break yy_forNext;
+                case 10: yy_isFinal = true; yy_state = 13; break yy_forNext;
+                case 15: yy_isFinal = true; yy_state = 14; break yy_forNext;
+                default: yy_isFinal = true; yy_noLookAhead = true; yy_state = 8; break yy_forNext;
+              }
+
+            case 2:
+              switch (yy_input) {
+                case 11: yy_isFinal = true; yy_state = 15; break yy_forNext;
+                case 21: yy_isFinal = true; yy_state = 16; break yy_forNext;
+                default: yy_isFinal = true; yy_noLookAhead = true; yy_state = 8; break yy_forNext;
+              }
+
+            case 3:
+              switch (yy_input) {
+                case 6: 
+                case 8: 
+                case 9: yy_isFinal = true; yy_state = 17; break yy_forNext;
+                case 29: yy_isFinal = true; yy_noLookAhead = true; yy_state = 18; break yy_forNext;
+                default: yy_isFinal = true; yy_noLookAhead = true; yy_state = 8; break yy_forNext;
+              }
+
+            case 4:
+              switch (yy_input) {
+                case 6: 
+                case 8: yy_isFinal = true; yy_state = 20; break yy_forNext;
+                case 9: yy_isFinal = true; yy_state = 21; break yy_forNext;
+                case 30: yy_isFinal = true; yy_noLookAhead = true; yy_state = 22; break yy_forNext;
+                case 31: yy_isFinal = true; yy_noLookAhead = true; yy_state = 23; break yy_forNext;
+                default: yy_isFinal = true; yy_noLookAhead = true; yy_state = 19; break yy_forNext;
+              }
+
+            case 5:
+              switch (yy_input) {
+                case 8: 
+                case 9: 
+                case 10: 
+                case 28: yy_isFinal = true; yy_noLookAhead = true; yy_state = 25; break yy_forNext;
+                case 11: 
+                case 32: yy_isFinal = true; yy_state = 26; break yy_forNext;
+                case 29: yy_isFinal = true; yy_noLookAhead = true; yy_state = 27; break yy_forNext;
+                case 30: yy_isFinal = true; yy_noLookAhead = true; yy_state = 28; break yy_forNext;
+                default: yy_isFinal = true; yy_noLookAhead = true; yy_state = 24; break yy_forNext;
+              }
+
+            case 6:
+              switch (yy_input)