473,324 Members | 2,356 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,324 software developers and data experts.

xsd:any help needed

I've got the following really simple schema :

<?xml version="1.0" ?>
<xs:schema targetNamespace="urn:503A2B4E-B364-47a4-AE5C-16E727275A70"
xmlns:mstns="urn:503A2B4E-B364-47a4-AE5C-16E727275A70"
xmlns="urn:503A2B4E-B364-47a4-AE5C-16E727275A70"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
attributeFormDefault="qualified" elementFormDefault="qualified">
<xs:element name="SMSAdapter" >
<xs:complexType>
<xs:sequence>
<xs:element name="phone" type="xs:string" minOccurs="0" />
<xs:element name="message" type="xs:string" minOccurs="0" />
<xs:any namespace="##any" processContents="skip" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
When I read the following xml

<?xml version="1.0" encoding="utf-8" ?>
<sms:SMSAdapter xmlns:sms="urn:503A2B4E-B364-47a4-AE5C-16E727275A70">
<sms:phone>0401328893</sms:phone>
<sms:message>South Africa 256/6 after 65 overs</sms:message>
</sms:SMSAdapter>

I get the error

The content model must be deterministic. Wildcard declaration along with a
local element declaration causes content model to become ambiguous. An error
occurred at file:///D:/Adapter.xsd(4, 4).

What exactly is wrong with this I need the schema to be expanded with
elements I don't understand or care about hence the xsd:any element.

Please help
Robert.
Nov 12 '05 #1
3 2180
You schema isn't deterministic. That's it. Remove minOccurs="0" on
message element definition to make it deterministic.
--
Oleg Tkachenko [XML MVP, XmlInsider]
http://blog.tkachenko.com
Nov 12 '05 #2
Can you explain a little more in detail I'm a complete idiot when it comes
it Xml Schema.

Thanks
Robert.

"Oleg Tkachenko [MVP]" <oleg@NO!SPAM!PLEASEtkachenko.com> wrote in message
news:Oc**************@TK2MSFTNGP11.phx.gbl...
You schema isn't deterministic. That's it. Remove minOccurs="0" on
message element definition to make it deterministic.
--
Oleg Tkachenko [XML MVP, XmlInsider]
http://blog.tkachenko.com

Nov 12 '05 #3
The WXS processor needs to know which schema particle it's validating an
element agains. So, in your schema, the following sequence causes a problem:

<xs:element name="phone" type="xs:string" minOccurs="0" />
<xs:element name="message" type="xs:string" minOccurs="0" />
<xs:any namespace="##any" processContents="skip" />

When the WXS processor finds an element "phone", how does it know whether it
should be validated against the optional (minOccurs="0") element or the
##any element? Being optional means that it could be validated by any. One
way of disambiguating the schema is to make the xs:any element be anything
on any namespace other than yours. This way, the processor knows that a
phone element in your namespace must be validated against your schema. And
any other elements NOT in your namespace should be skipped. That is, the
schema became deterministic with respect to the xs:any element. You can do
so by setting:

<xs:any namespace="##other" processContents="skip" />

--
Daniel Cazzulino [XML MVP]
Lagash Systems SA
http://weblogs.asp.net/cazzu

"Robert Rolls" <rr**@yahoo.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Can you explain a little more in detail I'm a complete idiot when it comes
it Xml Schema.

Thanks
Robert.

"Oleg Tkachenko [MVP]" <oleg@NO!SPAM!PLEASEtkachenko.com> wrote in message
news:Oc**************@TK2MSFTNGP11.phx.gbl...
You schema isn't deterministic. That's it. Remove minOccurs="0" on
message element definition to make it deterministic.
--
Oleg Tkachenko [XML MVP, XmlInsider]
http://blog.tkachenko.com


Nov 12 '05 #4

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

Similar topics

1
by: Honza Pazdziora | last post by:
Hello, I'm processing documents that can have any element names in them. The only restriction is placed on the attributes of these elements, each of them can only have two attributes of given...
0
by: Meredith | last post by:
Question: Can the XML <any> element restrict what datatype it stores? I am trying to write an extensible schema that has an element containing unbounded <any> elements of boolean type. Is it...
0
by: AL | last post by:
Hello, working on an xsd schema, I'd like it to have a node of which I don't know the content at design time: I want the document instance to identify such node contents, where content should have...
2
by: Victor Engmark | last post by:
I am making an XML Schema for emails, and would like to specify that any elements from the XHTML2 namespace are allowed in the body/contents and signature/footer parts of the message (and _only_...
0
by: Peter Aberline | last post by:
Hi all, I'm trying to write a schema which defines the following document. <root> <letters> <a>A</a> <dog>DOG<dog> <b>B</b> <fish>FISH</fish>
0
by: danjourno | last post by:
I have a number of xsd files defining schema for web services that are in pairs of a Request.xsd (to define the structure of a request) and a Response.xsd (to define the structure of a response)....
5
by: mkremser | last post by:
Hi NG! In a XSD, we (try to) specify that a node ("BsqCallInfo") has two attributes and can have any nodes as its children: <xsd:element name="BsqCallInfo"> <xsd:complexType> <xsd:choice...
2
by: yaya9 | last post by:
pls help me! I have a nested xml: <?xml version="1.0" encoding="utf-8" ?> <root> <myType> <FName /> <pop /> </myType> </root>
4
by: Jonas Bush | last post by:
I've got the some code to try and validate some xml. Against my schema, the "Good" xml (below) produces a couple of warnings, which I don't care about. The "Bad" xml (also below), produces warnings...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.