472,992 Members | 3,576 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,992 software developers and data experts.

Allowing specific elements from another namespace...

I have a document type which I'm developing and working with, which is
currently defined in a DTD, mainly because I still haven't really
learned to use schemas. In this document type I need to specify that
some specific elements may have children which are XHTML %Flow;
elements. It isn't valid for these elements to contain arbitrary
XHTML, and it isn't valid for other elements in my language to have
any XHTML children.

I presume I can't do this in a DTD (except by including the XHTML DTD
into mine, which would mean that I would end up with the whole of
XHTML in my namespace, which isn't what I want). But how would I go
about doing it in a schema?
Jun 27 '08 #1
2 1540
Simon Brooke wrote:
I have a document type which I'm developing and working with, which is
currently defined in a DTD, mainly because I still haven't really
learned to use schemas. In this document type I need to specify that
some specific elements may have children which are XHTML %Flow;
elements. It isn't valid for these elements to contain arbitrary
XHTML, and it isn't valid for other elements in my language to have
any XHTML children.

I presume I can't do this in a DTD (except by including the XHTML DTD
into mine, which would mean that I would end up with the whole of
XHTML in my namespace, which isn't what I want). But how would I go
about doing it in a schema?
The W3C XML schema language has an xs:any element where you can specify
a namespace so you can allow any element in the XHTML namespace. You
can't specify a certain type however so I don't know how you could
restrict the element children to be of type flow. It might be best to
import a schema for XHTML and then allow an XHTML div element as the
child e.g.
<xs:element ref="xhtml:div"/>
that way you can then have the other elements inside the div element.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jun 27 '08 #2
I presume I can't do this in a DTD

DTDs are not namespace aware. You could allow specific elements with a
particular prefix, and try to set up required/default declarations for
that prefix to be the intended namespace... but in general if you're
using namespaces (and these days you should be), you should move to XML
Schema and handle them properly.

In schemas, allowing specific elements in another namespace should be
straightforward: you should be able to bind a prefix to that namespace
and use the appropriate prefixed QNames in your schema's description of
legal contents just as you would reference elements within the same
namespace. There should be examples of this on the web in various schema
tutorials; I haven't gone hunting for one recently so I don't have a
good pointer to give you other than the Schema recommendation (which is
not easy reading).

Jun 27 '08 #3

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

Similar topics

0
by: C. M. Sperberg-McQueen | last post by:
wooks (wookiz@hotmail.com) wrote: > <?xml version='1.0'?> > <userlogin xmlns="urn:faster:userlogin" > xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'> > <login>mick</login> > ...
2
by: wooks | last post by:
I want to apply 2 changes to the following xml <ROOTSTUB app="appname"/> 1. change the app attribute to an element. 2. put the ROOTSTUB element into a namespace that is passed as a global...
8
by: Hugh Sparks | last post by:
When processing an xml document that contains elements such as: <element xmlns="goop"/> ... <element xmlns="gleep"/> I want to create two xsl stylesheet templates: one that matches the...
2
by: Brett Gerhardi | last post by:
Hi all, I'm trying to something that I'm sure must be possible within the schema language but I cannot seem to work it out. Briefly, I am defining a multi-tiered base structure - each tier has...
12
by: Lawrence Oluyede | last post by:
I've some problems with filtering out a specific element by the following xml snippet (is part of a bigger xml document): <entry> <link...
1
by: cmrchs | last post by:
Hi, is there an easy way to provide all elements in an xml-document of a namespace-prefix. Example of source file : <book> <title>Alaska</title> </book> convert to :
22
by: spam.noam | last post by:
Hello, I discovered that I needed a small change to the Python grammar. I would like to hear what you think about it. In two lines: Currently, the expression "x" is a syntax error. I suggest...
4
by: newbie120 | last post by:
Hi all maybe its just been a long day, but i have a question about call access modifiers in C#. Consider the following code. namespace Application { private class Class1 { int i;
22
by: Christopher Nelson | last post by:
I have a little menu system which essentially takes HTML like: <div id='foo'></div> and retrieves foo.shtml from the server and inserts it inside the <div>. But sometimes I'd like foo.shtml...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.