2013年11月18日星期一

reader reads the XML error, seeking answers ?

I shall compile an XML file on the d drive , the name is 1.xml.
code below
Document doc = null;
SAXReader reader = new SAXReader ();
List rowList = null;
File xmlFile = new File (path);
try {
System.out.println (path);
System.out.println ("aaaa");
doc = reader.read (xmlFile) ;/ / sentence error : [Ljava.lang.StackTraceElement; @ 145e044
System.out.println ("bbbb");

I ask, why the incorrect , why can not read , seeking answers to the great God , thank you !
------ Solution ---------------------------------------- ----
you put your complete copy error message come out on the stickers abnormal abnormal
------ Solution --------------- -----------------------------



wrong message to such a point ?
------ Solution ---------------------------------------- ----




Tieshanglai entire bar code stickers you do not just intercepted this point
------ For reference only ---------------- -----------------------
System.out.println (" error :" + e.getStackTrace ()); I use this print error message
becomes the case , error : [Ljava.lang.StackTraceElement; @ 145e044
------ For reference only ----------------- ----------------------
Yes , it's that point
------ For reference only ------- --------------------------------
public void anasXml (String path) {
Document doc = null;
SAXReader reader = new SAXReader ();
List rowList = null;
File xmlFile = new File (path);
try {
System.out.println (path);
System.out.println ("aaaa");
/ / reader.setEncoding ("utf-8");
doc = reader.read (xmlFile);
/ / System.out.println (reader.read (xmlFile));
System.out.println ("bbbb");
rowList = doc.selectNodes ("/ / channel / item");
for (Iterator iter = rowList.iterator (); iter.hasNext () ;) {
/ / obtain specific row element
Element element = (Element) iter.next ();
/ / get a list of all the attributes of the row element
List elementList = element.attributes ();
for (Iterator iter1 = elementList.iterator (); iter1.hasNext () ;) {
/ / each attribute into an abstract property , and then get their names and values
AbstractAttribute aa = (AbstractAttribute) iter1.next ();
System.out.println ("Name:" + aa.getName () + "; Value:" + aa.getValue ());
}
System.out.println (element.getName ());
System.out.println (element.attributeValue ("queryDTO.enterpriseId"));
System.out.println (element.elementText ("width")) ;/ / because there is no , so the output is null.
}

} catch (Exception e) {
System.out.println (" Error :" + e.getStackTrace ());
}
}
------ For reference only ------------------------- --------------
I know why , I have just posted up the web.xml file , you can read the XML file format illustrate my problem , thank you !
------ For reference only -------------------------------------- -



bother to try to use this to output exception e.printStackTrace ();

------ For reference only ---------------------------------- -----


halo you so that you understand what I do not understand

output abnormal use this to try e.printStackTrace ();

没有评论:

发表评论