Hello! I copy/pasted the part below from and older thread because I now have the same problem. I am using the following piece of code:
SAXReader sreader = new SAXReader(); sreader.setDocumentFactory(DatatypeDocumentFactory.getInstance()); sreader.setValidation(true); org.dom4j.Document dom4jDoc = null; try{ dom4jDoc = sreader.read(fname); }catch(Exception e){System.out.println("[Exception]:"+e);} org.dom4j.Element root = dom4jDoc.getRootElement(); Object obj = ((org.dom4j.Element)root.selectSingleNode("/fl:flowchart_root/fl:sequence/fl:task/fl:task_input_params/ fl:in_param/value")).getData(); where the corresponding node in the xml for this xpath is <fl:in_param><value xsi:type="xs:int">1</value></fl:in_param> obj gets the value 1 but as a string. Do you have any idea why? Florian, have you solved your problem? Please help! Thanx -stam ------------------------------------------------------- Sorry, I missed the Schema comment. How are you reading in the schema? Which Document class did you use? It would help if you sent a snippet of code as to how you read in the XML Schema. My guess is that it ended up with the standard DocumentFactory. DatatypeElement is extended from DefaultElement, so the instance you have apparently is not a DatatypeElement. Check and make sure the read looks something like this: SAXReader reader = new SAXReader(); reader.setDocumentFactory( DatatypeDocumentFactory.getInstance() ); Document doc = reader.read(xmlFile); Try that. ;-) Dave Florian Georg wrote: Hi, hmmm ... getData() just returns the same as getText(). My problem is, that I only have a Document with elements containing a 'type'-attribute, which contains names of (simple) Schema datatypes (int,long,date,....) .. e.g. Element <field type="xsd:int">12345</field> should map to an java.lang.Integer(not String!) with the value 12345 - or throw an Exception if the mapping couldn't be performed. (think of a method like "Object mapElementToObject (Element element)") I thought dom4j would perhaps provide necessary mappers/wrappers to do the mapping in a simple manner. ------------------------------------------------------- This SF.Net email sponsored by: Parasoft Error proof Web apps, automate testing & more. Download & eval WebKing and get a free book. www.parasoft.com/bulletproofapps _______________________________________________ dom4j-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/dom4j-user