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
Thomas RichburgSubject: How Come Stylus Studio Fails To Validate This Derived Date According to xsi;type specification and not the base type?
Author: Thomas Richburg
Date: 06 Aug 2010 01:25 PM
The following XML file is validated by Microsoft Web Studio validation processor, but receives eight error messages in Stylus Studio (which appear to stem from failure to associate the correct derived type as specified by the xsi:type attribute).

XML File Content:

<?xml version="1.0"?>
<OOC:DerivedTypeTester xsi:type="OOC:ADerivedClassByExtensionOfBaseClassDerivedByExtensionType"
xmlns:OOC="http://www.IntelligentKnowledgeProcessingSolutions.com/OasisObjectClass" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.IntelligentKnowledgeProcessingSolutions.com/OasisObjectClass file:///c:/TJRWork/VisualStudio2008Projects/TheFinalFrontier/OasisApplicationDevelopementServices/OasisApplicationScriptMngr/DerivedTypeTestTypeDef.xsd"
typeID="1" typeName="ADerivedClassByRestrictionType" InstName="ADerivedClassByExtension" >
<AnElement >ThisIsATest</AnElement>
<AnotherElement>This Is A Test</AnotherElement>
</OOC:DerivedTypeTester>

The associated schema for this XML File:

<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.IntelligentKnowledgeProcessingSolutions.com/OasisObjectClass"
xmlns:OOC="http://www.IntelligentKnowledgeProcessingSolutions.com/OasisObjectClass" >
<xsd:annotation>
<xsd:documentation>
</xsd:documentation>
</xsd:annotation>
<!--xsd:element ref="DerivedTypeTester" /-->
<xsd:element name="DerivedTypeTester" type="OOC:ABaseClassType" />
<!--xsd:element name="DerivedTypeTester" type="OOC:DerivedTypeTesterType" /-->
<xsd:complexType name="DerivedTypeTesterType" >
<xsd:sequence>
<xsd:element ref="OOC:ABaseClass" />
</xsd:sequence>
</xsd:complexType>
<xsd:element name="ABaseClass" type="OOC:ABaseClassType" abstract="false"/>
<xsd:complexType name="ABaseClassType">
<xsd:sequence>
</xsd:sequence>
<xsd:attribute name="typeName" type="xsd:NCName" default="ABaseType"/>
</xsd:complexType>
<xsd:element name="ADerivedClassByRestriction" type="OOC:ADerivedClassByRestrictionType"/>
<xsd:complexType name="ADerivedClassByRestrictionType">
<xsd:complexContent>
<xsd:restriction base="OOC:ABaseClassType">
<xsd:sequence>
</xsd:sequence>
<xsd:attribute name="typeName" type="xsd:NCName" fixed="ADerivedClassByRestrictionType"/>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
<xsd:element name="ADerivedClassByExtension" type="OOC:ADerivedClassByExtensionType"/>
<xsd:complexType name="ADerivedClassByExtensionType">
<xsd:complexContent>
<xsd:extension base="OOC:ABaseClassType">
<xsd:sequence>
<xsd:element name="AnElement" type="xsd:NCName"/>
</xsd:sequence>
<xsd:attribute name="InstName" type="xsd:NCName" fixed="ADerivedClassByExtension" use="required" />
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:element name="ADerivedClassByExtensionOfBaseClassDerivedByRestriction" type="OOC:ADerivedClassByExtensionOfBaseClassDerivedByRestrictionType"/>
<xsd:complexType name="ADerivedClassByExtensionOfBaseClassDerivedByRestrictionType">
<xsd:complexContent>
<xsd:extension base="OOC:ADerivedClassByRestrictionType">
<xsd:sequence>
<xsd:element name="AnotherElement" type="xsd:string" />
</xsd:sequence>
<xsd:attribute name="typeID" type="xsd:integer" default="0" />
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:element name="ADerivedClassByExtensionOfBaseClassDerivedByExtension" type="OOC:ADerivedClassByExtensionOfBaseClassDerivedByExtensionType"/>
<xsd:complexType name="ADerivedClassByExtensionOfBaseClassDerivedByExtensionType">
<xsd:complexContent>
<xsd:extension base="OOC:ADerivedClassByExtensionType">
<xsd:sequence>
<xsd:element name="AnotherElement" type="xsd:string" />
</xsd:sequence>
<xsd:attribute name="typeID" type="xsd:integer" default="0" />
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
</xsd:schema>

Please help me to understand what is going n here. It does not matter if my base type is abstract or not. Why the disagreement with Microsoft validation? Also, even with the Microsoft validated XML document (above) why won't it take qualified names for all elements and attributes related to the derived type?

Sincerely,


Thomas J. Richburg

Postnext
Ivan PedruzziSubject: How Come Stylus Studio Fails To Validate This Derived Date According to xsi;type specification and not the base type?
Author: Ivan Pedruzzi
Date: 06 Aug 2010 01:43 PM

Hi Thomas,

Different schema processor may deliver different result depending on the spec. interpretation.

The default processor in Stylus Studio is Apache Xerces C++.

Have you tried with other processors available in Stylus Studio?
http://www.stylusstudio.com/open_xsd_validation.html

Which processor will be used in production?


Ivan Pedruzzi
Stylus Studio Team

Postnext
Thomas RichburgSubject: How Come Stylus Studio Fails To Validate This Derived Date According to xsi;type specification and not the base type?
Author: Thomas Richburg
Date: 06 Aug 2010 04:33 PM
Thanks for your rapid response. I followed your advice and checked the
validity of the document against each of your supported validators. They all reported no errors except your default validator Xerces, which still reports eight. I still don't understand the reasons for the error when reading the W3C Specifications. Can you explain these errors from an XML Schema Validation point of view?

Errors received:
Validating DerivedTypeTesterDoc.xml...
file:///c:/TJRWork/VisualStudio2008Projects/TheFinalFrontier/OasisApplicationDevelopementServices/OasisApplicationScriptMngr/DerivedTypeTesterDoc.xml:5,111: attribute 'typeID' is not declared for element 'DerivedTypeTester'
file:///c:/TJRWork/VisualStudio2008Projects/TheFinalFrontier/OasisApplicationDevelopementServices/OasisApplicationScriptMngr/DerivedTypeTesterDoc.xml:5,111: attribute 'InstName' is not declared for element 'DerivedTypeTester'
file:///c:/TJRWork/VisualStudio2008Projects/TheFinalFrontier/OasisApplicationDevelopementServices/OasisApplicationScriptMngr/DerivedTypeTesterDoc.xml:6,3: no character data is allowed by content model
file:///c:/TJRWork/VisualStudio2008Projects/TheFinalFrontier/OasisApplicationDevelopementServices/OasisApplicationScriptMngr/DerivedTypeTesterDoc.xml:6,15: no declaration found for element 'AnElement'
file:///c:/TJRWork/VisualStudio2008Projects/TheFinalFrontier/OasisApplicationDevelopementServices/OasisApplicationScriptMngr/DerivedTypeTesterDoc.xml:7,3: no character data is allowed by content model
file:///c:/TJRWork/VisualStudio2008Projects/TheFinalFrontier/OasisApplicationDevelopementServices/OasisApplicationScriptMngr/DerivedTypeTesterDoc.xml:7,19: no declaration found for element 'AnotherElement'
file:///c:/TJRWork/VisualStudio2008Projects/TheFinalFrontier/OasisApplicationDevelopementServices/OasisApplicationScriptMngr/DerivedTypeTesterDoc.xml:8,1: no character data is allowed by content model
file:///c:/TJRWork/VisualStudio2008Projects/TheFinalFrontier/OasisApplicationDevelopementServices/OasisApplicationScriptMngr/DerivedTypeTesterDoc.xml:8,25: element 'AnElement' is not allowed for content model 'EMPTY'

The XML document DerivedTypeTesterDoc.xml is NOT valid (8 errors)

xsi:type support for specifying which derived type in the hiearchy of derived types is required when specifying the base type in the XML document. Part two of my post ask why the discrepancy. This happens to be a very important Schema feature that we use quite a bit. Is there a problem with Stylus Studio's internal Validator?

Sincerely,



Thomas J. Richburg

Postnext
Ivan PedruzziSubject: How Come Stylus Studio Fails To Validate This Derived Date According to xsi;type specification and not the base type?
Author: Ivan Pedruzzi
Date: 09 Aug 2010 02:25 PM

Hi Tom,

Sorry if it took a bit to answer the question.

Due to Xerces C++ limitation, the xsi:type attribute has to be after xsi:schemaLocation.

If you change the XML instance as follow it should validate fine.


<OOC:DerivedTypeTester
xsi:schemaLocation="http://www.IntelligentKnowledgeProcessingSolutions.com/OasisObjectClass DerivedTypeTestTypeDef.xsd"
xsi:type="OOC:ADerivedClassByExtensionOfBaseClassDerivedByExtensionType"
xmlns:OOC="http://www.IntelligentKnowledgeProcessingSolutions.com/OasisObjectClass"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
typeID="1"
typeName="ADerivedClassByRestrictionType"
InstName="ADerivedClassByExtension">

<AnElement>ThisIsATest</AnElement>
<AnotherElement>This Is A Test</AnotherElement>
</OOC:DerivedTypeTester>


Hope this helps
Ivan Pedruzzi
Stylus Studio Team
http://www.stylusstudio.com/xml_download.html

Postnext
Thomas RichburgSubject: How Come Stylus Studio Fails To Validate This Derived Date According to xsi;type specification and not the base type?
Author: Thomas Richburg
Date: 09 Aug 2010 03:38 PM
Hello Ian,

I tried your suggestion and Xerces did validate. This ordering restriction appears to be unique to Xerces. Perhaps you should alert other users to this fact.

Thanks muchly for resolving this issue with such a simple remedy. Non-validating errors like this one can render a sane person insane if one is not careful! Thanks again for your assistance.


Thomas Richburg

Posttop
Thomas RichburgSubject: How Come Stylus Studio Fails To Validate This Derived Date According to xsi;type specification and not the base type?
Author: Thomas Richburg
Date: 09 Aug 2010 03:41 PM
Hello Ivan,

Sorry for the mis-print of your name. By the way I prefer Thomas to Tom. I am often called by the Hebrew version of my name which is Toma.

Later!

 
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.