Hi all,
I've got the following validation problem. There are 2 schemas and a
document:
-----------------------------------------------------------------
bar.xsd
======
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns:bar="urn: bar" targetNamespace ="urn:bar"
xmlns="http://www.w3.org/2001/XMLSchema" elementFormDefa ult="qualified"
attributeFormDe fault="unqualif ied">
<element name="test">
<complexType>
<sequence>
<element name="qwe"/>
<element ref="bar:asd"/>
</sequence>
</complexType>
</element>
<element name="asd" abstract="true"/>
</schema>
foo.xsd
=====
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns:bar="urn: bar" xmlns:foo="urn: foo"
xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace ="urn:foo"
elementFormDefa ult="qualified" attributeFormDe fault="unqualif ied">
<import namespace="urn: bar" schemaLocation= "bar.xsd"/>
<element name="foo_asd" substitutionGro up="bar:asd"/>
</schema>
test.xml
======
<?xml version="1.0" encoding="UTF-8"?>
<test xmlns="urn:bar" xmlns:foo="urn: foo"
xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocat ion="urn:foo foo.xsd urn:bar bar.xsd">
<qwe/>
<foo:foo_asd/>
</test>
-----------------------------------------------------------------
The idea is that bar:asd is declared as abstract, and is substituted with
foo:foo_asd. All this validates perfectly in XML Spy and in any version of
MSXML, but the .NET parser comlains in the following way : The element
'urn:bar:test' has invalid child element 'urn:foo:foo_as d'. Expected
'urn:bar:asd'. An error occurred at , (5, 3).
It is obvious that we can't really have bar:asd, because it is abstract.
Does anybody have a clue what might be missing?
Thanks a lot in advance for any help!
Michael 3 1779
I would try just referring to the foo schema in your xsi:schemaLocat ion
attribute, as in xsi:schemaLocat ion="urn:foo foo.xsd". Since foo.xsd
imports bar.xsd, I think this should work. Different processors handle
schemaLocation attributes differently; the XML Schema spec is flexible on
this topic.
Hope that helps,
Priscilla
------------------------------------------------------------------
Priscilla Walmsley
Author, Definitive XML Schema / XML in Office 2003 http://www.datypic.com
------------------------------------------------------------------
"Michael Skulsky" <sy****@nm.ru > wrote in message
news:uH******** ******@TK2MSFTN GP14.phx.gbl... Hi all,
I've got the following validation problem. There are 2 schemas and a document:
----------------------------------------------------------------- bar.xsd ====== <?xml version="1.0" encoding="UTF-8"?> <schema xmlns:bar="urn: bar" targetNamespace ="urn:bar" xmlns="http://www.w3.org/2001/XMLSchema" elementFormDefa ult="qualified" attributeFormDe fault="unqualif ied">
<element name="test"> <complexType> <sequence> <element name="qwe"/> <element ref="bar:asd"/> </sequence> </complexType> </element>
<element name="asd" abstract="true"/> </schema>
foo.xsd ===== <?xml version="1.0" encoding="UTF-8"?> <schema xmlns:bar="urn: bar" xmlns:foo="urn: foo" xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace ="urn:foo" elementFormDefa ult="qualified" attributeFormDe fault="unqualif ied">
<import namespace="urn: bar" schemaLocation= "bar.xsd"/>
<element name="foo_asd" substitutionGro up="bar:asd"/> </schema>
test.xml ====== <?xml version="1.0" encoding="UTF-8"?> <test xmlns="urn:bar" xmlns:foo="urn: foo" xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocat ion="urn:foo foo.xsd urn:bar bar.xsd">
<qwe/> <foo:foo_asd/>
</test> -----------------------------------------------------------------
The idea is that bar:asd is declared as abstract, and is substituted with foo:foo_asd. All this validates perfectly in XML Spy and in any version of MSXML, but the .NET parser comlains in the following way : The element 'urn:bar:test' has invalid child element 'urn:foo:foo_as d'. Expected 'urn:bar:asd'. An error occurred at , (5, 3).
It is obvious that we can't really have bar:asd, because it is abstract. Does anybody have a clue what might be missing? Thanks a lot in advance for any help!
Michael
Substitution groups across namespace did not work correctly in .net
framework 1.1. This works correctly in .net framework 2.0 beta2.
"Michael Skulsky" <sy****@nm.ru > wrote in message
news:uH******** ******@TK2MSFTN GP14.phx.gbl... Hi all,
I've got the following validation problem. There are 2 schemas and a document:
----------------------------------------------------------------- bar.xsd ====== <?xml version="1.0" encoding="UTF-8"?> <schema xmlns:bar="urn: bar" targetNamespace ="urn:bar" xmlns="http://www.w3.org/2001/XMLSchema" elementFormDefa ult="qualified" attributeFormDe fault="unqualif ied">
<element name="test"> <complexType> <sequence> <element name="qwe"/> <element ref="bar:asd"/> </sequence> </complexType> </element>
<element name="asd" abstract="true"/> </schema>
foo.xsd ===== <?xml version="1.0" encoding="UTF-8"?> <schema xmlns:bar="urn: bar" xmlns:foo="urn: foo" xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace ="urn:foo" elementFormDefa ult="qualified" attributeFormDe fault="unqualif ied">
<import namespace="urn: bar" schemaLocation= "bar.xsd"/>
<element name="foo_asd" substitutionGro up="bar:asd"/> </schema>
test.xml ====== <?xml version="1.0" encoding="UTF-8"?> <test xmlns="urn:bar" xmlns:foo="urn: foo" xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocat ion="urn:foo foo.xsd urn:bar bar.xsd">
<qwe/> <foo:foo_asd/>
</test> -----------------------------------------------------------------
The idea is that bar:asd is declared as abstract, and is substituted with foo:foo_asd. All this validates perfectly in XML Spy and in any version of MSXML, but the .NET parser comlains in the following way : The element 'urn:bar:test' has invalid child element 'urn:foo:foo_as d'. Expected 'urn:bar:asd'. An error occurred at , (5, 3).
It is obvious that we can't really have bar:asd, because it is abstract. Does anybody have a clue what might be missing? Thanks a lot in advance for any help!
Michael
Thanks a lot for your help, in fact I've already found that out.
Both the example below and my actual XML files using this technology
validate perfectly using XmlSchemaSet object in .NET 2.0, but there seems to
be no way to have them validated in 1.1 with XmlSchemaCollec tion - except
for using MSXML of course.
Thanks again everybody for your help.
Michael
"Zafar Abbas" <so*****@somewh ere.com> wrote in message
news:%2******** ********@TK2MSF TNGP14.phx.gbl. .. Substitution groups across namespace did not work correctly in .net framework 1.1. This works correctly in .net framework 2.0 beta2.
"Michael Skulsky" <sy****@nm.ru > wrote in message news:uH******** ******@TK2MSFTN GP14.phx.gbl... Hi all,
I've got the following validation problem. There are 2 schemas and a document:
----------------------------------------------------------------- bar.xsd ====== <?xml version="1.0" encoding="UTF-8"?> <schema xmlns:bar="urn: bar" targetNamespace ="urn:bar" xmlns="http://www.w3.org/2001/XMLSchema" elementFormDefa ult="qualified" attributeFormDe fault="unqualif ied">
<element name="test"> <complexType> <sequence> <element name="qwe"/> <element ref="bar:asd"/> </sequence> </complexType> </element>
<element name="asd" abstract="true"/> </schema>
foo.xsd ===== <?xml version="1.0" encoding="UTF-8"?> <schema xmlns:bar="urn: bar" xmlns:foo="urn: foo" xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace ="urn:foo" elementFormDefa ult="qualified" attributeFormDe fault="unqualif ied">
<import namespace="urn: bar" schemaLocation= "bar.xsd"/>
<element name="foo_asd" substitutionGro up="bar:asd"/> </schema>
test.xml ====== <?xml version="1.0" encoding="UTF-8"?> <test xmlns="urn:bar" xmlns:foo="urn: foo" xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocat ion="urn:foo foo.xsd urn:bar bar.xsd">
<qwe/> <foo:foo_asd/>
</test> -----------------------------------------------------------------
The idea is that bar:asd is declared as abstract, and is substituted with foo:foo_asd. All this validates perfectly in XML Spy and in any version of MSXML, but the .NET parser comlains in the following way : The element 'urn:bar:test' has invalid child element 'urn:foo:foo_as d'. Expected 'urn:bar:asd'. An error occurred at , (5, 3).
It is obvious that we can't really have bar:asd, because it is abstract. Does anybody have a clue what might be missing? Thanks a lot in advance for any help!
Michael
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Stefan Richter |
last post by:
Hi, after coding for days on stupid form validations -
Like:
strings (min / max length), numbers(min / max value), money(min / max
value), postcodes(min / max value), telefon numbers,
email adresses and so on.
I thought it might be a better way to programm an automated, dynamic
form validation that works for all kinds of fields, shows the
necessary error messages and highlights the coresponding form fields.
|
by: wumingshi |
last post by:
Hi,
When validating an XML instance, sometimes the schema is not enough to
expression the validation rules. Additional validation rules may be
expressed in an application-specific way. For example, using XPath or
Java method. So is there a concept and/or standard for post-schema
validation or application validation? Is there any hook in XML
standards that allow me to hook up with my customized validation?
Additionally and more...
|
by: Tim Meagher |
last post by:
I am trying to use both validation controls and to add submit button
attributes, but when I add the button attributes, the javascript fpr the
validation controls is no longer created for the page. How can I use both?
Thank you,
Tim Meagher
|
by: AlexS |
last post by:
Hello,
I have error when reading schema using XmlSchema. Read and then .Compile:
System.Xml.Schema.XmlSchemaException: May not be nominated as the
{substitution
group affiliation} of any other declaration. An error occurred at , (11, 3).
Schema compile error:
System.Exception: Schema error ---> System.Xml.Schema.XmlSchemaException:
May no
|
by: Jeffry van de Vuurst |
last post by:
Hi,
I'm working on an xml schema and I'm running into some problems
relating substitutionGroups and extensions.
This xsd validates fine:
There are three elements and three complex types and every element has
the type of some complexType.
<?xml version="1.0" encoding="UTF-8"?>
| |
by: XSD-optimist |
last post by:
I am trying to generate the classes for an XSD schema using the
Microsoft XSD Object Code Generator (XSDObjGen).
I am having a schema that contains the definition of the following:
1. a complex type 'ExternalDestinationBaseComplexType'
2. abstract element 'ExternalDestinationDefinitionEntry' of type
'ExternalDestinationBaseComplexType'
3. two elements 'SAP' and 'Dir' of type
ExternalDestinationBaseComplexType with substitutionGroup set...
|
by: Matt |
last post by:
I want to know if ASP.NET Web Forms Validation Controls are Server-Side or
Client-Side form validation? Since I think each validator control can select
either 1) JavaScript based error dialog or 2) show the error message next to
the control. For example, if the text field is empty with RequiredField
Validator control, it can show the value in ControlToValidate property in
two ways as I mentioned.
Please advise. Thanks!
|
by: Stephen |
last post by:
Hi,
the validation controls dont work on Netscape or Mozilla and only on
Internet Explorer
why? How do i correct this problem?
Thanks
|
by: steve_marjoribanks |
last post by:
I'm fairly new to XML and schemas and I'm trying to work out why a
schema I've been given keeps throwing up validation errors in XMLSpy.
The section of code with the problem is:
<!--============= Element =============-->
<element name="conResults" type="agsml:CongArrayType"
substitutionGroup="agsml:_congProperty"/>
<!--============= ComplexType =============-->
<complexType name="CongArrayType">
<complexContent>
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |