  | Mailing List | | Home | | Forum Home | | JBoss - Java Application Server | | Tomcat - JSP/Servlet container | | Struts - A MVC web framework | | iText - An open source PDF Java Library | | JDOM - JDOM XML Parser | | JSP - A mailing list about Java Server Pages specification and reference | | J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition | | J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog | | Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology | |
Struts & Hibernate
|
|
|
  | | | Reading files without a DTD | Reading files without a DTD 2006-06-20 - By Dmitriy Viner
Back I'm trying to traverse a well-formed files without a dtd. I'm not validating any files. I have it explicitly turned off. Files between 10k and 10M go through without any problems. However once the file becomes 20M I'm getting this exception from exactly the same code that reads smaller files without any problems: parser = new SAXBuilder(); document = parser.build("file.xml"); String:org.jdom.input.JDOMParseException: Error on line 1 of document file:// /C:/samples/file.xml: cvc-elt.1: Cannot find the declaration of element 'astg'. Message:Error on line 1 of document file:///C:/samples/file.xml: cvc-elt.1: Cannot find the declaration of element 'astg'. Java Result: 1 File file.xml is just well formed file with a root tag astg and structure that looks exactly like this: <astg> <element1/> <element2/> ...... </astg> If I add a DOCTYPE statement and a dummy dtd the file goes right through. <?xml version="1.0" encoding="UTF-8 (See http://UTF-8.ora-code.com)"?> <!DOCTYPE astg SYSTEM "vlr.dtd" [ ]> <astg> <element1/> <element2/> ...... </astg> astg.dtd <?aptxml version="1.0" encoding="utf-8 (See http://utf-8.ora-code.com)"?> <!ELEMENT astg (#PCDATA)> Do you guys have any idea what is possible cause of the exception? Regards, DV
-- ---- ---- ---- ---- ---- ----- Sneak preview the all-new Yahoo.com. It's not radically different. Just radically better. <div><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">I'm trying to traverse a well-formed files without a dtd. I'm not validating any files. I have it explicitly turned off. Files between 10k and 10M go through without any problems. However once the file becomes 20M I'm getting this exception from exactly the same code that reads smaller files without any problems:<?xml:namespace prefix = o ns = "urn:schemas -microsoft-com:office:office" /><o:p></o:p></SPAN></div> <div><SPAN style="FONT -SIZE: 10pt; FONT-FAMILY: Arial"> <o:p></o:p></SPAN></div> <div><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"> parser = new SAXBuilder();<o :p></o:p></SPAN></div> <div><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"> document = parser.build("file.xml"); <o:p></o:p></SPAN></div> <div><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"> <o:p></o:p></SPAN></div> <div><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">String:org.jdom.input.JDOMParseException: Error on line 1 of document <A href="file:///C:/samples/file.xml">file:///C:/samples/file.xml</A>: cvc-elt.1 : Cannot find the declaration of element 'astg'.<BR>Message:Error on line 1 of document <A href="file:///C:/samples/file.xml">file:///C:/samples/file.xml</A>: cvc-elt.1: Cannot find the declaration of element 'astg'.<BR>Java Result: 1<o:p ></o:p></SPAN></div> <div><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"> <o:p></o:p></SPAN></div> <div><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">File file.xml is just well formed file with a root tag astg and structure that looks exactly like this:</SPAN></div> <div><SPAN style="FONT -SIZE: 10pt; FONT-FAMILY: Arial"><o:p></o:p></SPAN> </div> <div><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"><astg><o:p></o:p></SPAN></div > <div><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"> <element1/> <element2/> ......<o:p></o:p></SPAN></div> <div><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"></astg><o:p></o:p></SPAN></div> <div><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"><BR> <o:p></o:p></SPAN></div> <div><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">If I add a DOCTYPE statement and a dummy dtd the file goes right through. <o:p></o:p></SPAN> </div> <div><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"> <o:p></o:p> </SPAN></div> <div><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"><?xml version="1.0" encoding="UTF-8 (See http://UTF-8.ora-code.com)"?><BR><!DOCTYPE astg SYSTEM "vlr.dtd" [<BR> ]><o:p></o:p></SPAN></div> <div><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"><astg><o:p></o:p></SPAN></div> <div><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"> < ;element1/> <element2/> ......<o:p></o:p></SPAN></div> <div><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"></astg><o:p></o:p></SPAN></div> <div><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"> <o:p></o:p></SPAN></div> <div><SPAN style= "FONT-SIZE: 10pt; FONT-FAMILY: Arial">astg.dtd<o:p></o:p></SPAN></div> <div> <SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"><?aptxml version="1.0" encoding="utf-8 (See http://utf-8.ora-code.com)"?><BR><!ELEMENT astg (#PCDATA)><o:p></o:p></SPAN></div > <div class=MsoNormal style="MARGIN: 0in 0in 0pt"><o:p><STRONG><FONT face= "Times New Roman" size=3> </FONT></STRONG></o:p></div> <div class =MsoNormal style="MARGIN: 0in 0in 0pt"><STRONG><FONT face="Times New Roman" size =3>Do you guys have any idea what is possible cause of the exception?</FONT>< /STRONG></div> <div class=MsoNormal style="MARGIN: 0in 0in 0pt"><o:p><STRONG> <FONT face="Times New Roman" size=3> </FONT></STRONG></o:p></div> <div class=MsoNormal style="MARGIN: 0in 0in 0pt"><STRONG><FONT face="Times New Roman " size=3>Regards,</FONT></STRONG></div> <div class=MsoNormal style="MARGIN: 0in 0in 0pt"><STRONG><FONT size=3><FONT face="Times New Roman" >DV<o:p></o:p></FONT></FONT></STRONG></div> <div> </div><p>  <hr size=1>Sneak preview the <a href="http://us.rd.yahoo.com/evt=40762/*http: //www.yahoo.com/preview"> all-new Yahoo.com</a>. It's not radically different. Just radically better.
__ ____ ____ ____ ____ ____ ____ ____ ____ ____ To control your jdom-interest membership: http://www.jdom.org/mailman/options/jdom-interest/youraddr@(protected)
|
|
 |