473,725 Members | 2,118 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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:complexTyp e name="contentsT ype" use="optional">
<xsd: ...
</xsd:complexType >

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

</xsd:schema>

--
Victor Engmark
Jul 20 '05 #1
2 4595
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:complexTyp e name="contentsT ype" use="optional">
<xsd: ...
</xsd:complexType >
Perhaps what you want is

<xsd:complexTyp e name="contentsT ype">
<xsd:sequence >
<xsd:any
namespace="http ://www.w3.org/2002/06/xhtml2"
processContents ="strict"
minOccurs="0"
maxOccurs="unbo unded">
</xsd:any>
</xsd:sequence>
</xsd:complexType >

<!-- Footer structure --> <xsd:complexTyp e name="footerTyp e" 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:complexTyp e name="footerTyp e">
<xsd:choice minOccurs="0" maxOccurs="unbo unded">
<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:complexTyp e name="footerTyp e" 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:complexTyp e name="footerTyp e">
<xsd:choice minOccurs="0" maxOccurs="unbo unded">
<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:complexTyp e name="signature Type" 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
4173
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 to create a simple example that generates the error (included below). I have two imported schemas, and JAXB seems to only want to import one of them (possibly because they have same namespace (???)).
2
4658
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 (XMLSpy4) but not with Xerces 2.6.0. I've included a really short and simple example to illustrate it. I would like to get some comments on the validation capabilities of Xerces 2.6.0. I though it *fully* supported W3C Schema!
4
2393
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 generate any of the specific instances. sample schema one: <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"> <xs:element name="base">
2
2494
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 target namespace of the components from the included schema document. I'm confused because of the rules I read in the XML Schema spec <http://www.w3.org/TR/xmlschema-1/#element-element>: > If the <element> element information item has <schema>...
8
2813
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 to be working. I am trying to import a complex type/simple type element type from an external xml schema. I am using xs:import tag with namespace and schemalocation attributes defined and have also declared xmlns relative to this xml schema. I...
0
1498
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 embedded resources (in the same namespace).: The Code: templateDocument = new XmlDataDocument();
4
2502
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 of projects. Therefore, I wish to include the project customType in the projectCollection namespace. I therefore have declared two xsd documents: project.xsd and projectcollection.xsd
1
6403
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 reference this wsdl in .NET it seems to do it fine, yet there are no objects to reference except RateQuoteBeanService. In the WSDL it looks like there should be getRateQuote, and QUOTEREQUEST, etc.
10
6936
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: xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:xenc="http://www.w3.org/2001/04/xmlenc#". I have these schemas all locally on the disk, but it does not work. If I try on a computer with internet access then it works just fine. Does someone know what to do. Function with...
0
3362
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" xmlns:h="http://www.w3.org/1999/xhtml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="alarm-manual alarm-manual.xsd" <h:p>Text ... <a:par-value name="myName"/... text </h:p>
0
8752
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9401
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...
1
9176
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
8097
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6011
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4519
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4784
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3221
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
2
2635
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.