Can you save the string you pass in parseText() into file and attach it to e-mail? I copied XML from text of your e-mail and it worked for me...
Filip Jirsák 2008/11/3 Alessio Camaroto <[EMAIL PROTECTED]>: > The XML String it's an XML file valid I'm sure. I use the XML DB Api's to > obtain the files XML and I can only obtain Strings of files XML. > > 2008/11/3 Filip Jirsák <[EMAIL PROTECTED]> >> >> In case you have XML in String it is OK to use >> DocumentHelper.parseText(). The exception you mentioned is probably >> caused by invalid XML "file" -- "<?xml..." (= XML prologue) must start >> at very beginning of String you put into parseText(). >> >> By the way, in case you use XML DB -- there is possibility to obtain >> XML from XML DB as SAX o DOM mostly which is better then using String. >> For example org.xmldb.api.modules.XMLResource class from XMLDB:API >> has getContentAsDOM() and getContentAsSAX() methods. >> >> Filip Jirsák >> >> 2008/11/3 Alessio Camaroto <[EMAIL PROTECTED]>: >> > Sorry but I read a file XML from an XML DB, and It returns to me a >> > String >> > not a file. So what can I do ? >> > >> > 2008/11/3 Filip Jirsák <[EMAIL PROTECTED]> >> >> >> >> Hello, >> >> ii is better to use org.dom4j.io.SAXReader class for XML file parsing. >> >> DocumentHelper.parseText() is only helper method for case you have XML >> >> in memory as String, which is rarely case. >> >> >> >> Anyway, I saved your example into file E:\test.xml and used following >> >> code: >> >> >> >> FileReader reader = new FileReader("E:\\test.xml"); >> >> char[] buf = new char[10240]; >> >> int length = reader.read(buf); >> >> reader.close(); >> >> String xml = new String(buf, 0, length); >> >> System.out.println(xml); >> >> DocumentHelper.parseText(xml); >> >> >> >> It works for me with dom4j 1.6.1, I have no exception. But in you >> >> listing there is "Error on line 2 of document". XML prologue >> >> (<?xml...) must start at the very beginning of file, there can be >> >> only UTF-8 BOM before it, no spaces, no line ends, no white chars. >> >> >> >> Filip Jirsák >> >> >> >> 2008/11/2 Alessio Camaroto <[EMAIL PROTECTED]>: >> >> > I try to parse the follow xml file: >> >> > <?xml version="1.0" standalone="yes"?> >> >> > <OAI-PMH xmlns="http://www.openarchives.org/OAI/2.0/" >> >> > >> >> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >> >> > >> >> > xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/ >> >> > http://www.openarchives.org/OAI/2.0/OAI-PMH.xsd"> >> >> > <responseDate>2008-11-02T15:58:05+01:00</responseDate> >> >> > <request verb="GetRecord" >> >> > >> >> > >> >> > identifier="oai:uni-muenster.de:2599::1-3e33ba6f-1c06-4840-ae8a-4c0511a16bc5" >> >> > >> >> > >> >> > metadataPrefix="oai_dc">http://oai.demo.driver.research-infrastructures.eu/oai</request> >> >> > <GetRecord> >> >> > <record> >> >> > <header> >> >> > >> >> > >> >> > >> >> > <identifier>oai:uni-muenster.de:2599::1-3e33ba6f-1c06-4840-ae8a-4c0511a16bc5</identifier> >> >> > <datestamp>2005-09-07</datestamp> >> >> > <setSpec>1-3e33ba6f-1c06-4840-ae8a-4c0511a16bc5</setSpec> >> >> > </header> >> >> > <metadata> >> >> > <oai_dc:dc >> >> > xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/" >> >> > xmlns:dc="http://purl.org/dc/elements/1.1/" >> >> > xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/ >> >> > http://www.openarchives.org/OAI/2.0/oai_dc.xsd"> >> >> > <dc:creator>Keiner, Iris</dc:creator> >> >> > <dc:title>Mechanismen der Radikalentstehung in >> >> > AR42J-Zellen</dc:title> >> >> > <dc:subject>dk01</dc:subject> >> >> > <dc:subject>610</dc:subject> >> >> > <dc:subject>Signaltransduktion, Pankreatitis, AR42J-Zelle, >> >> > Sauerstoffradikalentstehung, Kalzium, Stickoxid-Radikale</dc:subject> >> >> > <dc:language>deu/ger</dc:language> >> >> > >> >> > >> >> > >> >> > <dc:identifier>http://miami.uni-muenster.de/resolver/urn:nbn:de:hbz:6-85609664301</dc:identifier> >> >> > <dc:publisher/> >> >> > <dc:source/> >> >> > <dc:contributor>Kucharzik, Torsten</dc:contributor> >> >> > <dc:relation/> >> >> > <dc:description>Die akute experimentelle Pankreatitis zeichnet >> >> > sich >> >> > durch einen Anstieg oxidativer Vorgänge aus. Die vorliegenden >> >> > Ergebnisse >> >> > zeigen unterschiedliche Orte der Radikalproduktion in der >> >> > Signaltransduktion >> >> > der AR42J-Zelle auf. Nachdem CCK an seinen Rezeptor gebunden hat, >> >> > kommt >> >> > es >> >> > zur Gi-unabhängigen PKA-Aktivierung. PKA führt zu einer Aktivierung >> >> > der >> >> > PLC >> >> > ß. Das entstehende InsP3 erhöht die cytoplasmatische >> >> > Kalzium-Konzentration, >> >> > was zur Entstehung von Radikalen führt. Es konnte weiterhin gezeigt >> >> > werden, >> >> > dass Bombesin ähnliche Effekte auf die Radikalentstehung hat wie CCK, >> >> > was >> >> > für eine trypsinunabhängige Radikalentstehung spricht. Nach Hemmung >> >> > der >> >> > mitochondrialen gleichzeitig mit der durch Kalzium entstehenden >> >> > Radikale >> >> > wird die CCK-induzierte Radikalentstehung vollends unterbunden. >> >> > Immunhistochemisch konnte nachgewiesen werden, dass es nach >> >> > CCK-Stimulation >> >> > zur DNA-Oxidation kommt, welche durch Anwesenheit von NO Radikalen >> >> > abgeschwächt wird.</dc:description> >> >> > </oai_dc:dc> >> >> > </metadata> >> >> > </record> >> >> > </GetRecord> >> >> > </OAI-PMH> >> >> > >> >> > I use DocumentHelper.parseText(record) but it throws the follow >> >> > exception >> >> > org.dom4j.DocumentException: Error on line 2 of document : The >> >> > processing >> >> > instruction target matching "[xX][mM][lL]" is not allowed. Nested >> >> > exception: >> >> > The processing instruction target matching "[xX][mM][lL]" is not >> >> > allowed. >> >> > >> >> > What's wrong ? >> >> > >> >> > Thanks a lot >> >> > Alessio >> >> > >> >> > >> >> > >> >> > ------------------------------------------------------------------------- >> >> > This SF.Net email is sponsored by the Moblin Your Move Developer's >> >> > challenge >> >> > Build the coolest Linux based applications with Moblin SDK & win >> >> > great >> >> > prizes >> >> > Grand prize is a trip for two to an Open Source event anywhere in the >> >> > world >> >> > http://moblin-contest.org/redirect.php?banner_id=100&url=/ >> >> > _______________________________________________ >> >> > dom4j-user mailing list >> >> > dom4j-user@lists.sourceforge.net >> >> > https://lists.sourceforge.net/lists/listinfo/dom4j-user >> >> > >> >> > >> >> >> >> >> >> >> >> -- >> >> Filip Jirsák >> >> [EMAIL PROTECTED] >> > >> > >> >> >> >> -- >> Filip Jirsák >> [EMAIL PROTECTED] > > -- Filip Jirsák [EMAIL PROTECTED] ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ dom4j-user mailing list dom4j-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dom4j-user