How to add internal DTD subset to the newly created xml file using javax.xml
Post here questions and problems related to oXygen frameworks/document types.
-
- Posts: 168
- Joined: Fri Feb 28, 2020 4:02 pm
How to add internal DTD subset to the newly created xml file using javax.xml
Post by vishwavaranasi »
Hello Team , I know this is a general java question
am using the API
import javax.xml.parsers.DocumentBuilder;
import javax.xml.transform.Transformer;
to create a xml
I am trying to add the DOCTYPE and DTD declaration as below
but my final doctype declaration should be
I want add at the end an empty internal subset [] ..how to do this in java ?
am using the API
import javax.xml.parsers.DocumentBuilder;
import javax.xml.transform.Transformer;
to create a xml
I am trying to add the DOCTYPE and DTD declaration as below
Code: Select all
TransformerFactory transformerFactory = TransformerFactory.newInstance();
transformer = transformerFactory.newTransformer();
transformer.setOutputProperty(
OutputKeys.DOCTYPE_PUBLIC, "-//XXX//DTD XXX YYY XXX//EN");
transformer.setOutputProperty(
OutputKeys.DOCTYPE_SYSTEM, "XXX.dtd");
Code: Select all
DOCTYPE XXX PUBLIC "-//XXX//DTD XXX YYY XXX//EN" "XXX.dtd"[]
Thanks,
vishwa
vishwa
-
- Posts: 9431
- Joined: Fri Jul 09, 2004 5:18 pm
Re: How to add internal DTD subset to the newly created xml file using javax.xml
Hi,
You cannot set an internal DTD subset just by setting properties on the transformer.
You could try to force outputting the DOCTYPE along with its subset directly from the XSLT template:
or as a workaround after applying the XSLT and producing the content, apply some regular expression on the content and replace the empty DOCTYPE string with a DOCTYPE which contains an internal subset.
Regards,
Radu
You cannot set an internal DTD subset just by setting properties on the transformer.
You could try to force outputting the DOCTYPE along with its subset directly from the XSLT template:
Code: Select all
<xsl:template match="/">
<xsl:text disable-output-escaping="yes"><!DOCTYPE abc[<!ENTITY ent 'test'>]></xsl:text>
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 168
- Joined: Fri Feb 28, 2020 4:02 pm
Re: How to add internal DTD subset to the newly created xml file using javax.xml
Post by vishwavaranasi »
Thanks Radu 

Thanks,
vishwa
vishwa
Return to “SDK-API, Frameworks - Document Types”
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