Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

DTD conversion

Former Member
0 Likes
1,040

Hi

I've done an XML encoding, but need to convert it into DTD format.What do mean by DTD format? Can anyone give me sample program for XML conversion in DTD format?

Thanks in advance.

5 REPLIES 5
Read only

sridharreddy_kondam
Active Contributor
0 Likes
800

Hi Suresh,

U can find ur solution in

<b>http://www.sapgenie.com/mysap/xml.htm</b>

Regards,

Sridhar

Read only

Former Member
0 Likes
800

HI

GOOD

The purpose of a DTD is to define the legal building blocks of an XML document. It defines the document structure with a list of legal elements. A DTD can be declared inline in your XML document, or as an external reference.

Internal DTD

This is an XML document with a Document Type Definition: (Open it in IE5, and select view source)

<?xml version="1.0"?>

<!DOCTYPE note [

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

<!ELEMENT to (#PCDATA)>

<!ELEMENT from (#PCDATA)>

<!ELEMENT heading (#PCDATA)>

<!ELEMENT body (#PCDATA)>

]>

<note>

<to>Tove</to>

<from>Jani</from>

<heading>Reminder</heading>

<body>Don't forget me this weekend!</body>

</note>

The DTD is interpreted like this:

!ELEMENT note (in line 2) defines the element "note" as having four elements: "to,from,heading,body".

!ELEMENT to (in line 3) defines the "to" element to be of the type "CDATA".

!ELEMENT from (in line 4) defines the "from" element to be of the type "CDATA"

and so on.....

External DTD

This is the same XML document with an external DTD: (Open it in IE5, and select view source)

<?xml version="1.0"?>

<!DOCTYPE note SYSTEM "note.dtd">

<note>

<to>Tove</to>

<from>Jani</from>

<heading>Reminder</heading>

<body>Don't forget me this weekend!</body>

</note>

This is a copy of the file "note.dtd" containing the Document Type Definition:

<?xml version="1.0"?>

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

<!ELEMENT to (#PCDATA)>

<!ELEMENT from (#PCDATA)>

<!ELEMENT heading (#PCDATA)>

<!ELEMENT body (#PCDATA)>

Why use a DTD?

XML provides an application independent way of sharing data. With a DTD, independent groups of people can agree to use a common DTD for interchanging data. Your application can use a standard DTD to verify that data that you receive from the outside world is valid. You can also use a DTD to verify your own data.

THANKS

MRUTYUN

Read only

Former Member
0 Likes
800

Suresh,

DTD is the Document Type Definition for the Output of IDocs in XML files. See the configuration of DTD - Document Type Definition at the sap help.

http://help.sap.com/saphelp_nw04/helpdata/en/d2/69c045994448adad27d36c4154fe74/frameset.htm

Hope this helps you.

rgds,

TM.

Read only

Former Member
0 Likes
800

Hi,

A DTD is associated with a particular document via a Document Type Declaration, which is a bit of markup that appears near the start of the associated document. The declaration establishes that the document is an instance of the type defined by the referenced DTD.

The declarations in a DTD are divided into an internal subset and an external subset. The declarations in the internal subset are embedded in the Document Type Declaration in the document itself. The declarations in the external subset are located in a separate text file. The external subset may be referenced via a public identifier and/or a system identifier. Programs for reading documents may not be required to read the external subset.

[edit]

Examples

Here is an example of a Document Type Declaration containing both public and system identifiers:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

Here is an example of a Document Type Declaration that encapsulates an internal subset consisting of a single entity declaration:

<!DOCTYPE foo [ <!ENTITY greeting "hello"> ]>

All HTML 4.01 documents are expected to conform to one of three SGML DTDs. The public identifiers of these DTDs are constant and are as follows:

-//W3C//DTD HTML 4.01//EN

-//W3C//DTD HTML 4.01 Transitional//EN

-//W3C//DTD HTML 4.01 Frameset//EN

The system identifiers of these DTDs, if present in the Document Type Declaration, will be URI references. System identifiers can vary, but are expected to point to a specific set of declarations in a resolvable location. SGML allows for public identifiers to be mapped to system identifiers in catalogs that are optionally made available to the URI resolvers used by document parsing software.

Document Type Definition (DTD), defined slightly differently within the XML and SGML specifications, is one of several SGML and XML schema languages, and is also the term used to describe a document or portion thereof that is authored in the DTD language. A DTD is primarily used for the expression of a schema via a set of declarations that conform to a particular markup syntax and that describe a class, or type, of SGML or XML documents, in terms of constraints on the structure of those documents. A DTD may also declare constructs that are not always required to establish document structure, but that may affect the interpretation of some documents.

<b>Below links consist of more on DTD and XML examples.</b>

http://en.wikipedia.org/wiki/Document_Type_Definition

http://www.w3schools.com/dtd/default.asp

http://www.xmlfiles.com/examples/

<b>Reward if helpful</b>

Rgds,

Shakuntala

Read only

Former Member
0 Likes
800

Thanks to all who has helped in fixing up this issue.