XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
Mans LarssonSubject: Newbie question?
Author: Mans Larsson
Date: 15 Dec 2005 04:20 AM
Hello,

I have a problem, that is probably not related to Stylus Studio, probably related to me and my lack of knowledge... But I was hoping to get some help anyway.

I have made a XML and a XSD file to go with it. Everything works fine except for one thing; I get; "file:///c:/dev/kdb.xml:63,106: Element 'product' is not valid for content model: '((title,isbn," and so on...

It seems to me that my XSD does not allow XML-blocks that are not "complete", ie. Not containing all the elements described in the XSD? If so, how can I overcome this issue?

Sorry to put this lame question here, but I have searched the net for answers without getting anywhere...

Here is some snippets from my XML and XSD (it's to large to post in full here);

My XML-file:

<?xml version="1.0" encoding="UTF-8"?>
<kdbmeta xmlns="http://www.sli.se" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sli.se kdb.xsd">
<products>
<product type="delete" originator-id="XX" originator-item-id="123456" />
<product type="complete" originator-id="XX" originator-item-id="12346">
<title>Some title...</title>
<isbn>132456789</isbn>

...lots of stuff here edited away...

</product>
</products>
</kdbmeta>

... and so on...

My XSD-file:

<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.sli.se" xmlns="http://www.sli.se" elementFormDefault="qualified">
<xs:element name="kdbmeta">
<xs:complexType>
<xs:sequence>
<xs:element name="products" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="product" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="title" type="titleType" minOccurs="1" maxOccurs="1"/>
<xs:element name="isbn" type="isbnType" minOccurs="0" maxOccurs="1"/>

...lots of stuff here edited away...

</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="type" type="type-typeEnum" use="required"/>
<xs:attribute name="originator-id" type="originator-idType" use="required"/>
<xs:attribute name="originator-item-id" type="originator-item-idType" use="required"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>

"Fingers crossed" someone here understand my issue and have the time help me out...

Postnext
Minollo I.Subject: Newbie question?
Author: Minollo I.
Date: 15 Dec 2005 08:55 AM
Mans,
from what I can see from the fragments you posted, your schema is saying that a "product" *must* have one and only one "title"; that's what minOccurs and maxOccurs mean in:
<xs:element name="title" type="titleType" minOccurs="1" maxOccurs="1"/>

But in your XML you have:
<product type="delete" originator-id="XX" originator-item-id="123456" />

...which is clearly wrong according to what the schema says.

If you want to allow "product"'s with no "title"'s then you'll need to change the "title" definition in the schema to be:
<xs:element name="title" type="titleType" minOccurs="0" maxOccurs="1"/>

Hope this helps,
Minollo

Posttop
Mans LarssonSubject: Newbie question?
Author: Mans Larsson
Date: 15 Dec 2005 10:59 AM
Thank you!!

Of course that's the problem, now then you mentioned it! It's easy to "be blind" when working with a problem to long...

Again, thank you for your help.

 
Topic Page 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.