• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how to define data types in xml document

 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
I worte an application in java to retrieve data from xml and insert that data in to the database.
Here I got the problem with datatatypes.
Now I would like to know whether it is possible to know the data types from xml document
Thank u in advance
Saradhi
 
Sheriff
Posts: 5782
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nope it is not possible. Everything in the XML is interpreted as plain text data. You will have to write an intelligent routine to infer the datatypes during the parsing. One way to do it is to store column descriptions for a particular table and during the XML parsing simply look up the datatype for that particular column.
Or you can have an attirbute called type and store types as string values. For example -
< EmployeeName type = "String">
David Copperfield
</EmployeeName>
<EmployeeSalary type = "Number">
200200.90
</EmployeeSalary>
<EmployeeDateJoined type = "DateTime">
05/15/1993
</EmployeeDateJoined>

Hope that helps!
------------------
Ajith Kallambella M.
Sun Certified Programmer for the Java�2 Platform.
IBM Certified Developer - XML and Related Technologies, V1.
 
reply
    Bookmark Topic Watch Topic
  • New Topic