$ more q1 let $d := doc("gb.xml") for $s in $d/gradebook/students/student return $s $ java net.sf.saxon.Query -q:q1 <?xml version="1.0" encoding="UTF-8"?> <student> <sid>1111</sid> <fname>Nandita</fname> <lname>Rajshekhar</lname> <minit>K</minit> </student><student> <sid>2222</sid> <fname>Sydney</fname> <lname>Corn</lname> <minit>A</minit> </student><student> <sid>3333</sid> <fname>Susan</fname> <lname>Williams</lname> <minit>B</minit> </student><student> <sid>4444</sid> <fname>Naveen</fname> <lname>Rajshekhar</lname> <minit>B</minit> </student><student> <sid>5555</sid> <fname>Elad</fname> <lname>Yam</lname> <minit>G</minit> </student><student> <sid>6666</sid> <fname>Lincoln</fname> <lname>Herring</lname> <minit>F</minit> </student><student> <sid>7777</sid> <fname>Stephanie</fname> <lname>Martin</lname> <minit>G</minit> </student>
$ java net.sf.saxon.Transform -s:sbooks.xml -xsl:p1.xsl -o:p1Out.xml $ more p1Out.xml <html> <body> <h2>Book Catalog</h2> </body> </html>
$ java XSDSample students.xml Parsing students.xml The input file <students.xml> parsed without errors $ java XSDSample students.xsd Parsing students.xsd The input file <students.xsd> parsed without errors $ java XSDSetSchema students.xsd students.xml Parsing students.xml The input file <students.xml> parsed without errors
You can also use Oracle's XQuery implementation which is available within SQL*Plus on the command line as follows (this assumes that you have the query in file q1.sql and the XML document stored in the Oracle database:
$ more p2/q1.sql set long 1024 -- -- Query 9.1 -- Get all students. -- xquery let $d := doc("/public/book/gb.xml") for $s in $d/gradebook/students/student return $s / $ sql raj SQL*Plus: Release 11.1.0.6.0 - Production on Sat Feb 7 20:23:53 2015 Copyright (c) 1982, 2007, Oracle. All rights reserved. Enter password: Connected to: Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL> @q1 Result Sequence -------------------------------------------------------------------------------- <student> <sid>1111</sid> <fname>Nandita</fname> <lname>Rajshekhar</lname> <minit>K</minit> </student> <student> <sid>2222</sid> <fname>Sydney</fname> <lname>Corn</lname> Result Sequence -------------------------------------------------------------------------------- <minit>A</minit> </student> <student> <sid>3333</sid> <fname>Susan</fname> <lname>Williams</lname> <minit>B</minit> </student> <student> Result Sequence -------------------------------------------------------------------------------- <sid>4444</sid> <fname>Naveen</fname> <lname>Rajshekhar</lname> <minit>B</minit> </student> <student> <sid>5555</sid> <fname>Elad</fname> <lname>Yam</lname> <minit>G</minit> Result Sequence -------------------------------------------------------------------------------- </student> <student> <sid>6666</sid> <fname>Lincoln</fname> <lname>Herring</lname> <minit>F</minit> </student> <student> <sid>7777</sid> Result Sequence -------------------------------------------------------------------------------- <fname>Stephanie</fname> <lname>Martin</lname> <minit>G</minit> </student> 7 item(s) selected. SQL> exit;
Page Maintained by raj@cs.gsu.edu