Convert DTD to XML / Generate XML instances from DTD
Questions about XML that are not covered by the other forums should go here.
-
- Posts: 14
- Joined: Wed Sep 20, 2006 7:07 pm
Convert DTD to XML / Generate XML instances from DTD
Post by heavydawson »
Hey all,
I'm wondering if it's possible to convert a DTD to XML as is possible with Stylus:
http://www.stylusstudio.com/dtd/dtd_to_xml.html
Also I'm wondering if the possibility is available to generate XML instances from DTD. I'm aware they exist for generating XML instances from XML Schema, but generating from DTD would also be useful.
If neither feature is available, then I'll move this to the feature request forum.
I'm wondering if it's possible to convert a DTD to XML as is possible with Stylus:
http://www.stylusstudio.com/dtd/dtd_to_xml.html
Also I'm wondering if the possibility is available to generate XML instances from DTD. I'm aware they exist for generating XML instances from XML Schema, but generating from DTD would also be useful.
If neither feature is available, then I'll move this to the feature request forum.
-
- Posts: 501
- Joined: Mon Feb 03, 2003 10:56 am
Hello,
Each time you create a new XML file based on a DTD, oXygen generates the required content for the root element automatically. There is no need for a new tool.
Let's take for example the following DTD:
We have severeal required attributes. The b element is a choice between x and y.
To generate an XML instance based on this DTD, go to the File menu/New, choose XML from the list, then in the XML document configuration wizard select the DTD and check the checkboxes: "Add optional content" and "Add first Choice particle". Just like in the following screenshot:
The created document is:
Regards,
Dan
Each time you create a new XML file based on a DTD, oXygen generates the required content for the root element automatically. There is no need for a new tool.
Let's take for example the following DTD:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<!ELEMENT a (b,c,d) >
<!ELEMENT b (x|y) >
<!ATTLIST b b_attr CDATA #REQUIRED>
<!ELEMENT x (t,w)>
<!ATTLIST x x_attr CDATA #REQUIRED>
<!ELEMENT c (#PCDATA)>
<!ELEMENT d (#PCDATA)>
<!ELEMENT y (#PCDATA)>
<!ELEMENT w (#PCDATA)>
<!ELEMENT t (#PCDATA)>
To generate an XML instance based on this DTD, go to the File menu/New, choose XML from the list, then in the XML document configuration wizard select the DTD and check the checkboxes: "Add optional content" and "Add first Choice particle". Just like in the following screenshot:

The created document is:
Code: Select all
<a>
<b b_attr="">
<x x_attr="">
<t></t>
<w></w>
</x>
</b>
<c></c>
<d></d>
</a>
Dan
Return to “General XML Questions”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service