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

Problem with a XML schema

Hello,

I'm a newbie in XML and I want to create a schema (XSD file) to describe
the syntax of a XML file.

I've this problem : the text of a particular XML tag (called <change>)
may contain HTML tags like <b>, <i>, <ul>, <liand others.

How can I describe this tag in XSD to allow any HTML tag inside ?

For example, the XML document has the line :

<change date="2006-11-02">Bug fix for <i>Products</iand <i>Users</i>
in the <b><i>main</i></bform</change>

Thanks for your help.

Patrick
Nov 3 '06 #1
4 1092
Patrick wrote:
How can I describe this tag in XSD to allow any HTML tag inside ?
Either spell out the full list of tags, or use xs:any
(http://www.w3.org/TR/2004/REC-xmlsch...028/#Wildcards)

A slightly better answer, I think, would be to explicitly allow XHTML
tags inside -- since XHTML is an XML language (which HTML isn't, so
you'd have to XMLify the HTML anyway) and since that would let you
constrain the xs:any specifically to tags in the XHTML namespace so
folks couldn't drop something completely bogus there.
--
Joe Kesselman / Beware the fury of a patient man. -- John Dryden
Nov 3 '06 #2
Joseph Kesselman a écrit :
Patrick wrote:
>How can I describe this tag in XSD to allow any HTML tag inside ?
Either spell out the full list of tags, or use xs:any
(http://www.w3.org/TR/2004/REC-xmlsch...028/#Wildcards)

A slightly better answer, I think, would be to explicitly allow XHTML
tags inside -- since XHTML is an XML language (which HTML isn't, so
you'd have to XMLify the HTML anyway) and since that would let you
constrain the xs:any specifically to tags in the XHTML namespace so
folks couldn't drop something completely bogus there.
Thanks for your quick answer.

I tried xs:any but have still a problem ...

I wrote the following XSD code :

<xsd:complexType name="change_type" mixed="true">
<xsd:sequence>
<xsd:any minOccurs="0" maxOccurs="unbounded" />
</xsd:sequence>
<xsd:attribute name="date"
type="xsd:date"
use="required"/>
</xsd:complexType>

<xsd:element name="change"
type="change_type"
maxOccurs="unbounded"/>

to describe the following XML line :

<change date="2006-11-02">Bug fix for <i>Products</iand <i>Users</i
in the <b><i>main</i></bform</change>

But the validator returns the error :

The element 'i' is not declared

Where is the problem ?

Thanks a lot.
Nov 3 '06 #3
Patrick a écrit :
Joseph Kesselman a écrit :
>Patrick wrote:
>>How can I describe this tag in XSD to allow any HTML tag inside ?

Either spell out the full list of tags, or use xs:any
(http://www.w3.org/TR/2004/REC-xmlsch...028/#Wildcards)

A slightly better answer, I think, would be to explicitly allow XHTML
tags inside -- since XHTML is an XML language (which HTML isn't, so
you'd have to XMLify the HTML anyway) and since that would let you
constrain the xs:any specifically to tags in the XHTML namespace so
folks couldn't drop something completely bogus there.

Thanks for your quick answer.

I tried xs:any but have still a problem ...

I wrote the following XSD code :

<xsd:complexType name="change_type" mixed="true">
<xsd:sequence>
<xsd:any minOccurs="0" maxOccurs="unbounded" />
</xsd:sequence>
<xsd:attribute name="date"
type="xsd:date"
use="required"/>
</xsd:complexType>

<xsd:element name="change"
type="change_type"
maxOccurs="unbounded"/>

to describe the following XML line :

<change date="2006-11-02">Bug fix for <i>Products</iand <i>Users</i
in the <b><i>main</i></bform</change>

But the validator returns the error :

The element 'i' is not declared

Where is the problem ?

Thanks a lot.
A self-answer ...

I had forgotten to add the attribute processContents="skip" in the
xsd:any declaration (an other newbie error).

Now all is ok, the XML is validated.

Thanks ... to me and to the documentation !!!

Patrick
Nov 3 '06 #4
Sorry I forgot to mention that; glad you got it working.
Nov 3 '06 #5

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

Similar topics

2
by: AlexS | last post by:
Hello, I have error when reading schema using XmlSchema. Read and then .Compile: System.Xml.Schema.XmlSchemaException: May not be nominated as the {substitution group affiliation} of any...
0
by: Martin Hart | last post by:
Hi, postgresql 7.4beta4 on linux and postgresql 7.3.4 on linux We have a database that we routinely backup using "pg_dump -a" We have to do this (dump the data only) because of various...
2
by: Rajesh Jain | last post by:
I Have 2 separate schemas. --------------Schema 1 is defined as below----------- <xs:schema targetNamespace="http://Schemas/1" xmlns="http://Schemas/1" xmlns:xs="http://www.w3.org/2001/XMLSchema"...
6
by: trexim | last post by:
Hi, I am trying to create a Web Reference for CSTA using the URL http://www.ecma-international.org/standards/ecma-348/csta-wsdl/csta-wsdl-all-operations.wsdl Visual .Net complains that: "...
1
by: Rohit Raghuwanshi | last post by:
Hello all, we are running a delphi application with DB2 V8.01 which is causing deadlocks when rows are being inserted into a table. Attaching the Event Monitor Log (DEADLOCKS WITH DETAILS) here....
1
by: Vikky | last post by:
Hi All: I have a problem with DB2 locking scheme. I am dealing with two processes modifying the DBMS (here IBM DB2 7.1 FP8 on Solaris) simulteneously. P1: Huge transactional data being...
2
by: Ali | last post by:
I am having problem compiling schema contained in WSDL file when analyzing schema types contained in it (for example http://www.ebout.net/net/GoogleSearch.wsdl). Following code demonstrates my...
0
by: Matt | last post by:
I have a problem when I select node elements from an xml file and validata each node againts the schema. I use XmlValidatingReader and it complains about elements not being declared. I have...
1
by: Angel \Java\ Lopez | last post by:
Hi people! I'm running a Visual Studio 2005, Professional, on Windows XP Professional. I've found a little big problem, reading a DataSet. If I try: ds.ReadXml("c:\data.xml") it raises...
2
by: yannick.beot | last post by:
Hi, I have a problem with nested namespace in a schema. I defined a schema A. A is importing a schema B with the namespace nsB and a schema C with the namespace nsC. But both B and C are...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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,...
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,...

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.