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:
Parsing Flow of XML Document with DTD Declarations
How to show the parsing flow of XML documents with DTD declarations?
✍: FYIcenter
You can show the parsing flow of XML documents with DTD declarations
with the sax\DocumentTracer.java program
provided in the Apache Xerces package as shown below.
Compile and run sax\DocumentTracer.java program on the sample XML file UserDTD.xml:
\fyicenter\xerces-2_11_0\samples>\fyicenter\jdk-1.8.0\bin\java
-cp .;..\xercesImpl.jar sax.DocumentTracer UserDTD.xml
setDocumentLocator(locator=org.apache.xerces.parsers.AbstractSAXParser$LocatorPr
oxy@69663380)
startDocument()
comment(text=" Copyright (c) 2017 FYIcenter.com ")
startDTD(name="User",publicId=null,systemId=null)
elementDecl(name="User",contentModel="(ID,BirthDate,Name,Sex)")
elementDecl(name="ID",contentModel="(#PCDATA)")
elementDecl(name="BirthDate",contentModel="(#PCDATA)")
elementDecl(name="Name",contentModel="(#PCDATA)")
elementDecl(name="Sex",contentModel="(#PCDATA)")
endDTD()
startElement(uri="",localName="User",qname="User",attributes={})
ignorableWhitespace(text="\n ")
startElement(uri="",localName="ID",qname="ID",attributes={})
characters(text="101")
endElement(uri="",localName="ID",qname="ID")
ignorableWhitespace(text="\n ")
startElement(uri="",localName="BirthDate",qname="BirthDate",attributes={})
characters(text="1970-01-01+00:01")
endElement(uri="",localName="BirthDate",qname="BirthDate")
ignorableWhitespace(text="\n ")
startElement(uri="",localName="Name",qname="Name",attributes={})
characters(text="Frank Y. Ivy")
endElement(uri="",localName="Name",qname="Name")
ignorableWhitespace(text="\n ")
startElement(uri="",localName="Sex",qname="Sex",attributes={})
characters(text=" Male")
endElement(uri="",localName="Sex",qname="Sex")
ignorableWhitespace(text="\n")
endElement(uri="",localName="User",qname="User")
endDocument()
⇒ Using Apache Xerces JAXP Sample Programs
⇐ Show XML Parsing Flow with sax\DocumentTracer.java
2017-07-30, ∼1861🔥, 0💬
Popular Posts:
Where Can I see Java Source Code files for Xerces Java 2.11.2? Here are Java Source Code files for X...
MP3SPI is a Java Service Provider Interface that adds MP3 (MPEG 1/2/2.5 Layer 1/2/3) audio format su...
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 ...
maven-model-builder-3.5. 4.jaris the JAR file for Apache Maven 3.5.4 Model Builder module. Apache Ma...
Where to find answers to frequently asked questions on Downloading and Installing ojdbc.jar - JDBC D...