Jump to content
Sign in to follow this  
VagosM

Xpath in xml file

Recommended Posts

i have write an xml file and his xsd i try to make sql querys by using the keys but i cant take a result.

XMLFILE

<?xml version="1.0" encoding="UTF-8" ?><Record xsi:noNamespaceSchemaLocation="C:UsersvagosDesktopdb.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">	<Conservatory ConservatoryID="C100">		<Name>...</Name>		<Address>			<Street>..</Street>			<Zip>...</Zip>		    <City>...</City>		</Address>	</Conservatory>		<Student StudentID="S100">		<ConservatoryID fkConservatoryID="C100"/>		<Name>...</Name> 		<Address>			<Street>.....</Street>			<Zip>....</Zip>		    <City>.....</City>		</Address>	</Student>		<Teacher TeacherID="T100">		<ConservatoryID fkConservatoryID="C100"/>		<Name>......</Name>		<Name_speciality>....</Name_speciality>	</Teacher>		<Instrument InstrumentID="I100">		<ConservatoryID fkConservatoryID="C100"/>		<TeacherID fkTeacherID="T100"/>		<StudentID fkStudentID="100"/>		<Name>.....</Name>		<InstrumentType>.....</InstrumentType>		</Instrument>		</Record>

The XSD file

<?xml version="1.0" encoding="UTF-8"?><!-- edited with XMLSpy v2009 (http://www.altova.com) by Aruna (Nil) --><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">				<xs:element name="Record" maxOccurs="unbounded">					<xs:complexType>						<xs:sequence>							<xs:element name="Conservatory" maxOccurs="unbounded">								<xs:complexType>									<xs:sequence>										<xs:element name="Name" type="xs:string"/>										<xs:element name="Address" type="AddressType"/>									</xs:sequence>									<xs:attribute name="ConservatoryID" type="xs:string" use="required"/>								</xs:complexType>							</xs:element>							<xs:element name="Student" maxOccurs="unbounded">								<xs:complexType>									<xs:sequence>										<xsd:complexType>                                          <xsd:attribute name="fkConservatoryID" type="xsd:string" use="required"/>                                       </xsd:complexType>										<xs:element name="Name" type="xs:string"/>										<xs:element name="Address" type="AddressType"/>									</xs:sequence>									<xs:attribute ref="StudentID" type="xs:string" use="required"/>								</xs:complexType>							</xs:element>							<xs:element name="Teacher" maxOccurs="unbounded">								<xs:complexType>									<xs:sequence>									    <xsd:complexType>                                          <xsd:attribute name="fkConservatoryID" type="xsd:string" use="required"/>                                        </xsd:complexType>										<xs:element name="Name" type="xs:string"/>										<xs:element name="Name_speciality" type="xs:string"/>									</xs:sequence>									<xs:attribute ref="TeacherID" type="xs:string" use="required"/>								</xs:complexType>							</xs:element>							<xs:element name="Instrument" maxOccurs="unbounded">								<xs:complexType>									<xs:sequence>										<xsd:complexType>                                          <xsd:attribute name="fkConservatoryID" type="xsd:string" use="required"/>										  <xsd:attribute name="fkTeacherID" type="xsd:string" use="required"/>										  <xsd:attribute name="fkStudentID" type="xsd:string" use="required"/>                                        </xsd:complexType>										<xs:element name="Name" type="xs:string"/>										<xs:element name="InstrumentType" type="xs:string"/>									</xs:sequence>									<xs:attribute ref="InstrumentID" type="xs:string" use="required"/>								</xs:complexType>							</xs:element>							<xs:element name="AddressType" maxOccurs="unbounded">								<xs:complexType>									<xs:sequence>										<xs:element name="Street" type="xs:string"/>										<xs:element name="Zip" type="xs:string"/>										<xs:element name="City" type="xs:string"/>									</xs:sequence>								</xs:complexType>							</xs:element>						</xs:sequence>					</xs:complexType>					<xs:key name="PKConservatory">						<xs:selector xpath="Conservatory"/>						<xs:field xpath="@ConservatoryID"/>					</xs:key>					<xs:key name="PKStudent">						<xs:selector xpath="Student"/>						<xs:field xpath="@StudentID"/>					</xs:key>					<xs:key name="PKTeacher">						<xs:selector xpath="Teacher"/>						<xs:field xpath="@TeacherID"/>					</xs:key>					<xs:key name="PKInstrument">						<xs:selector xpath="Instrument"/>						<xs:field xpath="@InstrumentID"/>					</xs:key>					<xs:keyref name="FKStudentToConservatory" refer="PKConservatory">						<xs:selector xpath="Student"/>						<xs:field xpath="@fkConservatoryID"/>					</xs:keyref>					<xs:keyref name="FKTeacherToConservatory" refer="PKConservatory">						<xs:selector xpath="Teacher"/>						<xs:field xpath="@fkConservatoryID"/>					</xs:keyref>					<xs:keyref name="FKInstrumentToConservatory" refer="PKConservatory">						<xs:selector xpath="Instrument"/>						<xs:field xpath="@fkConservatoryID"/>					</xs:keyref>					<xs:keyref name="FKInstrumentToTeacher" refer="PKTeacher">						<xs:selector xpath="Instrument"/>						<xs:field xpath="@fkTeacherID"/>					</xs:keyref>					<xs:keyref name="FKInstrumentToStudent" refer="PKStudent">						<xs:selector xpath="Instrument"/>						<xs:field xpath="@fkStudentID"/>					</xs:keyref>	             </xs:element></xs:schema>
Edited by VagosM

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...