XML convert to DTD Default element type

Oxygen general issues.
SmithGP
Posts: 1
Joined: Wed Apr 23, 2008 11:06 pm

XML convert to DTD Default element type

Post by SmithGP »

When converting the following XML:

<?xml version="1.0" encoding="UTF-8"?>
<XMLDocument>
<Tag1>Data</Tag1>
<Tag2></Tag2>
</XMLDocument>



To a DTD:

<?xml encoding="UTF-8"?>

<!ELEMENT XMLDocument (Tag1,Tag2)>
<!ATTLIST XMLDocument
xmlns CDATA #FIXED ''>

<!ELEMENT Tag1 (#PCDATA)>
<!ATTLIST Tag1
xmlns CDATA #FIXED ''>

<!ELEMENT Tag2 EMPTY>
<!ATTLIST Tag2
xmlns CDATA #FIXED ''>



The Tag2 shows EMPTY.

When converting, is there a way to force all EMPTY tags to (#PCDATA)?
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: XML convert to DTD Default element type

Post by sorin_ristache »

Hello,

The converter looks at the content of the tags when it generates the content model for that XML element. If you want (#PCDATA) content for a tag you have to insert non-empty content in that tag:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<XMLDocument>
<Tag1>Data</Tag1>
<Tag2>Data2</Tag2>
</XMLDocument>
Regards,
Sorin
Post Reply