Re: [OT] Newbie Question:XML parsing

2003-06-05 Thread Max Cooper
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]



RE: Newbie Question:XML parsing

2003-06-05 Thread shirishchandra.sakhare
If you want to just read the file and validate it against some rules, then may be you 
need to write a dtd/schema for the file and just read teh file using xerces or some 
other parser while setting the validate feature true...That is simple and easy..Apart 
from writting the xml schema /dtd part..:-))

But if you need to populate java objects from the xml file contents, have a look at 
Castor.It eliminates the need to know jaxp at all..

If you need any more help,let me know.

regards,
Shirish

-Original Message-
From: Andrew Hill [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 05, 2003 6:25 AM
To: Struts Users Mailing List
Subject: RE: Newbie Question:XML parsing


Nah, thats really a job for your parser.
Struts does come with a marvellous thing called "Digester" (which is part of
the commons project) but thats used for creating objects (usually for
configuration (its used in struts to process struts-config)) so is probably
not applicable to what your trying to do. (Digester itself uses whatever
parser is available to do the underlying xml parsing)

btw: Try and use the jaxp api if you can, then you wont be tying yourself to
any particular parser implementation so if you later decide to use a
different parser than xerces you can.

-Original Message-
From: Sushil Jain [mailto:[EMAIL PROTECTED]
Sent: Sunday, 5 June 1994 12:08
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]



RE: Newbie Question:XML parsing

2003-06-05 Thread Navjot Singh
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]



RE: Newbie Question:XML parsing

2003-06-05 Thread Andrew Hill
Nah, thats really a job for your parser.
Struts does come with a marvellous thing called "Digester" (which is part of
the commons project) but thats used for creating objects (usually for
configuration (its used in struts to process struts-config)) so is probably
not applicable to what your trying to do. (Digester itself uses whatever
parser is available to do the underlying xml parsing)

btw: Try and use the jaxp api if you can, then you wont be tying yourself to
any particular parser implementation so if you later decide to use a
different parser than xerces you can.

-Original Message-
From: Sushil Jain [mailto:[EMAIL PROTECTED]
Sent: Sunday, 5 June 1994 12:08
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]



Newbie Question:XML parsing

2003-06-04 Thread Sushil Jain
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]