473,834 Members | 1,939 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

xsd:any help needed

I've got the following really simple schema :

<?xml version="1.0" ?>
<xs:schema targetNamespace ="urn:503A2B 4E-B364-47a4-AE5C-16E727275A70"
xmlns:mstns="ur n:503A2B4E-B364-47a4-AE5C-16E727275A70"
xmlns="urn:503A 2B4E-B364-47a4-AE5C-16E727275A70"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
attributeFormDe fault="qualifie d" elementFormDefa ult="qualified" >
<xs:element name="SMSAdapte r" >
<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="##an y" processContents ="skip" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
When I read the following xml

<?xml version="1.0" encoding="utf-8" ?>
<sms:SMSAdapt er xmlns:sms="urn: 503A2B4E-B364-47a4-AE5C-16E727275A70">
<sms:phone>0401 328893</sms:phone>
<sms:message>So uth 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 2206
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!P LEASEtkachenko. com> wrote in message
news:Oc******** ******@TK2MSFTN GP11.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="##an y" 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="##ot her" processContents ="skip" />

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

"Robert Rolls" <rr**@yahoo.com > wrote in message
news:%2******** ********@TK2MSF TNGP09.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!P LEASEtkachenko. com> wrote in message
news:Oc******** ******@TK2MSFTN GP11.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
1693
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 names. I'd like to validate this input. I can specify this requirement using xsd:any for /root element, like: <xsd:element name="root">
0
1512
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 possible to control the <any> element within the schema or must something like an XSLT template be applied instead? I'd like to do something like this:
0
1579
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 a complex structure (complex type). Probably xs:anytype is what I need, but I miss something... In the following schema, I define a "genericchild" node, which I'd want to be able to contain any (complex type) node I want to put in there: :...
2
4601
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_ there). I guess I have to use some combination of the xsd:import and xsd:any elements, but I'm not sure of the syntax. What should I fill into the following structure and/or the top of the file? <?xml version="1.0"?> <xsd:schema...
0
2160
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
2072
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). What I am trying to do is a) use these files to build a WSDL file and from there b) build the basic skeleton Java classes needed to create this rpc web service (using WSDL2Java or something). I am wondering if anyone has any advice on the first...
5
1810
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 minOccurs="0" maxOccurs="unbounded"> <xsd:any processContents="lax"/> </xsd:choice>
2
3388
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
1743
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 as well, but *should* be producing errors. The XML validator at http://apps.gotdotnet.com/xmltools/xsdvalidator/Default.aspx reports that the "Good" xml produces warnings, but the "bad" xml produces errors, which is what I want to reproduce in...
0
9799
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10795
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10512
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 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...
1
10550
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,...
0
10220
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 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...
1
7760
isladogs
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...
0
5796
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4427
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
3
3083
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.