Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

errormessages in xml with visual studio


  • Please log in to reply
No replies to this topic

#1 Timjan1

Timjan1

  • Members
  • 4 posts
  • OFFLINE
  •  
  • Local time:11:39 AM

Posted 18 December 2016 - 04:50 PM

Hello everyone,

 

I am writeting a xml schema for a xml instance but I keep get messages that something is wrong. But I dont what is wrong with my code. 

 

this is the instance:

<?xml version="1.0" encoding="utf-8" ?>
<avhbo:hbo5 xmlns:avhbo="http://www.test.be/hbo5">
  <opleiding naam="Landmeter"/>
  <opleiding naam="Boekhouden">
    <modules>
      <module code="A5" lestijden="60">Export</module>
    </modules>
  </opleiding>
  <opleiding naam="Informatica">
    <modules>
      <module code="A5" lestijden="120">Programmeren 1</module>
      <module code="A7" lestijden="40">IT Organisatie</module>
    </modules>
    <cursisten>
      <cursist naam="Piet Pienter"/>
      <cursist naam="Bert Bibber"/>
      <cursist naam="Theo Flitser"/>
    </cursisten>
    <inschrijvingen>
      <module code="A5">
        <periode academiejaar="2015-2016" semester="2">
          <cursist naam="Piet Pienter"/>
          <cursist naam="Bert Bibber"/>
        </periode>
      </module>
      <module code="A7">
        <periode academiejaar="2015-2016" semester="2">
          <cursist naam="Piet Pienter"/>
        </periode>
        <periode academiejaar="2016-2017" semester="1">
          <cursist naam="Bert Bibber"/>
          <cursist naam="Theo Flitser"/>
        </periode>
        <!--<periode academiejaar="2016-2017" semester="1"/>--><!--Contradictorisch met 16.--><!--There is a duplicate key sequence '2016-2017 1' key or unique identity constraint.-->
      </module>
      <!--<module code="A8"/>--><!--The key sequence 'A8' fails to refer to some key.-->
    </inschrijvingen>
  </opleiding>
</avhbo:hbo5>

this is my schema:


<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="opleiding">
    <xs:complexType mixed="true">
      <xs:sequence>
        <xs:element name="modules" maxOccurs="1">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="module"  minOccurs="0">
                <xs:complexType>
                  <xs:simpleContent>
                    <xs:extension base="xs:string">
                      <xs:attribute type="xs:string" name="opleiding"/>
                      <xs:attribute type="xs:byte" name="code"/>
                      <xs:attribute type="xs:integer" name="lestijden" use="optional"/>
                      <xs:attribute type="xs:integer" name="inschrijvingen" use="optional"/>
                    </xs:extension>
                  </xs:simpleContent>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <xs:element name="cursisten" minOccurs="0">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="cursist" maxOccurs="unbounded" minOccurs="0">
                <xs:complexType>
                  <xs:simpleContent>
                    <xs:extension base="xs:string">
                      <xs:attribute type="xs:string" name="naam"/>
                    </xs:extension>
                  </xs:simpleContent>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <xs:element name="inschrijvingen" minOccurs="0">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="periode" maxOccurs="unbounded" minOccurs="0">
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element name="cursist" maxOccurs="unbounded" minOccurs="0">
                            <xs:complexType>
                              <xs:simpleContent>
                                <xs:extension base="xs:string">
                                  <xs:attribute type="xs:string" name="naam" use="optional"/>
                                </xs:extension>
                              </xs:simpleContent>
                            </xs:complexType>
                          </xs:element>
                        </xs:sequence>
                        <xs:attribute type="xs:string" name="academiejaar" use="optional"/>
                        <xs:attribute type="xs:byte" name="semester" use="optional"/>
                      </xs:complexType>
                    </xs:element>
                    <unique name="codeopleiding">
                      <selector xpath="periode"/>
                      <field xpath="semester"/>
                      <field xpath="academiejaar"/>
                    </unique>
                  </xs:sequence>
                  <xs:attribute type="xs:string" name="code" use="optional"/>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
</xs:schema>

I got a message in visual studio by the line of <unique name="codeopleiding">

 

and this is what I wanne set to the schema:

 

00. Make a chart with the name http://www.test.be/hbo5 determined the data schema of XML instances that contain a list of modules, participants and registrations for various HBO5 training. See if the test.be.hbo5.xml file for an example of compliant XML instance.
 
01. A HBO5 root element contains 0 or more <opleiding> elements.
 
02. A <opleiding> element has a required name attribute that any string value can contain.
03. A <opleiding> element optionally contains a sequence of <modules>, <cursisten> and <inschrijvingen> elements.
04. The <modules> element can also occur if only one in this sequence.
 
05. A <modules> element can contain a list of 0 or more <module> elements.
06. <module> child element of <module> has a compulsory code attribute and an optional attribute class schedule. The value of this <module> element can be any string. The class schedule attribute must contain a positive integer.
07. A code attribute consists of a character A, B, C, a, b or c, followed by a number.
08. Each code attribute value must be unique per <opleiding>.
 
09. A <cursisten> element contains 0 or more <cursist> elements.
10. <cursist> element has never been a value, but always has a required name attribute.
11. The name attribute can be any string value.
 
12. <inschrijvingen> element contains 0 or more <module> elements.
13. A <module> child element of <inschrijvingen> has a required attribute code which is made in the same way (07).
14. The code attribute value of the <module> child elements of <inschrijvingen> must refer to an existing module code in this program.
15. <module> child element of <entries> has a list of 0 or more <period> elements.
16. <periode> element has a required academic attribute, which can contain any string value, and a semester attribute.
17. The semester attribute values ​​can only contain 1 or 2.
18. <periode> element can appear only once in a given academic year and semester enrollment value per module.
19. <periode> element may contain 0 or more <participant> elements.
20. <inschrijvingen> child element of <periode> is in just the same way composed of a <inschrijvingen> child element of <inschrijvingen> 
 
--------------------------------------------
 
Can someone give me the right block? Or tell me that everything is ok? I dont see whats wrong with this code. And I think I am right for every setting.
 
Friendly regards
 
Tim

Edited by Timjan1, 18 December 2016 - 04:51 PM.


BC AdBot (Login to Remove)

 





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users