i need to read a dynamic xml file from java code.. i have googled it but got only code for static xml parsing...can any one help in this regard...thanking you in advance.
hi,
All code online would be according to your defination, "static"
This is because usually a parser has an idea about the grammar
The apis mentioned will allow you to access the elements of an xml file
so say, you have the following:
and :
When you parse this with SAX,
you will come across document start eg: root
and for every tag, you will read the element start eg: name/userId
then you will read the chars within it eg: "salvin" / "java"
Now its up to you to write logic for them.
Without logic, its only known that A contains B.
also note that the example I have written is "flat" and usually xml contains nested data within tags...
So here, your code should expect that "site" is a parent for a series of elements including "name","desc","url"
also note the attributes "isMultiline" and "openInNewWindow"
what would you expect the code to do in the given xml example ?