473,508 Members | 2,088 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Xml Schema - block attribute

Hi folks,

I don't know what the block attribute means. The final attribute looks
like to be simple: I can prevent derivations. Did I write
final="restriction" and I restrict it in another complexType XML Spy
said, that it's wrong - fine.

But my "block" examples don't work:

Schema:

<xs:complexType name="AA">
<xs:complexContent>
<xs:extension base="XXX">
<xs:sequence>
<xs:element name="AA" type="xs:string"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>

<xs:complexType name="BB">
<xs:complexContent>
<xs:extension base="XXX">
<xs:sequence>
<xs:element name="BB" type="xs:string"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>

<xs:complexType name="XXX" abstract="true" block="extension">
<xs:sequence>
<xs:element name="A" type="xs:string"/>
</xs:sequence>
</xs:complexType>

<xs:element name="test" type="XXX"/>
Instance:

<ttt:test xmlns:ttt="http://Olli"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://Olli
C:\test.xsd" xsi:type="ttt:AA">

<A></A>
<AA></AA>

</ttt:test>

----
I expected, that the Validator give a message like: No you forbid it
-you said in the schema that you don't want! But Xml Spy means
everything is fine. Why? Maybe you've got a better example for me to
learn what "block" means.

tnx a lot,
Olli
Jul 20 '05 #1
1 3606
A simple way to think about these is that final constrains schemas while
block constrains documents. Block substitution says an instance document
can't replace an element in the model with one from its substitution group;
block restriction/extension say an instance can't use an xsi:type that is a
restriction/extension of the declared element type.

Bob Foster
http://www.xmlbuddy.com/

"ProgrammierMan" <pr************@genion.de> wrote in message
news:f8**************************@posting.google.c om...
Hi folks,

I don't know what the block attribute means. The final attribute looks
like to be simple: I can prevent derivations. Did I write
final="restriction" and I restrict it in another complexType XML Spy
said, that it's wrong - fine.

But my "block" examples don't work:

Schema:

<xs:complexType name="AA">
<xs:complexContent>
<xs:extension base="XXX">
<xs:sequence>
<xs:element name="AA" type="xs:string"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>

<xs:complexType name="BB">
<xs:complexContent>
<xs:extension base="XXX">
<xs:sequence>
<xs:element name="BB" type="xs:string"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>

<xs:complexType name="XXX" abstract="true" block="extension">
<xs:sequence>
<xs:element name="A" type="xs:string"/>
</xs:sequence>
</xs:complexType>

<xs:element name="test" type="XXX"/>
Instance:

<ttt:test xmlns:ttt="http://Olli"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://Olli
C:\test.xsd" xsi:type="ttt:AA">

<A></A>
<AA></AA>

</ttt:test>

----
I expected, that the Validator give a message like: No you forbid it
-you said in the schema that you don't want! But Xml Spy means
everything is fine. Why? Maybe you've got a better example for me to
learn what "block" means.

tnx a lot,
Olli

Jul 20 '05 #2

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

Similar topics

4
2371
by: Gordon Dickens | last post by:
I have target xml to generate from schema. All of the XML instances have the same global element i.e. <base>. I would like to combine all of the schemas into a single schema where I could...
4
1331
by: Nicolas Mailhot | last post by:
Hi, I've been sent an xsd that uses the following construct : <xsi:element name="foo"> <xsi:complexType name="foo"> Is this something allowed ? I couldn't find anything that said it's...
0
1705
by: Rajesh Jain | last post by:
I Have 2 separate schemas. --------------Schema 1 is defined as below----------- <xs:schema targetNamespace="http://Schemas/1" xmlns="http://Schemas/1" xmlns:xs="http://www.w3.org/2001/XMLSchema"...
6
2558
by: Martin | last post by:
Hi, I have a xml file like the one below <?xml version="1.0" encoding="utf-8"?><e1 xmlns:e1="http://tempuri.org/Source1.xsd" e1:att1="1" e1:att2="2" e1:rest="345"/> If I try to create a...
0
11251
by: Derek | last post by:
I am creating an intranet using Visual Web Developer Express Edition. Everything has been working OK until yesterday when I started getting 62 messages all beginning "Could not find schema...
4
7724
by: Stan R. | last post by:
Hello, I have xmllint and xsltproc installed and running on both my linux and win32 platforms, all seems good. I have a couple questions though. 1) If I have an external dtd file, which is...
1
4724
by: tankbattle | last post by:
That is, what's the difference between <complexType name="Address" final="restriction"> <sequence> <element name="name" type="string"/> <element name="street" type="string"/> <element...
3
5615
by: Eric Lilja | last post by:
Hello again, I'm having a new problem converting a dtd to an xml schema. This once is a little bit more complicated than in my previous question. The following file validates correctly: <?xml...
0
2613
by: rautsmita | last post by:
hello friends , i am using to jdk6 and JAXB2.0, i have geomtry.xsd file i am trying to compile this file using jaxb but i got some error i.e.The particle of the type is not a valid restriction of...
0
7225
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7124
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...
0
7326
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
7385
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
4707
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...
0
3195
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...
0
1558
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 ...
1
766
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
418
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.