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

XSD Schema import

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 xmlns:xsd="http://www.w3.org/2001/XMLSchema">

<!-- Definition of header structure -->

<!-- Contents structure -->
<xsd:complexType name="contentsType" use="optional">
<xsd: ...
</xsd:complexType>

<!-- Footer structure -->
<xsd:complexType name="footerType" use="optional">
<xsd:element name="signature">
<xsd: ...
</xsd:element>
</xsd:complexType>

</xsd:schema>

--
Victor Engmark
Jul 20 '05 #1
2 4556
Victor Engmark <vi************@cern.ch> writes:
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 xmlns:xsd="http://www.w3.org/2001/XMLSchema">

<!-- Definition of header structure -->

<!-- Contents structure -->
<xsd:complexType name="contentsType" use="optional">
<xsd: ...
</xsd:complexType>
Perhaps what you want is

<xsd:complexType name="contentsType">
<xsd:sequence>
<xsd:any
namespace="http://www.w3.org/2002/06/xhtml2"
processContents="strict"
minOccurs="0"
maxOccurs="unbounded">
</xsd:any>
</xsd:sequence>
</xsd:complexType>

<!-- Footer structure --> <xsd:complexType name="footerType" use="optional">
<xsd:element name="signature">
<xsd: ...
</xsd:element>
</xsd:complexType>


Here it's not clear to me what you intend. If you want
any number of XHTML 2 elements, intermingled with occurrences
of the 'signature' element, then this should work:

<xsd:complexType name="footerType">
<xsd:choice minOccurs="0" maxOccurs="unbounded">
<xsd:element name="signature"></xsd:element>
<xsd:any namespace="http://www.w3.org/2002/06/xhtml2"
processContents="strict">
</xsd:any>
</xsd:choice>
</xsd:complexType>

As far as I can tell, wildcards which allow elements (or attributes)
from a particular namespace can be included in a schema document even
when there is no import of the relevant namespace; an import is
required if you want to say "an XHTML 2 div, h1, or p is allowed here"
but not (as far as I can see from a quick look at the spec) for a
wildcard. Also, neither Xerces J nor XSV complains about a missing
import. But if you are designing your vocabulary to be used in
conjunction with XHTML, an import would probably be a good idea.

-C. M. Sperberg-McQueen
World Wide Web Consortium
Jul 20 '05 #2
C. M. Sperberg-McQueen wrote:
Victor Engmark <vi************@cern.ch> writes: <!-- Footer structure -->
<xsd:complexType name="footerType" use="optional">
<xsd:element name="signature">
<xsd: ...
</xsd:element>
</xsd:complexType>

Here it's not clear to me what you intend. If you want
any number of XHTML 2 elements, intermingled with occurrences
of the 'signature' element, then this should work:

<xsd:complexType name="footerType">
<xsd:choice minOccurs="0" maxOccurs="unbounded">
<xsd:element name="signature"></xsd:element>
<xsd:any namespace="http://www.w3.org/2002/06/xhtml2"
processContents="strict">
</xsd:any>
</xsd:choice>
</xsd:complexType>


No, it is more that the <signature> element is the only one I have
thought of so far as the contents of <footer>. My XML could therefore
have been written thus:
<xsd:complexType name="signatureType" use="optional">
<xsd: ...
</xsd:complexType>

What I wanted to express was that there will maximum one <signature> in
the <footer>, but it can contain any XHTML2 elements.

--
Victor Engmark
Jul 20 '05 #3

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

Similar topics

1
by: Dennis B. Hansen | last post by:
Hi all... I'm having some problems JAXB compiling som schemas, and was wondering if what i was trying to do is simply wrong... the problem seems to be with my import statements, and I've tried...
2
by: Olaf Meyer | last post by:
Apprentently xerces 2.6.0 (Java) does not validate against contraints specified in the schema (e.g. constraints specified via unique element). The validation works with the XML editor I'm using...
4
by: Gordon Dickens | last post by:
I have target xml to generate from schema. All of the XML instances have the same global element i.e. <base>. I would like to combine all of the schemas into a single schema where I could...
2
by: Stanimir Stamenkov | last post by:
I'm trying to find out if it is permissible to include a schema document with absent target namespace to a schema with specified target namespace, and if it is, what are the rules to resolve the...
8
by: Poonam | last post by:
Hi, Can some one please help me with (or point me to) a very simple but working code sample that shows how to import XML Schema. I have tried many samples out there on internet but nothing seems...
0
by: Eric van Wijk | last post by:
Hi, When I try to assign a schema to a dataset using the ReadXmlSchema method, that schema does not import any schemas included with xs:import. Both schema's are stored in the assembly as...
4
by: Iain A. Mcleod | last post by:
Hi I'm stuck with the following schema validation problem in VS.NET 2003: I have two types of xml document and related schema: project and projectCollection. A projectcollection is just a set...
1
by: billa1972 | last post by:
Hi, I am trying to hook into Yellow Freight's rating webservice. Below is the wsdl. When i try and create a proxy file with wsdl.exe i get the following errors, see below. Also, when i...
10
by: gmocnik | last post by:
I am validating XML files on a server which has no internet access and the validadation in C# does not work. Schema with which I am validating has namespaces like:...
0
by: mk189 | last post by:
Hi, I am trying to create XML schema of custom markup language, enriched by XHTML. In simplified version, the XML documet could look like that: <a:alarm-manual xmlns:a="alarm-manual"...
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
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...
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...
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...
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.