90 likes | 183 Views
Using XML Tools. CS551 – Fall 2001. Tools available:. XML Notepad Jcreator IBM XML4J Xalan. XML Notepad:. Editor to create well-formed xml documents, xml schema, xsl stylesheets. Available: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnxml/html/xmlpaddownload.asp
E N D
Using XML Tools CS551 – Fall 2001
Tools available: • XML Notepad • Jcreator • IBM XML4J • Xalan
XML Notepad: • Editor to create well-formed xml documents, xml schema, xsl stylesheets. • Available:http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnxml/html/xmlpaddownload.asp • Can insert element, child element, attributes, comment, and text nodes. • Does not create DTDs or insert PI, CDATA (use regular notepad or Peter’s XML editor 1.1).
Open XML Notepad in your Start Bar. • Enter the information below: • Save as ‘simple.xml’ • Open ‘simple.xml’ in Internet Explorer.
Jcreator 1.5: • Fully-functional Java IDE. • Available:http://download.cnet.com/downloads/0-10085-100-2729088.html?tag=st.dl.10001-103-1.lst-7-1.2729088 • Set classpath to c:\jdk1.3.1: • Configure -> Options -> JDK Profiles -> select ‘JDK version 1.3.1’ -> Edit -> Home path (…) -> select path c:\jdk1.3.1 • To run/execute project with command-line arguments: • Project -> Project Settings -> JDK Tools -> Select tool type: Run Application -> select <Default> -> Edit -> Parameters -> set “Prompt for main function argument” checkbox to ‘True’.
IBM XML4J 3.2.1: • A validating XML parser written in 100% pure Java that contains classes and methods for parsing, generating, manipulating, and validating XML documents. • Available: http://www.alphaworks.ibm.com/tech/xml4j • Current version supports up to DOM level 2, SAX 2.0, xml schema recommendation, and JAXP 1.1. • Includes Xerces –Jv.1.4.1 .jar file. • To use the classes in XML4J, you must set your Java CLASSPATH variable so that Java can locate the xerces.jar and xercesSamples.jar files: • (in Jcreator) Configure -> Options -> JDK Profiles -> select JDK version -> Edit -> Add Package -> add c:/xml4j-j-bin.3.2.1/xerces.jar and c:/xml4j-j-bin.3.2.1/xercesSamples.jar
Running the ‘TreeViewer’ sample: • (in Jcreator) File -> New –> Empty Project -> Project name: “treeviewer” • In Workspace window (top left) -> select “treeviewer” project -> right click -> Add Files -> add the following files from c:\xml4j-j-bin.3.2.1\samples\ui\ (TreeView.java, TreeViewer.java, DOMTree.java, and DefaultImages.java). • Build-> Compile Project • Copy your file ‘simple.xml’ into your treeviewer project directory. • Build -> Execute Project -> Set Run Configuration -> Ok -> Set main function argument -> type “simple.xml” -> Ok • See more samples at c:\xml4j-j-bin.3.2.1\docs\html\samples.html
Apache Xalan 1.5: • Xalan is an XSLT processor for transforming XML documents into HTML, text, or other XML document types. • Available:http://xml.apache.org/xalan-j/index.html • Current version supports W3C XSLT 1.0 and Xpath 1.0 recommendations. • Includes Xerces –Jv.1.4.3 .jar file. • To set the classpath in Jcreator: • Configure -> Options -> JDK Profiles -> select JDK version -> Edit -> Delete -> c:\xml4j-j-bin.3.2.1\xerces.jar • Add -> c:\xalan-j_2_2_D10\bin\xalan.jar • Add -> c:\xalan-j_2_2_D10\bin\xerces.jar
Running a XSL transformation: • Download my sample xsl stylesheet from: http://www.cstp.umkc.edu/~qchong/simple.xsl • (in Jcreator) File -> New –> Empty Project -> Project name: “transform” • In Workspace window (top left) -> select “transform” project -> right click -> Add Files -> add c:\xalan-j-2_2_D10\samples\SimpleTransform\SimpleTranform.java • Build-> Compile Project • Copy your file ‘simple.xml’ and ‘simple.xsl’ into your transform project directory. • Build -> Execute Project -> Set Run Configuration -> Ok -> Set main function argument -> type “simple.xsl simple.xml simple.html” -> Ok • See more samples at c:\xalan-j-2_2_D10\samples\