From XML into program variables: seek suggestions
I'm trying to read in and parse an XML file, with the object of being able to select an element by using its ID, and then put the various child element values into appropriate program structure or, in this case, Java object member variables, with the eventual intention of displaying them with Swing. I'm not sure of a good approach for this. I've tried getElementById, but what it returns is just the node identified by the ID attribute, and then it's up to me (the program) to walk the child elements and pick out the text appropriately. This seems a little too inflexible, and I'm wondering if there's a better approach. Parsing using a stylesheet might be good, but
1) is it very efficient? (Maybe I should not worry about this)
2) How do I get the results of the stylesheet into the Java variables? Read them from a Result object? If so, what kind of Result object?
Is there another, better approach? I'm having a hard time knowing which way to go here.
And last: is there another forum to which I should post this question?
Thanks for any help in advance.
|