my dog learned polymorphism*
The moose likes XML and Related Technologies and the fly likes writing xml given 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 "writing xml given XPATH" Watch "writing xml given XPATH" New topic
Author

writing xml given XPATH

Ramesh Patil
Greenhorn

Joined: Aug 09, 2004
Posts: 17
Hi,

Given that I have the xml schema, a value of an element and its xpath, can I create a XML file using JDOM. Please let me know if you have any information.

Thanks
Ramesh
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18570
    
    8

So you have:

1. A schema which describes what the XML file is going to look like

2. The value of some element (whatever that means) which is going to be in the XML file

3. An XPath expression that describes where that element is going to appear in the XML file.

Is that correct? In general I would say that you don't have enough information to create the XML file based on a single element, but there could be simple situations where you do.
Ramesh Patil
Greenhorn

Joined: Aug 09, 2004
Posts: 17
Yes Paul. That is the information that I have. The xpath gives us the location or say map to get to the node I need to populate. The xml does not need to be well formed.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12792
    
    5
I can't see how you can create a complete XML document with only the value of one element plus the schema unless it is a really simple schema. How could you populate all the other elements with values?

Why are you only considering JDOM?

Bill
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18570
    
    8

Originally posted by Ramesh Patil:
Yes Paul. That is the information that I have.
Well, now I'm surprised. I was sure the answer was going to be "no, you don't understand, here are the real requirements." I expect that either those aren't the real requirements, and you misunderstood something, or else the person who made up those requirements doesn't understand something.
 
GeeCON Prague 2014
 
subject: writing xml given XPATH