Declaring a DTD inline

J

Jared

Hello everyone,

I have been researching for some time now, but I cannot figure out how
to declare a DTD within my XML document using Java. Does anyone know
how this can be done?

Here is some data I've gathered:

- the DOMImplementation.createDocumentType method only creates
external DTDs (SYSTEM or PUBLIC)

- Transformer.setOutputProperty and Transformer.transform method
allows me to print out a reference to an external SYSTEM or PUBLIC DTD
in an xml file.

For such a large time investment, I have gathered suprisingly little
data.

Well, if someone could let me know if declaring an DTD inline is
possible with Java, that would be great.

Thanks,
Jared
 
S

Sudsy

Jared wrote:
Well, if someone could let me know if declaring an DTD inline is
possible with Java, that would be great.

Thanks,
Jared

An example from http://www.w3.org/TR/REC-xml#sec-prolog-dtd
regarding in-line DTD definition:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE greeting [
<!ELEMENT greeting (#PCDATA)>
]>
<greeting>Hello, world!</greeting>

Writing Java code which will generate the in-line DTD is left
as an exercise for the reader.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top