XPath or Xquery for Courses.xml

Reply

Join Date: Nov 2008
Posts: 3
Reputation: bullockpasha is an unknown quantity at this point 
Solved Threads: 0
bullockpasha bullockpasha is offline Offline
Newbie Poster

XPath or Xquery for Courses.xml

 
0
  #1
Jan 16th, 2009
I created a courses.xml file and I want to find the answers for following queries.I am new to xml so I want to know how I can do it.I want to use Xpath or Xquery. Here is the queries i want to find:
1-How can I find find the TA of the network courses that listed in CS department,
taught in spring semester and do not have textbook, and return his/her last name
2-How can I find the CS courses in which a person named Jack served as AI, list the books used in these courses and semesters in which the books are used.

<?xml version="1.0" encoding="ISO‐8859‐1" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="firstname" type="xs:string"/>
<xs:element name="middlename" type="xs:string"/>
<xs:element name="lastname" type="xs:string"/>
<xs:element name="instructor">
<xs:complexType>
<xs:sequence>
<xs:element ref="firstname" minOccur = "0" />
<xs:element ref="middlename" minOccur = "0" maxOccur = "2"/>
<xs:element ref="lastname"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="TA">
<xs:complexType>
<xs:sequence>
<xs:element ref="firstname" minOccur = "0" />
<xs:element ref="middlename" minOccur = "0" maxOccur = "2"/>
<xs:element ref="lastname"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="course">
<xs:complexType>
<xs:sequence>
<xs:element name="listingDept" type="xs:string"/>
<xs:element name="courseid" type="xsositiveInteger"/>
<xs:element name="session" maxOccur = "10">
<xs:complexType>
<xs:sequence>
<xs:element ref="instructor"/>
<xs:element ref="TA" minOccur = "0" maxOccur = "2"/>
<xs:element name="book" maxOccur = "6"/>
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="title" type="xs:string"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="year" type="xs:string"/>
<xs:attribute name="semester" type="xs:string"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="title" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>
<xs:element name="Courses">
<xs:complexType>
<xs:sequence>
<xs:element ref="course"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 95
Reputation: fpmurphy is an unknown quantity at this point 
Solved Threads: 5
fpmurphy fpmurphy is offline Offline
Junior Poster in Training

Re: XPath or Xquery for Courses.xml

 
0
  #2
Jan 20th, 2009
What you provided us was an XML schema file. There is no way anybody can help you until you provide an example of your actual XML file containing some sample data.
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 3
Reputation: bullockpasha is an unknown quantity at this point 
Solved Threads: 0
bullockpasha bullockpasha is offline Offline
Newbie Poster

Re: XPath or Xquery for Courses.xml

 
0
  #3
Jan 20th, 2009
Well.A courses xml file confirms this schema.It shouldnt be a problem I think.
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 95
Reputation: fpmurphy is an unknown quantity at this point 
Solved Threads: 5
fpmurphy fpmurphy is offline Offline
Junior Poster in Training

Re: XPath or Xquery for Courses.xml

 
0
  #4
Jan 22nd, 2009
Sorry, but without seeing the instantiation of this schema i.e. an actual XML file, nobody is going to be able to help you with your query.
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 3
Reputation: bullockpasha is an unknown quantity at this point 
Solved Threads: 0
bullockpasha bullockpasha is offline Offline
Newbie Poster

Re: XPath or Xquery for Courses.xml

 
0
  #5
Jan 22nd, 2009
Thanks.I already did it.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the XML, XSLT and XPATH Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC