You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ashish Kulkarni <ku...@yahoo.com> on 2003/11/03 21:58:39 UTC

[OT] create XML based on DTD from resultset on fly

Hi,
i have designed a DTD for my XML file, now i want to
genereate a XML file based on this DTD on the fly,
I will run a SQL querry, which will return me a result
set, i want to create XML file from this resultset, 
and i dont want to write it to a file, i want to just
create a XML file so can be used for further
processing,
I have to create a PDF file from this XML and i have
already desinged a XSLT for converting this XML to
PDF.
So my flow would be

                DTD                    XSLT
                 |                       |
                 |                       | 
                 v                       v  
resultset -->create XML on fly ---> xslt process
-->pdf

Any suggestions or code
Ashish

__________________________________
Do you Yahoo!?
Exclusive Video Premiere - Britney Spears
http://launch.yahoo.com/promos/britneyspears/

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: [OT] create XML based on DTD from resultset on fly

Posted by Adam Hardy <ah...@cyberspaceroad.com>.
On 11/03/2003 09:58 PM Ashish Kulkarni wrote:
> Hi,
> i have designed a DTD for my XML file, now i want to
> genereate a XML file based on this DTD on the fly,
> I will run a SQL querry, which will return me a result
> set, i want to create XML file from this resultset, 
> and i dont want to write it to a file, i want to just
> create a XML file so can be used for further
> processing,

Hi Ashish,
check out JAXB xml data binding from Sun. It will definitely do what you 
want, but it might be a bit over the top for your needs.

JAXB has a run-once class-generator which generates a bunch of java 
class based on your DTD. You then incorporate the classes into your 
project at design time. Then at runtime you put the data from the 
resultset into them, and then send the root node object to the 
Marshaller to create the XML. (Or is it the Unmarshaller - I always get 
it confused).

Adam

-- 
struts 1.1 + tomcat 5.0.12 + java 1.4.2
Linux 2.4.20 RH9

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org