Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Create New XML Document using XPATH

 
sam kulkarni
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

Is it possible to create new xml document using XPATH.
Also, if any other approach is welcome

I have a String Array describing the node where we have to populate and a csv of data.
e.g. {"/root/parent1/child1/leafnodedata","/root/parent1/child1/leafnodedata2","/root/parent1/leafnodedata3"} this way

CSV :
data1,data2,data3
abc,xyz,pqr

Thanks
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, XPath is for extracting information from XML documents.

You can create XML using any number of APIs (DOM, JDOM, dom4j, XOM, etc.)
 
sam kulkarni
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a ton for a quick reply!

Also, please let me know if any one has any other approach to convert an csv to xml using String array headers in Java as mentioned in my 1st post.

Thanks!
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13058
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You might find something useful in the Servingxml toolkit. It can do a lot with flat file input and that site has extensive examples.

I'm curious - how did you end up with this String[] as a description of the desired XML output format?

Bill
 
sam kulkarni
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Bill,
Thanks for the reply.
I also have an xsd using which i can populate java objects.But as it is a multilevel xml finding difficult to populate java objects.
But in one of the sites(ricebridge.com) i checked that using String [] as meta data we can populate xml file using csv manager etc.
So i thought whether there is any freeware available on the similar lines.


Thanks.
 
Jimmy Clark
Ranch Hand
Posts: 2187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Eclipse Modeling Framework makes it relatively easy to create Java-based data objects based on an XML schema. Moreover, the code-generation capabilities are very sound and enable developers to focus on business requirements instead of hand-writing code with low-level API, e.g. DOM, SAX, XSLT, etc.
 
sam kulkarni
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply.
I am new to this site and started liking this very much!
Hats off!!
By the way.
The problem i am facing is to populate complex Java Objects reading csv using which i can populate xml using some thing like JAXB etc.
I tried using Super Csv but i am unable to use that for Complex Java Objects.
Need Help!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic