Results 1 to 5 of 5
Thread: JAVA and XML Problem
- 11-18-2008, 02:03 AM #1
Member
- Join Date
- Jun 2008
- Posts
- 5
- Rep Power
- 0
JAVA and XML Problem
Hi,
I have a really big XML to handle (around 5000 lines).
Basically I need to read it and pass the data to UI.
It has a lot of tags and most of them have attributes.
The problem is I need to pass tag names, attribute names etc... to get the data.
If it were a small XML, i could have done it by passing the tag names and attributes names.
Now, I want to know if i can just do something like get the root tag , get its name, check if it has children, if yes then get the tag names and text. Check if the tags have attributes. If yes, get their name and values, and so on. I can then put the tag names, tag values , attribute names, attribute values and the text values in a collection class along with the tags heirarchy wrt the root tag(0 for root, 1 for root's children, 2 for its grandchildren...) and pass it to the UI.
Is there a way to do this?
Thanks in advance
Praveen
- 01-19-2009, 02:36 PM #2
Member
- Join Date
- Jan 2009
- Posts
- 14
- Rep Power
- 0
xml parsing through all the elements
Hi ,
You can parse (using dom4j) the xml file each element and loop throgh all child elements like ......
Element result = (Element) document.getRootElement();
List resultElements = result.elements();
if (resultElements != null && resultElements.size() != 0) {
for (int i = 0; i < resultElements.size(); i++) {
oneChiled= (Element) resultElements.get(i);
etc....
}
You try to store all the elements received in a collection.
- 02-06-2009, 05:15 AM #3
Member
- Join Date
- Jul 2008
- Location
- india
- Posts
- 35
- Rep Power
- 0
JAVA Supports parser DOM to parse the xml ...
- 02-22-2009, 08:14 PM #4
Member
- Join Date
- Feb 2009
- Posts
- 2
- Rep Power
- 0
buddy i am creating a svg generator and have developed an gui but svg data is stored in xml format can any one help me out here
- 02-22-2009, 08:28 PM #5
Member
- Join Date
- Feb 2009
- Posts
- 2
- Rep Power
- 0
help please urgently
hi guys,
i am crating a image developer whose image is stored in xml format i.e. basically a SVG creator, i have developed a basic model but i am unable to save those document in x,l format because i dont know how to use parsers of dom and basic XML component with java.
can any one help me i am in real trouble
Similar Threads
-
Java problem
By grend in forum New To JavaReplies: 5Last Post: 08-18-2008, 11:44 PM -
Problem in java
By saytri in forum New To JavaReplies: 4Last Post: 01-16-2008, 10:09 PM -
Problem in java
By saytri in forum New To JavaReplies: 6Last Post: 01-09-2008, 04:13 PM -
JAVA if problem
By toby in forum New To JavaReplies: 2Last Post: 07-25-2007, 07:58 PM -
java SE 6 problem
By techlance in forum Java AppletsReplies: 1Last Post: 06-28-2007, 10:10 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks