Author |
Message
|
fjb_saper |
Posted: Thu Oct 22, 2009 4:17 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Seb wrote: |
Hi Kimbert,
This is the error I get:
Quote: |
Type restriction error 'http://www.company.de/schemas#MyElement_._type' (content type incompatible with the content type of the baseType): attribute declaration 'MyAttribute' does not exist in the base type. |
|
You are in fact trying to do 2 operations in one.
Restricting the base type
Adding an attribute.
You should clearly separate the 2 operations.
You can then have following setup:
Code: |
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified" xmlns="http://www.company.de/schemas" targetNamespace="http://www.company.de/schemas">
<xsd:element name="MyElement">
<xsd:complexType>
<xsd:complexContent>
<!-- define here the element restrictions / values -->
</xsd:complexContent>
<xsd:attribute name="myattribute" type="MyType" />
</xsd:complexType>
</xsd:element>
<xsd:complexType name="MyType">
<xsd:simpleContent>
<xsd:extension base="xsd:integer">
<xsd:anyAttribute namespace="##any"/>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
</xsd:schema>
|
Or something like it...
I believe you're having trouble with the complexType 'MyType' because when using it as restriction base, how do you specify what you want restricted... the element or the attribute or both?
The change should really be made to the type MyType and have it refer to typed elements and/or typed attributes...
 _________________ MQ & Broker admin |
|
Back to top |
|
 |
Seb |
Posted: Thu Oct 22, 2009 9:18 pm Post subject: |
|
|
Apprentice
Joined: 27 Mar 2009 Posts: 41
|
Hi fjb_saber,
I might be wrong, but taking the attribute definition off the element's restriction should not be a valid option, because I (my customer's provider) want to restrict the definition of any attributes in MyType to that single attribute.
With your definition I would be able to validate a XML document, which contains "MyAttribute", but could rather contain any other attribute, as anyAttribute got not restricted.
By the way, I created a MsgDef from that schema and I do not see "MyAttribute". |
|
Back to top |
|
 |
fjb_saper |
Posted: Fri Oct 23, 2009 12:56 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Because I did not camelcase myattribute in the definition?
What happens if you use the toolkit to create the definition (mxsd) in graphical mode and export the mxsds to xsds (generate from message set)?
 _________________ MQ & Broker admin |
|
Back to top |
|
 |
Seb |
Posted: Fri Oct 23, 2009 1:12 am Post subject: |
|
|
Apprentice
Joined: 27 Mar 2009 Posts: 41
|
Hehe,
good point! I already tried that.
I can create the type ... export ... looks exactly the same like in my XSD. Then, I reuse the type in a restriction ... everything fine. But when I add a local attribute within the restriction, I get exactly the same error like if the MsgDef is created from the XSD.  |
|
Back to top |
|
 |
fjb_saper |
Posted: Fri Oct 23, 2009 1:22 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Seb wrote: |
Hehe,
good point! I already tried that.
I can create the type ... export ... looks exactly the same like in my XSD. Then, I reuse the type in a restriction ... everything fine. But when I add a local attribute within the restriction, I get exactly the same error like if the MsgDef is created from the XSD.  |
What I meant is doing all your definitions in the toolkit.
Only export once you have had success with defining all your types and restrictions using the graphical toolkit.
What I am thinking is that your type definitions may not be granular enough:
Like define a type that restricts your integer values
Then define an element typed after that
Then define an attribute typed after that
Then define a type of attribute typed after the restricted integer with ##any namespace.
Then use an attribute typed after that...
In that case you need 2 attribute types:
one with the restriction on values
one typed after the restriction on values with namespace ##any...
When using the attribute type in your definition choose wisely...
 _________________ MQ & Broker admin |
|
Back to top |
|
 |
kimbert |
Posted: Fri Oct 23, 2009 2:02 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
I think your schema is valid. I'll follow this up internally and let you know what I discover. |
|
Back to top |
|
 |
Seb |
Posted: Mon Oct 26, 2009 12:35 am Post subject: |
|
|
Apprentice
Joined: 27 Mar 2009 Posts: 41
|
Hi
@fjb_saber: Yes that's what I did, I just generated the XSD from the message definition to see the results in between.
@kimbert: Is it worth to open a PMR for that?
Thanks guys! |
|
Back to top |
|
 |
kimbert |
Posted: Mon Oct 26, 2009 1:09 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Might be worth opening a PMR, but I suggest that you wait until I've found out a couple more facts. It would be a shame to open a PMR for something that isn't a product defect  |
|
Back to top |
|
 |
kimbert |
Posted: Thu Oct 29, 2009 3:09 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Both of your schemas were OK. This is a defect in the toolkit's schema validation logic.
Please raise a PMR, and please make sure that you include the URL of this thread for background info. |
|
Back to top |
|
 |
|