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

XML Schema: unknown sub-element

I would like to have something like this:

<a:element1 xmlns:a="...">
<a:element2>
<b:element1 xmlns:b="...">
<b:element2/>
</b:element1>
</a:element2>
</a:element1>

where the schema of a:... doesn't know anything about schema b:..., but
knows where there will be (unknown) non-a:... elements. is this possible
with XML Schema?

Thomas Jollans

Jul 20 '05 #1
3 1916
"Thomas Jollans" <no****@jollans.com> schrieb im Newsbeitrag
news:bp*************@news.t-online.com...
I would like to have something like this:

<a:element1 xmlns:a="...">
<a:element2>
<b:element1 xmlns:b="...">
<b:element2/>
</b:element1>
</a:element2>
</a:element1>

where the schema of a:... doesn't know anything about schema b:..., but
knows where there will be (unknown) non-a:... elements. is this possible
with XML Schema?


Possible!

<xs:element name="element2">
<xs:complexType>
<xs:sequence>
<xs:any namespace="xyz"
processContents="skip"
maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>

This allows <element2> of the target namespace to include all elements of
namespace 'xyz'.

Flo
Jul 20 '05 #2
Florian Deissenboeck wrote:
"Thomas Jollans" <no****@jollans.com> schrieb im Newsbeitrag
news:bp*************@news.t-online.com...
I would like to have something like this:

<a:element1 xmlns:a="...">
<a:element2>
<b:element1 xmlns:b="...">
<b:element2/>
</b:element1>
</a:element2>
</a:element1>

where the schema of a:... doesn't know anything about schema b:..., but
knows where there will be (unknown) non-a:... elements. is this possible
with XML Schema?

Possible!

<xs:element name="element2">
<xs:complexType>
<xs:sequence>
<xs:any namespace="xyz"
processContents="skip"
maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>

This allows <element2> of the target namespace to include all elements of
namespace 'xyz'.

Flo


So, as far as I can see from http://www.w3.org/TR/xmlschema-1, if I omit
the namespace attribute, I can use any namespace. but what does the
processContent attribute do?

Thomas

Jul 20 '05 #3
> > <xs:element name="element2">
<xs:complexType>
<xs:sequence>
<xs:any namespace="xyz"
processContents="skip"
maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>

This allows <element2> of the target namespace to include all elements of namespace 'xyz'.

Flo


So, as far as I can see from http://www.w3.org/TR/xmlschema-1, if I omit
the namespace attribute, I can use any namespace. but what does the
processContent attribute do?

I consider omitting the namespace attribute not very elegant. By doing so
you simply allow everything at this point, this allows structure which
aren't allowed in other places of your document. For the
processContents-Attribute see the following Quote.

Flo

Quoting from "XML Schema" by Eric van der Vlist (O'Reilly): "processContents
specifies the behavior of the validator regarding the elements or attributes
from the specified namespace. The possible values are 'skip' (no validation
is attempted on these elements or attributes), 'strict' (schemas for the
namespace that will be included need to be available, and validators will
validate the elements and attributes against these schemas), or 'lax'
(validators will do their best to find a schema for the included elements
and attributes, validate them when they have found one, and silently skip
the validation when they haven't."


Jul 20 '05 #4

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

Similar topics

6
by: Phil Jarvis | last post by:
I have an XML Schema with regular expressions. e.g. <xsd:pattern value="{1}*"/> I have other patterns in the same schema document which share regular expression substructure, like the string...
2
by: Patrick Hatcher | last post by:
Pg: 7.4. I thought there was supposed to be switch to allow dumping of schema X from a database in version 7.4? But I don't see one. Is it still not possible? TIA Patrick Hatcher
1
by: Phil | last post by:
Is there an easy way to get the schema's data type for a XPathNavigator value? I need to be able to determine the data type for the xml value based off of an unknown schema and unknown xml file...
7
by: Sharon | last post by:
I have successfully loaded a DataSet object with a XML schema (XSD). Now I wish to populate the tables that was created in the DataSet. I have an XML file/string that contain all the needed data...
2
by: JC Voon | last post by:
Hi: What is the best way to copy the schema of one DataTable to another ?, The DataTable.Clone will create a new DataTable Currently i do it manually destTable.Clear()...
2
by: Anony Mous | last post by:
Hi, I've seen in previous posts that recommended practice for database backup is to run the dump utility twice. Once for schema only and a second time for data only (I think). Up to know,...
4
by: Marcin Cenkier | last post by:
Hi, I can create a schema from xsd file: Schema s = SchemaFactory.newInstance(_XMLConstants.W3C_XML_SCHEMA_NS_URI_).newSchema(new StreamSource(res.getInputStream())); but when using...
1
by: Kenneth Stephen | last post by:
Hi, I have a primitive type int type which is restricted to the values of 0 to 23. Let me call the restricted type "HourType". I want to write out a list of the form: HourRangeType =HourType...
1
Bob Ross
by: Bob Ross | last post by:
I am simply playing around with xml schemas to understand them better and came across this article - http://msdn2.microsoft.com/en-us/library/as3tta56.aspx The trouble is in this example no...
4
by: omono84 | last post by:
I know that this should be rather simple but i seem to be missing a step to get it to work. and have been unable to find a solution on the net. The aim is that I click on the open button to find...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
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: 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: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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.