XSDML (Extensible Software Document Markup Language)

Sapid/XML uses the extended version of the XSDML derived from JX-model3.

DTD (Document Type Definition)

The DTD for the original version of XSDML is JX-model3.dtd and the extended version of XSDML, called XSDML level3, is JX-model3-ext.dtd.

Elements of XSDML

The original version of XSDML is generated after syntactic parsing and locally semantic analysis, which represents source code written in Java programming language (Java2 ver 1.4) as 20 non-terminal elements and 7 terminal elements as shown in the following table. The terminal element has only the textual while the non-terminal element can nest others.

Elements of XSDML
Element nameFragment of Java source code
File compilation unit (File)
Package package declaration
Import import declaration
Class class declaration
Intf interface declaration
Ctor constructor declaration
Method method declaration
SInit static initializer
Field field declaration
Param formal parameter
Local localvariable declaration
ExtdOpt superclass clause
ImplOpt superinterface clause
ThrwOpt throws clause
Members class/Interface body
QName qualified identifier
Type type
Stmt statement
Label label declaration
Expr expression
ident identifier
literal literal
comment comment
kw keyword
op operator
sp blank or tab character
nl new line character

The extended version of XSDMLis generated after globally semantic analysis. In addition to the elements described above, 3 elements are used. These elements have no textual content and never nest others.

Additional elements of XSDML level3
Element nameFragment of Java source code
Ances ancestor of the class
FqnMap fully qualified name map

Attributes of XSDML

The original version of XSDML has the following 24 attributes.

Attributes of XSDML
Attribute nameAttribute typeDescription
id ID identification number
path NMTOKEN relative path name of the file
name NMTOKEN file/class name
qname NMTOKEN fully qualified name
line NMTOKEN line number
offset NMTOKEN offset
newline NMTOKEN line feed code
sort NMTOKEN minor name classifying elements
typefirst IDREF link to the first Type element
typenext IDREF link to the next Type element that follows a Type element
omitted BOOL "yes" if two or more variable names are declared continuously with commas
access NMTOKEN accessibility determined as either "Public", "Protedted", "Private", or none
final BOOL "yes" if the code fragment is declared final
abstract BOOL "yes" if the code fragment is declared abstract
static BOOL "yes" if the code fragment is declared static
synchro BOOL "yes" if the code fragment is declared synchronized
native BOOL "yes" if the code fragment is declared native
volatile BOOL "yes" if the code fragment is declared volatile
transient BOOL "yes" if the code fragment is declared transient
strictfp BOOL "yes" if the code fragment is declared strictfp
read BOOL "yes" if the variable is used without changing its value
write BOOL "yes" if the variable is used with changing its value
defid IDREF links to the definition or declaration of the elemet
fqn NMTOKEN fully qualified name

The extended version of XSDML uses 4 attributes in addition to the attributes described above.

Additional attributes of XSDML level3
Attribute nameAttribute typeDescription
classpath NMTOKEN classpath used when analyzing the source code
ref NMTOKEN class name that the element refers to
distance NMTOKEN distance between the class and its ancestor or descendant
jar NMTOKEN name of the .jar file


NOTE: The red letters indicate the target code fragment. The code enclosed by green rectangles is the converted XSDML document.
NOTE: We insert moderate blanks and new lines in the converted document so that the readers easily see it although the actual code does not contain such characters.

1. File

This element indicates the .java file and can be a document root node of the DOM tree.

<File classpath="x" id="s792723457" path="x" sort="level3"> ... </File>

2. Package

package java2d;

<Package id="d0" qname="java2d"><kw>package</kw><sp> </sp> <QName id="s843055163"> <ident>java2d</ident> </QName><op>;</op> </Package>

3. Import

import java.awt.*;

<Import id="d6" qname="java.awt.*"><kw>import</kw><sp> </sp> <QName id="s843055197"> <ident>java</ident><op>.</op><ident>awt</ident><op>.</op><op>*</op></ident> </QName><op>;</op> </Import>

4. Class

package java2d;
public class Java2Demo {
...
}

<Class access="Public" fqn="java2d.Java2Demo" id="s796917761"> <kw>public</kw><sp> </sp><kw>class</kw><sp> </sp> <ident defid="s796917761">Java2Demo</ident> <sp> </sp> ... </Class>

5. Intf

package java2d;
public interface CustomControlsContext {
...
}

<Intf access="Public" fqn="java2d.CustomControlsContext" id="s801112065"> <kw>public</kw><sp> </sp><kw>interface</kw><sp> </sp> <ident defid="s801112065">CustomControlsContext</ident> <sp> </sp> ... </Intf>

6. Ctor

public class Java2Demo {
public Java2Demo() {
...
}

...
}

<Ctor access="Public" fqn="java2d.Java2Demo" id="s809500692"> <kw>public</kw><sp> </sp> <ident defid="s809500692">Java2Demo</ident> <op>(</op><op>)</op> ... </Ctor>

7. Method

public class Java2Demo {
public void actionPerformed(ActionEvent e) {
...
}

...
}

<Method access="Public" id="s809500685" typefirst="s813695063"> <kw>public</kw><sp> </sp> <Type fqn="void" id="s813695063" sort="Primitive"><kw>void</kw></Type><sp> </sp> <ident defid="s809500685">actionPerformed</ident> <op>(</op> ... </Method>

8. SInit

public class Java2Demo {
static {
...
}

...
}

<SInit id="s822083585"> <kw>static</kw><sp> </sp> ... </SInit>

9. Field

public class Java2Demo {
private JMenuItem ccthreadMI, verboseMI;
...
}

<Field access="Private" id="s805306460" typefirst="s813695141"> <kw>private</kw><sp> </sp> <Type fqn="javax.swing.JMenuItem" id="s813695141" sort="Object"> <ident>JMenuItem</ident> </Type><sp> </sp> <Expr id="s805306461" sort="VarRef"> <ident defid="s805306460">ccthreadMI</ident> </Expr> </Field> <op>,</op><sp> </sp> <Field access="Private" id="s805306459" omitted="yes" typefirst="s813695141"> <ident defid="s805306459">verboseMI</ident> </Field>

10. Param

public class Java2Demo {
public void actionPerformed(ActionEvent e) {
...
}
...
}

<Param id="s805306430" typefirst="s813695064"> <Type fqn="java.awt.event.ActionEvent" id="s813695064" sort="Object"> <ident>ActionEvent</ident> </Type><sp> </sp> <ident defid="s805306430">e</ident> </Param>

11. Local

public class Surface {
private BufferedImage createSGISurface(int w, int h, int pixelBits) {
int rMask32 = 0xFF000000;
...
}
...
}

<Local id="s805306435" typefirst="s813695069"> <Type fqn="int" id="s813695069" sort="Primitive"> <kw>int</kw> </Type><sp> </sp> <Expr id="s830472901" sort="VarRef" write="yes"> <ident defid="s805306435">rMask32</ident> </Expr> <sp> </sp><op>=</op><sp> </sp> <Expr id="s830472902" sort="Literal"> <literal id="s834666556" sort="INT">0xFF000000</literal> </Expr> </Local>

12. ExtdOpt

import javax.swing.*;
public class Java2Demo extends JPanel {
...
}

<ExtdOpt id="d7" typefirst="s813694977"> <Type fqn="javax.swing.JPanel" id="s813694977" sort="Object"> <ident>JPanel</ident> </Type> </ExtdOpt>

13. ImplOpt

import java.awt.event.*;
public class Java2Demo implements ActionListener {
...
}

<ImplOpt id="d8" typefirst="s813694978"> <Type fqn="java.awt.event.ActionListener" id="s813694978" sort="Object"> <ident>ActionListener</ident> </Type> </ImplOpt>

14. ThrwOpt

public class Surface {
public int print(Graphics g) throws PrinterException {
...
}
...
}

<ThrwOpt id="d9" typefirst="s813695009"> <Type fqn="java.awt.print.PrinterException" id="s813695009" sort="Object"> <ident>PrinterException</ident> </Type> </ThrwOpt>

15. Members

public class Java2Demo {
...
}

<Members><op>{</op> ... </Members>

16. QName

package java2d;

<QName id="s843055163"> <ident defid="s843055163">java2d</ident> </QName><op>

17. Type

public class Java2Demo {
static DemoGroup group[];
...
}

<Type fqn="java2d.DemoGroup" id="s813695155" sort="Object"> <ident>DemoGroup</ident> </Type><sp> </sp> <ident defid="s805306412">group</ident> <Type fqn="java2d.DemoGroup[]" id="s813695154" sort="Array" typenext="s813695155"> <op>[]</op> </Type>

Values of the sort attribute of the Type element
sort valueDescription
Array array type (pairs of square brackets [])
Primitive primitive type (including void)
Object reference type

18. Stmt

public class Java2Demo {
public void actionPerformed(ActionEvent e) {
if (cloningfeature == null) {
...
}

...
}
...
}

<Stmt id="s826278120" sort="IFELSE"> <kw>if</kw><sp> </sp><op>(</op> <Expr id="s830473257" sort="CondEQ"> <Expr id="s830473258" read="yes" sort="VarRef"> <ident defid="s805306434" fqn="java2d.CloningFeature" ref="java2d.Java2Demo">cloningfeature</ident> </Expr><sp> </sp><op>==</op><sp> </sp> <Expr id="s830473259" sort="Literal"> <literal sort="NULL">null</literal> </Expr> </Expr><op>)</op> ... </Stmt>

Values of the sort attribute of the Stmt element
sort valueDescription
EMPTY empty statement
EXPR expression statement
BLOCK block
DOWHILE do statement
WHILE while statement
FOR for statement
IFELSE if-then statement
SWITCH switch statement
BREAK break statement
CONT continue statement
RETURN return statement
SYNCHRO synchronized statement
THROW throw statement
TRY try statement
ASSERT assert statement

19. Label

public class Surface {
private BufferedImage createBinaryImage(int w, int h, int pixelBits) {
switch (pixelBits) {
case 1:
...
break;
}
...
}
...
}

<Label id="s851443719"> <kw>case</kw><sp> </sp> <Expr id="s830472964" sort="Literal"> <literal id="s834666560" sort="INT">1</literal> </Expr><op>:</op> </Label>

20. Expr

public class Java2Demo {
public void actionPerformed(ActionEvent e) {
if (e.getSource().equals(fileMI)) {
System.exit(0);
} ...
}
...
}

<Expr id="s830473240" sort="DOT"> <Type fqn="java.lang.System" id="s843055153" sort="Object"> <ident>System</ident> </Type><op>.</op> <Expr id="s830473242" sort="MethodCall"> <ident defid="c30" fqn="void" ref="java.lang.System">exit</ident> <op>(</op> <Expr id="s830473243" sort="Literal"> <literal id="s834666606" sort="INT">0</literal> </Expr><op>)</op> </Expr> </Expr>

Values of the sort attribute of the Expr element
sort valueDescription
MUL multiplication operator (*)
DIV division operator (/)
MOD remainder operator (%)
ADD addition operator (+)
SUB subtraction operator (-)
SHL left shift (<<)
SHR signed right shift(>>)
SHRZ unsigned right shift(>>>)
NOT bitwise complement operator (~)
AND bitwise or boolean operator (&)
XOR bitwise or boolean operator (^)
OR bitwise or boolean operator (|)
Assign assignment operator (=)
Assign$op compound assignment operator, the $op is either MUL, DIV, MOD, ADD, SUB, SHL, SHR, SHRZ, NOT, AND, XOR, or OR (*= /= %= += -= <<= >>= >>>= ~= &= ^= |=)
DOT dot operation (.)
InstanceOf type comparison operator (instanceof)
PreINC prefix increment operator (++)
PreDEC prefix decrement operator (--)
PostINC postfix increment operator (++)
PostDEC postfix decrement operator (--)
Plus unary plus operator (+)
Minus unary minus operator (-)
LogicalNOT logical complement operator (!)
LogicalAND conditional-and operator (&&)
LogicalXOR conditional-xor operator
LogicalOR conditional-or operator (||)
CondLT comparison operator (<)
CondGT comparison operator (>)
CondLE comparison operator (<=)
CondEQ equality operator (==)
CondNE equality operator (!=)
CondGE comparison operator (>=)
Selection conditional operator (? :)
CtorCall constructor call
SpCtorCall call to a superclass's constructor
MethodCall method call
Listed sequential values delimited with commas
ArrayAccess array access expression
InstanceCreation class instance creation expression
ArrayCreation array creation expression
Cast cast expression
Paren parenthesized expression
VarRef variable reference; the read and write attributes are added.
TypeRef type reference
Literal literal
This this operation
Class class literal
Empty empty expression


21. ident

public class Java2Demo {
...
}

<ident defid="s796917761">Java2Demo</ident>

22. literal

public class Java2Demo {
public Java2Demo() {
progressLabel.setText("Loading images");
...
}
...
}

<literal id="s834666651" sort="STR">"Loading images"</literal>

Values of the sort attribute of the literal element
sort valueDescription
INT integer literal
FLOAT floating-point literal
STR string literal
CHAR character literal
BOOL boolean literal
NULL null literal

23. comment

/*
* @(#)Java2Demo.java
*/

<comment id="s855638022">/* * @(#)Java2Demo.java */</comment>

24. kw

public class Java2Demo {
...
}

<kw>class</kw>

Keywords:
abstract boolean break byte case catch char class continue default do double else extends final finally float for if implements import instanceof int interface long native new package private protected public return short static strictfp super switch synchronized this throw throws transient try void volatile while

25. op

public class Java2Demo {
...
}

<op>{</op>

Operators and separators:
! != %| & && &= ( ) * *= + ++ += , - -- -= . / /= : ; < << <<= <= = == > >= >> >>= >>> >>>= ? [ ] ^ ^= { | |= || } ~

26. sp

<sp> </sp>

27. nl

<nl line="40" offset="1833"> </nl>


28. FqnMap

This element stores information about a fully-qualified name.

<FqnMap fqn="javax.swing.JMenuItem" jar="/usr/java/j2sdk1.4.2_01/jre/lib/rt.jar" path="javax/swing/JMenuItem.class"> </FqnMap>

29. Ances

This element stores information about an ancestor of the class.

<Ances distance="1" name="javax.swing.JPanel" sort="CLASS"></Ances>

Values of the sort attribute of the Ances element
sort valueDescription
CLASS the ancestor is a class
INTERFACE the ancestor is an interface


Copyright © 2003-2004 The Java-XML Tools Project. All rights reserved.
For problems or questions regarding this web, please contact www@jtool.org.
Last updated: