473,395 Members | 1,468 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,395 software developers and data experts.

xsd:any with nested xml

pls help me!

I have a nested xml:
<?xml version="1.0" encoding="utf-8" ?>
<root>
<myType>
<FName />
<pop />
</myType>
</root>

with this xsd:
<?xml version="1.0" encoding="utf-8" ?>
<xsd:schema id="test1" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="root">
<xsd:complexType>
<xsd:sequence minOccurs="0" maxOccurs="1">
<xsd:element name="myType" type="niceType" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:complexType name="niceType">
<xsd:sequence minOccurs="0" maxOccurs="unbounded">
<xsd:element name="FName" type="xsd:string" minOccurs="0" maxOccurs="1" />
<xsd:any namespace="##any" processContents="skip" />
</xsd:sequence>
</xsd:complexType>
</xsd:schema>

I'm getting an unhandled exception

anyone?
Nov 12 '05 #1
2 3370
Your schema is non deterministic since it violates UPA rules defined by the
W3C Xml Schema Spec[1]. The wildcard (##any) allows element 'Fname' as well
so at validation time it could not be determined which particle to validate
by.

[1] http://www.w3.org/TR/xmlschema-1/#cos-nonambig

You have to modify your schema to be un ambiguous in order to use it for
validation.

"yaya9" <ya*****@cellcom.co.il> wrote in message
news:67*************************@posting.google.co m...
pls help me!

I have a nested xml:
<?xml version="1.0" encoding="utf-8" ?>
<root>
<myType>
<FName />
<pop />
</myType>
</root>

with this xsd:
<?xml version="1.0" encoding="utf-8" ?>
<xsd:schema id="test1" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="root">
<xsd:complexType>
<xsd:sequence minOccurs="0" maxOccurs="1">
<xsd:element name="myType" type="niceType" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:complexType name="niceType">
<xsd:sequence minOccurs="0" maxOccurs="unbounded">
<xsd:element name="FName" type="xsd:string" minOccurs="0" maxOccurs="1" />
<xsd:any namespace="##any" processContents="skip" />
</xsd:sequence>
</xsd:complexType>
</xsd:schema>

I'm getting an unhandled exception

anyone?

Nov 12 '05 #2
Hi,
Thanks for your quick response.
Sorry but I have some questions for you :-)
1. You wrote that ##any makes a conflict with FName. So, how can this:
<xsd:any namespace="##any" processContents="skip" />
come with additonal elements at all?
2. I succeeded to validate the above xsd:any with FName element in a
non-nested schema:
<xsd:element name="root">
<xsd:complexType>
<xsd:sequence minOccurs="0" maxOccurs="1">
<xsd:element name="FName" type="xsd:string" minOccurs="0"
maxOccurs="1" />
<xsd:any namespace="##any" processContents="skip" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>

Why in this case there is no ambiguousness?
3.How can I keep the original xsd structure and be able to validate
xml with an undefined elements?

Thanks a lot pal.
"Zafar Abbas [MSFT]" <za****@microsoft.com> wrote in message news:<#9**************@TK2MSFTNGP10.phx.gbl>...
Your schema is non deterministic since it violates UPA rules defined by the
W3C Xml Schema Spec[1]. The wildcard (##any) allows element 'Fname' as well
so at validation time it could not be determined which particle to validate
by.

[1] http://www.w3.org/TR/xmlschema-1/#cos-nonambig

You have to modify your schema to be un ambiguous in order to use it for
validation.

"yaya9" <ya*****@cellcom.co.il> wrote in message
news:67*************************@posting.google.co m...
pls help me!

I have a nested xml:
<?xml version="1.0" encoding="utf-8" ?>
<root>
<myType>
<FName />
<pop />
</myType>
</root>

with this xsd:
<?xml version="1.0" encoding="utf-8" ?>
<xsd:schema id="test1" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="root">
<xsd:complexType>
<xsd:sequence minOccurs="0" maxOccurs="1">
<xsd:element name="myType" type="niceType" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:complexType name="niceType">
<xsd:sequence minOccurs="0" maxOccurs="unbounded">
<xsd:element name="FName" type="xsd:string" minOccurs="0" maxOccurs="1" />
<xsd:any namespace="##any" processContents="skip" />
</xsd:sequence>
</xsd:complexType>
</xsd:schema>

I'm getting an unhandled exception

anyone?

Nov 12 '05 #3

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>
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...
3
by: Robert Rolls | last post by:
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"...
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: koger | last post by:
Hi there! I'm creating a .net c# web service where I'm transforming from XML from one XSD to another XSD. I want the XML input to follow the input-XSD. I would like to use the XSD directly, but I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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
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
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...

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.