Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (102)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (322)
Collections:
Other Resources:
XML DTD Validaiton with sax\Writer.java
How to perform XML DTD validation with sax\Writer.java provided in the Apache Xerces package?
✍: FYIcenter
You can perform XML DTD validation with the sax\Writer.java program
provided in the Apache Xerces package as shown below.
Run the sax\Writer.java program with "-v" option to turn on validation. If the input XML file does not meet the requirements of its DTD, you will see validation errors:
\fyicenter\xerces-2_11_0\samples>\fyicenter\jdk-1.8.0\bin\java
-cp .;..\xercesImpl.jar sax.Writer -v UserError.xml
<?xml version="1.0" encoding="UTF-8"?>
<User>
<ID>101</ID>
<Name>Frank Y. Ivy</Name>
[Error] UserError.xml:14:8: The content of element type "User" must match "(ID+,
BirthDate+,Name+,Sex+)".
</User>
The XML file with DTD used in the above test is:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- Copyright (c) 2017 FYIcenter.com -->
<!DOCTYPE User [
<!ELEMENT User (ID+, BirthDate+, Name+, Sex+)>
<!ELEMENT ID (#PCDATA)>
<!ELEMENT BirthDate (#PCDATA)>
<!ELEMENT Name (#PCDATA)>
<!ELEMENT Sex (#PCDATA)>
]>
<User>
<ID>101</ID>
<Name>Frank Y. Ivy</Name>
</User>
⇒ XML Schema Validaiton with sax\Writer.java
⇐ JAR Files Required to Run sax\Writer.java
2017-10-08, ∼4500🔥, 0💬
Popular Posts:
JDK 11 jdk.jlink.jmod is the JMOD file for JDK 11 JLink tool, which can be invoked by the "jlink" co...
itextpdf.jar is a component in iText 5 Java library to provide core functionalities. iText Java libr...
Jetty provides an HTTP server, HTTP client, and javax.servlet container. These components are open s...
What Is log4j-1.2.13.jar? I got the JAR file from logging-log4j-1.2.13.zip .log4j-1.2.13.jar is the ...
SLF4J API is a simple API that allows to plug in any desired logging library at deployment time. Her...