• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

writing xml given XPATH

 
Ramesh Y Patil
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 Y Patil
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13073
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic