This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have Dawn & David Griffiths on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes XML extract unknown Tag Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "XML extract unknown Tag" Watch "XML extract unknown Tag" New topic
Author

XML extract unknown Tag

Gorge Stephens
Greenhorn

Joined: Feb 14, 2011
Posts: 2
Hello all,

I quite a beginner with XML and I don't understand how to retrieve an unknown tag. Below is a small sample.

I am able to pull out most of the information that I need however I don't have any idea how to pull out the tag names that I won't know ahead of time.

In the sample below I want to get "fields" and "tos" extracted with the data (old and new) but I won't know their names to put in the xsl. Is this possible to do?

Thanks for any help.

George


Paul Clapham
Sheriff

Joined: Oct 14, 2005
Posts: 19686
    
  10

It isn't going to be possible to do something which you can't describe. That's a basic rule of programming.

It's quite possible you will be able to do what needs to be done, but first you have to describe what needs to be done. I don't see any such description in your post. So, your first step is to describe the requirements. If the element names are unpredictable then that's the way it is, and you'll have to get a description of the requirements which doesn't use element names.
Gorge Stephens
Greenhorn

Joined: Feb 14, 2011
Posts: 2
Thanks for taking the time to reply. I think I get your meaning here.

Best regards,

George
Paul Clapham
Sheriff

Joined: Oct 14, 2005
Posts: 19686
    
  10

That's good. You can do lots of things with XSLT. If you run into problems when you start implementing your proposed solution, the Ranch is here to help you.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: XML extract unknown Tag
 
It's not a secret anymore!