0
votes

I am having an issue with the XML that I am working with currently.

Error: Ln 152 Col 13 - cvc-complex-type.2.4.b: The content of element 'programs' is not complete. One of '{program}' is expected. 1 Errors (RESOLVED)

Error: cvc-elt.l: Cannot find the declaration of element 'xs:schema'.

I would want to know if anyone else has been through this error and found a fix of it, thanks.

EDIT: I had to edit the post because I am working with the same file, and it confused one of the members when I posted xml and xsd file. I think I should just post the file that I am having issues with, still learning SO, sorry.

XSD:

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

<xs:element name="CBC_programs">
    <xs:complexType>
        <xs:sequence>
            <xs:element name="programs" />
        </xs:sequence>
    </xs:complexType>
</xs:element>

<xs:element name="programs">
    <xs:complexType>
        <xs:sequence>
            <xs:element name="Business_Programs" />
            <xs:element name="Law_Programs_in_Ontario" />
            <xs:element name="Information_Technology_Programs" />
            <xs:element name="Engineering_Programs" />
            <xs:element name="Marketing_Programs" />
            <xs:element name="Health_Administration_Programs" />
            <xs:element name="Community_Service_and_Child_Care_Programs" />
        
        <xs:element ref="program" minOccurs="1" maxOccurs="unbounded" />

        </xs:sequence>
    </xs:complexType>
</xs:element>

<xs:element name="program">
    <xs:complexType>
        <xs:sequence>
            <xs:element name="name" />
            <xs:element name="length" />
            <xs:element name="tuition" />
            <xs:element name="description" />
        </xs:sequence>
        <xs:attribute name="program_id" type="xs:string"/>
    </xs:complexType>
</xs:element>

</xs:schema>
1
Do you wish to change your XSD to match your XML, or vice versa?kjhughes
no; I wanted to figure out what was causing the error but I found out that I was referencing programs instead of just declaring the it. This error has been resolved. The second error is cvc-elt.l: Cannot find the declaration of element 'xs:schema'. That I am still struggling to figure out.Nitewalkr
You can fix your error by changing your XML or by changing your XSD (or both, technically). Which do you wish to change?kjhughes
The XSD is the only one I am trying to work with only, (xsd needs to be changed.) I am updating my main topic to what error I have recently resolved, and what I am trying to fix.Nitewalkr
Possible duplicate of stackoverflow.com/questions/7348353/… -- what validator are you working with, in what environment?C. M. Sperberg-McQueen

1 Answers

0
votes

there are a few things with your schema:

  1. you are not defining a namespace for it
  2. in your complextype definitions you declare the elements but not their type (this is the error you are getting... it's not able to figure out what is the type for programs) e.g.
<xs:element name="description" type="xs:string"/>
  1. the use of sequence plus element ref in 'programs' looks a bit odd, are you sure this is what you want to achieve?

http://www.w3schools.com/xml/schema_intro.asp has a good tutorial on schemas, otherwise add a comment if you want me to expand the answer.