Index: /FCKdtd2js/trunk/_source/src/net/fckeditor/devutil/dtd/DTDJsGenerator.java
===================================================================
--- /FCKdtd2js/trunk/_source/src/net/fckeditor/devutil/dtd/DTDJsGenerator.java	(revision 316)
+++ /FCKdtd2js/trunk/_source/src/net/fckeditor/devutil/dtd/DTDJsGenerator.java	(revision 317)
@@ -25,7 +25,10 @@
 import java.io.IOException;
 import java.io.PrintStream;
-import java.util.Collection;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.text.ParseException;
 import java.util.Collections;
-import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
@@ -37,13 +40,4 @@
 import java.util.TreeSet;
 
-import com.wutka.dtd.DTD;
-import com.wutka.dtd.DTDContainer;
-import com.wutka.dtd.DTDElement;
-import com.wutka.dtd.DTDEmpty;
-import com.wutka.dtd.DTDItem;
-import com.wutka.dtd.DTDName;
-import com.wutka.dtd.DTDPCData;
-import com.wutka.dtd.DTDParser;
-
 /**
  * Takes a DTD file as input, and produces a compressed JS map from it.
@@ -62,9 +56,26 @@
 		if(args.length < 1) writeHelp(System.out);
 		
-		// Create a file object.
-		File dtdFile = new File(args[0]);
-		if(!dtdFile.exists()) {
-			System.err.println("Unable to locate DTD file ["+dtdFile.getPath()+"]");
-			return;
+		// Prepare holder for URI.
+		URI dtdUri = null;
+		
+		// First test for file
+		File dtdFile = new File(args[0].trim());
+		if(dtdFile.exists()) {
+			// Convert File to URI
+			dtdUri = dtdFile.getAbsoluteFile().toURI();
+		}
+		else {
+			// Try to parse as URI.
+			try {
+				dtdUri = new URI(args[0].trim());
+				if(!dtdUri.isAbsolute()) {
+					System.err.println("URI is not absolute : " + args[0].trim());
+					return;
+				}
+			}
+			catch(URISyntaxException e) {
+				System.err.println("Unable to parse : " + args[0].trim());
+				return;
+			}
 		}
 		
@@ -81,5 +92,5 @@
 		// Create application instance, and execute the parsing.
 		try {
-			DTDJsGenerator generator = new DTDJsGenerator(dtdFile, removeTags);
+			DTDJsGenerator generator = new DTDJsGenerator(dtdUri, removeTags);
 			generator.run();
 		}
@@ -102,5 +113,5 @@
 	//#####################################################################
 	
-	protected File 	_dtdFile;
+	protected URI 	_dtdUri;
 	protected Set  	_removeTags;
 	
@@ -111,7 +122,7 @@
 	 * @param removeTags The tags to use as root tags.
 	 */
-	public DTDJsGenerator(File dtdFile, Set removeTags) {
-		if(dtdFile == null || removeTags == null) throw new IllegalArgumentException("File parameter cannot be null.");
-		_dtdFile = dtdFile;
+	public DTDJsGenerator(URI dtdUri, Set removeTags) {
+		if(dtdUri == null || removeTags == null) throw new IllegalArgumentException("File parameter cannot be null.");
+		_dtdUri = dtdUri;
 		if(removeTags == null) removeTags = Collections.EMPTY_SET;
 		_removeTags = removeTags;
@@ -121,11 +132,8 @@
 	 * Runs the generator.
 	 */
-	public void run() throws IOException {
+	public void run() throws IOException, ParseException {
 		// Parse the DTD tree.
-		DTDParser parser = new DTDParser(_dtdFile);
-		DTD dtd = parser.parse();
-
-		// Create a group map.
-		Map<String,ElementGroup> groupMap = createElementGroupMap(dtd);
+		XmlDefinitionParser xmlDefParser = new WutkaDTDParser();
+		Map<String, ElementGroup> groupMap = xmlDefParser.parseXmlDefinition( _dtdUri );
 		
 		// Remove unwanted elements from the map.
@@ -144,5 +152,5 @@
 		
 		// Build Javascript from the DTD map.
-		String comment = "This file was automatically generated from the file: " + _dtdFile.getName();
+		String comment = "This file was automatically generated from : " + (new File(_dtdUri.getPath())).getName();
 		
 		ElementGroupMapJavascriptBuilder jsBuilder = new ElementGroupMapJavascriptBuilder();
@@ -300,80 +308,5 @@
 	}
 
-	/**
-	 * Creates a map over all elementgroups in the DTD.
-	 * @param dtd The DTD to create map from
-	 * @return The Map containing all elementgroups.
-	 */
-	protected Map<String,ElementGroup> createElementGroupMap(DTD dtd) {
-		// Create a common empty group...
-		ElementGroup<String> emptyGroup = new ElementGroup<String>();
-		
-		// Create map containing the element groups.
-		Map<String,ElementGroup> resultMap = new HashMap<String,ElementGroup>();
-		// Get elements from DTD.
-		Collection elements = dtd.elements.values();
-		
-		// Loop through elements and register them.		
-		for(Iterator it = elements.iterator(); it.hasNext(); ) {
-			DTDElement element = (DTDElement)it.next();
-			
-			// Check if element exists in nodemap.
-			if(element.content instanceof DTDContainer) {
-				
-				//System.out.println("Container: " + element.name );
-				
-				// Create an element group to contain sub elements.
-				ElementGroup<String> newGroup = new ElementGroup<String>();
-
-				// Call recursive method to get all nodes.
-				if(appendAllowedElementsRecursive((DTDContainer)element.content, newGroup)) {
-					// Add the group to the result map.
-					resultMap.put(element.name, newGroup);
-				}
-			}
-			else
-			if(element.content instanceof DTDEmpty){
-				//System.out.println("Empty    : " +element.name);
-				// Handle DTDEmpty
-				resultMap.put(element.name, emptyGroup);
-			}
-		}
-		
-		return resultMap;
-	}
-	
-	/**
-	 * We need a recursive method in order to resolve all elements in a collection.
-	 */
-	protected boolean appendAllowedElementsRecursive(DTDContainer col, ElementGroup<String> targetGroup) {
-		// Loop through allowed children.
-		DTDItem[] allowedChilds = col.getItems();
-		
-		boolean hasRealContent = false;
-		for(int i = 0; i < allowedChilds.length; i++) {
-			// System.out.println(" - Allowed childs ["+col+"] : " + allowedChilds[i].getClass() );
-			
-			if(allowedChilds[i] instanceof DTDName) {
-				targetGroup.add(((DTDName)allowedChilds[i]).value);
-				hasRealContent = true;
-			}
-			else 
-			if(allowedChilds[i] instanceof DTDContainer) {
-				boolean recResult = appendAllowedElementsRecursive((DTDContainer)allowedChilds[i], targetGroup);
-				hasRealContent = hasRealContent || recResult; 
-			}
-			else
-			if(allowedChilds[i] instanceof DTDPCData) {
-				targetGroup.add("#"); // Indicates that text is allowed.
-				hasRealContent = true;
-			}
-			else
-			if(allowedChilds[i] instanceof DTDEmpty) {
-				hasRealContent = true;
-			}
-		}
-		return hasRealContent;
-	}
-	
+
 	
 }
Index: /FCKdtd2js/trunk/_source/src/net/fckeditor/devutil/dtd/WutkaDTDParser.java
===================================================================
--- /FCKdtd2js/trunk/_source/src/net/fckeditor/devutil/dtd/WutkaDTDParser.java	(revision 317)
+++ /FCKdtd2js/trunk/_source/src/net/fckeditor/devutil/dtd/WutkaDTDParser.java	(revision 317)
@@ -0,0 +1,109 @@
+package net.fckeditor.devutil.dtd;
+
+import java.io.IOException;
+import java.net.URI;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import com.wutka.dtd.DTD;
+import com.wutka.dtd.DTDContainer;
+import com.wutka.dtd.DTDElement;
+import com.wutka.dtd.DTDEmpty;
+import com.wutka.dtd.DTDItem;
+import com.wutka.dtd.DTDName;
+import com.wutka.dtd.DTDPCData;
+import com.wutka.dtd.DTDParser;
+
+/**
+ * XML definition parser using the Wutka DTD parser library.
+ */
+public class WutkaDTDParser implements XmlDefinitionParser {
+
+	/**
+	 * {@inheritDoc}
+	 */
+	public Map<String, ElementGroup> parseXmlDefinition(URI uri) throws IOException {
+		// Parse the DTD tree.
+		DTDParser parser = new DTDParser(uri.toURL());
+		DTD dtd = parser.parse();
+		return createElementGroupMap(dtd);
+	}
+
+	/**
+	 * Creates a map over all elementgroups in the DTD.
+	 * @param dtd The DTD to create map from
+	 * @return The Map containing all elementgroups.
+	 */
+	protected Map<String,ElementGroup> createElementGroupMap(DTD dtd) {
+		// Create a common empty group...
+		ElementGroup<String> emptyGroup = new ElementGroup<String>();
+		
+		// Create map containing the element groups.
+		Map<String,ElementGroup> resultMap = new HashMap<String,ElementGroup>();
+		// Get elements from DTD.
+		Collection elements = dtd.elements.values();
+		
+		// Loop through elements and register them.		
+		for(Iterator it = elements.iterator(); it.hasNext(); ) {
+			DTDElement element = (DTDElement)it.next();
+			
+			// Check if element exists in nodemap.
+			if(element.content instanceof DTDContainer) {
+				
+				//System.out.println("Container: " + element.name );
+				
+				// Create an element group to contain sub elements.
+				ElementGroup<String> newGroup = new ElementGroup<String>();
+
+				// Call recursive method to get all nodes.
+				if(appendAllowedElementsRecursive((DTDContainer)element.content, newGroup)) {
+					// Add the group to the result map.
+					resultMap.put(element.name, newGroup);
+				}
+			}
+			else
+			if(element.content instanceof DTDEmpty){
+				//System.out.println("Empty    : " +element.name);
+				// Handle DTDEmpty
+				resultMap.put(element.name, emptyGroup);
+			}
+		}
+		
+		return resultMap;
+	}
+	
+	/**
+	 * We need a recursive method in order to resolve all elements in a collection.
+	 */
+	protected boolean appendAllowedElementsRecursive(DTDContainer col, ElementGroup<String> targetGroup) {
+		// Loop through allowed children.
+		DTDItem[] allowedChilds = col.getItems();
+		
+		boolean hasRealContent = false;
+		for(int i = 0; i < allowedChilds.length; i++) {
+			// System.out.println(" - Allowed childs ["+col+"] : " + allowedChilds[i].getClass() );
+			
+			if(allowedChilds[i] instanceof DTDName) {
+				targetGroup.add(((DTDName)allowedChilds[i]).value);
+				hasRealContent = true;
+			}
+			else 
+			if(allowedChilds[i] instanceof DTDContainer) {
+				boolean recResult = appendAllowedElementsRecursive((DTDContainer)allowedChilds[i], targetGroup);
+				hasRealContent = hasRealContent || recResult; 
+			}
+			else
+			if(allowedChilds[i] instanceof DTDPCData) {
+				targetGroup.add("#"); // Indicates that text is allowed.
+				hasRealContent = true;
+			}
+			else
+			if(allowedChilds[i] instanceof DTDEmpty) {
+				hasRealContent = true;
+			}
+		}
+		return hasRealContent;
+	}
+}
Index: /FCKdtd2js/trunk/_source/src/net/fckeditor/devutil/dtd/XmlDefinitionParser.java
===================================================================
--- /FCKdtd2js/trunk/_source/src/net/fckeditor/devutil/dtd/XmlDefinitionParser.java	(revision 317)
+++ /FCKdtd2js/trunk/_source/src/net/fckeditor/devutil/dtd/XmlDefinitionParser.java	(revision 317)
@@ -0,0 +1,24 @@
+package net.fckeditor.devutil.dtd;
+
+import java.io.IOException;
+import java.net.URI;
+import java.util.Map;
+
+
+/**
+ * Interface implemented by all classes providing means for parsing a XML
+ * definition file into a Map of ElementGroups. Examples of XML definition
+ * files are DTDs and XML Schemas (XSD). 
+ */
+public interface XmlDefinitionParser {
+
+	/**
+	 * Method used parse a Xml definition into a Map of ElementGroups. 
+	 * 
+	 * @param url The URL for the definition
+	 * @return Map of elementgroups representing the XML definition.
+	 * @throws IOException if DTD could not be parsed.
+	 */
+	public Map<String, ElementGroup> parseXmlDefinition(URI url) throws IOException;
+	
+}
