- From: <noah_mendelsohn@us.ibm.com>
- Date: Wed, 10 May 2006 16:35:56 -0400
- To: George Cristian Bina <george@oxygenxml.com>
- Cc: Balakrishnan <balakrishnan@alden.co.in>, xmlschema-dev@w3.org
This question comes up from time to time, and it may be worth reminding
readers of this list why XML Schema does not let you define entities. In
short, it's because we would have also had to change the XML 1.0
recommendation, which basically says that entities are resolved from the
definitions in DTDs. Having new sources of entity definitions is not a
"plug point" in XML 1.x as it stands. So, we could have easily defined
entities, but XML would not have done anything with them! Significant
time was spent during the development of Schema 1.0 trying to find a
sensible way around this, and we gave up. So, at least for the forseeable
future, you need to use DTDs if you want to define entities.
By the way, we are also sometimes asked why you can't have the equivalent
of a DTD internal subset, I.e. putting a schema fragment in the XML file
but outside of the document element tree, and the answer is similar: XML
is not extensible in that way either. The only "schema" language that can
be embedded as an internal subset in an XML document is a DTD.
--------------------------------------
Noah Mendelsohn
IBM Corporation
One Rogers Street
Cambridge, MA 02142
1-617-693-4036
--------------------------------------
George Cristian Bina <george@oxygenxml.com>
Sent by: xmlschema-dev-request@w3.org
05/10/2006 02:38 PM
To: Balakrishnan <balakrishnan@alden.co.in>
cc: xmlschema-dev@w3.org, (bcc: Noah Mendelsohn/Cambridge/IBM)
Subject: Re: [xmlschema-dev] <none>
Hi,
You need a DTD for entities. You can have something like below for
instance:
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE root [
<!ENTITY copy "sample">
]>
<root>
<test>this is the test © node</test>
</root>
Best Regards,
George
---------------------------------------------------------------------
George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
Balakrishnan wrote:
> Dear All,
>
> I am new to Schema. I have more questions, first one here.
>
> How to declare the entities in the schema? Could you advice please.
>
> eg. XML
> <?xml version="1.0" encoding="utf-8" ?>
> <root>
> <test>this is the test © node</test>
> </root>
>
>
> eg. Schema
> <xsd:schema version='1.0'
> xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
> <xsd:element name='root'>
> <xsd:complexType>
> <xsd:sequence>
> <xsd:element name='test'/>
> </xsd:sequence>
> </xsd:complexType>
> </xsd:element>
> </xsd:schema>
>
> Many thanks
> Bala
Received on Wednesday, 10 May 2006 20:36:13 UTC