Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > XSD Schema import

Reply
Thread Tools

XSD Schema import

 
 
Victor Engmark
Guest
Posts: n/a
 
      02-02-2004
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 xmlnssd="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
 
Reply With Quote
 
 
 
 
C. M. Sperberg-McQueen
Guest
Posts: n/a
 
      02-02-2004
Victor Engmark <(E-Mail Removed)> 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 xmlnssd="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
 
Reply With Quote
 
 
 
 
Victor Engmark
Guest
Posts: n/a
 
      02-03-2004
C. M. Sperberg-McQueen wrote:

> Victor Engmark <(E-Mail Removed)> 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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Validation with XSD using XML::LibXML::Schema, and XML::Validator::Schema huntingseasonson@gmail.com Perl Misc 5 11-29-2006 12:37 PM
Validation of XSD (XML Schema) against XSD Rushi XML 1 12-09-2005 08:12 AM
Import XSD schema into WSDL Wm. Scott Miller ASP .Net Web Services 1 09-14-2005 08:11 PM
XML schema - Make xsd include another xsd stiank81 XML 4 06-26-2005 05:11 PM
Difference between <import ....xsd> and <xlink:href=.....xsd> ???? Bernd Oninger XML 1 06-30-2004 08:21 AM



Advertisments