[XMLSCHEMA-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: [xmlschema-dev] Entity

From: George Cristian Bina <george@oxygenxml.com>
Date: Thu, 11 May 2006 19:45:20 +0300
Message-ID: <44636A20.3040005@oxygenxml.com>
To: Balakrishnan <balakrishnan@alden.co.in>
CC: xmlschema-dev@w3.org
xsd schema entity

Hi Bala,

The document is valid against the schema. It depends how you invoke the 
validation, in this case you should make sure you do only XML Schema 
validation (not DTD validation) and you should specify the schema 
externally as the document does not refer it.
If you change the sample document like

<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE root [
   <!ENTITY copy "sample">
]>
<root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:noNamespaceSchemaLocation="sample.xsd">
      <test>this is the test &copy; node</test>
</root>

then you will have the schema referred by the document.

If you use XercesJ for validation for instance you can set the
http://java.sun.com/xml/jaxp/properties/schemaLanguage property to 
http://www.w3.org/2001/XMLSchema in order to validate against the XML 
Schema and not against the DTD.

Best Regards,
George
---------------------------------------------------------------------
George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com


Balakrishnan wrote:
> Thanks George,
> 
> I have tried the below, but not working for me.
> 
> I have attached sample XML and XSD file for your reference. Could you advice
> where I am mistake.
> 
> Many thanks
> Bala
> 
> 
> -----Original Message-----
> From: George Cristian Bina [mailto:george@oxygenxml.com]
> Sent: Thursday, 11 May 2006 12:09
> To: Balakrishnan
> Cc: xmlschema-dev@w3.org
> 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 &copy; 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 &copy; 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
>>
>> ------------------------------------------------------------------------
>>
>> <?xml version="1.0" encoding="utf-8" ?>
>> <!DOCTYPE root [
>>   <!ENTITY copy "sample">
>> ]>
>> <root>
>>      <test>this is the test &copy; node</test>
>> </root>
>>
>> ------------------------------------------------------------------------
>>
>> <?xml version='1.0' encoding='utf-8'?>
>> <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>
Received on Thursday, 11 May 2006 16:42:59 GMT

Subscribe to the Stylus Scoop newsletter for helpful XML tips and tutorials.
Email
First Name
Last Name
Company

Download Stylus Studio 6 XML Enterprise Edition

Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2007 All Rights Reserved.