I'll third the recommendation to use Digester. I needed to parse an XML file for the securityfilter project, and I had not done any XML parsing before so I was expecting it to be a fair amount of work to do. Then I recieved a contributed solution from a member of this list that used Digester. It only took me a few minutes of looking at the code to understand how it worked. Digester is great for the kind of config-file parsing that my project needed. Here's a link to the class that uses Digester to parse the securityfilter config file (see the loadConfig() method for the Digester part): http://tinyurl.com/dj54
Having struggled with some software that used XML for configuration but had no DTD before (what the heck can I specify, and how?), I decided to write a DTD for the config file for my project. I used XML Spy to create the DTD pretty quickly, despite not having any experience with authoring DTDs before. The DTD language has some annoying limitations (which seems to explain why many projects/products don't use a DTD for their config files), but I was able to come up with a DTD that worked for my needs. Now that I had a DTD, Digester could validate it during the parse. Digester also allows you (as the developer of the software that reads the XML file) to register a local copy of the DTD for validation, rather than retrieving it from the internet. You can also turn validation on or off, a feature you may want to allow the users of your project to control. -Max ----- Original Message ----- From: "Navjot Singh" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <[EMAIL PROTECTED]> Sent: Wednesday, June 04, 2003 11:55 PM Subject: RE: Newbie Question:XML parsing > you may wish to see apache digester. > > |-----Original Message----- > |From: Sushil Jain [mailto:[EMAIL PROTECTED] > |Sent: Sunday, June 05, 1994 9:38 AM > |To: Struts Users Mailing List > |Subject: Newbie Question:XML parsing > | > | > |I am new to Struts. I am buiding an application in which I need to > |explicitily read an XML file as Input , and then validate the file itself > |and the fields of the record in it against some rules . Wanted to know if > |Struts provide some mechanism for it or there need to use some parser like > |xerces for it. > |Thanks > |Sushil > | > |>Disclaimer : > |>This message is intended only for the named recipient. If you are not > |>the intended recipient you are notified that disclosing, copying, > |>distributing or taking any action in reliance on the contents of this > |>information is strictly prohibited. > |> > |> > |> > |>--------------------------------------------------------------------- > |>To unsubscribe, e-mail: [EMAIL PROTECTED] > |>For additional commands, e-mail: [EMAIL PROTECTED] > |> > |> > |> > |> > |>--------------------------------------------------------------------- > |>To unsubscribe, e-mail: [EMAIL PROTECTED] > |>For additional commands, e-mail: [EMAIL PROTECTED] > |> > | > |_________________________________________________________________ > |The new MSN 8: smart spam protection and 2 months FREE* > |http://join.msn.com/?page=features/junkmail > | > | > |--------------------------------------------------------------------- > |To unsubscribe, e-mail: [EMAIL PROTECTED] > |For additional commands, e-mail: [EMAIL PROTECTED] > | > | > | > |--------------------------------------------------------------------- > |To unsubscribe, e-mail: [EMAIL PROTECTED] > |For additional commands, e-mail: [EMAIL PROTECTED] > | > | > |--------------------------------------------------------------------- > |To unsubscribe, e-mail: [EMAIL PROTECTED] > |For additional commands, e-mail: [EMAIL PROTECTED] > | > | > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]