473,406 Members | 2,894 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Cannot create a valid instance from my schema

The schema below describes an interface to a form where the
appInterface type is an extension of an abstract type called interface
and it contains an appFrame element that is an extension of an empty
abstract complex type called frameInterface (the reason for that is so
that the system will recognise all frames by virtue of their being
derived from frameInterface type).

<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="urn:faster:defineApplication"
xmlns="urn:faster:defineApplication"
elementFormDefault="qualified">
<xsd:simpleType name="entityNameType">
<xsd:restriction base="xsd:NCName">
<!-- defines alphanumeric field that contains at least 1 alpha-->
<xsd:pattern value="\p{L}\w*"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:complexType name="interface" abstract="true">
<xsd:sequence>
<xsd:any namespace="##local" processContents="lax" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="appInterface">
<xsd:complexContent>
<xsd:extension base="interface">
<xsd:sequence>
<xsd:element ref="appFrame"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="frameInterface" abstract="true"/>
<xsd:complexType name="appFrame">
<xsd:complexContent>
<xsd:extension base="interface">
<xsd:sequence>
<xsd:element ref="name">
</xsd:element>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:element name="name" type="entityNameType"/>
<xsd:element name="appFrame" type="appFrame"/>
<xsd:element name="root" type="appInterface"/>
</xsd:schema>

I cannot understand why my instance keeps failing validation

<?xml version="1.0"?>
<root xmlns="urn:faster:defineApplication">
<labels name="Application" xmlns=""></labels>
<name>again</name>
</root>

I keep getting element content is invalid according to DTD/Schema

I am at my wits end with this so help will be gratefully appreciated
Jul 20 '05 #1
1 2166


wooks wrote:
The schema below describes an interface to a form where the
appInterface type is an extension of an abstract type called interface
and it contains an appFrame element that is an extension of an empty
abstract complex type called frameInterface (the reason for that is so
that the system will recognise all frames by virtue of their being
derived from frameInterface type).

<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="urn:faster:defineApplication"
xmlns="urn:faster:defineApplication"
elementFormDefault="qualified">
<xsd:simpleType name="entityNameType">
<xsd:restriction base="xsd:NCName">
<!-- defines alphanumeric field that contains at least 1 alpha-->
<xsd:pattern value="\p{L}\w*"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:complexType name="interface" abstract="true">
<xsd:sequence>
<xsd:any namespace="##local" processContents="lax" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="appInterface">
<xsd:complexContent>
<xsd:extension base="interface">
<xsd:sequence>
<xsd:element ref="appFrame"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="frameInterface" abstract="true"/>
<xsd:complexType name="appFrame">
<xsd:complexContent>
<xsd:extension base="interface">
<xsd:sequence>
<xsd:element ref="name">
</xsd:element>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:element name="name" type="entityNameType"/>
<xsd:element name="appFrame" type="appFrame"/>
<xsd:element name="root" type="appInterface"/>
</xsd:schema>

I cannot understand why my instance keeps failing validation

<?xml version="1.0"?>
<root xmlns="urn:faster:defineApplication">
<labels name="Application" xmlns=""></labels>
<name>again</name>
</root>

I keep getting element content is invalid according to DTD/Schema


The following is a valid instance:

<?xml version="1.0" encoding="UTF-8"?>
<root xmlns="urn:faster:defineApplication"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:faster:defineApplication test2004081201Xsd.xml">
<labels name="Application" xmlns=""></labels>
<appFrame>
<whatever xmlns="">Kibology</whatever>
<name>again</name>
</appFrame>
</root>

you need to have an <appFrame> element and have that contain a sequence
of any element and a <name> element.
--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Christopher Brandsdal | last post by:
Hi! I get an error when I run my code Is there any other way to get te information from my form? Heres the error I get and the code beneath. Line 120 is market with ''''''''''''Line...
8
by: baustin75 | last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie only when debugging in php designer 2005 -------------------------------------------------------------------------------- ...
9
by: Rob Mayo | last post by:
I have a bunch of XSD files in my assembly as embedded content that are read out via reflection and streams. My app creates the XML on the fly, and I want to validate it using the schema files...
2
by: Ian Emery | last post by:
Hi, I am trying to validate an XML file using the XmlValidatingReader and XmlUrlResolver. The code for which goes like this: // Read the XML file. XmlTextReader xmlReader = new XmlTextReader(...
2
by: PeterW | last post by:
I have an xml file from which I want to generate an xsd schema and at a later stage a cs class. The xml file has a mix of defined namespaces and also an empty namespace. These are defined as...
10
by: Henrik Dahl | last post by:
Hello! I have an xml schema which has a date typed attribute. I have used xsd.exe to create a class library for XmlSerializer. The result of XmlSerializer.Serialize(...) should be passed as the...
3
by: Lord0 | last post by:
I am trying to implement variable content containers using an abstract type and type substitution. My schema is as follows: <?xml version="1.0" encoding="UTF-8"?> <schema...
13
by: Bill Nguyen | last post by:
Is it possible to create your won XSD to use with .NET based on an XML content? For example the one below: <?xml version="1.0"?> <pcats:FuelsDoc...
3
by: Rahul B | last post by:
Hi, I have a user UCLDEV1 which is a part of staff and a group(db2schemagrp1) to which i have not given any permissions. The authorizations of that user are shown as db2 =get authorizations...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.