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

Re: DTD 2 Schema

  • From: "G. Ken Holman" <gkholman@CraneSoftwrights.com>
  • To: xml-dev@lists.xml.org
  • Date: Thu, 23 Jul 2009 14:38:51 -0400

Re:  DTD 2 Schema
At 2009-07-23 11:31 -0700, Paul M wrote:
>Hi:
>
>I attempted to use DTDinst on sample dtd. I always receive syntax 
>error on 1st line, column 0.
>
>Sample dtd
><!DOCTYPE note [
><!ELEMENT note (to,from,heading,body)>
><!ELEMENT to (#PCDATA)>
><!ELEMENT from (#PCDATA)>
><!ELEMENT heading (#PCDATA)>
><!ELEMENT body (#PCDATA)>
>]>
>
>
>
>p.s. any other recommend dtd 2 schema translators?

Sorry, I should have also mentioned that a DTD (document type 
definition) does *not* contain a DOCTYPE (document type declaration).

You've quoted an entire document type declaration, which is not valid 
as a standalone DTD (and never has been valid as a standalone DTD 
even though a prominent vendor supported it as such in both SGML and 
XML tools, much to the consternation of other vendors who were being 
told by customers they were wrong).

Perhaps your DTDinst you are using just needs to see a DTD and not a 
document type declaration (I am not familiar with the tool):

<!ELEMENT note (to,from,heading,body)>
<!ELEMENT to (#PCDATA)>
<!ELEMENT from (#PCDATA)>
<!ELEMENT heading (#PCDATA)>
<!ELEMENT body (#PCDATA)>

For example, this is the output from Trang on the above:

T:\ftemp>copy con paul.dtd
<!ELEMENT note (to,from,heading,body)>
<!ELEMENT to (#PCDATA)>
<!ELEMENT from (#PCDATA)>
<!ELEMENT heading (#PCDATA)>
<!ELEMENT body (#PCDATA)>

^Z
         1 file(s) copied.

T:\ftemp>trang -I dtd -O xsd paul.dtd con
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
elementFormDefault="qualified">
   <xs:element name="note">
     <xs:complexType>
       <xs:sequence>
         <xs:element ref="to"/>
         <xs:element ref="from"/>
         <xs:element ref="heading"/>
         <xs:element ref="body"/>
       </xs:sequence>
     </xs:complexType>
   </xs:element>
   <xs:element name="to" type="xs:string"/>
   <xs:element name="from" type="xs:string"/>
   <xs:element name="heading" type="xs:string"/>
   <xs:element name="body" type="xs:string"/>
</xs:schema>

T:\ftemp>

I hope this helps.

. . . . . . . . Ken

--
XQuery/XSLT/XSL-FO hands-on training - Oakland, CA, USA 2009-08-03
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/x/
Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video
Video lesson:    http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18
Video overview:  http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18
G. Ken Holman                 mailto:gkholman@CraneSoftwrights.com
Male Cancer Awareness Nov'07  http://www.CraneSoftwrights.com/x/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

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-2013 All Rights Reserved.