XML Validator and Quip - PowerPoint PPT Presentation

1 / 26
About This Presentation
Title:

XML Validator and Quip

Description:

XML Validator and Quip – PowerPoint PPT presentation

Number of Views:159
Avg rating:3.0/5.0
Slides: 27
Provided by: qin4
Category:
Tags: xml | book | crimson | quip | store | validator

less

Transcript and Presenter's Notes

Title: XML Validator and Quip


1
XML Validator and Quip
  • Chen Qing

2
XML Validator
  • Link
  • http//www.sun.com/software/xml/developers/multisc
    hema
  • Download it and then unzip it
  • Under the directory /msv-20020414, you can find
  • commandline.html, containing the command lines
    used to do the validation
  • msv.jar, which is used to do the validation
  • It can be use to validate XML either XSD or DTD

3
An Example
  • Suppose I have a XML file, named BookStore.xsd
    and a XSD file, named BookStore.xml
  • They are saved at the directory C/temp/

4
An Example
  • BookStore.xsd
  • lt?xml version"1.0"?gt
  • ltxsdschema xmlnsxsd"http//www.w3.org/2001/XMLS
    chema"gt
  • ltxsdelement name"BookStore"gt
  • ltxsdcomplexTypegt
  • ltxsdsequencegt
  • ltxsdelement ref"Book"
    minOccurs"1" maxOccurs"unbounded"/gt
  • lt/xsdsequencegt
  • lt/xsdcomplexTypegt
  • lt/xsdelementgt

5
An Example
  • BookStore.xml
  • lt?xml version"1.0"?gt
  • ltBookStore gt
  • ltBookgt
  • ltTitlegtMy Life and Timeslt/Titlegt
  • ltAuthorgtPaul McCartneylt/Authorgt
  • ltDategtJuly, 1998lt/Dategt
  • ltISBNgt94303-12021-43892lt/ISBNgt
  • ltPublishergtMcMillin
    Publishinglt/Publishergt
  • lt/Bookgt
  • lt/BookStoregt

6
An Example
  • Run java -jar msv.jar strict /temp/BookStore.xsd
    /temp/BookStore.xml

7
Quip for XQuery
  • Download Quip at http//www.softwareag.com/develop
    er/quip/
  • Unzip quip
  • Read the readme.txt
  • You may make necessary change at QuipGui.cmd
  • Run QuipGui.cmd

8
Quip for XQuery
  • Make necessary change at QuipGui.cmd
  • For example
  • The version of JDK on a PC is jdk1.3.1_03, and
    install at directory C\jdk1.3.1_03. Then, in the
    QuipGui.cmd the corresponding part should be
    changed into
  • _at_REM settings for jdk1.3.1_03_at_set
    JDKC\jdk1.3.1_03_at_set JREDIRJDK\jre\bin_at_set
    PATHJREDIRJREDIR\hotspot

9
Quip for XQuery
  • There is Quip installed in ECS lab!
  • Change QuipGui.cmd into
  • _at_echo Starting QuipGui
  • _at_REM Usage QuipGui
  • _at_setlocal
  • _at_set HOMEDIR.
  • _at_set BINDIRHOMEDIR
  • _at_set JAVABINDIRHOMEDIR
  • _at_set EXAMPLEDIRHOMEDIR\examples
  • _at_REM settings for jdk1.3.1_03
  • _at_set JDKC\jdk1.3.1_03
  • _at_set JREDIRJDK\jre\bin
  • _at_set PATHJREDIRJREDIR\hotspot
  • _at_java -classpath JAVABINDIR/quip.jarJAVABINDIR
    /crimson.jarJAVABINDIR/jaxp.jarJAVABINDIR/l
    og4j-core.jar -DquipcmdBINDIR/quip.exe
    -DhomedirEXAMPLEDIR -Dtargetfilesystem
    -DdatapathEXAMPLEDIR -Dservernamelocalhost
    -DdatabasenamemyDb com.softwareag.xtools.quip.gui
    .QuipFrame

10
Run Quip
11
Run Quip
12
XSU
  • XML-SQL Utility (XSU)
  • Menu
  • http//otn.oracle.com/docs/tech/xml/oracle_xsu/doc
    _library/adx04xsu.html1005680
  • There are some sample codes in Java which are
    very useful.

13
Install XSU
  • XSU JAR File
  • http//www.utdallas.edu/lkhan/Spring2002/XSU111_8
    16_ver2_1_0_beta.zip
  • XMLProject.jar
  • http//www.utdallas.edu/lkhan/Spring2002/XMLProje
    ct.jar

14
Install XSU
  • Unzip XSU111_816_ver2_1_0_beta.zip
  • Update the classpath so that your OS can
    recognize
  • XMLProject.jar
  • The path /OracleXSU111/lib/
  • This is the class library for XSU

15
Install XSU in Unix Account
  • Unzip XSU111_816_ver2_1_0_beta.zip to your Unix
    account.
  • For example, install it under directory /XML
  • Also copy XMLProject.jar to directory /XML
  • Update classpath
  • Which means, make necessary changes in your
    .bash_profile

16
Install XSU in Unix Account
  • You should add following lines in your
    .bash_profile

export CLASSPATHCLASSPATH/XML/OracleXSU111/lib
/xsu111.jar export CLASSPATHCLASSPATH/XML/
OracleXSU111/lib/sax2.jar export
CLASSPATHCLASSPATH/XML/OracleXSU111/lib/xmlpar
serv2.jar export CLASSPATHCLASSPATH/XML/XMLPro
ject.jar
17
Install JDBC Driver
  • Download http//www.utdallas.edu/lkhan/Spring2002
    /classes12.zip
  • Save it to Unix account, for instance save it
    under directory /project4
  • Update .bash_profile
  • Add one line
  • export CLASSPATHCLASSPATH/project4/classes12.z
    ip

18
Get connect to Oracle
private static Connection getConnection(String
user, String passwd) throws SQLException
DriverManager.registerDriver(new
oracle.jdbc.driver.OracleDriver())
Connection conn DriverManager.getConne
ction("jdbcoraclethin_at_delphi.utdallas.edu1521
last",user,passwd) return conn
  • The user name and password is your sqlplus
    user/password on delphi server

19
Build a Simple Web application
  • Install jsdk2.1 web server in your Unix account
  • Write a simple servlet
  • Deploy your servlet to web server
  • Start the web server
  • You can access your web application with browser

20
Install jsdk2.1 web server
  • Download jsdk2.1 from http//www.utdallas.edu/lkh
    an/Spring2002/jsdk2_1-solsparc.tar
  • Unzip the tar file using following command
  • tar -xvf jsdk2_1-solsparc.tar
  • Add these lines to .bash_profile to set CLASSPATH
  • Assuming jsdk2.1 folder is at Home Directory
    Level
  • export CLASSPATHCLASSPATH/jsdk2.1
  • export CLASSPATHCLASSPATH/jsdk2.1/servlet.jar

21
Start jsdk2.1 web server
  • Run ./startserver.sh under gtjsdk2.1 directory,
  • If You can not find startserver.sh and
    stopserver.sh in this directory, just
  • Rename startserver--gtstartserver.sh
  • Rename stopserver--gt stopserver.sh
  • Default port NO is 8080

22
A simple example for servlet
  • Basically, it is a piece of java code that
    post/get web info to/from web server
  • import java.io.
  • import java.text.
  • import java.util.
  • import javax.servlet.
  • import javax.servlet.http.
  • import java.sql.
  • public class HelloWorldExample extends
    HttpServlet

23
A simple example
  • public void doGet(HttpServletRequest request,
    HttpServletResponse response)
  • throws IOException, ServletException
  • response.setContentType("text/html")
  • PrintWriter out response.getWriter()
  • out.println("lthtmlgt")
  • out.println("ltbody bgcolor\"white\"gt")
  • out.println("ltheadgt")
  • String title "helloWorld!!"
  • out.println("lttitlegt" title "lt/titlegt")
  • out.println("lt/headgt")
  • out.println("ltbodygt")
  • out.println("lth1gt" title "lt/h1gt")
  • out.println("lt/bodygt")
  • out.println("lt/htmlgt")

24
Deploy the application
  • Jsdk2.1?webpages?WEB-INF?servlets
  • jsdk s docbase (application root) is pointing to
    webapps
  • docbase is defined in file default.cfg
  • HelloWorldExample should be store under servlets
    directory

25
Deploy the application
26
Deploy the application
Write a Comment
User Comments (0)
About PowerShow.com