[
Lists Home |
Date Index |
Thread Index
]
Hi All,
I have written a Java application which simply parses the given XML file.
But now I want to turn the validation ON, so that it will validate the XML
document against the specified DTD within the DOCTYPE declaration. Here is
my code:
DOMParser parser = new DOMParser();
try
{
parser.setFeature("http://xml.org/sax/features/validation", true);
if(debugSwitch)
{
String[] temp = parser.getFeaturesRecognized();
for(int i=0; i<temp.length; i++)
System.out.println(temp[i]);
}
parser.parse(xmlFile);
doc = parser.getDocument();
But even when I define an element which is not specified in the DTD it is
parsing the XML file without any errors. I am going crazy. Please help me
out.
BEGIN:VCARD
VERSION:2.1
N:AVRS;Rajesh
FN:Rajesh AVRS
ORG:Wipro Technologies;EAI
TITLE:Programmer
TEL;WORK;VOICE:8520416 Ex: 6478
ADR;WORK;ENCODING=QUOTED-PRINTABLE:;;6th Tower,=0D=0A1st Floor, C Wing,=0D=0AECity-2;Bangalore;Karnataka;560001=
;India
LABEL;WORK;ENCODING=QUOTED-PRINTABLE:6th Tower,=0D=0A1st Floor, C Wing,=0D=0AECity-2=0D=0ABangalore, Karnataka 56=
0001=0D=0AIndia
ADR;HOME;ENCODING=QUOTED-PRINTABLE:;;1/1, Ashraya,=0D=0AAnjaneya Temple Road,=0D=0A3rd Cross,=0D=0ANagasandra;B=
angalore;Karnataka;560032;India
LABEL;HOME;ENCODING=QUOTED-PRINTABLE:1/1, Ashraya,=0D=0AAnjaneya Temple Road,=0D=0A3rd Cross,=0D=0ANagasandra=0D=
=0ABangalore, Karnataka 560032=0D=0AIndia
X-WAB-GENDER:2
URL;HOME:http://www.rajesh-avrs.com
URL;WORK:http://www.wipro.com
BDAY:20000331
EMAIL;PREF;INTERNET:rajesh.ram@wipro.com
REV:20020122T041335Z
END:VCARD
-----------------------------------------------------------------------------------------------------------------------
Information transmitted by this E-MAIL is proprietary to Wipro and/or its Customers and
is intended for use only by the individual or entity to which it is
addressed, and may contain information that is privileged, confidential or
exempt from disclosure under applicable law. If you are not the intended
recipient or it appears that this mail has been forwarded to you without
proper authority, you are notified that any use or dissemination of this
information in any manner is strictly prohibited. In such cases, please
notify us immediately at mailto:mailadmin@wipro.com and delete this mail
from your records.
------------------------------------------------------------------------------------------------------------------------
|