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>

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.

Well.A courses xml file confirms this schema.It shouldnt be a problem I think.

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.

Thanks.I already did it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.