如何通过java程序使用DOCTYPE中指定的私有外部DTD创建XML文件,如下所示:
<!DOCTYPE MY1 SYSTEM "my1.dtd">
Assuming you want to use the W3C DOM implementation that is part of the Oracle JRE then use a DOMImplementation https://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-102161490 and do eg
Document doc = domImplementation.createDocument(
null,
"MY1",
domImplementation.createDocumentType("MY1", null, "my1.dtd")
);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.