Web Developer's Virtual Library: Encyclopedia of Web Design Tutorials, Articles and Discussions


WDVL Newsletter

Active Server Pages
JSP/Java Servlets
Microsoft SQL Server
Daily Backup
Dedicated Servers
Streaming Audio/Video
24-hour Support    

jobs.webdeveloper.com

Hiermenus


e-commerce
Partner With Us















Developer Channel
FlashKit.com
JavaScript.com
JavaScriptSource
Developer Jobs
ScriptSearch
StreamingMediaWorld
Web Developer's Journal
Web Developer's Virtual Library
WebDeveloper.com
Webreference
Web Hosts
XMLfiles.com

internet.com
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers


Editing it the Cheap Way: EditorMaker

July 19, 1999

Conceptually, EditorMaker from IBM's alphaWorks group is very similar to Xeena. Given an input DTD, it creates a custom XML editor. However, rather than creating the editor instance at runtime (like Xeena), EditorMaker uses a two pass process. First, it reads the DTD and generates a set of Java classes that implement the specific editor, and then it compiles the Java code and produces a .jar (Java Archive) file. In the second pass, you invoke java runtime with the new .jar in your path and the name of the previously generated specific editor class.

For example, to generate the Java classes for a DTD named ORDER.dtd (a sample provided by IBM), the following .bat file should do the trick. (Note that IBM's xml4j and BeanMaker are also required.)

set savedCLASSPATH=%CLASSPATH%
set XML4J=C:\XML\alphaWorks\xml4j-1-1-9\xml4j_1_1_9.jar
set MAKERS=..\beanmaker\beanmaker.jar;.\editormaker.jar
set CLASSPATH=%XML4J%;%MAKERS%;%CLASSPATH%
java EditorMaker ORDER.dtd
set CLASSPATH=%savedCLASSPATH%

This will create a sources directory (folder) containing the source code for the specific editor, an ORDER\editor directory containing the class files, and a jar directory containing ORDER.editor.jar.

XML EditorMaker
by IBM alphaWorks
XML EditorMaker takes a DTD as input and generates a visual XML document editor customized for the DTD. (This is very similar to what Xeena does.)
alphaWorks.ibm.com/tech/xmleditormaker Mac, Windows 95/NT/98 or Unix platforms. Requirements: JDK 1.1.6, IBM XML Parser for Java (1.1.4 or later), and IBM XML BeanMaker.
[none] No screenshot available; see text.

For the second pass, we need to add the new .jar to our CLASSPATH and point java at the Editor class that corresponds to the first element in the DTD.

set savedCLASSPATH=%CLASSPATH%
set XML4J=C:\XML\alphaWorks\xml4j-1-1-9\xml4j_1_1_9.jar
set MAKERS=..\beanmaker\beanmaker.jar;.\editormaker.jar
set OURS=.\jar\ORDER.editor.jar
set CLASSPATH=%XML4J%;%OURS%;%MAKERS%;%CLASSPATH%
java order.editor.OrderEditor
set CLASSPATH=%savedCLASSPATH%

Unfortunately, it appears that EditorMaker works only with JDK 1.1.6. I tried both JDK 1.1.7a and JDK 1.2.1 and was unable to successfully compile the code generated using the ORDER.dtd example. The error (below) concerned StringTokenizer which should be in java.util, a package not imported in the generated code. Your results may differ. Email me if you can get this example to work.

C:\XML\alphaWorks\editormaker>java EditorMaker ORDER.dtd
Compiling with: javac -d . sources\ORDER\editor\*.java
sources\ORDER\editor\OrderEditor.java:425: 
Class ORDER.editor.StringTokenizer not found.
EditorMaker: compilation generated warning or error
EditorMaker: ORDER.editor.jar successfully generated in 
editor directory

Here is ORDER.dtd:

<!ELEMENT Order (Customer,Manifest,Receipt)>
<!ELEMENT Customer EMPTY>
<!ATTLIST Customer ID CDATA #IMPLIED>
<!ELEMENT Manifest EMPTY>
<!ATTLIST Manifest MID  NMTOKENS #IMPLIED>
<!ELEMENT Receipt EMPTY>
<!ATTLIST Receipt RID CDATA #IMPLIED>

Editing it the Cheap Way: Xeena
Doing It With XML, Part 2
Adding a Touch of Style: CSS


Up to => Home / Authoring / Languages / XML / Tutorials / DoingIt




Jupiter Online Media: internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and Jupiter Online Media

Jupitermedia Corporate Info


Legal Notices, Licensing, & Permissions, Privacy Policy.

Web Hosting | Newsletters | Tech Jobs | Shopping | E-mail Offers