473,473 Members | 1,768 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

SUBJECT: XML schema together with XHTML

Hi there,

I have the following situation:
I want to create an XML document that contains 2 parts:
a) a XHTML part (it can be either version 1.0 or 1.1 )
b) a non XHTML part that contains some information about the first
part - like the location of that content or some other info on
different constituents of the first part

The elements of the second part are defined by an XML schema.

My question is how to do this in an elegant manner?
Should I import somehow (I have no idea how) the XHTML schema on the
part 2 schema? Or should I deal only on the instance XML file with
this issue (if yes - how)?

Thanks a lot for the help.

Daniel

Feb 13 '07 #1
3 1737
da*********@gmail.com wrote:
I have the following situation:
I want to create an XML document that contains 2 parts:
a) a XHTML part (it can be either version 1.0 or 1.1 )
b) a non XHTML part that contains some information about the first
part - like the location of that content or some other info on
different constituents of the first part

The elements of the second part are defined by an XML schema.

My question is how to do this in an elegant manner?
Should I import somehow (I have no idea how) the XHTML schema on the
part 2 schema? Or should I deal only on the instance XML file with
this issue (if yes - how)?
You can author the schema for the elements you want to define yourself
and then, where XHTML elements are allowed, you use xs:any together with
the XHTML namespace http://www.w3.org/1999/xhtml. On the xs:any element
you use the attribute processContents="lax", that way the processor will
validate if a schema for that namespace is known or skip validation if
no schema is known.
As for importing an XHTML schema, the W3C has made various efforts at
doing this, one is <http://www.w3.org/TR/xhtml1-schema/>, it is only a
note however, not a normative schema. Importing a schema is simply done
with e.g.
<xs:import namespac="http://www.w3.org/1999/xhtml"/>
with an optional URL provided for the schema location.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Feb 13 '07 #2
Martin,
Thanks for your pointer - it is very useful.
I am still getting an error on the validation. Maybe I am doing
something wrong.
I did this:

###schema
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.myTarget.com"
xmlns="http://www.myTarget.com"
elementFormDefault="qualified">

<xsd:element name="LDOC">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="XHTML" minOccurs="1" maxOccurs="1"/>
<xsd:element ref="META" minOccurs="1" maxOccurs="1"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>

<xsd:element name="XHTML" type="XHTMLType"/>
<xsd:complexType name="XHTMLType">
<xsd:complexContent>
<xsd:restriction base="xsd:anyType">
<xsd:anyAttribute namespace="http://www.w3.org/1999/
xhtml" processContents="lax"/>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>

####### xml file

<?xml version="1.0" encoding="UTF-8"?>
<lxx:LCCDOC xmlns:lxx="http://www.myTarget.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.myTarget.com
file:LDocument_V0.xsd">

<lxx:XHTML>
<html></html <!-- ERROR -->
</lxx:XHTML>

<lxx:META>

On Feb 13, 9:39 am, Martin Honnen <mahotr...@yahoo.dewrote:
dantohes...@gmail.com wrote:
I have the following situation:
I want to create an XML document that contains 2 parts:
a) a XHTML part (it can be either version 1.0 or 1.1 )
b) a non XHTML part that contains some information about the first
part - like the location of that content or some other info on
different constituents of the first part
The elements of the second part are defined by an XML schema.
My question is how to do this in an elegant manner?
Should I import somehow (I have no idea how) the XHTML schema on the
part 2 schema? Or should I deal only on the instance XML file with
this issue (if yes - how)?

You can author the schema for the elements you want to define yourself
and then, where XHTML elements are allowed, you use xs:any together with
the XHTML namespacehttp://www.w3.org/1999/xhtml. On the xs:any element
you use the attribute processContents="lax", that way the processor will
validate if a schema for that namespace is known or skip validation if
no schema is known.
As for importing an XHTML schema, the W3C has made various efforts at
doing this, one is <http://www.w3.org/TR/xhtml1-schema/>, it is only a
note however, not a normative schema. Importing a schema is simply done
with e.g.
<xs:import namespac="http://www.w3.org/1999/xhtml"/>
with an optional URL provided for the schema location.

--

Martin Honnen
http://JavaScript.FAQTs.com/

Feb 13 '07 #3
My BAD,
I was making a mistake. Bellow is the good example.
A problem still arises: the solution works if my XHTML part has an
XHTM schema header. What if that XHTML is "coordinated" by a DTD? How
can I still incorporate that part in my XML file?

I do appreciate your help - Thank you!

Daniel

the good XML schema:
<xsd:element name="XHTML">
<xsd:complexType>
<xsd:sequence>
<xsd:any minOccurs="0" namespace="http://www.w3.org/
1999/xhtml" processContents="lax"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
Feb 13 '07 #4

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

Similar topics

7
by: Gili Korman | last post by:
Hi all, I need to create an XSD schema that will reperesent the following: <LIST> <ITEM1/> 0-unbounded <ITEM3/> 0-unbounded </LIST> or
4
by: Iain Robinson | last post by:
Hi all, I'm pretty new to schemas and i've been using Oxygen XML editor to generate and associate XSD files from my own XML files. The results are pretty simple but there is one aspect thats...
0
by: Binesh Bannerjee | last post by:
Hi... I've asked before about making an element in a schema be able to use xhtml... I've attached my schema definition below... What I'm curious about, is whether there's a means to add a length...
2
by: Mike Bridge | last post by:
Hi- I've created an XHTML extension module which validates correctly using the W3C online schema validator, but fails when I use the .net 1.1 validator. It seems to be choking on an included W3C...
3
by: farseer | last post by:
Hello, i have a schema which also imports the XHTML schema: <xsd:import namespace="http://www.w3.org/1999/xhtml" schemaLocation="http://www.w3.org/2002/08/xhtml/xhtml1-strict.xsd"/> This...
1
by: comic_rage | last post by:
Hi, I am trying to add an annotation with a documentation, which contains several nodes. So far, I having a problem on how to code this with C#. Any help is appreciated. <xsd:annotation>...
3
by: Sathyaish | last post by:
Thingies: - Report Definition Language (RDL) - Resource Definition Framework (RDF) - Web Service Definition Language (WSDL) - C# Application Markup Language (CSAML) - Extensible Application...
6
by: Grant Robertson | last post by:
If I use the 'any' element in my schema to allow elements from another schema to be used in instance documents based on my schema, is there a way to force that the contents of that element must be...
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: 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...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...
0
muto222
php
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.