IBM's XML for Java is an Extensible Markup Language (XML) processor written in Java (alpha level). XML for Java provides two main functions:
unzip
or WinZip
executable..
xml4j_n_n_n.zip
into a directory.
C:\>unzip some_directory\xml4j_n_n_n.zip C:\>cd xml4j C:\xml4j>
You will see the following files in the xml4j
directory:
FAQ.html FAQ README.html this file license.html license information apiDocs\ directory for API documents docs\ directory for documents data\personal.dtd sample DTD file data\personal.xml sample XML document src\ directory for source code xml4j_n_n_n.jar contains parser class files xml4jSamples_n_n_n.jar
contains samples class files scripts\
directory for build scripts samples\ sample XML4J applications
C:\xml4j>type data\personal.xml C:\xml4J>jre -cp xml4j_n_n_n.jar;xml4jSamples_n_n_n.jar samples.XJParse.XJParse -d data\personal.xml
This fatal error is because of a bug in the JIT (symcjit.dll
) shipped with JDK 1.1.6. The fix is
to apply a patch which can be downloaded from the JavaSoft website: http://www.javasoft.com/products/jdk/1.1/download-jdk-windows.html
Installing the patch involves replacing symcjit.dll
with the new one.
.tar.gz
format. (If you have installed the unzip
command for UNIX, ZIP format is also Ok.)
# cd /usr/local # gzip -dc some_directory/xml4j.n.n.n.tar.gz | tar xvf - # cd xml4j
You will see the following files in the xml4j
directory:
FAQ.html FAQ README.html this file license.html license information api/ directory for API documents docs/ directory for documents data/personal.dtd sample DTD file data/personal.xml sample XML document src/ directory for source code xml4j_n_n_n.jar contains class files xml4jSamples_n_n_n.jar contains samples class files scripts/
directory for build scripts samples/ sample XML4J applications
# cat data/personal.xml # jre -cp "xml4j_n_n_n.jar:xml4jSamples_n_n_n.jar" samples.XJParse.XJParse -d data/personal.xml
Some sample applications provided are (all classes required to run these sample applications are in xml4jSamples_n_n_n.jar
.
Remember, 'jre' ignores the CLASSPATH environment variable and so you have to specify any non-standard .jar files
(like swing etc) explicitly using the -cp option)
:
XJParse is an XML syntax checker. To check an XML document, type:
jre -cp xml4j_n_n_n.jar;xml4jSamples_n_n_n.jar samples.XJParse.XJParse -d <xml-filename>
jre -cp xml4j_n_n_n.jar;xml4jSamples_n_n_n.jar samples.CdfEditor.CdfEditor
jre -cp xml4j_n_n_n.jar;xml4jSamples_n_n_n.jar samples.Miscellaneous.GeneratingSample e:\xml4j\data\personal.dtd
com.ibm.xml.parser.util.TreeFactory
. You need to install JFC
1.1 (Swing-1.0) to run this program.
jre -cp "xml4j_n_n_n.jar;xml4jSamples_n_n_n.jar;C:/swing-1.0.2/swingall.jar" samples.Miscellaneous.TreeView
data\personal.xml
com.ibm.xml.xpointer
package. You need to install JFC
1.1 (Swing-1.0) to run this program.
jre -cp "xml4j_n_n_n.jar;xml4jSamples_n_n_n.jar;C:/swing-1.0.2/swingall.jar" samples.Miscellaneous.XPointerDemo
data\personal.xml
On certain platforms, where 'jre' is not be available, you can run these samples using 'java'. For this you
can edit the CLASSPATH environment variable to include the parser (xml4j_n_n_n.jar
) and samples (xml4jSamples_n_n_n.jar
)
jar files.
This distribution archive includes a file named xml4j_n_n_n.jar
. Add this file to your CLASSPATH
environment variable, writing a command such as
set CLASSPATH=C:\xml4j\xml4j_n_n_n.jar;.
(for Windows)
(assuming that you have installed XML for Java in C:\xml4j.)
setenv CLASSPATH /usr/local/xml4j/xml4j_n_n_n.jar:.
(for UNIX, csh/tcsh)
export CLASSPATH="/usr/local/xml4j/xml4j_n_n_n.jar:."
(for UNIX, ksh/bash/zsh)
The following resources are provided for application development:
<?xml encoding="...."
'com.ibm.xml.parser.SAXDriver
provides the SAX interface.
com.ibm.xml.xpointer
package provides parsing XPointer expression, generating an XPointer
instance from a node in a document tree, searching for nodes pointed by an XPointer
instance.
XJParse
can now handle wild cards for filenames.DOCTYPE
line is specified.valid/sa/052.xml
.NOTATIONS
.StringPool#expandTable()
crashes.HTML DTD: TABLE
content model's error.
DTD
, a PE
substitution at the end of a CDATA
clause causes
the parser to fail.INCLUDE
section generates error.getInsertableElementsForValidContent()
.Parent
class thread-safe.
ToXMLStringVisitor()
prints entity declarations incorrectly.readDTDStream()
.
README.html
, limitation of MS JVM in lack of support for IANA encodings.SYSTEMID
.
TXElement#getNamespaceForQName()
and TXElement#getNamespaceForPrefix()
methods.Util.getInvalidURIChar()
to RFC2396.getDigest()
for EntityReference
doesn't work.newChild
parameter equals oldChild
parameter in Parent#replaceChild()
.<?foo?>
crashes the parser.
HTML40frameset.xml.dtd
and HTML40loose.xml.dtd
.printNonSpecifiedAttributes
flag to ToXMLPrintVisitor
.-stoponerror
' command line option to samples.XJParse.XJParse
.com.ibm.xml.parser.SAXDriver.parse()
is called a second time.!DOCTYPE
and one or more !ELEMENT
declarations.com.ibm.xml.parser.Parent.realInsert()
should not call isCheckOwnerDocument()
if it was
not created by a factory.getSpecified()
flag.ErrorListerner.error()
method's return type from void
to int
.]]>
' terminating conditional sections in DTD's are not recognized.TXDocument
.TXNodeList#replace()
doesn't set next/previousSibling
of removed Node
to
null
.HTMLPrintVisitor
should not print comments in interal DTD.
org.w3c.dom
package by java-binding.zip in PR-DOM.NodeList#getSize()
to NodeList#getLength()
NamedNodeMap#getSize()
to NamedNodeMap#getLength()
NodeType
symbols (Node.ELEMENT
to Node.ELEMENT_NODE
, etc.)
Node#getOwnerDocument()
DocumentFragment#getMasterDoc()
Notation#setSystemId()
Notation#setPublicId()
Entity#setSystemId()
Entity#setPublicId()
Exception
instead of IOException
in API (parser\FormatPrintVisitor.java ...).TXAttribute#toXMLString()
prints contents twice.TXCDATASection#getNodeType()
doesn't return Node.CDATA_SECTION
HTMLPrintVisitor
can't print empty content like "<BODY></BODY>".HTMLPrintVisitor
should not print entity references.ToXMLStringVisitor
prints replaced text instead of entity references in attribute values.resolveEntity()
handler that returns an InputSource
now works.TXAttribute
has only String value, no value as child nodes.XPointer#point()
doesn't work against a tree including EntityR.Node
instead of DocumentFragment
.Node#insertBefore()/replaceChild()/appendChild()
check types of children.Attribute#getParentNode()/getPreviousSibling()/getNextSibling()
always returns null.Element#getElementsByTagName()
returns all elements when the parameter is "*
".ElementFactory
interface because all factory functions are moved to the TXDocument
class.
toplevel/samples
directory.TXAttribute#toXMLString()
prints attribute value twice.DTD#makeContentElementList()
doesn't return null for EMPTY/ANY elements.TXElement#normalize()
isn't implemented.XPointer#point(TXDocument)
should be point(Document)
.
DTD#getInsertableElementsForValidContent()
doesn't return correct result.ContentModel#checkAfterTargetPosition()
is wrong.TXComment
is always printed as "<!--null-->".NullPointerException
in init2()
.TXPI("foo", "bar")
is printed as "<?foobar?>".TXDocument
aren't used.ToXMLStringVisitor
and FormatPrintVisitor
print an internal DTD subset twice, GeneralReference(&foo;)
and the reference's contents.Parent#insertAfter()
doesn't work correctly.Parser#readDTDStream()
aborts by NullPointerException
.
Parser#parseSingleContent()
for alias featurecom.ibm.xml.sample.Alias
and alias.dtd, alias-sample.xmlStderr#loadCatalog()
TXElement#addTextElement()
util.TreeFactory
for current DefaultElementFactory
util.XHFactory
to util.HTMLPrintVisitor
Util.backReference()
doesn't convert ' and
com.ibm.xml.sample.HTMLPrint
Format#printSpace()
to Util
, Format#indent()
to Util
DefaultElementFactory#sortStringVector()
to Util
FormatPrintVisitor
, and removed Format
Text#insert()
com.ibm.xml.xpointer.Version
com.ibm.xml.parser.Version
DTD#getInsertableElementsForValidContent()
Parser#setNamespace()
to TXDocument#setNamespaceParameters()
Parser#getNumberOfWarnings()
Parser#setEndBy1stError()
com.ibm.xml.xpointer.Pointed
XPointer#point()
XPointerSample
to XPointerDemo
XPointer#point()
com.ibm.xml.sample.XPointerSample
TXAttributeList#toArray()
to makeArray()
because of a conflict to java.util.Vector#toArray()
in JDK-1.2beta
TXElement#attributeElements()
Child#makeXPointer()
, XPointer#makeXPointer(Child)
TXElement#searchAncestors()
searchAncestors()
from TXElement
to Child
Namespace#getNSNs()/setNSNs()
to Namespace#getNSName()/setNSName()
Namesapce#getNSPrefixName()/setNSPrefixName()
Namespace#getUniversalName()
TXElement#TXElement(TXDocument,String prefix,String localpart)
ElementFactory#createText(char[],int,int,boolean) and modify the parser to use this method insted
of createText(String,boolean)
com.ibm.xml.sample
package
java.io.Serializable
interface to object model classes.
com.ibm.xml.sample.SerializeSave
and com.ibm.xml.sample.SerializeLoad
EntityValue
and Entity
DTD#getEntity()
Source#Source(InputStream,String)
and Source#getEncoding()
Parser#notifyNextEncoding()
TXElement#setUserData()
and getUserData()
Parser#setDebugPrintName()
Attlist#getAttDef(String)
Attlist#contains()
Attlist#addElement()
returns boolean
Entity
TXDocument#setRootName()
ContentModel
LibraryException
characters()
.
NodeList
s returned by getElementsByTagName()
aren't LIVE.
Microsoft's JVM does not support the same encodings as the Sun's JVM implementation. So if you use any of these encodings (like ISO-8859-2) in your document in a Windows environment with Microsoft's JVM, you will get a run time error. This is a limitation of Microsoft's JVM.
Current releases of JVM from SUN Microsystems (JDK 1.1.6) do not correctly support EBCDIC encodings. Does not translate the new line character correctly.
IBM's implemenation of Java 1.1.6 correctly tranlates EBCDIC characters to Unicode.
Technical questions and comments to alphaWorks communityXchange or xml4j@us.ibm.com.
Non-technical questions to xml4j@us.ibm.com.
[ IBM | alphaWorks | XML for Java | communityXchange - XML for Java]