CVS structure renamed. org.eclipse.wtp.* has been moved to org.eclipse.*
diff --git a/bundles/org.eclipse.wst.dtd.core/.classpath b/bundles/org.eclipse.wst.dtd.core/.classpath
new file mode 100644
index 0000000..065ac06
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/.classpath
@@ -0,0 +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"/>
+</classpath>
diff --git a/bundles/org.eclipse.wst.dtd.core/.cvsignore b/bundles/org.eclipse.wst.dtd.core/.cvsignore
new file mode 100644
index 0000000..ba077a4
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/.cvsignore
@@ -0,0 +1 @@
+bin
diff --git a/bundles/org.eclipse.wst.dtd.core/.project b/bundles/org.eclipse.wst.dtd.core/.project
new file mode 100644
index 0000000..3bb71a0
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>org.eclipse.wst.dtd.core</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.ManifestBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.SchemaBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+		<nature>org.eclipse.pde.PluginNature</nature>
+	</natures>
+</projectDescription>
diff --git a/bundles/org.eclipse.wst.dtd.core/README.txt b/bundles/org.eclipse.wst.dtd.core/README.txt
new file mode 100644
index 0000000..5b71e3e
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/README.txt
@@ -0,0 +1 @@
+This plugin extends the core model to implement a dtd specific model.
\ No newline at end of file
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..58016dd
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/build.properties
@@ -0,0 +1,7 @@
+bin.includes = icons/,\
+               plugin.properties,\
+               dtdmodel.jar,\
+               plugin.xml
+jars.compile.order = dtdmodel.jar
+source.dtdmodel.jar = src/
+output.dtdmodel.jar = bin/
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_comm.gif b/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/fldr_comm.gif
new file mode 100644
index 0000000..28c2ccb
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/icons/full/obj16/fldr_comm.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/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..0c806f8
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/plugin.properties
@@ -0,0 +1,112 @@
+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..20563fd
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/plugin.xml
@@ -0,0 +1,73 @@
+<?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="Eclipse.org"
+	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.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.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..c037b19
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/Attribute.java
@@ -0,0 +1,372 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - 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 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 ENTITY = DTDPlugin.getDTDString("_UI_ENTITY_NAME_DESC"); //$NON-NLS-1$
+	public static final String ENTITIES = DTDPlugin.getDTDString("_UI_ENTITY_NAMES_DESC"); //$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 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[] types = {CDATA, ID, IDREF, IDREFS, ENTITY, ENTITIES, NMTOKEN, NMTOKENS, ENUMERATED_NAME, ENUMERATED_NOTATION};
+
+	protected static Hashtable typeHash = new Hashtable();
+
+	{
+		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$
+	}
+
+	public static final String IMPLIED = "#IMPLIED"; //$NON-NLS-1$
+	public static final String REQUIRED = "#REQUIRED"; //$NON-NLS-1$
+	public static final String FIXED = "#FIXED"; //$NON-NLS-1$
+
+	//  public static final String IMPLIED = "IMPLIED";
+
+	public Attribute(DTDFile file, IStructuredDocumentRegion flatNode) {
+		super(file, flatNode);
+	}
+
+	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;
+	}
+
+	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 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 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 String getDefaultValue() {
+		ITextRegion defaultValue = getNextQuotedLiteral(iterator());
+		if (defaultValue != null) {
+			return getValueFromQuotedRegion(defaultValue);
+		}
+		return ""; //$NON-NLS-1$
+	}
+
+	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 void setDefaultKind(String kind) {
+		beginRecording(this, DTDPlugin.getDTDString("_UI_LABEL_ATTR_DEFAULT_KIND")); //$NON-NLS-1$
+		setDefaultKind(this, kind);
+		endRecording(this);
+	}
+
+	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 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 getDefaultKind() {
+		ITextRegion defaultKindRegion = getDefaultKindRegion();
+		if (defaultKindRegion != null) {
+			return getStructuredDocumentRegion().getText(defaultKindRegion);
+		}
+
+		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 void setType(String type) {
+		beginRecording(this, DTDPlugin.getDTDString("_UI_LABEL_ATTR_TYPE")); //$NON-NLS-1$
+		setType(this, type);
+		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 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 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;
+				}
+			}
+		}
+
+	}
+
+	private AttributeEnumList enumList = null;
+
+	public AttributeEnumList getEnumList() {
+		return enumList;
+	}
+}
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..f539ee1
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/AttributeEnumList.java
@@ -0,0 +1,72 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - 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 {
+
+	public AttributeEnumList(DTDFile file, IStructuredDocumentRegion flatNode) {
+		super(file, flatNode);
+	}
+
+	public Image getImage() {
+		// never exposed in tree
+		return null;
+	}
+
+	private ArrayList list = new ArrayList();
+
+	// 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(String[] items) {
+		beginRecording(this, DTDPlugin.getDTDString("_UI_LABEL_ATTR_ENUM_ITEMS")); //$NON-NLS-1$
+		setItems(this, items);
+		endRecording(this);
+	}
+
+	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);
+		}
+	}
+}
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..9b666be
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/AttributeList.java
@@ -0,0 +1,119 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - 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 Image getImage() {
+		return DTDPlugin.getInstance().getImage(DTDResource.ATTRIBUTELISTICON);
+	}
+
+	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 ()
+	}
+
+	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 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);
+	}
+}
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..40d5d1e
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/CMBasicNode.java
@@ -0,0 +1,169 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - 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 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 isPCData() {
+		ITextRegion pcdata = getNextRegion(iterator(), DTDRegionTypes.CONTENT_PCDATA);
+		if (pcdata != null) {
+			return true;
+		}
+		return false;
+	}
+
+	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 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 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();
+	}
+
+	// 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 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;
+	}
+
+	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..8714159
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/CMGroupNode.java
@@ -0,0 +1,416 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - 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 CMGroupNode extends CMRepeatableNode {
+
+	public static final char CHOICE = '|';
+	public static final char SEQUENCE = ',';
+
+	//  protected ArrayList children = new ArrayList();
+
+	public CMGroupNode(DTDFile file, IStructuredDocumentRegion flatNode) {
+		super(file, flatNode);
+	}
+
+	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$
+	}
+
+	protected char connector = SEQUENCE;
+
+	/**
+	 * 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;
+	}
+
+	/**
+	 * 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 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 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 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;
+			}
+		}
+	}
+
+	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 addChild() {
+		beginRecording(this, DTDPlugin.getDTDString("_UI_LABEL_CM_GRP_NODE_ADD_CHILD")); //$NON-NLS-1$
+		DTDNode lastNode = (DTDNode) getLastChild();
+		if (lastNode != null) {
+			replaceText(this, lastNode.getEndOffset(), 0, String.valueOf(getConnector()) + " NewChild"); //$NON-NLS-1$
+		}
+		else {
+			replaceText(this, getStartOffset() + 1, 0, "NewChild"); //$NON-NLS-1$
+		}
+
+		endRecording(this);
+	}
+
+  public String getName() 
+  {
+    return ""; //$NON-NLS-1$
+  }
+
+  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 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);
+	}
+
+	// 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 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 ()
+
+	}
+
+	//    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..b0cb170
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/CMNode.java
@@ -0,0 +1,131 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - 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 CMNode(DTDFile file, IStructuredDocumentRegion flatNode) {
+		super(file, flatNode);
+	}
+
+	public static final String EMPTY = DTDPlugin.getDTDString("_UI_LABEL_CM_NODE_EMPTY"); //$NON-NLS-1$
+	public static final String ANY = DTDPlugin.getDTDString("_UI_LABEL_CM_NODE_ANY"); //$NON-NLS-1$
+	public static final String PCDATA = DTDPlugin.getDTDString("_UI_LABEL_CM_NODE_PCDATA"); //$NON-NLS-1$
+	public static final String MIXED = DTDPlugin.getDTDString("_UI_LABEL_CM_NODE_MIX_CONTENT"); //$NON-NLS-1$
+	public static final String CHILDREN = DTDPlugin.getDTDString("_UI_LABEL_CM_NODE_CHILD_CONTENT"); //$NON-NLS-1$
+
+
+	boolean rootElementContent;
+
+	/**
+	 * 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;
+	}
+
+	// this is only valid to ask if the content is a root element content
+	abstract public String getType();
+
+	/**
+	 * Set the value of rootElementContent.
+	 * @param v  Value to assign to rootElementContent.
+	 */
+	public void setRootElementContent(boolean v) {
+		this.rootElementContent = v;
+	}
+
+	// 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);
+			}
+		}
+	}
+
+	// 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);
+		}
+	}
+
+	//    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..6e7ce36
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/CMRepeatableNode.java
@@ -0,0 +1,79 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - 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 OPTIONAL = '?';
+	public static final char ONE_OR_MORE = '+';
+	public static final char ZERO_OR_MORE = '*';
+
+
+	public CMRepeatableNode(DTDFile file, IStructuredDocumentRegion flatNode) {
+		super(file, flatNode);
+	}
+
+	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));
+				}
+			}
+		}
+	}
+
+	public Image getImage() {
+    DTDPlugin resourcePlugin = DTDPlugin.getInstance();
+    return resourcePlugin.getImage(DTDResource.ELEMENTREFICON);
+	}
+  
+}// 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..2377104
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/Comment.java
@@ -0,0 +1,76 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - 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 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$
+		}
+	}
+
+	public class StartEndPair {
+		public int startOffset, endOffset;
+	}
+
+	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..fac8c11
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/DTDFile.java
@@ -0,0 +1,671 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - 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.NewModelEvent;
+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 ArrayList lists = new ArrayList();
+	protected DTDModelImpl dtdModel;
+	protected IStructuredDocument fStructuredDocument;
+
+	public DTDFile(DTDModelImpl dtdModel) {
+		this.dtdModel = dtdModel;
+		this.fStructuredDocument = dtdModel.getStructuredDocument();
+	}
+
+	protected NodeList elementList = new NodeList(this, DTDRegionTypes.ELEMENT_TAG);
+	protected NodeList notationList = new NodeList(this, DTDRegionTypes.NOTATION_TAG);
+	protected NodeList entityList = new NodeList(this, DTDRegionTypes.ENTITY_TAG);
+	protected NodeList commentList = new NodeList(this, DTDRegionTypes.COMMENT_START);
+	protected NodeList unrecognizedList = new NodeList(this, DTDRegionTypes.UNKNOWN_CONTENT);
+	protected NodeList attlistList = new NodeList(this, DTDRegionTypes.ATTLIST_TAG);
+
+	public NodeList getElementsAndParameterEntityReferences() {
+		return elementList;
+	}
+
+	public NodeList getNotations() {
+		return notationList;
+	}
+
+	public NodeList getEntities() {
+		return entityList;
+	}
+
+	public NodeList getComments() {
+		return commentList;
+	}
+
+	public NodeList getUnrecognized() {
+		return unrecognizedList;
+	}
+
+	protected ArrayList folderList = null;
+
+	public ArrayList getNodeLists() {
+		if (folderList == null) {
+			folderList = new ArrayList();
+			folderList.add(notationList);
+			folderList.add(entityList);
+			folderList.add(elementList);
+			folderList.add(attlistList);
+			folderList.add(commentList);
+			folderList.add(unrecognizedList);
+		}
+		return folderList;
+	}
+
+	public DTDModelImpl getDTDModel() {
+		return dtdModel;
+	}
+
+
+
+	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 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 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 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 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 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 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);
+	}
+
+	private boolean isMovingNode = false;
+
+	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 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$
+		}
+	}
+
+	protected ArrayList nodeList = new ArrayList();
+
+	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);
+		 }*/
+	}
+
+	protected void removeNodes(List nodes) {
+		getNodes().removeAll(nodes);
+		/*    for (int i = 0; i < nodes.size(); i++) 
+		 {
+		 removeChild((DTDNode)nodes.get(i));
+		 } // end of for ()*/
+	}
+
+	public ArrayList getNodes() {
+		return nodeList;
+	}
+
+	public IStructuredDocument getStructuredDocument() {
+		return fStructuredDocument;
+	}
+
+	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 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 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;
+	}
+
+	boolean creatingNewModel = false;
+
+	public void newModel(NewModelEvent event) {
+		creatingNewModel = true;
+		nodeList.clear();
+		NodesEvent removeEvent = new NodesEvent();
+		removeEvent.getNodes().addAll(nodeList);
+		notifyNodesRemoved(removeEvent);
+		/*    removeChildNodes();*/
+
+		if (fStructuredDocument.getRegionList() != null) {
+			buildNodes(fStructuredDocument.getRegionList());
+		}
+		creatingNewModel = false;
+	}
+
+	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);
+		}
+	}
+
+	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 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;
+	}
+
+	// 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 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 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;
+	}
+
+	public boolean isUnrecognized(IStructuredDocumentRegion flatNode) {
+		return !isElement(flatNode) && !isEntity(flatNode) && !isNotation(flatNode) && !isParameterEntityReference(flatNode) && !isAttributeList(flatNode) && !isComment(flatNode);
+	}
+
+
+	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);
+	}
+
+	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 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 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);
+		}
+	}
+
+	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 Image getImage() {
+		return DTDPlugin.getInstance().getImage(DTDResource.DTDFILEICON);
+	}
+
+	public String getName() {
+		org.eclipse.core.runtime.Path path = new org.eclipse.core.runtime.Path(getDTDModel().getId().toString());
+		return path.lastSegment();
+	}
+
+	protected ArrayList modelListeners = new ArrayList();
+
+	public void addDTDFileListener(IDTDFileListener listener) {
+		modelListeners.add(listener);
+	}
+
+	public void removeDTDFileListener(IDTDFileListener listener) {
+		modelListeners.remove(listener);
+	}
+
+	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 notifyNodeChanged(DTDNode node) {
+		Iterator iter = modelListeners.iterator();
+		while (iter.hasNext()) {
+			IDTDFileListener listener = (IDTDFileListener) iter.next();
+			listener.nodeChanged(node);
+		}
+	}
+
+	/**
+	 * Sets the flatModel.
+	 * @param flatModel The flatModel to set
+	 */
+	public void setStructuredDocument(IStructuredDocument flatModel) {
+		this.fStructuredDocument = flatModel;
+	}
+
+	// Implements IndexedRegion
+
+	public boolean contains(int testPosition) {
+		return getStartOffset() <= testPosition && testPosition <= getEndOffset();
+	}
+
+	public int getEndOffset() {
+		return getStructuredDocument().getFirstStructuredDocumentRegion().getEndOffset();
+	}
+
+	public int getStartOffset() {
+		return getStructuredDocument().getFirstStructuredDocumentRegion().getStartOffset();
+	}
+}
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..acc6faf
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/DTDNode.java
@@ -0,0 +1,326 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - 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;
+
+	public DTDNode(DTDFile dtdFile, IStructuredDocumentRegion flatNode) {
+		this.dtdFile = dtdFile;
+		this.flatNode = flatNode;
+	}
+
+	// flat node that contains this node
+	protected IStructuredDocumentRegion flatNode;
+
+	/**
+	 * Get the value of flatNode.
+	 * @return value of flatNode.
+	 */
+	public IStructuredDocumentRegion getStructuredDocumentRegion() {
+		return flatNode;
+	}
+
+	/**
+	 */
+	public IFactoryRegistry getFactoryRegistry() {
+		DTDModelImpl model = dtdFile.getDTDModel();
+		if (model != null) {
+			IFactoryRegistry reg = model.getFactoryRegistry();
+			if (reg != null)
+				return reg;
+		}
+		return null;
+	}
+
+	/**
+	 * Set the value of flatNode.
+	 * @param v  Value to assign to flatNode.
+	 */
+	public void setStructuredDocumentRegion(IStructuredDocumentRegion v) {
+		this.flatNode = v;
+	}
+
+	public boolean contains(int testPosition) {
+		return containsRange(testPosition, testPosition);
+	}
+
+	public boolean containsRange(int start, int end) {
+		return getStartOffset() <= start && end <= getEndOffset();
+	}
+
+	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 int getStartOffset() {
+		return getStructuredDocumentRegion().getStartOffset(getStartRegion());
+	}
+
+	public int getEndOffset() {
+		return getStructuredDocumentRegion().getEndOffset(getEndRegion());
+	}
+
+	public int getNodeLength() {
+		return getEndOffset() - getStartOffset();
+	}
+
+	public int getFullNodeLength() {
+		return getWhitespaceEndOffset() - getStartOffset();
+	}
+
+	public boolean hasTrailingWhitespace() {
+		return whitespace.size() > 0;
+	}
+
+	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 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;
+	}
+
+	//  private Region startRegion,endRegion;
+	public ITextRegion getStartRegion() {
+		return regions.get(0);
+		//    return startRegion;
+	}
+
+	public ITextRegion getEndRegion() {
+		return regions.get(regions.size() - 1);//endRegion;
+	}
+
+	// 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 RegionIterator iterator() {
+		//    System.out.println("create region iter " + this.getClass() + " with start , end = " + getStartOffset() + ", " +getEndOffset());
+		return new RegionIterator(regions);
+	}
+
+	public ITextRegion getNameRegion() {
+		RegionIterator iter = iterator();
+		while (iter.hasNext()) {
+			ITextRegion region = iter.next();
+			if (region.getType() == DTDRegionTypes.NAME) {
+				return region;
+			}
+		}
+		return null;
+	}
+
+	public String getNodeName() {
+		return getName();
+	}
+
+	public short getNodeType() {
+		return -1;
+	}
+
+	public org.w3c.dom.Node cloneNode(boolean deepest) {
+		return null;
+	}
+
+	public boolean supports(java.lang.String feature, java.lang.String version) {
+		return false;
+	}
+
+	public String getName() {
+		ITextRegion region = getNameRegion();
+		if (region != null) {
+			return getStructuredDocumentRegion().getText(region);
+		}
+		return ""; //$NON-NLS-1$
+	}
+
+	public void beginRecording(Object requestor, String label) {
+		getDTDFile().getDTDModel().beginRecording(requestor, label);
+	}
+
+	public void endRecording(Object requestor) {
+		getDTDFile().getDTDModel().endRecording(requestor);
+	}
+
+	public void replaceText(Object requestor, int start, int length, String newText) {
+		getDTDFile().getStructuredDocument().replaceText(requestor, start, length, newText);
+	}
+
+	public void setName(String name) {
+		beginRecording(this, DTDPlugin.getDTDString("_UI_LABEL_DTD_NODE_NAME_CHG")); //$NON-NLS-1$
+		setName(this, name);
+		endRecording(this);
+	}
+
+	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);
+			}
+		}
+	}
+
+	// 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 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;
+		}
+	}
+
+	abstract public Image getImage();
+
+	public void resolveRegions() {
+	}
+
+	protected TextRegionListImpl regions = new TextRegionListImpl();
+
+	public void addRegion(ITextRegion region) {
+		/*
+		 if (startRegion == null) 
+		 {
+		 startRegion = region;
+		 }
+		 endRegion = region;*/
+		regions.add(region);
+	}
+
+	protected TextRegionListImpl whitespace = new TextRegionListImpl();
+
+	public void addWhitespaceRegion(ITextRegion region) {
+		whitespace.add(region);
+	}
+
+	// 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 DTDFile getDTDFile() {
+		return dtdFile;
+	}
+
+	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 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$
+	}
+
+}
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..e5f1ec2
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/DTDPlugin.java
@@ -0,0 +1,107 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - 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;
+	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 void startup() {
+		instance = this;
+	}
+
+	public synchronized static DTDPlugin getInstance() {
+		return instance;
+	}
+
+	public static DTDPlugin getPlugin() {
+		return 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 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;
+	}
+
+	/**
+	 * 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 ResourceBundle getResourceBundle() {
+		return resourceBundle;
+	}
+}
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..2947cd3
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/DTDResource.java
@@ -0,0 +1,56 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - 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 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 NOTATIONICON = "icons/full/obj16/notation.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 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_COMM = "icons/full/obj16/fldr_comm.gif"; //$NON-NLS-1$
+	public static final String FLDR_UNREC = "icons/full/obj16/fldr_unrec.gif"; //$NON-NLS-1$
+	
+	public static final String ONEICON = "icons/full/obj16/one.gif"; //$NON-NLS-1$
+	public static final String OPTIONALICON = "icons/full/obj16/optional.gif"; //$NON-NLS-1$
+	public static final String ONEORMOREICON = "icons/full/obj16/oneormore.gif"; //$NON-NLS-1$
+	public static final String ZEROORMOREICON = "icons/full/obj16/zeroormore.gif"; //$NON-NLS-1$
+
+	public static final String ONESEQUENCEICON = "icons/full/obj16/onesequence.gif"; //$NON-NLS-1$
+	public static final String OPTIONALSEQUENCEICON = "icons/full/obj16/optionalsequence.gif"; //$NON-NLS-1$
+	public static final String ONEORMORESEQUENCEICON = "icons/full/obj16/oneormoresequence.gif"; //$NON-NLS-1$
+	public static final String ZEROORMORESEQUENCEICON = "icons/full/obj16/zeroormoresequence.gif"; //$NON-NLS-1$
+
+	public static final String ONECHOICEICON = "icons/full/obj16/onechoice.gif"; //$NON-NLS-1$
+	public static final String OPTIONALCHOICEICON = "icons/full/obj16/optionalchoice.gif"; //$NON-NLS-1$
+	public static final String ONEORMORECHOICEICON = "icons/full/obj16/oneormorechoice.gif"; //$NON-NLS-1$
+	public static final String ZEROORMORECHOICEICON = "icons/full/obj16/zeroormorechoice.gif"; //$NON-NLS-1$
+
+	public static final String DTDFILEICON = "icons/full/obj16/DTDFile.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$
+}
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..e0693c3
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/Element.java
@@ -0,0 +1,201 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - 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 {
+
+	public Element(DTDFile dtdFile, IStructuredDocumentRegion flatNode) {
+		super(dtdFile, flatNode, DTDRegionTypes.ELEMENT_TAG);
+	}
+
+	public short getNodeType() {
+		return Node.ELEMENT_NODE;
+	}
+
+	public Node cloneNode(boolean deep) {
+		return new Element(dtdFile, flatNode);
+	}
+
+	protected CMNode contentModel;
+
+	public void setContentModel(CMNode contentModel) {
+		this.contentModel = contentModel;
+	}
+
+	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);
+	}
+
+	List attListList = new ArrayList();
+
+	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;
+	}
+
+	List attributes = new ArrayList();
+
+	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 CMNode getContentModel() {
+		//    Object[] children = getChildren()
+		return (CMNode) getFirstChild();//contentModel;
+	}
+
+	public Image getImage() {
+		return DTDPlugin.getInstance().getImage(DTDResource.ELEMENTICON);
+	}
+
+	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();
+
+		}
+	}
+
+	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 void addChild() {
+		beginRecording(this, DTDPlugin.getDTDString("_UI_LABEL_ELEMENT_ADD_CHILD")); //$NON-NLS-1$
+		addContent(this, " EMPTY"); //$NON-NLS-1$
+		endRecording(this);
+	}
+
+	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);
+		}
+	}
+}
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..40b9c08
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/Entity.java
@@ -0,0 +1,316 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - 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 {
+
+	public Entity(DTDFile file, IStructuredDocumentRegion flatNode) {
+		super(file, flatNode, DTDRegionTypes.ENTITY_TAG);
+	}
+
+	public ITextRegion getPercentRegion() {
+		return getNextRegion(iterator(), DTDRegionTypes.PERCENT);
+	}
+
+	/**
+	 * Get the value of isParameterEntity.
+	 * @return value of isParameterEntity.
+	 */
+	public boolean isParameterEntity() {
+		return getPercentRegion() != null;
+	}
+
+	private static String setParameterEntity = DTDPlugin.getDTDString("_UI_LABEL_ENTITY_SET_PARM_ENTITY"); //$NON-NLS-1$
+	private static String setGeneralEntity = DTDPlugin.getDTDString("_UI_LABEL_ENTITY_SET_GENERAL_ENTITY"); //$NON-NLS-1$
+
+	/**
+	 * 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);
+		}
+	}
+
+	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$
+	}
+
+	/**
+	 * Get the value of externalEntity.
+	 * @return value of externalEntity.
+	 */
+	public boolean isExternalEntity() {
+		return getPublicKeywordRegion(iterator()) != null || getSystemKeywordRegion(iterator()) != null;
+	}
+
+	private static String setExternalEntity = DTDPlugin.getDTDString("_UI_LABEL_ENTITY_SET_EXT_ENTITY"); //$NON-NLS-1$
+	private static String setInternalEntity = DTDPlugin.getDTDString("_UI_LABEL_ENTITY_SET_INT_ENTITY"); //$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);
+		}
+	}
+
+
+	/**
+	 * 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$
+	}
+
+	/**
+	 * 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);
+	}
+
+	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);
+			}
+		}
+	}
+
+	/**
+	 * 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$
+	}
+
+	/**
+	 * 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);
+	}
+
+	/**
+	 * 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);
+					}
+				}
+			}
+		}
+	}
+
+	public Image getImage() {
+		return DTDPlugin.getInstance().getImage(DTDResource.ENTITYICON);
+	}
+
+}
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..ae0b462
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/ExternalNode.java
@@ -0,0 +1,239 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - 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 {
+
+	public ExternalNode(DTDFile file, IStructuredDocumentRegion flatNode, String tagType) {
+		super(file, flatNode, tagType);
+	}
+
+	String publicID;
+
+	public ITextRegion getPublicKeywordRegion(RegionIterator iter) {
+		return getNextRegion(iter, DTDRegionTypes.PUBLIC_KEYWORD);
+	}
+
+	public ITextRegion getSystemKeywordRegion(RegionIterator iter) {
+		return getNextRegion(iter, DTDRegionTypes.SYSTEM_KEYWORD);
+	}
+
+	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;
+	}
+
+	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;
+	}
+
+	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;
+	}
+
+	/**
+	 * 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 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(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 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$
+						}
+					}
+				}
+			}
+		}
+	}
+
+	String systemID;
+
+	/**
+	 * 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$
+	}
+
+
+	/**
+	 * 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);
+	}
+
+	/**
+	 * 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$
+					}
+
+				}
+			}
+
+		}
+	}
+}
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..b693fdd
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/Logger.java
@@ -0,0 +1,123 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - 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 {
+	private static Plugin fPlugin = DTDPlugin.getInstance();
+	private static final String fPluginId = fPlugin.getDescriptor().getUniqueIdentifier();
+
+	private static final String TRACEFILTER_LOCATION = "/debug/tracefilter"; //$NON-NLS-1$
+
+	public static final int OK = IStatus.OK; // 0
+	public static final int INFO = IStatus.INFO; // 1
+	public static final int WARNING = IStatus.WARNING; // 2
+	public static final int ERROR = IStatus.ERROR; // 4
+
+	public static final int OK_DEBUG = 200 + OK;
+	public static final int INFO_DEBUG = 200 + INFO;
+	public static final int WARNING_DEBUG = 200 + WARNING;
+	public static final int ERROR_DEBUG = 200 + ERROR;
+
+	/**
+	 * 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 traceException(String category, String message, Throwable exception) {
+		_trace(category, message, exception);
+	}
+
+	public static void traceException(String category, Throwable exception) {
+		_trace(category, exception.getMessage(), exception);
+	}
+
+	public static void trace(String category, String message) {
+		_trace(category, message, null);
+	}
+}
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..11dacb2
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/NamedTopLevelNode.java
@@ -0,0 +1,131 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - 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 {
+
+	public NamedTopLevelNode(DTDFile dtdFile, IStructuredDocumentRegion flatNode, String type) {
+		super(dtdFile, flatNode);
+		tagStartType = type;
+	}
+
+	private String tagStartType;
+
+	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);
+		}
+	}
+
+	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;
+	}
+
+}
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..ed6715b
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/NodeList.java
@@ -0,0 +1,105 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - 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 String listType;
+	protected DTDFile dtdFile;
+
+	public NodeList(DTDFile dtdFile, String tokenType) {
+		listType = tokenType;
+		this.dtdFile = dtdFile;
+	}
+
+	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$
+	}
+
+	ArrayList listNodes = new ArrayList();
+
+	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;
+	}
+
+	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.UNKNOWN_CONTENT) {
+			return DTDPlugin.getInstance().getImage(DTDResource.FLDR_UNREC);
+		}
+		return null;
+	}
+}
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..6ec36e0
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/Notation.java
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - 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..32ffe6e
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/ParameterEntityReference.java
@@ -0,0 +1,113 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - 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 ParameterEntityReference(DTDFile file, IStructuredDocumentRegion flatNode) {
+		super(file, flatNode, DTDRegionTypes.COMMENT_START);
+	}
+
+	public Image getImage() {
+		return DTDPlugin.getInstance().getImage(DTDResource.ENTITYREFERENCEICON);
+	}
+
+	public String getName() {
+		return getStructuredDocumentRegion().getText();
+	}
+
+	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 setReferencedEntity(Object requestor, String name) {
+		replaceText(requestor, getStructuredDocumentRegion().getStartOffset(), getStructuredDocumentRegion().getLength(), "%" + name + ";"); //$NON-NLS-1$ //$NON-NLS-2$
+	}
+
+	public String getReferencedEntity() {
+		String text = getName();
+		return getName().substring(1, text.length() - 1);
+	}
+
+	private Entity cachedEntity = null;
+
+	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 class StartEndPair {
+		public int startOffset, endOffset;
+	}
+
+	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 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..ba9fb38
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/TopLevelNode.java
@@ -0,0 +1,82 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - 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 ITextRegion getStartRegion() {
+		if (flatNode.getRegions().size() > 0) {
+			return flatNode.getRegions().get(0);
+		}
+		return null;
+	}
+
+	public ITextRegion getEndRegion() {
+		int size = flatNode.getRegions().size();
+		if (size > 0) {
+			return flatNode.getRegions().get(size - 1);
+		}
+		return null;
+	}
+
+	public RegionIterator iterator() {
+		//    System.out.println("create region iter " + this.getClass() + " with start , end = " + getStartOffset() + ", " +getEndOffset());
+		return new RegionIterator(flatNode, getStartOffset(), getEndOffset());
+	}
+
+	public void addWhitespaceStructuredDocumentRegion(IStructuredDocumentRegion node) {
+		flatNodes.add(node);
+	}
+
+	// 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();
+	}
+
+	// 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());
+	}
+}
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..22a0cf2
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/Unrecognized.java
@@ -0,0 +1,38 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - 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..af20517
--- /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) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - 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.builder.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..18acac8
--- /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) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - 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.builder.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..c9a6338
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/content/ContentDescriberForDTD.java
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - 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.encoding.AbstractContentDescriber;
+import org.eclipse.wst.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..1ff3a47
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/document/DTDModel.java
@@ -0,0 +1,23 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - Initial API and implementation
+*   Jens Lukowski/Innoopract - initial renaming/restructuring
+* 
+*/
+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..1f2f13a
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/document/DTDModelImpl.java
@@ -0,0 +1,259 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - Initial API and implementation
+*   Jens Lukowski/Innoopract - initial renaming/restructuring
+* 
+*/
+package org.eclipse.wst.dtd.core.document;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+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.NewModelEvent;
+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 {
+
+	private DTDFile document;
+
+	// entity reference names found in the conditional IGNORE sections
+	private Vector ignoredEntityRefs;
+
+	public DTDModelImpl() {
+		super();
+		document = new DTDFile(this);
+		document.addDTDFileListener(new IDTDFileListener() {
+			public void nodesAdded(NodesEvent event) {
+				checkIfExternalReferencesChanged(event);
+			}
+
+			public void nodesRemoved(NodesEvent event) {
+				checkIfExternalReferencesChanged(event);
+			}
+
+			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();
+					}
+				}
+			}
+		});
+	}
+
+	// Returns entity reference names that are in
+	// the conditional IGNORE sections.
+	public Vector getIgnoredEntityRefs() {
+		if (ignoredEntityRefs == null)
+			ignoredEntityRefs = new Vector();
+		return ignoredEntityRefs;
+	}
+
+	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();
+				}
+			}
+		}
+	}
+
+
+	public DTDFile getDTDFile() {
+		return document;
+	}
+
+	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 void newModel(NewModelEvent 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 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 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 setStructuredDocument(IStructuredDocument newStructuredDocument) {
+		IStructuredDocument oldStructuredDocument = super.getStructuredDocument();
+		if (newStructuredDocument == oldStructuredDocument)
+			return; // noting to do
+
+		if (oldStructuredDocument != null)
+			oldStructuredDocument.removeModelChangingListener(this);
+		super.setStructuredDocument(newStructuredDocument);
+		if (newStructuredDocument != null)
+			newStructuredDocument.addModelChangingListener(this);
+		document.setStructuredDocument(newStructuredDocument);
+	}
+
+	private boolean refreshRequired = false;
+
+	public void setRefreshRequired(boolean value) {
+		refreshRequired = value;
+	}
+
+	public boolean isRefreshRequired() {
+		return refreshRequired;
+	}
+
+	public void setReferencedModelsChanged() {
+		refreshRequired = true;
+	}
+
+	public boolean isReferencedModelsChanged() {
+		return refreshRequired;
+	}
+
+	//
+	// 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;
+	}
+
+	private List errorMessages = new ArrayList();
+
+	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;
+	}
+
+	public void beginRecording(Object requester, String label) {
+		super.beginRecording(requester, label);
+		// clear reference updater cache
+		getReferenceUpdater().clearCache();
+	}
+
+	public void endRecording(Object requester) {
+		super.endRecording(requester);
+		// clear reference updater cache
+		getReferenceUpdater().clearCache();
+	}
+
+	protected DTDReferenceUpdater refUpdater = new DTDReferenceUpdater();
+
+	public DTDReferenceUpdater getReferenceUpdater() {
+		return refUpdater;
+	}
+
+}
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..748a7fd
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/encoding/DTDDocumentCharsetDetector.java
@@ -0,0 +1,54 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - Initial API and implementation
+*   Jens Lukowski/Innoopract - initial renaming/restructuring
+* 
+*/
+package org.eclipse.wst.dtd.core.encoding;
+
+import java.io.IOException;
+
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.wst.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;
+	}
+
+	public void set(IDocument document) {
+		set(new DocumentReader(document, 0));
+
+
+	}
+
+	/**
+	 *
+	 */
+
+	protected void parseInput() throws IOException {
+		IDocumentCharsetDetector documentEncodingDetector = new XMLDocumentCharsetDetector();
+		documentEncodingDetector.set(fReader);
+		fEncodingMemento = documentEncodingDetector.getEncodingMemento();
+
+	}
+
+}
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..921643c
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/encoding/DTDDocumentLoader.java
@@ -0,0 +1,60 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - 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.text.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.internal.text.BasicStructuredDocument;
+import org.eclipse.wst.sse.core.parser.RegionParser;
+
+
+public final class DTDDocumentLoader extends AbstractDocumentLoader {
+
+	public DTDDocumentLoader() {
+		super();
+	}
+
+	public IDocumentPartitioner getDefaultDocumentPartitioner() {
+		return new StructuredTextPartitionerForDTD();
+	}
+
+	protected String getSpecDefaultEncoding() {
+		String enc = "UTF-8"; //$NON-NLS-1$
+		return enc;
+	}
+
+	public IDocumentCharsetDetector getDocumentEncodingDetector() {
+		if (fDocumentEncodingDetector == null) {
+			fDocumentEncodingDetector = new DTDDocumentCharsetDetector();
+		}
+		return fDocumentEncodingDetector;
+	}
+
+	public RegionParser getParser() {
+		return new DTDRegionParser();
+	}
+
+	public IEncodedDocument newEncodedDocument() {
+		BasicStructuredDocument flatModel = new BasicStructuredDocument(getParser());
+		DTDStructuredDocumentReParser reParser = new DTDStructuredDocumentReParser();
+		reParser.setStructuredDocument(flatModel);
+		flatModel.setReParser(reParser);
+		return flatModel;
+	}
+
+}
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..1594d0d
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/event/IDTDFileListener.java
@@ -0,0 +1,23 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - 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 nodesAdded(NodesEvent event);
+
+	public void nodesRemoved(NodesEvent event);
+
+	public void nodeChanged(DTDNode node);
+}
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..433aca1
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/event/NodesEvent.java
@@ -0,0 +1,32 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - 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..29431d0
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/internal/text/DTDStructuredDocumentReParser.java
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - 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;
+
+public class DTDStructuredDocumentReParser extends StructuredDocumentReParser {
+	protected StructuredDocumentEvent reparse(IStructuredDocumentRegion dirtyStart, IStructuredDocumentRegion dirtyEnd) {
+		return super.reparse(dirtyStart, dirtyEnd);
+	}
+
+	public StructuredDocumentEvent checkForCrossStructuredDocumentRegionBoundryCases() {
+		IStructuredDocumentRegion startNode = fStructuredDocument.getRegionAtCharacterOffset(fStart);
+		IStructuredDocumentRegion endNode = fStructuredDocument.getRegionAtCharacterOffset(fStart + fLengthToReplace - 1);
+		return reparse(startNode.getStart(), endNode.getEnd());
+	}
+
+}
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..aacdf91
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/internal/text/DTDStructuredDocumentRegionFactory.java
@@ -0,0 +1,32 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - 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..1f7b906
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/internal/text/RegionIterator.java
@@ -0,0 +1,82 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - 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 {
+	public RegionIterator(IStructuredDocumentRegion node) {
+		this(node, node.getStart(), node.getEnd());
+	}
+
+	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 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;
+			}
+		}
+	}
+
+	private IStructuredDocumentRegion flatNode;
+	private ITextRegionList regions;
+	private ITextRegion startRegion, endRegion;
+	private int startOffset, endOffset;
+
+	private int currentIndex;
+
+	public ITextRegion next() {
+		if (hasNext()) {
+			return regions.get(currentIndex++);
+		}
+		throw new NoSuchElementException();
+	}
+
+	public ITextRegion previous() {
+		if (hasPrevious()) {
+			return regions.get(--currentIndex);
+		}
+		throw new NoSuchElementException();
+	}
+
+	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;
+	}
+}
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..f3f47bf
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/modelhandler/DTDModelDumper.java
@@ -0,0 +1,34 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - 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.encoding.EncodingRule;
+import org.eclipse.wst.sse.core.IStructuredModel;
+import org.eclipse.wst.sse.core.ModelDumper;
+
+public final class DTDModelDumper implements ModelDumper {
+
+	/* (non-Javadoc)
+	 */
+	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..d41f44b
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/modelhandler/DTDModelLoader.java
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - 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 IStructuredModel newModel() {
+		IStructuredModel model = new DTDModelImpl();
+		// now done in create
+		//model.setStructuredDocument(createNewStructuredDocument());
+		//model.setFactoryRegistry(defaultFactoryRegistry());
+		return model;
+	}
+
+	public ModelLoader newInstance() {
+		return new DTDModelLoader();
+	}
+
+	public IDocumentLoader getDocumentLoader() {
+		if (documentLoaderInstance == null) {
+			documentLoaderInstance = new DTDDocumentLoader();
+		}
+		return documentLoaderInstance;
+	}
+}
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..d593376
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/modelhandler/ModelHandlerForDTD.java
@@ -0,0 +1,46 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - 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 ModelLoader getModelLoader() {
+		return new DTDModelLoader();
+	}
+
+	public IDocumentLoader getDocumentLoader() {
+		return new DTDDocumentLoader();
+	}
+
+	public IDocumentCharsetDetector getEncodingDetector() {
+		return new DTDDocumentCharsetDetector();
+	}
+
+}
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..41354c7
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/parser/DTDRegion.java
@@ -0,0 +1,57 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - 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 {
+	//TODO private String text;
+	//TODO protected IStructuredDocumentRegion parent;
+
+	public DTDRegion(String newContext, int newStart, int newLength) {
+		super(newContext, newStart, newLength, newLength);
+	}
+
+	/* TODO
+	 public int getEndOffset() 
+	 {
+	 return parent.getStartOffset() + getEnd();
+	 }
+
+	 public int getStartOffset() 
+	 {
+	 return parent.getStartOffset() + getStart();
+	 }
+
+	 public int getTextEndOffset() 
+	 {
+	 return parent.getStartOffset() + getTextEnd();
+	 }
+	 
+	 public void setParent(IStructuredDocumentRegion parent)
+	 {
+	 this.parent = parent;
+	 }
+	 
+	 public IStructuredDocumentRegion getParent()
+	 {
+	 return parent;
+	 }
+	 */
+
+	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..28e1995
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/parser/DTDRegionFactory.java
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - 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..7078776
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/parser/DTDRegionParser.java
@@ -0,0 +1,269 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - 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.parser.tokenizer.DTDTokenizer;
+import org.eclipse.wst.dtd.core.parser.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);
+	}
+
+	private 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..32bbd92
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/parser/DTDRegionTypes.java
@@ -0,0 +1,76 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - 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.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/parser/tokenizer/DTDTokenizer.java b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/parser/tokenizer/DTDTokenizer.java
new file mode 100644
index 0000000..bcd7b99
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/parser/tokenizer/DTDTokenizer.java
@@ -0,0 +1,1275 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - Initial API and implementation
+*   Jens Lukowski/Innoopract - initial renaming/restructuring
+* 
+*/
+package org.eclipse.wst.dtd.core.parser.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
+ */
+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 private 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 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"};
+
+	/**
+	 * 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
+	 */
+	private int yycolumn;
+
+	/** 
+	 * yy_atBOL == true <=> the scanner is currently at the beginning of a line
+	 */
+	private boolean yy_atBOL = true;
+
+	/** yy_atEOF == true <=> the scanner is at the EOF */
+	private boolean yy_atEOF;
+
+	/* user code: */
+	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;
+	}
+
+
+	/**
+	 * 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/parser/tokenizer/Token.java b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/parser/tokenizer/Token.java
new file mode 100644
index 0000000..e1b26ec
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/parser/tokenizer/Token.java
@@ -0,0 +1,61 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - Initial API and implementation
+*   Jens Lukowski/Innoopract - initial renaming/restructuring
+* 
+*/
+package org.eclipse.wst.dtd.core.parser.tokenizer;
+
+public class Token extends Yytoken {
+	public static final int NAME = 0;
+	public static final int START_TAG = 1;
+	public static final int END_TAG = 2;
+	public static final int LEFT_PAREN = 3;
+	public static final int RIGHT_PAREN = 4;
+	public static final int WHITESPACE = 5;
+	public static final int CONNECTOR = 6;
+
+	//    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 EXCLAMATION = 8;
+	public static final int COMMENT_START = 9;
+
+
+	public static final int NOTATION_TAG = 20;
+	public static final int NOTATION_CONTENT = 21;
+
+	public static final int ENTITY_TAG = 30;
+	public static final int ENTITY_PARM = 31;
+	public static final int ENTITY_CONTENT = 32;
+
+	public static final int ELEMENT_TAG = 40;
+	public static final int ELEMENT_CONTENT = 41;
+	public static final int CONTENT_EMPTY = 42;
+	public static final int CONTENT_ANY = 43;
+	public static final int CONTENT_PCDATA = 44;
+
+
+	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/parser/tokenizer/Yytoken.java b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/parser/tokenizer/Yytoken.java
new file mode 100644
index 0000000..65afb52
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/parser/tokenizer/Yytoken.java
@@ -0,0 +1,90 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - Initial API and implementation
+*   Jens Lukowski/Innoopract - initial renaming/restructuring
+* 
+*/
+package org.eclipse.wst.dtd.core.parser.tokenizer;
+
+class Yytoken {
+	public String m_type;
+	public String m_text;
+	public int m_line;
+	public int m_charBegin;
+	public int m_length;
+
+	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 String getType() {
+		return m_type;
+	}
+
+	public int getStartLine() {
+		return m_line;
+	}
+
+	public int getStartOffset() {
+		return m_charBegin;
+	}
+
+	public int getEndOffset() {
+		return m_charBegin + m_length;
+	}
+
+	public int getLength() {
+		return m_length;
+	}
+
+	public String getText() {
+		return m_text;
+	}
+
+	public void setStartOffset(int startOffset) {
+		m_charBegin = startOffset;
+	}
+
+	public void updateOffset(int delta) {
+		m_charBegin += delta;
+	}
+
+	public void updateText(String newText) {
+		m_text = newText;
+		m_length = newText.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 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$
+	}
+}
+
diff --git a/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/text/rules/StructuredTextPartitionerForDTD.java b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/text/rules/StructuredTextPartitionerForDTD.java
new file mode 100644
index 0000000..c6ee747
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/text/rules/StructuredTextPartitionerForDTD.java
@@ -0,0 +1,36 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - Initial API and implementation
+*   Jens Lukowski/Innoopract - initial renaming/restructuring
+* 
+*/
+package org.eclipse.wst.dtd.core.text.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.core.default"; //$NON-NLS-1$
+
+	public StructuredTextPartitionerForDTD() {
+		super();
+	}
+
+	/* (non-Javadoc)
+	 */
+	public String getDefault() {
+		return ST_DTD_DEFAULT;
+	}
+
+	/* (non-Javadoc)
+	 */
+	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/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..f0c2567
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/util/DTDBatchNodeDelete.java
@@ -0,0 +1,57 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - 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 List nodes = new ArrayList();
+	protected DTDFile dtdFile;
+
+	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..46c93ce
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/util/DTDExternalReferenceRemover.java
@@ -0,0 +1,141 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - 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 {
+
+	public DTDExternalReferenceRemover() {
+
+	}
+
+	protected boolean isUpdating = false;
+
+	protected boolean isParmEntity = false;
+	protected String oldRefName = ""; //$NON-NLS-1$
+	protected Object requestor;
+	protected DTDNode nodeToDelete;
+
+	protected DTDBatchNodeDelete batchDelete;
+	protected List externalElementsAndParmEntities = new ArrayList();
+
+	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 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 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 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 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..d6d7887
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/util/DTDModelUpdater.java
@@ -0,0 +1,136 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - 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 {
+
+	public DTDModelUpdater() {
+
+	}
+
+	protected boolean isUpdating = false;
+
+	protected boolean isParmEntity = false;
+	protected String oldRefName = ""; //$NON-NLS-1$
+	protected Object requestor;
+	protected DTDNode nodeToDelete;
+
+	protected List nodesToDelete = new ArrayList();
+
+	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 visitElement(Element element) {
+		if (isParmEntity) {
+			if (element.getName().equals(oldRefName)) {
+				element.setName(requestor, "TempName"); //$NON-NLS-1$
+			}
+		}
+		super.visitElement(element);
+	}
+
+	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 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 visitReference(CMBasicNode node) {
+		super.visitReference(node);
+
+		if (node.getName().equals(oldRefName)) {
+			DTDNode parent = (DTDNode) node.getParentNode();
+			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/DTDNotationReferenceRemover.java b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/util/DTDNotationReferenceRemover.java
new file mode 100644
index 0000000..410a30d
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/util/DTDNotationReferenceRemover.java
@@ -0,0 +1,93 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - 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 {
+
+	public DTDNotationReferenceRemover() {
+
+	}
+
+	protected Object requestor;
+	protected Notation notation;
+	protected String notationName;
+
+	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 visitEntity(Entity entity) {
+		if (entity.getNotationName().equals(notationName)) {
+			entity.setNotationName(requestor, ""); //$NON-NLS-1$
+		}
+	}
+
+	public void visitAttributeList(AttributeList attList) {
+		Attribute attr = (Attribute) attList.getFirstChild();
+		while (attr != null) {
+			visitAttribute(attr);
+			attr = (Attribute) attr.getNextSibling();
+		}
+	}
+
+	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);
+			}
+		}
+	}
+
+}// 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..9342958
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/util/DTDReferenceUpdater.java
@@ -0,0 +1,197 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - 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 {
+
+	public DTDReferenceUpdater() {
+
+	}
+
+	protected boolean isUpdating = false;
+
+	protected boolean isParmEntity = false;
+	protected boolean isNotation = false;
+	protected String oldRefName = "", newRefName = ""; //$NON-NLS-1$ //$NON-NLS-2$
+	protected String newName = ""; //$NON-NLS-1$
+	protected Object requestor;
+	protected DTDNode referencedNode = null;
+
+	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;
+	}
+
+	public void visitElement(Element element) {
+		if (isParmEntity) {
+			if (element.getName().equals(oldRefName)) {
+				element.setName(requestor, newRefName);
+				references.add(element);
+			}
+		}
+		super.visitElement(element);
+	}
+
+	public void visitAttributeList(AttributeList attList) {
+		if (!isNotation && attList.getName().equals(oldRefName)) {
+			attList.setName(requestor, newRefName);
+			references.add(attList);
+		}
+		super.visitAttributeList(attList);
+	}
+
+	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 visitReference(CMBasicNode node) {
+		super.visitReference(node);
+		if (isParameterEntityRef(oldRefName) && !isParmEntity) {
+			return;
+		}
+
+		if (node.getName().equals(oldRefName)) {
+			node.setName(requestor, newRefName);
+			references.add(node);
+		}
+	}
+
+	public void visitExternalParameterEntityReference(ParameterEntityReference parmEntityRef) {
+		super.visitExternalParameterEntityReference(parmEntityRef);
+		if (parmEntityRef.getName().equals(oldRefName)) {
+			parmEntityRef.setReferencedEntity(requestor, newName);
+			references.add(parmEntityRef);
+		}
+	}
+
+	public void clearCache() {
+		referencedNode = null;
+		references.clear();
+	}
+
+	// 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 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);
+			}
+		}
+	}
+}
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..8e9b6d7
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/util/DTDSAXParser.java
@@ -0,0 +1,156 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - 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;
+	}
+
+	//
+	//  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();
+	//    }
+	//  }
+	//
+	private boolean isEntityRef(String token) {
+		// Looking for the pattern "nnnn%nnnnn".
+		if (token.indexOf('%') != -1)
+			return true; // candidate for entity reference
+		else
+			return false;
+	}
+
+	//
+	private 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#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;
+	}
+
+	/* (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;
+	}
+
+	/* (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/DTDVisitor.java b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/util/DTDVisitor.java
new file mode 100644
index 0000000..4118feb
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/util/DTDVisitor.java
@@ -0,0 +1,108 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - 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() {
+
+	}
+
+	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 visitElement(Element element) {
+		CMNode content = element.getContentModel();
+		visitContentNode(content);
+		visitAttributes(element.getElementAttributes());
+	}
+
+	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 visitAttribute(Attribute 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 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) {
+	}
+
+	public void visitExternalParameterEntityReference(ParameterEntityReference parmEntityRef) {
+	}
+
+	// utility method
+	public boolean isParameterEntityRef(String reference) {
+		if (reference.length() > 0) {
+			return reference.charAt(0) == '%' && reference.charAt(reference.length() - 1) == ';';
+		}
+		return false;
+	}
+
+
+}
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..f85f6b8
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/util/LabelValuePair.java
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - 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
new file mode 100644
index 0000000..065ac06
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/.classpath
@@ -0,0 +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"/>
+</classpath>
diff --git a/bundles/org.eclipse.wst.dtd.ui/.cvsignore b/bundles/org.eclipse.wst.dtd.ui/.cvsignore
new file mode 100644
index 0000000..ba077a4
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/.cvsignore
@@ -0,0 +1 @@
+bin
diff --git a/bundles/org.eclipse.wst.dtd.ui/.project b/bundles/org.eclipse.wst.dtd.ui/.project
new file mode 100644
index 0000000..1d02da4
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>org.eclipse.wst.dtd.ui</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.ManifestBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.SchemaBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+		<nature>org.eclipse.pde.PluginNature</nature>
+	</natures>
+</projectDescription>
diff --git a/bundles/org.eclipse.wst.dtd.ui/README.txt b/bundles/org.eclipse.wst.dtd.ui/README.txt
new file mode 100644
index 0000000..5a653fe
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/README.txt
@@ -0,0 +1 @@
+The dtd implementation of the sse editor.
\ No newline at end of file
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..d9166d0
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/build.properties
@@ -0,0 +1,7 @@
+bin.includes = icons/,\
+               plugin.properties,\
+               dtdeditor.jar,\
+               plugin.xml
+jars.compile.order = dtdeditor.jar
+source.dtdeditor.jar = src/
+output.dtdeditor.jar = bin/
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..62581e1
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/plugin.properties
@@ -0,0 +1,336 @@
+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
+
+!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..db25985
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/plugin.xml
@@ -0,0 +1,104 @@
+<?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="Eclipse.org"
+   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.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.encoding"/>
+   </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.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.wst.sse.ui.adapterFactoryDescription">
+      <adapterFactoryDescription
+            class="org.eclipse.wst.dtd.ui.registry.AdapterFactoryProviderForDTD">
+      </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="DTD Files"
+            category="org.eclipse.wst.sse.ui.preferences"
+            class="org.eclipse.wst.dtd.ui.preferences.ui.DTDFilesPreferencePage"
+            id="org.eclipse.wst.sse.ui.preferences.dtd">
+      </page>
+      <page
+            name="DTD Styles"
+            category="org.eclipse.wst.sse.ui.preferences.dtd"
+            class="org.eclipse.wst.dtd.ui.preferences.ui.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..f377fa3
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/ActionContributorDTD.java
@@ -0,0 +1,37 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - Initial API and implementation
+*   Jens Lukowski/Innoopract - initial renaming/restructuring
+* 
+*/
+package org.eclipse.wst.dtd.ui;
+
+import org.eclipse.wst.sse.ui.ui.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 {
+	private 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)
+	 */
+	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..fda2f17
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/DTDEditorPlugin.java
@@ -0,0 +1,84 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - 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.ui.plugin.AbstractUIPlugin;
+
+/**
+ * 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();
+	}
+
+	//Resource bundle.
+	private ResourceBundle resourceBundle;
+
+	/**
+	 * The constructor.
+	 */
+	public DTDEditorPlugin(IPluginDescriptor descriptor) {
+		super(descriptor);
+		plugin = this;
+		try {
+			resourceBundle = descriptor.getResourceBundle();
+		}
+		catch (MissingResourceException x) {
+			resourceBundle = null;
+		}
+	}
+
+	/**
+	 * Returns the plugin's resource bundle,
+	 */
+	public ResourceBundle getResourceBundle() {
+		return resourceBundle;
+	}
+}
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..92ebe31
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/StructuredTextEditorDTD.java
@@ -0,0 +1,18 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - Initial API and implementation
+*   Jens Lukowski/Innoopract - initial renaming/restructuring
+* 
+*/
+package org.eclipse.wst.dtd.ui;
+
+import org.eclipse.wst.sse.ui.StructuredTextEditor;
+
+public class StructuredTextEditorDTD extends StructuredTextEditor {
+}
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..4438e5d
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/StructuredTextViewerConfigurationDTD.java
@@ -0,0 +1,93 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - 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.text.rules.StructuredTextPartitionerForDTD;
+import org.eclipse.wst.dtd.ui.style.dtd.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)
+	 * 
+	 */
+	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();
+
+		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/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..c748bb3
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/editor/DTDEditorPluginImageHelper.java
@@ -0,0 +1,154 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - 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 final String PLUGINID = DTDEditorPlugin.getDefault().getBundle().getSymbolicName();
+	private static DTDEditorPluginImageHelper instance = null;
+
+	//	 save a descriptor for each image
+	private HashMap fImageDescRegistry = null;
+
+	/**
+	 * Gets the instance.
+	 * 
+	 * @return Returns a DTDEditorPluginImageHelper
+	 */
+	public synchronized static DTDEditorPluginImageHelper getInstance() {
+		if (instance == null)
+			instance = new DTDEditorPluginImageHelper();
+		return instance;
+	}
+
+	/**
+	 * 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();
+	}
+
+	/**
+	 * 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();
+			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;
+	}
+}
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..ddb738b
--- /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) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - 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_DTOOL_ADD_ATTRIBUTE = "icons/full/dtool16/ADD_Attribute.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_CTOOL_ADD_ELEMENT = "icons/full/ctool16/ADD_Element.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_ETOOL_ADD_ELEMENT = "icons/full/etool16/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_DTOOL_ADD_ELEMENTTOCONMODEL = "icons/full/dtool16/ADD_ElementToConModel.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_CTOOL_ADD_GROUPTOCONMODEL = "icons/full/ctool16/ADD_GroupToConModel.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_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..02974b7
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/editor/IHelpContextIds.java
@@ -0,0 +1,32 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - 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$
+}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/preferences/DTDPreferenceManager.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/preferences/DTDPreferenceManager.java
new file mode 100644
index 0000000..7833f4c
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/preferences/DTDPreferenceManager.java
@@ -0,0 +1,53 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - Initial API and implementation
+*   Jens Lukowski/Innoopract - initial renaming/restructuring
+* 
+*/
+package org.eclipse.wst.dtd.ui.preferences;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.wst.sse.ui.preferences.PreferenceManager;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+public class DTDPreferenceManager extends PreferenceManager {
+
+	static private DTDPreferenceManager instance = null;
+
+	public Document createDefaultPreferences() {
+		Document document = super.createDefaultPreferences();
+		if (document == null)
+			return document;
+
+		while (document.getChildNodes().getLength() > 0)
+			document.removeChild(document.getLastChild());
+		Element settings = document.createElement(getRootElementName());
+		document.appendChild(settings);
+
+		// workaround for XML4J implementation bug
+		Element spacer = document.createElement("spaceholder");//$NON-NLS-1$
+		settings.appendChild(spacer);
+
+		return document;
+	}
+
+	public String getFilename() {
+		if (fileName == null) {
+			fileName = Platform.getPlugin(org.eclipse.wst.sse.core.IModelManagerPlugin.ID).getStateLocation().toString() + "/dtdprefs.xml";//$NON-NLS-1$
+		}
+		return fileName;
+	}
+
+	public synchronized static DTDPreferenceManager getInstance() {
+		if (instance == null)
+			instance = new DTDPreferenceManager();
+		return instance;
+	}
+}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/preferences/ui/DTDColorManager.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/preferences/ui/DTDColorManager.java
new file mode 100644
index 0000000..563effe
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/preferences/ui/DTDColorManager.java
@@ -0,0 +1,143 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - Initial API and implementation
+*   Jens Lukowski/Innoopract - initial renaming/restructuring
+* 
+*/
+package org.eclipse.wst.dtd.ui.preferences.ui;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.wst.dtd.ui.style.dtd.IStyleConstantsDTD;
+import org.eclipse.wst.sse.ui.preferences.PreferenceManager;
+import org.eclipse.wst.sse.ui.preferences.ui.ColorHelper;
+import org.eclipse.wst.sse.ui.preferences.ui.ColorNames;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+
+public class DTDColorManager extends PreferenceManager {
+
+	private static DTDColorManager dtdColorManager = null;
+
+	protected DTDColorManager() {
+		super();
+	}
+
+	protected Element addColor(Node colors, String name, String foreground, String background) {
+		Element newColor = newColor(colors.getOwnerDocument(), name, foreground, background);
+		colors.appendChild(newColor);
+		return newColor;
+	}
+
+	/**
+	 * <!ELEMENT colors (color)
+	 * >
+	 * <!ELEMENT color EMPTY
+	 * >
+	 * <!ATTLIST color
+	 *     name       CDATA #REQUIRED 
+	 *     foreground CDATA #IMPLIED
+	 *     background CDATA #IMPLIED 
+	 *     bold CDATA #REQUIRED
+	 * >
+	 *
+	 */
+	public Document createDefaultPreferences() {
+		Document document = super.createDefaultPreferences();
+		if (document == null)
+			return document;
+
+		while (document.getChildNodes().getLength() > 0)
+			document.removeChild(document.getLastChild());
+		Element colors = document.createElement(getRootElementName());
+		document.appendChild(colors);
+		
+		addColor(colors, IStyleConstantsDTD.DTD_DEFAULT, getColorString(0, 0, 0), null);	//black
+		addColor(colors, IStyleConstantsDTD.DTD_TAG, getColorString(63, 63, 191), null);	// blue
+		addColor(colors, IStyleConstantsDTD.DTD_TAGNAME, getColorString(63, 63, 191), null);	// blue
+		addColor(colors, IStyleConstantsDTD.DTD_COMMENT, getColorString(127, 127, 127), null);	// grey
+		addColor(colors, IStyleConstantsDTD.DTD_KEYWORD, getColorString(128, 0, 0), null);	// dark red
+		addColor(colors, IStyleConstantsDTD.DTD_STRING, getColorString(63, 159, 95), null);	 //green
+		addColor(colors, IStyleConstantsDTD.DTD_DATA, getColorString(191, 95, 95), null);	 // light red
+		addColor(colors, IStyleConstantsDTD.DTD_SYMBOL, getColorString(128, 0, 0), null);	// dark red
+		return document;
+	}
+
+	public static String getColorString(int r, int g, int b) {
+		return "#" + getHexString(r, 2) + getHexString(g, 2) + getHexString(b, 2);//$NON-NLS-1$
+	}
+
+	public String getFilename() {
+		if (fileName == null) {
+			fileName = Platform.getPlugin(org.eclipse.wst.sse.core.IModelManagerPlugin.ID).getStateLocation().toString() + "/dtdsourcecolors.xml";//$NON-NLS-1$
+		}
+		return fileName;
+	}
+
+	public static String getHexString(int value, int minWidth) {
+		String hexString = Integer.toHexString(value);
+		for (int i = hexString.length(); i < minWidth; i++) {
+			hexString = "0" + hexString;//$NON-NLS-1$
+		}
+		return hexString;
+	}
+
+	/**
+	 * The intended name for the root Element of the Document; what is also
+	 * listed within the DOCTYPE declaration.
+	 * @return String
+	 */
+	public String getRootElementName() {
+		return ColorNames.COLORS;
+	}
+
+	public static DTDColorManager getDTDColorManager() {
+		if (dtdColorManager == null)
+			dtdColorManager = new DTDColorManager();
+		return dtdColorManager;
+	}
+
+	protected Element newColor(Document doc, String name, String foreground, String background) {
+		if (doc == null || name == null || name.length() < 1)
+			return null;
+		Element newColor = doc.createElement(ColorNames.COLOR);
+		newColor.setAttribute(ColorNames.NAME, name);
+		if (foreground != null)
+			newColor.setAttribute(ColorNames.FOREGROUND, foreground);
+		if (background != null)
+			newColor.setAttribute(ColorNames.BACKGROUND, background);
+		return newColor;
+	}
+
+	protected Element newColor(Document doc, String name, String foreground, String background, boolean bold, boolean italic) {
+		Element newColor = newColor(doc, name, foreground, background);
+		if (newColor == null)
+			return null;
+		newColor.setAttribute(ColorNames.BOLD, String.valueOf(bold));
+		newColor.setAttribute(ColorNames.ITALIC, String.valueOf(italic));
+		return newColor;
+	}
+	
+	/**
+	 * Return the color element for the given name in the color manager.
+	 * @param name preference key to look up
+	 * @return color element for the given name, null if it was not found
+	 */
+	public Element getColorElement(String name) {
+		Node colorsElement = getRootElement();
+		
+		for (Node colorNode = colorsElement.getFirstChild(); colorNode != null; colorNode = colorNode.getNextSibling()) {
+			if (colorNode.getNodeType() == Node.ELEMENT_NODE && ((Element) colorNode).getAttribute(ColorHelper.NAME).equals(name)) {
+				return (Element) colorNode;
+			}
+		}
+		return null;
+	}
+}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/preferences/ui/DTDColorPage.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/preferences/ui/DTDColorPage.java
new file mode 100644
index 0000000..b59387a
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/preferences/ui/DTDColorPage.java
@@ -0,0 +1,156 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - Initial API and implementation
+*   Jens Lukowski/Innoopract - initial renaming/restructuring
+* 
+*/
+package org.eclipse.wst.dtd.ui.preferences.ui;
+
+import java.util.ArrayList;
+import java.util.Dictionary;
+import java.util.Hashtable;
+
+import org.eclipse.core.runtime.Platform;
+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.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.dtd.IStyleConstantsDTD;
+import org.eclipse.wst.encoding.content.IContentTypeIdentifier;
+import org.eclipse.wst.sse.core.IModelManager;
+import org.eclipse.wst.sse.core.IModelManagerPlugin;
+import org.eclipse.wst.sse.ui.preferences.PreferenceManager;
+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;
+	}
+
+	protected PreferenceManager getColorManager() {
+		return DTDColorManager.getDTDColorManager();
+	}
+
+	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();
+
+		getColorManager().save();
+		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);
+
+	}
+}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/preferences/ui/DTDFilesPreferencePage.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/preferences/ui/DTDFilesPreferencePage.java
new file mode 100644
index 0000000..e7e7ff1
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/preferences/ui/DTDFilesPreferencePage.java
@@ -0,0 +1,59 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - Initial API and implementation
+*   Jens Lukowski/Innoopract - initial renaming/restructuring
+* 
+*/
+package org.eclipse.wst.dtd.ui.preferences.ui;
+
+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 IPreferenceStore doGetPreferenceStore() {
+		return DTDEditorPlugin.getDefault().getPreferenceStore();
+	}
+
+	/* (non-Javadoc)
+	 */
+	protected Preferences getModelPreferences() {
+		return DTDPlugin.getInstance().getPluginPreferences();
+	}
+
+	protected void doSavePreferenceStore() {
+		DTDPlugin.getInstance().savePluginPreferences(); // model
+	}
+
+	protected Control createContents(Composite parent) {
+		Composite composite = (Composite) super.createContents(parent);
+		WorkbenchHelp.setHelp(composite, IHelpContextIds.DTD_PREFWEBX_FILES_HELPID);
+		
+		setSize(composite);
+		loadPreferences();
+
+		return composite;
+	}
+
+	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..2995b83
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/registry/AdapterFactoryProviderForDTD.java
@@ -0,0 +1,73 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - 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/dtd/ColorManager.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/style/dtd/ColorManager.java
new file mode 100644
index 0000000..e911b8f
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/style/dtd/ColorManager.java
@@ -0,0 +1,63 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - Initial API and implementation
+*   Jens Lukowski/Innoopract - initial renaming/restructuring
+* 
+*/
+package org.eclipse.wst.dtd.ui.style.dtd;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * @deprecated Use base ColorRegistry instead TODO remove in C5 or earlier
+ */
+public class ColorManager {
+
+	private static ColorManager fgColorManager;
+
+	public static ColorManager getDefault() {
+		if (fgColorManager == null) {
+			fgColorManager = new ColorManager();
+		}
+		return fgColorManager;
+	}
+
+	protected Map fColorTable = new HashMap(10);
+
+	private ColorManager() {
+	}
+
+	public void dispose() {
+		Iterator e = fColorTable.values().iterator();
+		while (e.hasNext())
+			((Color) e.next()).dispose();
+	}
+
+	public Color getColor(RGB rgb) {
+		Color color = (Color) fColorTable.get(rgb);
+		if (color == null) {
+			color = new Color(getDisplay(), rgb);
+			fColorTable.put(rgb, color);
+		}
+		return color;
+	}
+
+	private Display getDisplay() {
+
+		return PlatformUI.getWorkbench().getDisplay();
+	}
+
+}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/style/dtd/DTDColors.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/style/dtd/DTDColors.java
new file mode 100644
index 0000000..0f5838f
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/style/dtd/DTDColors.java
@@ -0,0 +1,43 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - Initial API and implementation
+*   Jens Lukowski/Innoopract - initial renaming/restructuring
+* 
+*/
+package org.eclipse.wst.dtd.ui.style.dtd;
+
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.RGB;
+
+/**
+ * @deprecated use IStyleConstantsDTD and base ColorRegistry instead TODO remove in C5 or earlier
+ */
+public class DTDColors {
+	public static final Color DTD_DEFAULT = ColorManager.getDefault().getColor(new RGB(0, 0, 0)); //black
+
+	// tags are '<', '!', or '>'
+	public static final Color DTD_TAG = ColorManager.getDefault().getColor(new RGB(63, 63, 191)); // blue  
+
+	// tagnames are like ELEMENT, ATTLIST, etc.
+	public static final Color DTD_TAGNAME = ColorManager.getDefault().getColor(new RGB(63, 63, 191)); // blue
+
+	public static final Color DTD_COMMENT = ColorManager.getDefault().getColor(new RGB(127, 127, 127)); // grey
+
+	// keywords are constants like IMPLIED or PCDATA
+	public static final Color DTD_KEYWORD = ColorManager.getDefault().getColor(new RGB(128, 0, 0)); // dark red
+
+	// strings are anything in quotes
+	public static final Color DTD_STRING = ColorManager.getDefault().getColor(new RGB(63, 159, 95)); //green
+
+	// Data are variables
+	public static final Color DTD_DATA = ColorManager.getDefault().getColor(new RGB(191, 95, 95)); // light red
+
+	// All the remaining symbols
+	public static final Color DTD_SYMBOL = ColorManager.getDefault().getColor(new RGB(128, 0, 0)); // dark red
+}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/style/dtd/IStyleConstantsDTD.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/style/dtd/IStyleConstantsDTD.java
new file mode 100644
index 0000000..5a6d97f
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/style/dtd/IStyleConstantsDTD.java
@@ -0,0 +1,41 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - Initial API and implementation
+*   Jens Lukowski/Innoopract - initial renaming/restructuring
+* 
+*/
+package org.eclipse.wst.dtd.ui.style.dtd;
+
+/**
+ * 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_DEFAULT = "dtdDefault"; //$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$
+
+	public static final String DTD_COMMENT = "dtdComment"; //$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$
+
+	// Data are variables
+	public static final String DTD_DATA = "dtdData"; //$NON-NLS-1$
+
+	// All the remaining symbols
+	public static final String DTD_SYMBOL = "dtdSymbol"; //$NON-NLS-1$
+}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/style/dtd/LineStyleProviderForDTD.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/style/dtd/LineStyleProviderForDTD.java
new file mode 100644
index 0000000..1e4340b
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/style/dtd/LineStyleProviderForDTD.java
@@ -0,0 +1,153 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - Initial API and implementation
+*   Jens Lukowski/Innoopract - initial renaming/restructuring
+* 
+*/
+package org.eclipse.wst.dtd.ui.style.dtd;
+
+import org.eclipse.jface.text.TextAttribute;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.wst.dtd.core.parser.DTDRegionTypes;
+import org.eclipse.wst.dtd.ui.preferences.ui.DTDColorManager;
+import org.eclipse.wst.sse.core.text.ITextRegion;
+import org.eclipse.wst.sse.ui.preferences.PreferenceManager;
+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;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+
+public class LineStyleProviderForDTD extends AbstractLineStyleProvider implements LineStyleProvider {
+	public LineStyleProviderForDTD() {
+		super();
+		loadColors();
+	}
+
+	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;
+	}
+
+	/* (non-Javadoc)
+	 */
+	protected PreferenceManager getColorManager() {
+		return DTDColorManager.getDTDColorManager();
+	}
+	
+	protected void loadColors() {
+		PreferenceManager mgr = getColorManager();
+		Node colors = mgr.getRootElement();
+		if (colors == null)
+			return;
+		clearColors();
+		//----------------------------------------------------------------------
+		// (pa) 20021217
+		// cmvc defect 235554
+		// performance enhancement: using child.getNextSibling() rather than
+		// nodeList(item) for O(n) vs. O(n*n)
+		//----------------------------------------------------------------------
+		for (Node colorNode = colors.getFirstChild(); colorNode != null; colorNode = colorNode.getNextSibling()) {
+			//		NodeList colorList = colors.getChildNodes();
+			//		for (int i = 0; i < colorList.getLength(); i++) {
+			//			Node colorNode = colorList.item(i);
+			if (colorNode.getNodeType() != Node.ELEMENT_NODE)
+				continue;
+			Element color = (Element) colorNode;
+			String colorName = color.getAttribute(ColorHelper.NAME);
+			if (colorName == null || colorName.length() < 1)
+				continue;
+			RGB foreground = ColorHelper.toRGB(color.getAttribute(ColorHelper.FOREGROUND));
+			RGB background = ColorHelper.toRGB(color.getAttribute(ColorHelper.BACKGROUND));
+			boolean bold = Boolean.valueOf(color.getAttribute(ColorHelper.BOLD)).booleanValue();
+
+			if (colorName.equals(IStyleConstantsDTD.DTD_DEFAULT)) {
+				getTextAttributes().put(IStyleConstantsDTD.DTD_DEFAULT, createTextAttribute(foreground, background, bold));
+			}
+			else if (colorName.equals(IStyleConstantsDTD.DTD_TAG)) {
+				getTextAttributes().put(IStyleConstantsDTD.DTD_TAG, createTextAttribute(foreground, background, bold));
+			}
+			else if (colorName.equals(IStyleConstantsDTD.DTD_TAGNAME)) {
+				getTextAttributes().put(IStyleConstantsDTD.DTD_TAGNAME, createTextAttribute(foreground, background, bold));
+			}
+			else if (colorName.equals(IStyleConstantsDTD.DTD_COMMENT)) {
+				getTextAttributes().put(IStyleConstantsDTD.DTD_COMMENT, createTextAttribute(foreground, background, bold));
+			}
+			else if (colorName.equals(IStyleConstantsDTD.DTD_KEYWORD)) {
+				getTextAttributes().put(IStyleConstantsDTD.DTD_KEYWORD, createTextAttribute(foreground, background, bold));
+			}
+			else if (colorName.equals(IStyleConstantsDTD.DTD_STRING)) {
+				getTextAttributes().put(IStyleConstantsDTD.DTD_STRING, createTextAttribute(foreground, background, bold));
+			}
+			else if (colorName.equals(IStyleConstantsDTD.DTD_DATA)) {
+				getTextAttributes().put(IStyleConstantsDTD.DTD_DATA, createTextAttribute(foreground, background, bold));
+			}
+			else if (colorName.equals(IStyleConstantsDTD.DTD_SYMBOL)) {
+				getTextAttributes().put(IStyleConstantsDTD.DTD_SYMBOL, createTextAttribute(foreground, background, bold));
+			}
+		}
+	}
+	protected void clearColors() {
+		getTextAttributes().clear();
+	}
+	/**
+	 * preferencesChanged method comment.
+	 */
+	public void preferencesChanged() {
+		loadColors();
+		super.preferencesChanged();
+	}
+}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/style/dtd/LineStyleProviderForDTDSubSet.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/style/dtd/LineStyleProviderForDTDSubSet.java
new file mode 100644
index 0000000..be9d058
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/style/dtd/LineStyleProviderForDTDSubSet.java
@@ -0,0 +1,144 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - Initial API and implementation
+*   Jens Lukowski/Innoopract - initial renaming/restructuring
+* 
+*/
+package org.eclipse.wst.dtd.ui.style.dtd;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.core.runtime.Platform;
+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.dtd.core.text.rules.StructuredTextPartitionerForDTD;
+import org.eclipse.wst.dtd.ui.preferences.ui.DTDColorManager;
+import org.eclipse.wst.encoding.content.IContentTypeIdentifier;
+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.preferences.PreferenceManager;
+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;
+import org.w3c.dom.Element;
+
+
+public class LineStyleProviderForDTDSubSet extends AbstractLineStyleProvider implements LineStyleProvider {
+
+	private IStructuredModel fInternalModel = null;
+	private StyleRange[] fInternalRanges;
+	private int fInternalAdjustment;
+	private LineStyleProviderForDTD fInternalProvider = null;
+
+	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) {
+		Element color = DTDColorManager.getDTDColorManager().getColorElement(IStyleConstantsDTD.DTD_DEFAULT);
+
+		RGB foreground = ColorHelper.toRGB(color.getAttribute(ColorHelper.FOREGROUND));
+		RGB background = ColorHelper.toRGB(color.getAttribute(ColorHelper.BACKGROUND));
+		boolean bold = Boolean.valueOf(color.getAttribute(ColorHelper.BOLD)).booleanValue();
+
+		return createTextAttribute(foreground, background, bold);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 */
+	protected PreferenceManager getColorManager() {
+		return DTDColorManager.getDTDColorManager();
+	}
+
+	private IModelManager getModelManager() {
+
+		IModelManagerPlugin plugin = (IModelManagerPlugin) Platform.getPlugin(IModelManagerPlugin.ID);
+		return plugin.getModelManager();
+	}
+
+	/**
+	 * @return
+	 */
+	private IStructuredDocument getInternalDocument() {
+
+		if (fInternalModel == null) {
+			fInternalModel = getModelManager().createUnManagedStructuredModelFor(IContentTypeIdentifier.ContentTypeID_DTD);
+		}
+		return fInternalModel.getStructuredDocument();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 */
+	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;
+	}
+
+	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..bfa5477
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/taginfo/DTDBestMatchHoverProcessor.java
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - 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)
+	 */
+	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/ui/dnd/DTDDragAndDropManager.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/ui/dnd/DTDDragAndDropManager.java
new file mode 100644
index 0000000..a70a8cf
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/ui/dnd/DTDDragAndDropManager.java
@@ -0,0 +1,44 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - Initial API and implementation
+*   Jens Lukowski/Innoopract - initial renaming/restructuring
+* 
+*/
+package org.eclipse.wst.dtd.ui.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/ui/dnd/DragAttributeCommand.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/ui/dnd/DragAttributeCommand.java
new file mode 100644
index 0000000..b904ef1
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/ui/dnd/DragAttributeCommand.java
@@ -0,0 +1,62 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - Initial API and implementation
+*   Jens Lukowski/Innoopract - initial renaming/restructuring
+* 
+*/
+package org.eclipse.wst.dtd.ui.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/ui/dnd/DragContentModelCommand.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/ui/dnd/DragContentModelCommand.java
new file mode 100644
index 0000000..1220e50
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/ui/dnd/DragContentModelCommand.java
@@ -0,0 +1,112 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - Initial API and implementation
+*   Jens Lukowski/Innoopract - initial renaming/restructuring
+* 
+*/
+package org.eclipse.wst.dtd.ui.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 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();
+	}
+
+	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);
+		}
+	}
+}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/ui/dnd/DragTopLevelNodesCommand.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/ui/dnd/DragTopLevelNodesCommand.java
new file mode 100644
index 0000000..76f0e60
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/ui/dnd/DragTopLevelNodesCommand.java
@@ -0,0 +1,63 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - Initial API and implementation
+*   Jens Lukowski/Innoopract - initial renaming/restructuring
+* 
+*/
+package org.eclipse.wst.dtd.ui.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 {
+
+	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;
+	}
+
+	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 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/ui/text/DTDDocumentRegionEdgeMatcher.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/ui/text/DTDDocumentRegionEdgeMatcher.java
new file mode 100644
index 0000000..17cfd12
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/ui/text/DTDDocumentRegionEdgeMatcher.java
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - Initial API and implementation
+*   Jens Lukowski/Innoopract - initial renaming/restructuring
+* 
+*/
+package org.eclipse.wst.dtd.ui.ui.text;
+
+import org.eclipse.wst.dtd.core.parser.DTDRegionTypes;
+import org.eclipse.wst.sse.ui.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..1e5db7f
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/DTDContentOutlineConfiguration.java
@@ -0,0 +1,206 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - 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.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;
+	}
+
+	/**
+	 */
+	public IContentProvider getContentProvider(TreeViewer viewer) {
+		if (fContentProvider == null) {
+			fContentProvider = new DTDTreeContentProvider();
+		}
+		return super.getContentProvider(viewer);
+	}
+
+	/**
+	 */
+	public ILabelProvider getLabelProvider(TreeViewer viewer) {
+		if (fLabelProvider == null) {
+			fLabelProvider = new DTDLabelProvider();
+		}
+		return super.getLabelProvider(viewer);
+	}
+
+	/**
+	 */
+	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());
+	}
+
+	/**
+	 */
+	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)
+	 * 
+	 */
+	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)
+	 * 
+	 */
+	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..edfa0c6
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/DTDContextMenuHelper.java
@@ -0,0 +1,310 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - 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 NodeList) {
+			NodeList folder = (NodeList) selectedObject;
+			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);
+			}
+			else if (folder.getListType().equals(DTDRegionTypes.COMMENT_START)) {
+				menu.add(addCommentAction);
+			}
+		}
+		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;
+	}
+
+	// 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);
+		//      }
+	}
+
+	//    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);
+	}
+}
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..f248187
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/DTDLabelProvider.java
@@ -0,0 +1,90 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - 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;
+
+/**
+ */
+
+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..705fa0e
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/DTDTreeContentProvider.java
@@ -0,0 +1,295 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - 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;
+
+/**
+ */
+
+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()) {
+				Attribute attr = (Attribute) node;
+				// then we must say that the element with the same name
+				// as our attributelist is our parent
+				String attListName = ((DTDNode) attr.getParentNode()).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..6034cc0
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/IndexedNodeList.java
@@ -0,0 +1,82 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - 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;
+	}
+
+	/**
+	 */
+	public boolean contains(int testPosition) {
+		return getStartOffset() <= testPosition && testPosition <= getEndOffset();
+	}
+
+	public boolean contains(Object child) {
+		return fTarget.getNodes().contains(child);
+	}
+
+	/**
+	 */
+	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;
+	}
+
+	/**
+	 */
+	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;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.lang.Object#toString()
+	 */
+	public String toString() {
+		return getClass().getName() + ":" + fTarget.toString(); //$NON-NLS-1$
+	}
+
+	/**
+	 * @return
+	 */
+	public NodeList getTarget() {
+		return fTarget;
+	}
+}
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..368c4f6
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/OrderAction.java
@@ -0,0 +1,54 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - Initial API and implementation
+*   Jens Lukowski/Innoopract - initial renaming/restructuring
+* 
+*/
+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;
+
+
+/**
+ */
+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);
+		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);
+	}
+}
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..7daa457
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/SortAction.java
@@ -0,0 +1,58 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - 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;
+
+
+/**
+ */
+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);
+		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);
+	}
+}
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..a11bd97
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/actions/AddAttributeAction.java
@@ -0,0 +1,53 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - 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);
+	}
+
+	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;
+	}
+
+	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);
+		}
+	}
+
+}
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..6a7f3a9
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/actions/AddAttributeListAction.java
@@ -0,0 +1,41 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - 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..c49389f
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/actions/AddCommentAction.java
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - 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 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..239d1b5
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/actions/AddElementAction.java
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - 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 AddElementAction extends BaseAction {
+
+	public AddElementAction(StructuredTextEditor editor, String label) {
+		super(editor, label);
+	}
+
+	public void run() {
+		DTDNode selectedNode = getFirstNodeSelected();
+
+		getModel().getDTDFile().createElement(selectedNode, "NewElement", 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/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..754058a
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/actions/AddElementToContentModelAction.java
@@ -0,0 +1,49 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - 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);
+	}
+
+	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;
+	}
+
+	public void run() {
+		DTDNode node = getFirstNodeSelected();
+
+		if (node instanceof CMGroupNode) {
+			((CMGroupNode) node).addChild();
+		}
+		else if (node instanceof Element) {
+			((Element) node).addChild();
+		}
+	}
+}
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..3ed35a2
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/actions/AddEntityAction.java
@@ -0,0 +1,31 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - 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 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..d639e14
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/actions/AddGroupToContentModelAction.java
@@ -0,0 +1,38 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - 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..94ee346
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/actions/AddNotationAction.java
@@ -0,0 +1,31 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - 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..60944d3
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/actions/AddParameterEntityReferenceAction.java
@@ -0,0 +1,46 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - 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..55bc4e9
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/actions/BaseAction.java
@@ -0,0 +1,75 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - 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 {
+	private StructuredTextEditor fTextEditor;
+
+	public BaseAction(StructuredTextEditor editor, String text, ImageDescriptor imageDesc) {
+		super(text);
+		fTextEditor = editor;
+		setImageDescriptor(imageDesc);
+	}
+
+	public BaseAction(StructuredTextEditor editor, String text) {
+		this(editor, text, null);
+	}
+
+	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;
+	}
+
+	protected IEditorActionBarContributor contextContributor;
+
+	public DTDModelImpl getModel() {
+		return (DTDModelImpl) getTextEditor().getModel();
+	}
+
+	public void setContextContributor(IEditorActionBarContributor contributor) {
+		contextContributor = contributor;
+	}
+
+	public IEditorActionBarContributor getContextContributor() {
+		return contextContributor;
+	}
+
+	/**
+	 * @return Returns the textEditor.
+	 */
+	public StructuredTextEditor getTextEditor() {
+		return fTextEditor;
+	}
+
+}
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..92be844
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/actions/DeleteAction.java
@@ -0,0 +1,67 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - 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 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
+		}
+	}
+
+	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);
+	}
+}
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..97d6942
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/properties/DTDPropertySourceAdapter.java
@@ -0,0 +1,127 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - 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..19a6fd9
--- /dev/null
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/properties/DTDPropertySourceAdapterFactory.java
@@ -0,0 +1,41 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - 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
new file mode 100644
index 0000000..065ac06
--- /dev/null
+++ b/bundles/org.eclipse.wst.sse.core/.classpath
@@ -0,0 +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"/>
+</classpath>
diff --git a/bundles/org.eclipse.wst.sse.core/.cvsignore b/bundles/org.eclipse.wst.sse.core/.cvsignore
new file mode 100644
index 0000000..ba077a4
--- /dev/null
+++ b/bundles/org.eclipse.wst.sse.core/.cvsignore
@@ -0,0 +1 @@
+bin
diff --git a/bundles/org.eclipse.wst.sse.core/.options b/bundles/org.eclipse.wst.sse.core/.options
new file mode 100644
index 0000000..2b235ff
--- /dev/null
+++ b/bundles/org.eclipse.wst.sse.core/.options
@@ -0,0 +1,11 @@
+org.eclipse.wst.sse.core/debug=true
+org.eclipse.wst.sse.core/debug/tracefilter=
+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/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
diff --git a/bundles/org.eclipse.wst.sse.core/.project b/bundles/org.eclipse.wst.sse.core/.project
new file mode 100644
index 0000000..383f02e
--- /dev/null
+++ b/bundles/org.eclipse.wst.sse.core/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>org.eclipse.wst.sse.core</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.ManifestBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.SchemaBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+		<nature>org.eclipse.pde.PluginNature</nature>
+	</natures>
+</projectDescription>
diff --git a/bundles/org.eclipse.wst.sse.core/README.txt b/bundles/org.eclipse.wst.sse.core/README.txt
new file mode 100644
index 0000000..4eb3ccf
--- /dev/null
+++ b/bundles/org.eclipse.wst.sse.core/README.txt
@@ -0,0 +1,2 @@
+The core model of the sse framework. It provides the base document classes,
+builders and parsers.
\ No newline at end of file
diff --git a/bundles/org.eclipse.wst.sse.core/build.properties b/bundles/org.eclipse.wst.sse.core/build.properties
new file mode 100644
index 0000000..e3909c4
--- /dev/null
+++ b/bundles/org.eclipse.wst.sse.core/build.properties
@@ -0,0 +1,7 @@
+bin.includes = plugin.properties,\
+               model.jar,\
+               plugin.xml,\
+               .options
+jars.compile.order = model.jar
+source.model.jar = src/
+output.model.jar = bin/
diff --git a/bundles/org.eclipse.wst.sse.core/plugin.properties b/bundles/org.eclipse.wst.sse.core/plugin.properties
new file mode 100644
index 0000000..bdfcf7c
--- /dev/null
+++ b/bundles/org.eclipse.wst.sse.core/plugin.properties
@@ -0,0 +1,13 @@
+Structured_Text_Model.name=Structured Text Model
+Structured_Text_Model_NL_Support.name=Structured Text Model NL Support
+# extension names
+Adapt_On_Create_Factory_Extension.name=Adapt On Create Factory Extension
+Document_Types_Extension.name=Document Types Extension
+JSP_Embedded_Content_Type_Handler_Extension.name=JSP Embedded Content Type Handler Extension
+Content_Type_Factory_Contribution_Extension.name=Content Type Factory Contribution Extension
+CSS_Profile_Extension.name=CSS Profile Extension
+Comment_Element_Handler_Extension.name=Comment Element Handler Extension
+Model_Handler_Extension.name=Model Handler Extension
+Structured_Builder_Participant_Extension.name=Structured Builder Participant Extension
+SDMB.name=Structured Document and Model Builder
+Format_Processors_Extension.name=Format Processors Extension
diff --git a/bundles/org.eclipse.wst.sse.core/plugin.xml b/bundles/org.eclipse.wst.sse.core/plugin.xml
new file mode 100644
index 0000000..865037f
--- /dev/null
+++ b/bundles/org.eclipse.wst.sse.core/plugin.xml
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+<plugin
+   id="org.eclipse.wst.sse.core"
+   name="%Structured_Text_Model.name"
+   version="1.0.0"
+   provider-name="Eclipse.org"
+   class="org.eclipse.wst.sse.core.ModelPlugin">
+
+   <runtime>
+      <library name="model.jar">
+         <export name="*"/>
+      </library>
+   </runtime>
+   <requires>
+      <import plugin="org.eclipse.core.runtime.compatibility"/>
+      <import plugin="org.eclipse.core.resources"/>
+<!-- need to re-export jface.txt since our API depends on it, 
+			such as IStructuredDocument extends IDocument 
+		-->
+      <import plugin="org.eclipse.jface.text" export="true"/>
+<!-- need to re-export emf.common since our API depends on it, 
+			such as StructuredTextUndoManager's getCommmand method returns an 
+			emf.common.Command
+		-->
+      <import plugin="org.eclipse.emf.common" export="true"/>
+      <import plugin="org.eclipse.wst.contentmodel"/>
+      <import plugin="org.eclipse.wst.xml.uriresolver"/>
+      <import plugin="org.eclipse.core.runtime"/>
+      <import plugin="org.eclipse.wst.encoding"/>
+      <import plugin="org.eclipse.core.filebuffers"/>
+   </requires>
+
+
+<!-- deprecated -->
+   <extension-point id="adaptOnCreateFactory" name="%Adapt_On_Create_Factory_Extension.name"/>
+   <extension-point id="documentTypes" name="%Document_Types_Extension.name"/>
+   <extension-point id="embeddedTypeHandler" name="JSP Embedded Content Type Handler"/>
+   <extension-point id="contentTypeFactoryContribution" name="%Content_Type_Factory_Contribution_Extension.name"/>
+<!-- I commented out ... clients should just use the normal platform way of registering these 
+		adapterFactories. At worst, they'd need a small plugin with 'startup' specified ... but that's 
+		better than us getting hit with the performance impact (of loading plugins and pre-reqs, etc.). 
+		<extension-point id="uriResolverAdapterFactory" name="Resource Adapter Factory for Creating URIResolvers"/>
+	-->
+   <extension-point id="cssprofile" name="%CSS_Profile_Extension.name"/>
+   <extension-point id="commentElementHandler" name="%Comment_Element_Handler_Extension.name"/>
+<!-- this plug-in provides support for this extension point -->
+   <extension-point id="modelHandler" name="%Model_Handler_Extension.name"/>
+<!-- builder participant; must implement org.eclipse.wst.sse.core.builder.IBuilderParticipant -->
+   <extension-point id="builderparticipant" name="%Structured_Builder_Participant_Extension.name" schema="schema/builderparticipant.exsd"/>
+   <extension-point id="formatProcessors" name="%Format_Processors_Extension.name" schema="schema/formatProcessors.exsd"/>
+
+<!-- not for use by clients -->
+   <extension-point id="builderdelegate" name="Structured Builder Delegate"/>
+
+   <extension point="org.eclipse.core.resources.builders"
+       id="structuredbuilder"
+       name="%SDMB.name">
+      <builder
+           hasNature="false">
+         <run
+            class="org.eclipse.wst.sse.core.internal.builder.StructuredDocumentBuilder"
+			>
+         </run>
+      </builder>
+   </extension>
+<!-- define our task marker type -->
+	<extension id="task" name="Structured Sources Task" point="org.eclipse.core.resources.markers">
+    	<super type="org.eclipse.core.resources.taskmarker"/> 
+    	<persistent value="true"/>
+	</extension>
+</plugin>
diff --git a/bundles/org.eclipse.wst.sse.core/src/Models.properties b/bundles/org.eclipse.wst.sse.core/src/Models.properties
new file mode 100644
index 0000000..bf4ca25
--- /dev/null
+++ b/bundles/org.eclipse.wst.sse.core/src/Models.properties
@@ -0,0 +1,63 @@
+Invalid_character_('<')_fo_ERROR_=IWAK0028E Invalid character ('<') found
+Invalid_character_('>')_fo_ERROR_=IWAK0029E Invalid character ('>') found
+Invalid_character_('&')_fo_ERROR_=IWAK0030E Invalid character ('&') found
+Original_Error__UI_=Original Error:
+Program_Error__ModelManage_EXC_=IWAK0031E Program Error: ModelManagerImpl::saveModel. Model should be in the cache
+Invalid_character_('__')_f_EXC_=IWAK0032E Invalid character ('\"') found
+Unkown_internal_scanner_er_ERROR_=IWAK0033E Unkown internal scanner error
+Internal_error__unknown_st_ERROR_=IWAK0034E Internal error: unknown state
+Error__could_not_match_inp_ERROR_=IWAK0035E Error: could not match input
+Error__pushback_value_was__ERROR_=IWAK0036E Error: pushback value was too large
+An_I/O_error_occured_while_EXC_=IWAK0037E An I/O error occured while scanning :
+3concat=File not found : \"{0}\"
+5concat=Error opening file \"{0}\"
+ul_____(template)_UI_=ul     (template)
+<ul>_n__<li>_Item_one_</li_UI_=<ul>\n  <li> Item one </li>\n  <li> Item two </li>\n</ul>\n
+dl_____(template)_UI_=dl     (template)
+<dl>_n__<dt>_First_definit_UI_=<dl>\n  <dt> First definition  <dd>  First explanation\n  <dt> Second definition <dd> Second explanation\n</dl>\n
+table_____(template)_UI_=table     (template)
+<table_border>_n__<tr>_n___UI_=<table border>\n  <tr>\n    <th>Column 1 Heading</th>\n    <th>Column 2 Heading</th>\n  </tr>\n  <tr>\n    <td>Row 1: Col 1</td>\n    <td>Row 1: Col 2</td>\n  </tr>\n</table>\n
+ol_____(template)_UI_=ol     (template)
+<ol>_n__<li>_Item_one_</li_UI_=<ol>\n  <li> Item one </li>\n  <li> Item two </li>\n</ol>\n
+html____(template)_UI_=html    (template)
+<html>_n<head>_n<title>Ins_UI_=<html>\n<head>\n<title>Insert title here</title>\n</head>\n<body>\n<|c>\n</body>\n</html>
+script_____(commented)_UI_=script     (commented)
+style_____(commented)_UI_=style     (commented)
+img_____(map)_UI=img     (map)
+Usage___java_HTMLTokenizer_EXC_=IWAK0038E Usage : java HTMLTokenizer <inputfile>
+## on the following line, just translate: "place title here" and "place content here"
+__>_n_t_t<TITLE><|c>place__UI_=\">\n\t\t<TITLE><|c>place title here</TITLE>\n\t</HEAD>\n\t<BODY>\n\t\tplace content here\n\t</BODY>\n</HTML>
+A_model's_id_can_not_be_nu_EXC_=IWAK0039E A model's id can not be null
+Flatmodel_constructor_doesn__t_know_how_to_deal_with_non-string_4=Flatmodel constructor doesn\'t know how to deal with non-string
+unexpected_ModelManager_Impl_1=unexpected ModelManager Impl
+continuous_1=continuous
+paged_2=paged
+visual_3=visual
+aural_4=aural
+tactile_5=tactile
+grid_6=grid
+bitmap_7=bitmap
+interactive_8=interactive
+static_9=static
+all_10=all
+Cleaning_up_element_{0}=Cleaning up element \"{0}\"
+Uppercasing_attribute_name_{0}=Uppercasing attribute name \"{0}\"
+Lowercasing_attribute_name_{0}=Lowercasing attribute name \"{0}\"
+Uppercasing_tag_name_{0}=Uppercasing tag name \"{0}\"
+Lowercasing_tag_name_{0}=Lowercasing tag name \"{0}\"
+Inserting_missing_end_tag_{0}=Inserting missing end tag \"{0}\"
+Inserting_missing_start_tag_{0}=Inserting missing start tag \"{0}\"
+Inserting_default_attribute_value_{0}=Inserting default attribute value \"{0}\"
+Quoting_attribute_value_{0}=Quoting attribute value \"{0}\"
+Formatting_start_tag_of_element_{0}=Formatting start tag of element \"{0}\"
+Formatting_end_tag_of_element_{0}=Formatting end tag of element \"{0}\"
+Formatting_element_{0}=Formatting element \"{0}\"
+Formatting_indentation_before_element_{0}=Formatting indentation before element \"{0}\"
+Formatting_indentation_after_element_{0}=Formatting indentation after element \"{0}\"
+Formatting_element_{0}=Formatting element \"{0}\"
+EOL_Windows_UI=Windows
+EOL_Unix_UI=UNIX
+EOL_Mac_UI=Mac
+NoTranslation=No translation
+StructuredDocumentBuilder.0=Updating builders
+ModelPlugin.0=Structured Builder
diff --git a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/AbstractAdapterFactory.java b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/AbstractAdapterFactory.java
new file mode 100644
index 0000000..76274d5
--- /dev/null
+++ b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/AbstractAdapterFactory.java
@@ -0,0 +1,79 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - Initial API and implementation
+*   Jens Lukowski/Innoopract - initial renaming/restructuring
+* 
+*/
+package org.eclipse.wst.sse.core;
+
+/**
+ * An abstract implementation of AdapterFactory that uses itself
+ * as the key.  Subclass to override behavior.
+ */
+abstract public class AbstractAdapterFactory implements AdapterFactory {
+
+	protected Object adapterKey;
+	protected boolean shouldRegisterAdapter = true;
+
+	public AbstractAdapterFactory() {
+		// default constructor sets the adapterKey to the adapter factory itself (i.e. "this")
+		adapterKey = this;
+	}
+
+	public AbstractAdapterFactory(Object adapterKey, boolean registerAdapters) {
+		this.adapterKey = adapterKey;
+		this.shouldRegisterAdapter = registerAdapters;
+	}
+
+	public INodeAdapter adapt(INodeNotifier target) {
+		// target was null when all text deleted?
+		if (target == null)
+			return null;
+		INodeAdapter adapter = target.getExistingAdapter(adapterKey);
+		return adapter != null ? adapter : adaptNew(target);
+	}
+
+	public INodeAdapter adaptNew(INodeNotifier target) {
+		INodeAdapter adapter = createAdapter(target);
+		if (adapter == null)
+			return adapter;
+		if (shouldRegisterAdapter)
+			target.addAdapter(adapter);
+		return adapter;
+	}
+
+	abstract protected INodeAdapter createAdapter(INodeNotifier target);
+
+	public boolean isFactoryForType(Object type) {
+		return type.equals(adapterKey);
+	}
+
+	public void release() {
+		// default is to do nothing
+	}
+
+	public void setAdapterKey(Object key) {
+		if (adapterKey != null)
+			throw new IllegalAccessError("INodeAdapter Key cannot be set more than once."); //$NON-NLS-1$
+		adapterKey = key;
+	}
+
+	public void setRegisterAdapters(boolean flag) {
+		shouldRegisterAdapter = flag;
+	}
+
+	/**
+	 * Subclasses should normally implement their own 'copy' method.
+	 * By default, we'll return the same instance, for convenience
+	 * of those using singleton factories.
+	 */
+	public AdapterFactory copy() {
+		return this;
+	}
+}
diff --git a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/AbstractModelLoader.java b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/AbstractModelLoader.java
new file mode 100644
index 0000000..c76a0ba
--- /dev/null
+++ b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/AbstractModelLoader.java
@@ -0,0 +1,283 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - Initial API and implementation
+*   Jens Lukowski/Innoopract - initial renaming/restructuring
+* 
+*/
+package org.eclipse.wst.sse.core;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.wst.encoding.EncodingRule;
+import org.eclipse.wst.sse.core.document.IDocumentLoader;
+import org.eclipse.wst.sse.core.document.IEncodedDocument;
+import org.eclipse.wst.sse.core.internal.Logger;
+import org.eclipse.wst.sse.core.text.IStructuredDocument;
+import org.eclipse.wst.sse.core.util.Assert;
+
+
+/**
+ * This class reads a file and creates an Structured Model.
+ */
+public abstract class AbstractModelLoader implements ModelLoader {
+	protected IDocumentLoader documentLoaderInstance;
+	protected static final int encodingNameSearchLimit = 1000;
+
+	/**
+	 * AbstractLoader constructor also initializes encoding converter/mapper
+	 */
+	public AbstractModelLoader() {
+		super();
+	}
+
+	/**
+	 * This method must return those factories which must be attached to the
+	 * structuredModel before content is applied.
+	 */
+	public List getAdapterFactories() {
+		// abstract method returns none
+		return new ArrayList(0);
+	}
+
+	protected void addFactories(IStructuredModel model, List factoryList) {
+		Assert.isNotNull(model);
+		IFactoryRegistry registry = model.getFactoryRegistry();
+		Assert.isNotNull(registry);
+		if (factoryList != null) {
+			Iterator iterator = factoryList.iterator();
+			while (iterator.hasNext()) {
+				AdapterFactory factory = (AdapterFactory) iterator.next();
+				registry.addFactory(factory);
+			}
+		}
+	}
+
+	/**
+	 * This method should perform all the model initialization required before
+	 * it contains content, namely, it should call newModel, the
+	 * createNewStructuredDocument(), then add those adapter factories which
+	 * must be set before content is applied. This method should be called by
+	 * "load" method. (this is tentative API)
+	 */
+	public IStructuredModel createModel() {
+		documentLoaderInstance = null;
+		IStructuredModel model = newModel();
+		IEncodedDocument structuredDocument = getDocumentLoader().createNewStructuredDocument();
+		if (structuredDocument instanceof IStructuredDocument) {
+			model.setStructuredDocument((IStructuredDocument) structuredDocument);
+			addFactories(model, getAdapterFactories());
+			//
+			initEmbeddedType(model);
+			// For types with propagating adapters, its important
+			// that the propagating adapter be in place before the contents
+			// are set.
+			preLoadAdapt(model);
+		}
+		return model;
+	}
+
+	abstract public IDocumentLoader getDocumentLoader();
+
+	/**
+	 * Method initEmbeddedType. Nothing to do here in super class.
+	 * 
+	 * @param model
+	 */
+	protected void initEmbeddedType(IStructuredModel model) {
+	}
+
+	/**
+	 * This method is used for cloning models.
+	 */
+	public IStructuredModel createModel(IStructuredModel oldModel) {
+		documentLoaderInstance = null;
+		IStructuredModel newModel = newModel();
+		IStructuredDocument oldStructuredDocument = oldModel.getStructuredDocument();
+		IStructuredDocument newStructuredDocument = oldStructuredDocument.newInstance();
+		newModel.setStructuredDocument(newStructuredDocument);
+		// NOTE: we DO NOT simply add the standard ones to the new model
+		// addFactories(newModel, getAdapterFactories());
+		// Now, we take the opportunity to add Factories from the oldModel's
+		// registry to the new model's registry .. if they do not already
+		// exist there.
+		duplicateFactoryRegistry(newModel, oldModel);
+		//addFactories(newModel, oldModel);
+		initEmbeddedType(oldModel, newModel);
+		// For types with propagating adapters, its important
+		// that the propagating adapter be in place before the contents
+		// are set.
+		preLoadAdapt(newModel);
+		return newModel;
+	}
+
+	/**
+	 * Method initEmbeddedType. Nothing to do here in super class.
+	 * 
+	 * @param oldModel
+	 * @param newModel
+	 */
+	protected void initEmbeddedType(IStructuredModel oldModel, IStructuredModel newModel) {
+	}
+
+	/**
+	 * deprecated -- use EncodingRule form
+	 */
+	synchronized public void load(InputStream inputStream, IStructuredModel model, String encodingName, String lineDelimiter) throws UnsupportedEncodingException, java.io.IOException {
+		// note we don't open the stream, so we don't close it
+		// TEMP work around to maintain previous function,
+		// until everyone can change to EncodingRule.FORCE_DEFAULT
+		if (encodingName != null && encodingName.trim().length() == 0) {
+			// redirect to new method
+			load(inputStream, model, EncodingRule.FORCE_DEFAULT);
+		}
+		else {
+			load(inputStream, model, EncodingRule.CONTENT_BASED);
+		}
+	}
+
+	public void load(InputStream inputStream, IStructuredModel model, EncodingRule encodingRule) throws UnsupportedEncodingException, java.io.IOException {
+		// note we don't open the stream, so we don't close it
+		IEncodedDocument structuredDocument = model.getStructuredDocument();
+		if (inputStream == null) {
+			structuredDocument = getDocumentLoader().createNewStructuredDocument();
+		}
+		else {
+			// assume's model has been initialized already with base location
+			structuredDocument = getDocumentLoader().createNewStructuredDocument(model.getBaseLocation(), inputStream, encodingRule);
+			// TODO: model's not designed for this!
+			model.setStructuredDocument((IStructuredDocument) structuredDocument);
+			((IStructuredDocument) structuredDocument).fireNewDocument(this);
+		}
+		documentLoaderInstance = null;
+
+	}
+
+	public void load(String filename, InputStream inputStream, IStructuredModel model, String junk, String dummy) throws UnsupportedEncodingException, java.io.IOException {
+		IEncodedDocument structuredDocument = model.getStructuredDocument();
+		if (inputStream == null) {
+			structuredDocument = getDocumentLoader().createNewStructuredDocument();
+		}
+		else {
+			structuredDocument = getDocumentLoader().createNewStructuredDocument(filename, inputStream);
+		}
+		// TODO: model's not designed for this!
+		model.setStructuredDocument((IStructuredDocument) structuredDocument);
+		((IStructuredDocument) structuredDocument).fireNewDocument(this);
+		documentLoaderInstance = null;
+
+	}
+
+	/**
+	 * required by interface, being declared here abstractly just as another
+	 * reminder.
+	 */
+	abstract public IStructuredModel newModel();
+
+	/**
+	 * This method gets a fresh copy of the data, and repopulates the models
+	 * ... by a call to setText on the structuredDocument. This method is
+	 * needed in some cases where clients are sharing a model and then changes
+	 * canceled. Say for example, one editor and several "displays" are
+	 * sharing a model, if the editor is closed without saving changes, then
+	 * the displays still need a model, but they should revert to the original
+	 * unsaved version.
+	 */
+	synchronized public void reload(InputStream inputStream, IStructuredModel structuredModel) {
+		documentLoaderInstance = null;
+		try {
+			// temp solution ... we should be able to do better (more efficient) in future. 
+			// Adapters will (probably) need to be sensitive to the fact that the document instance changed
+			// (by being life cycle listeners)
+			load(inputStream, structuredModel, EncodingRule.CONTENT_BASED);
+
+			//			// Note: we apparently read the data (and encoding) correctly
+			//			// before, we just need to make sure we followed the same rule as
+			//			// before.
+			//			EncodingMemento previousMemento = structuredModel.getStructuredDocument().getEncodingMemento();
+			//			EncodingRule previousRule = previousMemento.getEncodingRule();
+			//			//IFile file = ResourceUtil.getFileFor(structuredModel);
+			//			// Note: there's opportunity here for some odd behavior, if the
+			//			// settings have changed from the first load to the reload. But,
+			//			// hopefully,
+			//			// will result in the intended behavior.
+			//			Reader allTextReader = getDocumentLoader().readInputStream(inputStream, previousRule);
+			//
+			//			// TODO: avoid use of String instance
+			//			getDocumentLoader().reload(structuredModel.getStructuredDocument(), allTextReader);
+			//			// and now "reset" encoding memento to keep it current with the
+			//			// one
+			//			// that was just determined.
+			//			structuredModel.getStructuredDocument().setEncodingMemento(getDocumentLoader().getEncodingMemento());
+			//			structuredModel.setDirtyState(false);
+			//			StructuredTextUndoManager undoMgr = structuredModel.getUndoManager();
+			//			if (undoMgr != null) {
+			//				undoMgr.reset();
+			//			}
+		}
+		catch (UnsupportedEncodingException e) {
+			// couldn't happen. The program has apparently
+			// read the model once, and there'd be no reason the encoding
+			// could not be used again.
+			Logger.logException("Warning:  XMLLoader::reload.  This exception really should not have happened!! But will attemp to continue after dumping stack trace", e); //$NON-NLS-1$
+			throw new Error("Program Error", e); //$NON-NLS-1$
+		}
+		catch (IOException e) {
+			// couldn't happen. The program has apparently
+			// read the model once, and there'd be no (common) reason it
+			// couldn't be loaded again.
+			Logger.logException("Warning:  XMLLoader::reload.  This exception really should not have happened!! But will attemp to continue after dumping stack trace", e); //$NON-NLS-1$
+			throw new Error("Program Error", e); //$NON-NLS-1$
+		}
+	}
+
+	/**
+	 * There's nothing to do here in abstract class for initializing adapters.
+	 * Subclasses can and should override this method and provide proper
+	 * intialization (For example, to get DOM document and 'getAdapter' on it,
+	 * so that the first node/notifier has the adapter on it.)
+	 */
+	protected void preLoadAdapt(IStructuredModel structuredModel) {
+	}
+
+	/**
+	 * Normally, here in the abstact class, there's nothing to do, but we will
+	 * reset text, since this MIGHT end up being called to recover from error
+	 * conditions (e.g. IStructuredDocument exceptions) And, can be called by
+	 * subclasses.
+	 */
+	public IStructuredModel reinitialize(IStructuredModel model) {
+		// Note: the "minimumization" routines
+		// of 'replaceText' allow many old nodes to pass through, when
+		// really its assumed they are created anew.
+		// so we need to use 'setText' (I think "setText' ends up
+		// throwing a 'newModel' event though, that may have some
+		// implications.
+		model.getStructuredDocument().setText(this, model.getStructuredDocument().get());
+		return model;
+	}
+
+	private void duplicateFactoryRegistry(IStructuredModel newModel, IStructuredModel oldModel) {
+		List oldAdapterFactories = oldModel.getFactoryRegistry().getFactories();
+		List newAdapterFactories = new ArrayList();
+		Iterator oldListIterator = oldAdapterFactories.iterator();
+		while (oldListIterator.hasNext()) {
+			AdapterFactory oldAdapterFactory = (AdapterFactory) oldListIterator.next();
+			// now "clone" the adapterfactory
+			newAdapterFactories.add(oldAdapterFactory.copy());
+		}
+		// now that we have the "cloned" list, add to new model
+		addFactories(newModel, newAdapterFactories);
+	}
+
+}
diff --git a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/AbstractNotifier.java b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/AbstractNotifier.java
new file mode 100644
index 0000000..9355b8a
--- /dev/null
+++ b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/AbstractNotifier.java
@@ -0,0 +1,218 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - Initial API and implementation
+*   Jens Lukowski/Innoopract - initial renaming/restructuring
+* 
+*/
+package org.eclipse.wst.sse.core;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+
+import org.eclipse.core.runtime.Platform;
+
+
+/**
+ * AbstractNotifier is similar to (and based on) the EMF NotifierImpl
+ * class. This class is simpler (that is, not as many functions).
+ */
+public abstract class AbstractNotifier implements INodeNotifier {
+
+	private INodeAdapter[] fAdapters;
+	private int adapterCount = 0;
+	private final static int growthConstant = 3;
+	private final static boolean debugAdapterNotificationTime = "true".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.wst.sse.core/dom/adapter/notification/time")); //$NON-NLS-1$ //$NON-NLS-2$
+
+	/**
+	 * AbstractNotifier constructor comment.
+	 */
+	public AbstractNotifier() {
+		super();
+	}
+
+	/**
+	 * addAdapter method comment.
+	 */
+	public synchronized void addAdapter(INodeAdapter adapter) {
+
+		if (adapter == null)
+			return;
+		ensureCapacity(adapterCount + 1);
+		fAdapters[adapterCount++] = adapter;
+	}
+
+	/**
+	 * Default behavior for getting an adapter.
+	 */
+	public INodeAdapter getAdapterFor(Object type) {
+		// first, we'll see if we already have one
+		INodeAdapter result = getExistingAdapter(type);
+		// if we didn't find one in our list already,
+		// let's create it
+		if (result == null) {
+			IFactoryRegistry reg = getFactoryRegistry();
+			if (reg != null) {
+				AdapterFactory factory = reg.getFactoryFor(type);
+				if (factory != null) {
+					result = factory.adapt(this);
+				}
+			}
+			// We won't prevent null from being returned, but it would be unusual.
+			// It might be because Factory is not working correctly, or 
+			// not installed, so we'll allow warning message.
+			if ((result == null) && (org.eclipse.wst.sse.core.util.Debug.displayWarnings)) {
+				System.out.println("Warning: no adapter was found or created for " + type); //$NON-NLS-1$
+			}
+		}
+		return result;
+	}
+
+	/**
+	 * Returns a shallow clone of list, since
+	 * clients should not manipulate our list directly.
+	 * Instead, they should use add/removeAdapter.
+	 */
+	public Collection getAdapters() {
+		if (fAdapters != null) {
+			if (adapterCount == 0) {
+				fAdapters = null;
+				return Collections.EMPTY_LIST;
+			}
+			else {
+				// we need to make a new array, to be sure
+				// it doesn't contain nulls at end, which may be 
+				// present there for "growth". 
+				INodeAdapter[] tempAdapters = new INodeAdapter[adapterCount];
+				System.arraycopy(fAdapters, 0, tempAdapters, 0, adapterCount);
+				// EMF uses the unmodifiableCollection. Its a bit of a performance
+				// drain, but may want to leave in since
+				// it would "fail fast" if someone was trying to modify the list.
+				return Collections.unmodifiableCollection(Arrays.asList(tempAdapters));
+				//return Arrays.asList(newAdapters);
+			}
+		}
+		else
+			return Collections.EMPTY_LIST;
+	}
+
+	public INodeAdapter getExistingAdapter(Object type) {
+		INodeAdapter result = null;
+		for (int i = 0; i < adapterCount; i++) {
+			INodeAdapter a = fAdapters[i];
+			if (a.isAdapterForType(type)) {
+				result = a;
+				break;
+			}
+		}
+		// if we didn't find one in our list,
+		// return the null result
+		return result;
+	}
+
+	abstract public IFactoryRegistry getFactoryRegistry();
+
+	public void notify(int eventType, Object changedFeature, Object oldValue, Object newValue, int pos) {
+
+		if (fAdapters != null) {
+			int localAdapterCount = 0;
+			INodeAdapter[] localAdapters = null;
+
+			// lock object while making local assignments
+			synchronized (this) {
+				localAdapterCount = adapterCount;
+				localAdapters = new INodeAdapter[localAdapterCount];
+				System.arraycopy(fAdapters, 0, localAdapters, 0, localAdapterCount);
+			}
+
+			for (int i = 0; i < localAdapterCount; i++) {
+				INodeAdapter a = localAdapters[i];
+
+				if (debugAdapterNotificationTime) {
+					long getAdapterTimeCriteria = getAdapterTimeCriteria();
+					long startTime = System.currentTimeMillis();
+					// ** keep this line identical with non-debug version!!
+					a.notifyChanged(this, eventType, changedFeature, oldValue, newValue, pos);
+					long notifyDuration = System.currentTimeMillis() - startTime;
+					if (getAdapterTimeCriteria >= 0 && notifyDuration > getAdapterTimeCriteria) {
+						System.out.println("adapter notifyDuration: " + notifyDuration + "  class: " + a.getClass()); //$NON-NLS-1$ //$NON-NLS-2$
+					}
+				}
+				else {
+					// ** keep this line identical with debug version!!
+					a.notifyChanged(this, eventType, changedFeature, oldValue, newValue, pos);
+				}
+
+			}
+		}
+	}
+
+	private long getAdapterTimeCriteria() {
+		// to "re-get" the property each time is a little awkward, but we 
+		// do it that way to avoid adding instance variable just for debugging. 
+		// This method should only be called if debugAdapterNotifcationTime 
+		// is true.
+		final String criteriaStr = Platform.getDebugOption("org.eclipse.wst.sse.core/dom/adapter/notification/time/criteria"); //$NON-NLS-1$
+		long criteria = -1;
+		if (criteriaStr != null) {
+			try {
+				criteria = Long.parseLong(criteriaStr);
+			}
+			catch (NumberFormatException e) {
+				// catch to be sure we don't burb in notification loop, 
+				// but ignore, since just a debug aid
+			}
+		}
+		return criteria;
+	}
+
+	public synchronized void removeAdapter(INodeAdapter a) {
+		if (fAdapters == null || a == null)
+			return;
+		int newIndex = 0;
+		INodeAdapter[] newAdapters = new INodeAdapter[fAdapters.length];
+		int oldAdapterCount = adapterCount;
+		boolean found = false;
+		for (int oldIndex = 0; oldIndex < oldAdapterCount; oldIndex++) {
+			INodeAdapter candidate = fAdapters[oldIndex];
+			if (a == candidate) {
+				adapterCount--;
+				found = true;
+			}
+			else
+				newAdapters[newIndex++] = fAdapters[oldIndex];
+		}
+		if (found)
+			fAdapters = newAdapters;
+	}
+
+	private void ensureCapacity(int needed) {
+		if (fAdapters == null) {
+			// first time
+			fAdapters = new INodeAdapter[needed + growthConstant];
+			return;
+		}
+		int oldLength = fAdapters.length;
+		if (oldLength < needed) {
+			INodeAdapter[] oldAdapters = fAdapters;
+			INodeAdapter[] newAdapters = new INodeAdapter[needed + growthConstant];
+			System.arraycopy(oldAdapters, 0, newAdapters, 0, adapterCount);
+			fAdapters = newAdapters;
+		}
+	}
+
+	/**
+	 * Returns the adapterCount. Equivilent to,  but faster than, getAdapters().size();
+	 * @return int
+	 */
+	public int getAdapterCount() {
+		return adapterCount;
+	}
+
+}
diff --git a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/AbstractStructuredModel.java b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/AbstractStructuredModel.java
new file mode 100644
index 0000000..8b94a97
--- /dev/null
+++ b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/AbstractStructuredModel.java
@@ -0,0 +1,1187 @@
+/*
+* Copyright (c) 2002 IBM Corporation and others.
+* All rights reserved.   This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+* 
+* Contributors:
+*   IBM - Initial API and implementation
+*   Jens Lukowski/Innoopract - initial renaming/restructuring
+* 
+*/
+package org.eclipse.wst.sse.core;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.UnsupportedEncodingException;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.wst.encoding.EncodingRule;
+import org.eclipse.wst.sse.core.events.IStructuredDocumentListener;
+import org.eclipse.wst.sse.core.events.NewModelEvent;
+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.StructuredDocumentRegionsReplacedEvent;
+import org.eclipse.wst.sse.core.exceptions.ResourceInUse;
+import org.eclipse.wst.sse.core.exceptions.SourceEditingRuntimeException;
+import org.eclipse.wst.sse.core.internal.nls.ResourceHandler1;
+import org.eclipse.wst.sse.core.modelhandler.IModelHandler;
+import org.eclipse.wst.sse.core.text.IStructuredDocument;
+import org.eclipse.wst.sse.core.undo.StructuredTextUndoManager;
+import org.eclipse.wst.sse.core.util.URIResolver;
+import org.eclipse.wst.sse.core.util.Utilities;
+
+
+public abstract class AbstractStructuredModel implements IStructuredModel {
+
+	/**
+	 * @deprecated - will likely be deprecated soon, in favor of direct 'adds'
+	 *             ... but takes some redesign.
+	 */
+	public void setFactoryRegistry(IFactoryRegistry factoryRegistry) {
+
+		this.factoryRegistry = factoryRegistry;
+	}
+
+	class DirtyStateWatcher implements IStructuredDocumentListener {
+
+		public void newModel(NewModelEvent structuredDocumentEvent) {
+
+			// I don't think its safe to assume a new model
+			// is always "fresh", so we'll leave dirty state
+			// unchanged;
+			// but we'll tell everyone about it.
+			setDirtyState(fDirtyState);
+		}
+
+		public void noChange(NoChangeEvent structuredDocumentEvent) {
+
+			// don't change dirty state
+		}
+
+		public void nodesReplaced(StructuredDocumentRegionsReplacedEvent structuredDocumentEvent) {
+
+			setDirtyState(true);
+			// no need to listen any more
+			if (fStructuredDocument != null) {
+				fStructuredDocument.removeModelChangedListener(fDirtyStateWatcher);
+			}
+		}
+
+		public void regionChanged(RegionChangedEvent structuredDocumentEvent) {
+
+			setDirtyState(true);
+			// no need to listen any more
+			if (fStructuredDocument != null) {
+				fStructuredDocument.removeModelChangedListener(fDirtyStateWatcher);
+			}
+		}
+
+		public void regionsReplaced(RegionsReplacedEvent structuredDocumentEvent) {
+
+			setDirtyState(true);
+			// no need to listen any more
+			if (fStructuredDocument != null) {
+				fStructuredDocument.removeModelChangedListener(fDirtyStateWatcher);
+			}
+		}
+	}
+
+	private LifecycleNotificationManager fLifecycleNotificationManager;
+	private Object[] fModelStateListeners;
+	private IStructuredDocument fStructuredDocument;
+	private String fId;
+	//	private String fLineDelimiter;
+	//	private Object fType;
+	private IModelHandler fModelHandler;
+	private String fBaseLocation;
+	private IModelManager fModelManager;
+	private StructuredTextUndoManager fUndoManager = null;
+	private IFactoryRegistry factoryRegistry;
+	private boolean fDirtyState;
+	private DirtyStateWatcher fDirtyStateWatcher;
+	private URIResolver fResolver;
+	private boolean fNewState = false;
+	private int modelStateChanging;
+	//	private final static String platformLineDelimiter =
+	// System.getProperty("line.separator"); //$NON-NLS-1$
+	/**
+	 * The time stamp of the underlying resource's modification date, at the
+	 * time this model was created, or the last time it was saved. Note: for
+	 * this version, this variable is not set automatically, be needs to be
+	 * managed by client. The FileModelProvider does this for most cases, but
+	 * if client do not use FileModelProvider, they must set this variable
+	 */
+	public long fSynchronizationStamp = IResource.NULL_STAMP;
+	private boolean reinitializationNeeded;
+	private Object reinitializeStateData;
+
+	/**
+	 * AbstractStructuredModel constructor comment.
+	 */
+	public AbstractStructuredModel() {
+
+		super();
+		fDirtyStateWatcher = new DirtyStateWatcher();
+	}
+
+	/**
+	 * This API allows clients to declare that they are about to make a "large"
+	 * change to the model. This change might be in terms of content or it
+	 * might be in terms of the model id or base location. Note that in the
+	 * case of embedded calls, notification to listners is sent only once. Note
+	 * that the client who is making these changes has the responsibility to
+	 * restore the models state once finished with the changes. See getMemento
+	 * and restoreState. The method isModelStateChanging can be used by a
+	 * client to determine if the model is already in a change sequence.
+	 */
+	public synchronized void aboutToChangeModel() {
+
+		// notice this is just a public avenue to our protected method
+		fireModelAboutToBeChanged();
+	}
+
+	public synchronized void aboutToReinitializeModel() {
+
+		// notice this is just a public avenue to our protected method
+		fireModelAboutToBeReinitialized();
+	}
+
+	public synchronized void modelReinitialized() {
+
+		// notice this is just a public avenue to our protected method
+		fireModelReinitialized();
+	}
+
+	public synchronized void addModelLifecycleListener(IModelLifecycleListener listener) {
+
+		if (fLifecycleNotificationManager == null) {
+			fLifecycleNotificationManager = new LifecycleNotificationManager();
+		}
+		fLifecycleNotificationManager.addListener(listener);
+	}
+
+	/**
+	 * to be called only be "friendly" classes, such as ModelManger, 
+	 * and subclasses. 
+	 */
+	protected void signalLifecycleEvent(ModelLifecycleEvent event) {
+
+		if (fLifecycleNotificationManager == null)
+			return;
+		fLifecycleNotificationManager.signalLifecycleEvent(event);
+	}
+
+	public void removeModelLifecycleListener(IModelLifecycleListener listener) {
+
+		// if manager is null, then none have been added, so
+		// no need to remove it.
+		if (fLifecycleNotificationManager == null)
+			return;
+		fLifecycleNotificationManager.removeListener(listener);
+	}
+
+	public synchronized void addModelStateListener(IModelStateListener listener) {
+
+		if (!Utilities.contains(fModelStateListeners, listener)) {
+			int oldSize = 0;
+			if (fModelStateListeners != null) {
+				// normally won't be null, but we need to be sure, for first
+				// time through
+				oldSize = fModelStateListeners.length;
+			}
+			int newSize = oldSize + 1;
+			Object[] newListeners = new Object[newSize];
+			if (fModelStateListeners != null) {
+				System.arraycopy(fModelStateListeners, 0, newListeners, 0, oldSize);
+			}
+			// add listener to last position
+			newListeners[newSize - 1] = listener;
+			//
+			// now switch new for old
+			fModelStateListeners = newListeners;
+			//
+			// SIDE EFFECT
+			// Tell listener just added, the current state
+			//listener.elementDirtyStateChanged(this, isDirty());
+		}
+	}
+
+	public void beginRecording(Object requester) {
+
+		beginRecording(requester, null, null);
+	}
+
+	public void beginRecording(Object requester, int cursorPosition, int selectionLength) {
+
+		beginRecording(requester, null, null, cursorPosition, selectionLength);
+	}
+
+	public void beginRecording(Object requester, String label) {
+
+		beginRecording(requester, label, null);
+	}
+
+	public void beginRecording(Object requester, String label, int cursorPosition, int selectionLength) {
+
+		beginRecording(requester, label, null, cursorPosition, selectionLength);
+	}
+
+	public void beginRecording(Object requester, String label, String description) {
+
+		if (fUndoManager != null)
+			fUndoManager.beginRecording(requester, label, description);
+	}
+
+	public void beginRecording(Object requester, String label, String description, int cursorPosition, int selectionLength) {
+
+		if (fUndoManager != null)
+			fUndoManager.beginRecording(requester, label, description, cursorPosition, selectionLength);
+	}
+
+	/**
+	 * This API allows a client controlled way of notifying all ModelEvent
+	 * listners that the model has been changed. This method is a matched pair
+	 * to aboutToChangeModel, and must be called after aboutToChangeModel ...
+	 * or some listeners could be left waiting indefinitely for the changed
+	 * event. So, its suggested that changedModel always be in a finally
+	 * clause. Likewise, a client should never call changedModel without
+	 * calling aboutToChangeModel first. In the case of embedded calls, the
+	 * notification is just sent once.
+	 */
+	public synchronized void changedModel() {
+
+		// notice this is just a public avenue to our protected method
+		fireModelChanged();
+		// also note!
+		// if we've been "changed" by a client, we might still need
+		// to be re-initialized, so we'll check and handle that here.
+		// Note only does this provide a solution to some "missed"
+		// re-inits, in provides a built in way for clients to
+		// "force" the model to handle itself, by bracketing any
+		// changes with aboutToChange and changed, the model itself
+		// will check. But only call re-init if all other pending
+		// modelChanged states have been handled.
+		if (modelStateChanging == 0 && isReinitializationNeeded()) {
+			reinit();
+		}
+	}
+
+	/**
+	 * Based on similar method in FileDocumentProvider. It will provide what
+	 * the modificationStamp would be if resetSynchronzationStamp(resource)
+	 * were used, although for this 'compute' API, no changes to the instance
+	 * are made.
+	 */
+	public synchronized long computeModificationStamp(IResource resource) {
+
+		long modificationStamp = resource.getModificationStamp();
+		IPath path = resource.getLocation();
+		if (path == null) {
+			return modificationStamp;
+		}
+		// Note: checking existence of file is a little different than impl in
+		// the FileDocumentProvider. See defect number 223790.
+		File file = path.toFile();
+		if (!file.exists()) {
+			return modificationStamp;
+		}
+		modificationStamp = file.lastModified();
+		return modificationStamp;
+	}
+
+	/**
+	 * Provides a copy of the model, but a new ID must be provided. The
+	 * principle of this copy is not to copy fields, etc., as is typically done
+	 * in a clone method, but to return a model with the same content in the
+	 * structuredDocument. Note: It is the callers responsibility to
+	 * setBaseLocation, listners, etc., as appropriate. Type and Encoding are
+	 * the only fields set by this method. If the newId provided already exist
+	 * in the model manager, a ResourceInUse exception is thrown.
+	 */
+	public synchronized IStructuredModel copy(String newId) throws ResourceInUse {
+
+		IStructuredModel newModel = null;
+		// this first one should fail, if not, its treated as an error
+		// If the caller wants to use an existing one, they can call
+		// getExisting
+		// after this failure
+		newModel = getModelManager().getExistingModelForEdit(newId);
+		if (newModel != null) {
+			// be sure to release the reference we got "by accident" (and no
+			// longer need)
+			newModel.releaseFromEdit();
+			throw new ResourceInUse();
+		}
+		newModel = getModelManager().copyModelForEdit(getId(), newId);
+		return newModel;
+	}
+
+	/**
+	 * Disable undo management.
+	 */
+	public void disableUndoManagement() {
+
+		if (fUndoManager != null)
+			fUndoManager.disableUndoManagement();
+	}
+
+	/**
+	 * Enable undo management.
+	 */
+	public void enableUndoManagement() {
+
+		if (fUndoManager != null)
+			fUndoManager.enableUndoManagement();
+	}
+
+	public void endRecording(Object requester) {
+
+		if (fUndoManager != null)
+			fUndoManager.endRecording(requester);
+	}
+
+	public void endRecording(Object requester, int cursorPosition, int selectionLength) {
+
+		if (fUndoManager != null)
+			fUndoManager.endRecording(requester, cursorPosition, selectionLength);
+	}
+
+	protected void fireModelAboutToBeReinitialized() {
+
+		// we must assign listeners to local variable, since the add and remove
+		// listner
+		// methods can change the actual instance of the listener array from
+		// another thread
+		if (fModelStateListeners != null) {
+			Object[] holdListeners = fModelStateListeners;
+			for (int i = 0; i < holdListeners.length; i++) {
+				// NOTE: trick for transition. We actual use the same listeners
+				// as modelState, but only send this to those that have
+				// implemented ModelStateExtended.
+				IModelStateListener listener = (IModelStateListener) holdListeners[i];
+				if (listener instanceof IModelStateListenerExtended) {
+					IModelStateListenerExtended extendedListner = (IModelStateListenerExtended) listener;
+					extendedListner.modelAboutToBeReinitialized(this);
+				}
+			}
+		}
+	}
+
+	protected void fireModelReinitialized() {
+
+		// we must assign listeners to local variable, since the add and remove
+		// listner
+		// methods can change the actual instance of the listener array from
+		// another thread
+		if (fModelStateListeners != null) {
+			Object[] holdListeners = fModelStateListeners;
+			for (int i = 0; i < holdListeners.length; i++) {
+				// NOTE: trick for transition. We actual use the same listeners
+				// as modelState, but only send this to those that have
+				// implemented ModelStateExtended.
+				IModelStateListener listener = (IModelStateListener) holdListeners[i];
+				if (listener instanceof IModelStateListenerExtended) {
+					IModelStateListenerExtended extendedListner = (IModelStateListenerExtended) listener;
+					extendedListner.modelReinitialized(this);
+				}
+			}
+		}
+	}
+
+	/**
+	 * Informs all registered model state listeners that the the model is about
+	 * to under go a "large" change. This change might be interms of contents,
+	 * in might be in terms of the model id or base location.
+	 */
+	protected void fireModelAboutToBeChanged() {
+
+		// notice we only fire this event if we are not already in a model
+		// state changing sequence
+		if (modelStateChanging == 0) {
+			// we must assign listeners to local variable, since the add and
+			// remove listner
+			// methods can change the actual instance of the listener array
+			// from another thread
+			if (fModelStateListeners != null) {
+				Object[] holdListeners = fModelStateListeners;
+				for (int i = 0; i < holdListeners.length; i++) {
+					((IModelStateListener) holdListeners[i]).modelAboutToBeChanged(this);
+				}
+			}
+		}
+		// we always increment counter, for every request (so must receive
+		// corresponding number of 'changedModel' requests)
+		modelStateChanging++;
+	}
+
+	/**
+	 * Informs all registered model state listeners that an impending change is
+	 * now complete. This method must only be called by 'modelChanged' since it
+	 * keeps track of counts.
+	 */
+	protected void fireModelChanged() {
+
+		// always decrement
+		modelStateChanging--;
+		// to be less than zero is a programming error, but we'll reset to zero
+		// with no error messages.
+		if (modelStateChanging < 0)
+			modelStateChanging = 0;
+		// We only fire this event if all pending requests are done.
+		// That is, if we've received the same number of fireModelChanged as we
+		// have fireModelAboutToBeChanged.
+		if (modelStateChanging == 0) {
+			// we must assign listeners to local variable, since the add and
+			// remove listner
+			// methods can change the actual instance of the listener array
+			// from another thread
+			if (fModelStateListeners != null) {
+				Object[] holdListeners = fModelStateListeners;
+				for (int i = 0; i < holdListeners.length; i++) {
+					((IModelStateListener) holdListeners[i]).modelChanged(this);
+				}
+			}
+		}
+	}
+
+	/**
+	 * Informs all registered model state listeners about a change in the dirty
+	 * state of the model. The dirty state is entirely about changes in the
+	 * content of the model (not, for example, about changes to id, or base
+	 * location -- see modelMoved).
+	 */
+	protected void fireModelDirtyStateChanged(IStructuredModel element, boolean isDirty) {
+
+		// we must assign listeners to local variable, since the add and remove
+		// listner
+		// methods can change the actual instance of the listener array from
+		// another thread
+		if (fModelStateListeners != null) {
+			Object[] holdListeners = fModelStateListeners;
+			for (int i = 0; i < holdListeners.length; i++) {
+				((IModelStateListener) holdListeners[i]).modelDirtyStateChanged(element, isDirty);
+			}
+		}
+	}
+
+	/**
+	 * Informs all registered model state listeners about the deletion of a
+	 * model's underlying resource.
+	 */
+	protected void fireModelResourceDeleted(IStructuredModel element) {
+
+		// we must assign listeners to local variable, since the add and remove
+		// listner
+		// methods can change the actual instance of the listener array from
+		// another thread
+		if (fModelStateListeners != null) {
+			Object[] holdListeners = fModelStateListeners;
+			for (int i = 0; i < holdListeners.length; i++) {
+				((IModelStateListener) holdListeners[i]).modelResourceDeleted(element);
+			}
+		}
+	}
+
+	/**
+	 * Informs all registered model state listeners that the resource
+	 * underlying a model has been moved. This is typically reflected in a
+	 * change to the id, baseLocation, or both.
+	 */
+	protected void fireModelResourceMoved(IStructuredModel originalElement, IStructuredModel movedElement) {
+
+		// we must assign listeners to local variable, since the add and remove
+		// listner
+		// methods can change the actual instance of the listener array from
+		// another thread
+		if (fModelStateListeners != null) {
+			Object[] holdListeners = fModelStateListeners;
+			for (int i = 0; i < holdListeners.length; i++) {
+				((IModelStateListener) holdListeners[i]).modelResourceMoved(originalElement, movedElement);
+			}
+		}
+	}
+
+	/**
+	 * @return java.lang.String
+	 */
+	public java.lang.String getBaseLocation() {
+
+		return fBaseLocation;
+	}
+
+	/**
+	 *  
+	 */
+	public IFactoryRegistry getFactoryRegistry() {
+
+		if (factoryRegistry == null) {
+			factoryRegistry = new FactoryRegistry();
+		}
+		return factoryRegistry;
+	}
+
+	public IStructuredDocument getStructuredDocument() {
+
+		return fStructuredDocument;
+	}
+
+	/**
+	 * The id is the id that the model manager uses to identify this model
+	 */
+	public String getId() {
+
+		return fId;
+	}
+
+	/**
+	 * This method returns a mememto that can later be used to restore the
+	 * state at this point. A model's state, in this sense, does not relate to
+	 * its content, or Ids, etc., just its dirty state, and its synchronization
+	 * state with its underlying resource. The 'resource' argument must be the
+	 * resource that underlies the instance of the model this method is sent
+	 * to. Note: this parameter will not be required in future versions of
+	 * 'strucutured model'.
+	 */
+	public IStateMemento getMemento(IResource resource) {
+
+		ModelStateMemento memento = new ModelStateMemento();
+		memento.setUnderlyingResource(resource);
+		memento.setDirtyState(isDirty());
+		long modDate = computeModificationStamp(resource);
+		memento.setDatesInSync(fSynchronizationStamp == modDate);
+		return memento;
+	}
+
+	/**
+	 * This method is just for getting an instance of the model manager of the
+	 * right Impl type, to be used "internally" for making protected calls
+	 * directly to the impl class.
+	 */
+	// TODO: those places we now use non-public methods can now be fixed.
+	private ModelManagerImpl _getModelManager() {
+
+		if (fModelManager == null) {
+			// get the model manager from the plugin
+			// note: we can use the static "ID" variable, since we pre-req that
+			// plugin
+			IModelManagerPlugin plugin = (IModelManagerPlugin) Platform.getPlugin(IModelManagerPlugin.ID);
+			fModelManager = plugin.getModelManager();
+		}
+		if (!(fModelManager instanceof ModelManagerImpl)) {
+			throw new IllegalStateException(ResourceHandler1.getString("unexpected_ModelManager_Impl_1")); //$NON-NLS-1$
+		}
+		return (ModelManagerImpl) fModelManager;
+	}
+
+	/**
+	 */
+	public IModelManager getModelManager() {
+
+		return _getModelManager();
+	}
+
+	public abstract IndexedRegion getIndexedRegion(int offset);
+
+	/**
+	 * This function returns the reference count of underlying model.
+	 */
+	// TODO: try to refine the design not to use this function
+	public synchronized int getReferenceCount() {
+
+		if (getModelManager() == null)
+			return 0;
+		return getModelManager().getReferenceCount(getId());
+	}
+
+	/**
+	 * This function returns the reference count of underlying model.
+	 */
+	// TODO: try to refine the design not to use this function
+	public synchronized int getReferenceCountForEdit() {
+
+		if (getModelManager() == null)
+			return 0;
+		return getModelManager().getReferenceCountForEdit(getId());
+	}
+
+	/**
+	 * This function returns the reference count of underlying model.
+	 */
+	// TODO: try to refine the design not to use this function
+	public synchronized int getReferenceCountForRead() {
+
+		if (getModelManager() == null)
+			return 0;
+		return getModelManager().getReferenceCountForRead(getId());
+	}
+
+	/**
+	 */
+	public URIResolver getResolver() {
+
+		return fResolver;
+	}
+
+	/**
+	 * Insert the method's description here. Creation date: (9/7/2001 2:30:26
+	 * PM)
+	 * 
+	 * @return long
+	 */
+	public long getSynchronizationStamp() {
+
+		return fSynchronizationStamp;
+	}
+
+	public StructuredTextUndoManager getUndoManager() {
+
+		return fUndoManager;
+	}
+
+	public boolean isDirty() {
+
+		return fDirtyState;
+	}
+
+	/**
+	 * This method can be called to determine if the model is within a
+	 * "aboutToChange" and "changed" sequence.
+	 */
+	public synchronized boolean isModelStateChanging() {
+
+		return modelStateChanging > 0;
+	}
+
+	public boolean isNew() {
+
+		return fNewState;
+	}
+
+	public synchronized boolean isSaveNeeded() {
+
+		if (!isSharedForEdit())
+			return isDirty();
+		else
+			return false;
+	}
+
+	/**
+	 * This function returns true if there are other references to the
+	 * underlying model.
+	 */
+	public synchronized boolean isShared() {
+
+		if (getModelManager() == null)
+			return false;
+		return getModelManager().isShared(getId());
+	}
+
+	/**
+	 * This function returns true if there are other references to the
+	 * underlying model.
+	 */
+	public synchronized boolean isSharedForEdit() {
+
+		if (getModelManager() == null)
+			return false;
+		return getModelManager().isSharedForEdit(getId());
+	}
+
+	/**
+	 * This function returns true if there are other references to the
+	 * underlying model.
+	 */
+	public synchronized boolean isSharedForRead() {
+
+		if (getModelManager() == null)
+			return false;
+		return getModelManager().isSharedForRead(getId());
+	}
+
+	/**
+	 * This function allows the model to free up any resources it might be
+	 * using. In particular, itself, as stored in the IModelManager.
+	 */
+	public synchronized void releaseFromEdit() {
+
+		if (getModelManager() == null) {
+			throw new SourceEditingRuntimeException("Warning: AbstractStructuredModel::close:  model manager was null during a close of a model (which should be impossible)"); //$NON-NLS-1$
+		}
+		else {
+			// be sure to check the shared state before releasing. (Since
+			// isShared assumes a count
+			// of 1 means not shared ... and we want our '1' to be that one.)
+			boolean isShared = isShared();
+			_getModelManager().releaseFromEdit(getId());
+			// if no one else is using us, free up
+			// an resources
+			if (!isShared) {
+				_commonRelease();
+			}
+		}
+	}
+
+	private void _commonRelease() {
+
+		if (factoryRegistry != null) {
+			factoryRegistry.release();
+		}
+		// if document as not been changed, we'll still be listening for
+		// first change. This is not a critical clean up, since presumanly
+		// whole model and document are "going away", but can make
+		// other memory leaks harder to find if we stay attached.
+		// (Note: my first thought was to set fStructuredDocument to null also,
+		// but there's others in shutdown process that still need to
+		// get it, in order to disconnect from it.)
+		if (fStructuredDocument != null) {
+			fStructuredDocument.removeModelChangedListener(fDirtyStateWatcher);
+		}
+	}
+
+	/**
+	 * This function allows the model to free up any resources it might be
+	 * using. In particular, itself, as stored in the IModelManager.
+	 */
+	public synchronized void releaseFromRead() {
+
+		if (getModelManager() == null) {
+			throw new SourceEditingRuntimeException("Warning: AbstractStructuredModel::close:  model manager was null during a close of a model (which should be impossible)"); //$NON-NLS-1$
+		}
+		else {
+			// be sure to check the shared state before releasing. (Since
+			// isShared assumes a count
+			// of 1 means not shared ... and we want our '1' to be that one.)
+			boolean isShared = isShared();
+			_getModelManager().releaseFromRead(getId());
+			// if no one else is using us, free up
+			// an resources
+			if (!isShared) {
+				// factoryRegistry.release();
+				_commonRelease();
+			}
+		}
+	}
+
+	/**
+	 * This function replenishes the model with the resource without saving any
+	 * possible changes. It is used when one editor may be closing, and
+	 * specifially says not to save the model, but another "display" of the
+	 * model still needs to hang on to some model, so needs a fresh copy.
+	 */
+	public synchronized IStructuredModel reload(InputStream inputStream) throws IOException {
+
+		IStructuredModel result = null;
+		try {
+			aboutToChangeModel();
+			result = _getModelManager().reloadModel(getId(), inputStream);
+		}
+		catch (UnsupportedEncodingException e) {
+			// its a very serious error to get an unsupported encoding
+			// exception,
+			// since we've presumable loaded it once already, so won't bother
+			// with a checked exception.
+			throw new SourceEditingRuntimeException(e);
+		}
+		finally {
+			changedModel();
+		}
+		return result;
+	}
+
+	public synchronized IStructuredModel reinit() {
+
+		IStructuredModel result = null;
+		if (modelStateChanging == 0) {
+			try {
+				aboutToChangeModel();
+				aboutToReinitializeModel();
+				result = _getModelManager().reinitialize(this);
+			}
+			finally {
+				setReinitializeNeeded(false);
+				setReinitializeStateData(null);
+				modelReinitialized();
+				changedModel();
+			}
+		}
+		else {
+			System.out.println("indeed!!!"); //$NON-NLS-1$
+		}
+		return result;
+	}
+
+	public synchronized void save(OutputStream outputStream) throws UnsupportedEncodingException, CoreException, IOException {
+
+		String stringId = getId();
+		_getModelManager().saveModel(stringId, outputStream, EncodingRule.CONTENT_BASED);
+	}
+
+	public synchronized void save() throws UnsupportedEncodingException, IOException, CoreException {
+
+		String stringId = getId();
+		_getModelManager().saveModel(stringId, EncodingRule.CONTENT_BASED);
+	}
+
+	public synchronized void save(EncodingRule encodingRule) throws UnsupportedEncodingException, IOException, CoreException {
+
+		String stringId = getId();
+		_getModelManager().saveModel(stringId, encodingRule);
+	}
+
+	public synchronized void save(IFile iFile) throws UnsupportedEncodingException, IOException, CoreException {
+
+		String stringId = getId();
+		_getModelManager().saveModel(iFile, stringId, EncodingRule.CONTENT_BASED);
+	}
+
+	public synchronized void save(IFile iFile, EncodingRule encodingRule) throws UnsupportedEncodingException, IOException, CoreException {
+
+		String stringId = getId();
+		_getModelManager().saveModel(iFile, stringId, encodingRule);
+	}
+
+	public synchronized void removeModelStateListener(IModelStateListener listener) {
+
+		if ((fModelStateListeners != null) && (listener != null)) {
+			// if its not in the listeners, we'll ignore the request
+			if (Utilities.contains(fModelStateListeners, listener)) {
+				int oldSize = fModelStateListeners.length;
+				int newSize = oldSize - 1;
+				Object[] newListeners = new Object[newSize];
+				int index = 0;
+				for (int i = 0; i < oldSize; i++) {
+					if (fModelStateListeners[i] == listener) { // ignore
+					}
+					else {
+						// copy old to new if its not the one we are removing
+						newListeners[index++] = fModelStateListeners[i];
+					}
+				}
+				// now that we have a new array, let's switch it for the old
+				// one
+				fModelStateListeners = newListeners;
+			}
+		}
+	}
+
+	/**
+	 * A method that modififies the model's synchonization stamp to match the
+	 * resource. Turns out there's several ways of doing it, so this ensures a
+	 * common algorithm.
+	 */
+	public synchronized void resetSynchronizationStamp(IResource resource) {
+
+		setSynchronizationStamp(computeModificationStamp(resource));
+	}
+
+	/**
+	 * This API allows a client to initiate notification to all interested
+	 * parties that a model's underlying resource has been deleted.
+	 */
+	public synchronized void resourceDeleted() {
+
+		// notice this is just a public avenue to our protected method
+		fireModelResourceDeleted(this);
+	}
+
+	/**
+	 * This method allows a model client to initiate notification to all
+	 * interested parties that a model's underlying resource location has
+	 * changed. Note: we assume caller has already changed baseLocation, Id,
+	 * etc., since its really up to the client to determine what's "new" about
+	 * a moved model. Caution: 'this' and '