This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes Create New XML Document using XPATH Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Create New XML Document using XPATH" Watch "Create New XML Document using XPATH" New topic
Author

Create New XML Document using XPATH

sam kulkarni
Greenhorn

Joined: Mar 18, 2011
Posts: 12
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
Marshal

Joined: Mar 22, 2005
Posts: 42033
    
  64
No, XPath is for extracting information from XML documents.

You can create XML using any number of APIs (DOM, JDOM, dom4j, XOM, etc.)


Ping & DNS - my free Android networking tools app
sam kulkarni
Greenhorn

Joined: Mar 18, 2011
Posts: 12
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

Joined: Mar 22, 2000
Posts: 12791
    
    5
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

Joined: Mar 18, 2011
Posts: 12
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

Joined: Apr 16, 2008
Posts: 2187
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

Joined: Mar 18, 2011
Posts: 12
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!
 
GeeCON Prague 2014
 
subject: Create New XML Document using XPATH