Jump to content


  • Posts

  • Joined

  • Last visited

neigaard's Achievements


Newbie (1/7)



  1. Hm... I have no success. Here is my try: <?xml version="1.0" encoding="UTF-8"?><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:owl="http://www.w3.org/2002/07/owl#" elementFormDefault="qualified"><xs:element name="rdf:RDF"> <xs:complexType> <xs:sequence> <xs:element name="owl:Ontology" type="xs:string"> <xs:complexType> <xs:sequence> <xs:element name="rdfs:comment" type="xs:string"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="owl:Class" type="xs:string"> <xs:complexType> <xs:sequence> <xs:element name="owl:deprecated" type="xs:string"/> <xs:element name="rdfs:subClassOf" type="xs:string"/> <xs:element name="rdfs:label" type="xs:string"/> <xs:element name="rdfs:comment" type="xs:string"/> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType></xs:element></xs:schema> I use Apache Xerces to parse the XML, and here is what I get: org.xml.sax.SAXParseException: s4s-att-invalid-value: Invalid attribute value for 'name' in element 'element'. Recorded reason: cvc-datatype-valid.1.2.1: 'rdf:RDF' is not a valid value for 'NCName'. Any ideas?Thank youSøren
  2. HiI have some XML, that are a home made subset of OWL/RDF XML. I have some very specific rules, and I would like to make as much validation with XSD as possible. However I have failed even to make the simplest validation :)Here is a example of my XML: <?xml version="1.0" encoding="UTF-8"?><rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:owl="http://www.w3.org/2002/07/owl#"> <owl:Ontology rdf:about=""> <rdfs:comment>Must not be empty</rdfs:comment> </owl:Ontology> <owl:Class rdf:ID="XXX-id"> <rdfs:subClassOf rdf:resource="#YYY-id"></rdfs:subClassOf> <rdfs:label>Term X</rdfs:label> <rdfs:comment>Some comment X</rdfs:comment> </owl:Class> <owl:Class rdf:ID="YYY-id"> <rdfs:label>Term Y</rdfs:label> <rdfs:comment>Some comment Y</rdfs:comment> </owl:Class> <owl:Class rdf:ID="ZZZ-id"> <owl:deprecated/> <rdfs:subClassOf rdf:resource="#YYY-id"></rdfs:subClassOf> <rdfs:label>Term Z</rdfs:label> <rdfs:comment>Some comment Z</rdfs:comment> </owl:Class></rdf:RDF> Here are my rules: - The XML root element must be "rdf:RDF" - There must be one and only one "owl:Ontology" tag and it must contain one "rdfs:comment" tag and it must not be empty - There can be zero to many "owl:Class" tags - All "owl:Class" tags must contain a "rdfs:label" tag and it must not be empty - "owl:Class" tags can contain one "rdfs:subClassOf", "rdfs:comment" and "owl:deprecated" tags - There can be only one "owl:Class" that has no "rdfs:subClassOf" tag, which means only one root "owl:Class" - This does not apply to "owl:Class" tags containing a "<owl:deprecated/>" tag, as these "owl:Class" tags are not counted at valid - There must be no circular referencesI have read tutorials and what not, and I have tried several attempts, but I cant even get the basics to work. I do not know how to make a XSD that matches on the prefixes, so I cant even make it match a "rdf:RDF" tag??So any help will be greatly appriciated? Can I do all the validation I want with XSD, or do I have to some of it in code? How do I get started?Thank youSøren
  • Create New...