Jump to content

odinpeeg

Members
  • Content Count

    3
  • Joined

  • Last visited

Community Reputation

0 Neutral

About odinpeeg

  • Rank
    Newbie
  1. I get the following two errors, one recurs for each player element and one appears just the once.Validation 47, 37 cvc-complex-type.2.4.d: Invalid content was found starting with element 'tournamentposition'. No child element is expected at this point.Validation 51, 10 cvc-complex-type.2.4.d: Invalid content was found starting with element 'player'. No child element is expected at this point.Validation 65, 37 cvc-complex-type.2.4.d: Invalid content was found starting with element 'tournamentposition'. No child element is expected at this point.Validation 83, 37 cvc-complex-type.2.4.d: Invalid content was found starting with element 'tournamentposition'. No child element is expected at this point.(repeats same error. . . . Validation x,37)CheersTOm
  2. Hello all, I've been using the w3schools website to try and complete a piece of work which requires me to produce an XML file to store information and an XML Schema to validate it against. At the moment I'm having difficulty validating the part of it XML against the schema using this site:http://tools.decisionsoft.com/schemaValidate/ which will validate the schema and then the file against the schema.My XML file consists of (with more player elements):<dartsteam> <player> <firstname>Dan</firstname> <clubmoniker>Million Dollar Shot</clubmoniker> <lastname>Robins</lastname> <email>danrobins@hotmail.com</email><!--Speechamrks are not required around the quote--> <playerpic filename="images/lankydan.jpg"/> <walkintune> <artist>Kelis</artist> <track>Millionaire</track> </walkintune> <favouritequote quoteby="Fran Cotton">They used to say it was Loughborough arrogance but we prefer to call it a self beleif in our own skills and abilities.</favouritequote> <bringstoclub>As president I feel I bring security and stability to the club, plus with out me there would be no club as I founded it with Mr. Cummins</bringstoclub> <recentform> <tournamentposition placed="R1"/> <tournamentposition placed="QF"/> <tournamentposition placed="RU"/> </recentform> </player></dartsteam>The issue I am having is with the <recentform> tag as it is the parent of 3 empty elements. My schema is below and I do not know where I'm going wrong.<?xml version="1.0" encoding="ISO-8859-1" ?><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"><!--define the complextype for the player picture--><xs:complexType name="image"> <xs:attribute name="filename" type="xs:string"/></xs:complexType><!--defines the complex type used for the walk in tune--><xs:complexType name="trackinfo"> <xs:sequence> <xs:element name="artist" type="xs:string"/> <xs:element name="track" type="xs:string"/> </xs:sequence></xs:complexType><!--defines the complex type used for the favourite quote--><xs:complexType name="quote"> <xs:simpleContent> <xs:extension base="xs:string"> <xs:attribute name="quoteby" type="xs:string"/> </xs:extension> </xs:simpleContent></xs:complexType><!--defines the enumerations for the allowed tournament places--><xs:simpleType name="tournamentplaceenum"> <xs:restriction base="xs:string"> <xs:enumeration value="W"/> <!--winner--> <xs:enumeration value="RU"/> <!--runner up--> <xs:enumeration value="SF"/> <!--semi final--> <xs:enumeration value="QF"/> <!--Quarter final--> <xs:enumeration value="R1"/> <!--first round only--> </xs:restriction></xs:simpleType> <!--defines the type used to list the club tournament positiions--><!--(empty element so only specify attribute)--><xs:complexType name="tournamentplace"> <xs:attribute name="placed" type="tournamentplaceenum"/></xs:complexType><!--defines the list as a complex type--><xs:complexType name="tournamentplacelist"><xs:sequence><xs:element name="tournamentposition" type="tournamentplace"/></xs:sequence></xs:complexType><!--defines compelx type for the player record, which will reference the other complex types--><xs:complexType name="playerrecord"> <xs:sequence> <xs:element name="firstname" type="xs:string"/> <xs:element name="clubmoniker" type="xs:string"/> <xs:element name="lastname" type="xs:string"/> <xs:element name="email" type="xs:string" /> <xs:element name="playerpic" type="image" /> <!--references complex type--> <xs:element name="walkintune" type="trackinfo"/> <!--references complex type--> <xs:element name="favouritequote" type="quote"/> <!--reference complex type--> <xs:element name="bringstoclub" type="xs:string" /> <xs:element name="recentform" type="tournamentplacelist"/> <!--references complex type--> </xs:sequence></xs:complexType><!--define the type for the root element of the XML document--><xs:complexType name="dartsclub"> <xs:sequence> <xs:element name="player" type="playerrecord"/> <!--reference complex type--> </xs:sequence></xs:complexType><!--just one instance of the XML root document node--><xs:element name="dartsteam" type="dartsclub"/> <!--class complex type def of dart team--></xs:schema>How should I be setting the schema to stop the errors in validation? The schema for empty elements confuses me somewhat ..Thanks for any help anybodyTom
×
×
  • Create New...