validation error

Questions about XML that are not covered by the other forums should go here.
eHannes
Posts: 31
Joined: Sat Apr 16, 2005 11:29 am

validation error

Post by eHannes »

Hi,

Whene validating an xml instance i get the following error:

Code: Select all


Description: cvc-complex-type.2.4.a: Invalid content was found starting with element 'general'. One of '{general}' is expected.
What's the error??

Thanks, Hans
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Post by sorin_ristache »

Hello,

Please post small samples of the XML and XSD files for which you get that error.

Regards,
Sorin
eHannes
Posts: 31
Joined: Sat Apr 16, 2005 11:29 am

Post by eHannes »

Here's the XML.

btw when i parse the lom:lom element alone (not in the AOI-PMH container) it validates!
I guess it has to do with namespaces but i do not know exactly what.


Thanks, Hans

The exact error (oxygen gives me) is:

Code: Select all

SystemID: F:\Mijn documenten\projecten\triple-l\triple-l.xml
Location: 19:15
Description: cvc-complex-type.2.4.a: Invalid content was found starting with element 'general'. One of '{general}' is expected.
URL: http://www.w3.org/TR/xmlschema-1/#cvc-complex-type

Code: Select all


<?xml version="1.0" encoding="UTF-8"?>
<OAI-PMH xmlns="http://www.openarchives.org/OAI/2.0/"
xmlns:lom="http://library.wur.nl/WebQuery/ns/lom"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/ http://www.openarchives.org/OAI/2.0/OAI-PMH.xsd">
<responseDate>2006-08-03T13:12:08Z</responseDate>
<request verb="ListRecords" metadataPrefix="oai_lorenet"
>http://saraswati.ic.uva.nl/cgi/arno/oai/triple-l</request>
<ListRecords>
<record>
<header>
<identifier>oai:triple-l:209785</identifier>
<datestamp>2006-08-03</datestamp>
</header>
<metadata>
<lom:lom xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://library.wur.nl/WebQuery/ns/lom http://library.wur.nl/WebQuery/ns/lom.xsd"
isn="209785" cd="2006-08-03" cu="jscholt2" md="2006-08-03">
<general>
<title>
<langstring>
<value>gaga gaga</value>
<language>nl</language>
</langstring>
</title>
<catalogentry>
<catalog>nl.uva.uba.triple-l</catalog>
<entry>
<langstring>
<value>209785</value>
<language>x-none</language>
</langstring>
</entry>
</catalogentry>
<grouplanguage>nl</grouplanguage>
<description>
<langstring>
<value>gaga gaga foo bar [2006-08-03]</value>
<language>nl</language>
</langstring>
</description>
</general>
<metametadata>
<metadatascheme>LORENET</metadatascheme>
</metametadata>
<technical>
<format>video/quicktime</format>
<location>
<value>/http:// eeeeehhhh.nl</value>
<type>URI</type>
</location>
</technical>
<educational>
<learningresourcetype>
<source>
<langstring>
<value>TPPOVOv1.0</value>
<language>nl</language>
</langstring>
</source>
<value>
<langstring>
<value>foo bar</value>
<language>nl</language>
</langstring>
</value>
</learningresourcetype>
<context>
<source>
<langstring>
<value>TPPOVOv1.0</value>
<language>nl</language>
</langstring>
</source>
<value>
<langstring>
<value>WO</value>
<language>nl</language>
</langstring>
</value>
</context>
</educational>
<rights>
<cost>
<source>
<langstring>
<value>LOMv1.0</value>
<language>x-none</language>
</langstring>
</source>
<value>
<langstring>
<value>nee</value>
<language>nl</language>
</langstring>
</value>
</cost>
<copyrightandotherrestrictions>
<source>
<langstring>
<value>CCv2.5</value>
<language>x-none</language>
</langstring>
</source>
<value>
<langstring>
<value>http://creativecommons.org/licenses/by-nc-nd/2.5/nl/</value>
<language>nl</language>
</langstring>
</value>
</copyrightandotherrestrictions>
</rights>
<classification>
<purpose>
<source>
<langstring>
<value/>
<language>x-none</language>
</langstring>
</source>
<value>
<langstring>
<value/>
<language>x-none</language>
</langstring>
</value>
</purpose>
<taxonpath>
<taxon>
<id>08.41</id>
<entry>
<langstring>
<value>Filosofie - esthetica</value>
<language>nl</language>
</langstring>
</entry>
</taxon>
</taxonpath>
</classification>
</lom:lom>
</metadata>
</record>
</ListRecords>
</OAI-PMH>
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Post by sorin_ristache »

Hello,

The error message says that you need the general element from no namespace because that is how it is declared in the lom.xsd schema. In your XML document the default namespace is http://www.openarchives.org/OAI/2.0/ so you try to use the general element from the http://www.openarchives.org/OAI/2.0/ namespace. It worked when you placed the lom:lom element in other file because there you had the no namespace as default namespace. That means you have to specify that the subelements of lom:lom are in no namespace, for example by adding the xmlns="" to the lom:lom element:

Code: Select all

<lom:lom xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://library.wur.nl/WebQuery/ns/lom  http://library.wur.nl/WebQuery/ns/lom.xsd" isn="209785" cd="2006-08-03" cu="jscholt2" md="2006-08-03" xmlns="">
Regards,
Sorin
eHannes
Posts: 31
Joined: Sat Apr 16, 2005 11:29 am

Post by eHannes »

Hoi Sorin,

Thanks for your clear expanation!

Hans
Post Reply