I have some rules with xquery language that create some parts of ouput xml (ofcourse these rules are complex and I couldnt map them in easy way ), I convert output schema to JAXB Objects then I want read output xml that generated with xquery and populate JAXB Objects . finally I marshall the Objects and create ouput xml .
beacuse of this process , I cant does it with xslt completely , I use it in rules and generate parts of output xml and I have to place them according to output schema , I try to do it with DOM , read output schema with dom and create output xml but in this way I must know output schema that it isnt my goal.
if you have any idea please help me.
--- On Sat, 10/4/08, Wolfgang Laun <wolfgang.laun_at_gmail.com> wrote:
> From: Wolfgang Laun <wolfgang.laun_at_gmail.com>
> Subject: Re: How to fill dynamically JAXB java objects
> To: users_at_jaxb.dev.java.net
> Date: Saturday, October 4, 2008, 2:18 AM
> I understand that you have an input.xml (XML data), perhaps
> also an
> input.xsd (an XML schema) and and output.xsd (schema) and
> that
> "mapper" should produce some output.xml.
>
> - Are you sure that this isn't something you want to
> solve with XSLT?
> - How do you define the mapping between the input content
> tree and the
> output content tree?
>
> If your mapper "knows nothing about schemas" then
> it won't be able to
> produce the desired output. It'll have to know very
> much about
> schemas, perhaps even parse and interpret them.
>
> Anyway, I don't see that this is anything where JAXB
> would help you
> much, except, perhaps, for parsing the input XML, given
> that you have
> a schema for the input side.
>
>
> On Sat, Oct 4, 2008 at 8:32 AM, maliheh shariat
> <malsh20_at_yahoo.com> wrote:
> > I have to instantiate and populate that objects
> dynamiccaly, beacuse I 'm writing "Mapper
> project" , that gets output schemas and data xml as
> input then create new xml according to output schema , now I
> have to read output schemas (those objects) dynamically ,
> beacuse this project must be able to map any schemas without
> konwing anything about schemas , then populate them and
> finally marshal them in output xml .
> >
> >
> >
> >
> > --- On Tue, 9/30/08, Wolfgang Laun
> <wolfgang.laun_at_gmail.com> wrote:
> >
> >> From: Wolfgang Laun
> <wolfgang.laun_at_gmail.com>
> >> Subject: Re: How to fill dynamically JAXB java
> objects
> >> To: users_at_jaxb.dev.java.net
> >> Date: Tuesday, September 30, 2008, 3:11 AM
> >> You may be able to create an object from one of
> the JAXB
> >> generated
> >> classes by calling clazz.newInstance() after clazz
> =
> >> Class.forName(
> >> "..." ), but what then? I cannot imagine
> that
> >> you'll be able to
> >> provide meaningful data for these objects, just
> using
> >> reflection. And,
> >> even you could do so, what could you do with this
> object?
> >>
> >> Why do you think that you have to do this
> "dynamic
> >> element creation"?
> >>
> >> There is, of course, the possibility of inspecting
> (by
> >> reading the
> >> JAXB generated annotations) the generated Java
> classes.
> >> This will tell
> >> you which class(es) is (are) XML root elements,
> and the
> >> sub-elements
> >> and attributes of these elements as well. Then,
> you could
> >> inspect the
> >> sub-elements, etc. This is very similar to what
> JAXB itself
> >> does to
> >> learn about the bound XML structure, but this is
> quite
> >> complex. (And,
> >> once more, where would the data for the XML
> elements come
> >> from?)
> >> -W
> >>
> >> On Tue, Sep 30, 2008 at 7:48 AM, maliheh shariat
> >> <malsh20_at_yahoo.com> wrote:
> >> > Yes I mean the regular way is instantiate
> from jaxb
> >> objects and call setter methods but I want to
> instantiate
> >> and call setter methods in dynamically (I mean
> without I
> >> know the name of object I loop in jaxb objects ,
> instantiate
> >> it and setting their methods), I know that I must
> use
> >> class.forname but I have to know the root element
> for
> >> setting another elements in it .
> >> > do you have any suggestion or better way for
> doing
> >> this for me ?
> >> >
> >> > Thanks for your attention.
> >> >
> >> > Shariat
> >> >
> >> > --- On Mon, 9/29/08, Wolfgang Laun
> >> <wolfgang.laun_at_gmail.com> wrote:
> >> >
> >> >> From: Wolfgang Laun
> >> <wolfgang.laun_at_gmail.com>
> >> >> Subject: Re: How to fill dynamically JAXB
> java
> >> objects
> >> >> To: users_at_jaxb.dev.java.net
> >> >> Date: Monday, September 29, 2008, 3:31 AM
> >> >> What do you mean by "fixed way"
> and what
> >> by
> >> >> "fill dynamically"? Perhaps you
> >> >> post a Java code snippet of what you call
> >> "fixed
> >> >> way".
> >> >>
> >> >> Generally speaking, you create an object
> by a call
> >> to one
> >> >> of the methods in
> >> >> some JAXB generated ObjectFactory class
> >> >> ("createSomeElement") and then
> you
> >> >> call the methods setThisSubElement( ... )
> and
> >> >> setTahtAttribute( ... ) of the
> >> >> newly generated object. Except for the
> root
> >> element, all of
> >> >> these created
> >> >> objects have to be entered with setter
> methods as
> >> >> sub-elements of their
> >> >> parent elements.
> >> >>
> >> >>
> >> >> On Sat, Sep 27, 2008 at 9:24 AM, maliheh
> shariat
> >> >> <malsh20_at_yahoo.com> wrote:
> >> >>
> >> >> > Hi Friends
> >> >> >
> >> >> > I created Jaxb java classes and now
> I want to
> >> fill
> >> >> them dynamically , but I
> >> >> > dont know how I can dynamically fill
> JAXB
> >> java objects
> >> >> (I can do it in fix
> >> >> > way) ,I must say that their data are
> in xml
> >> file to
> >> >> fill java objects ,
> >> >> > please help me.
> >> >> >
> >> >> > Thanks alot
> >> >> >
> >> >> > Shariat
> >> >> >
> >> >> >
> >> >> >
> >> >> >
> >> >> >
> >> >>
> >>
> ---------------------------------------------------------------------
> >> >> > To unsubscribe, e-mail:
> >> >> users-unsubscribe_at_jaxb.dev.java.net
> >> >> > For additional commands, e-mail:
> >> >> users-help_at_jaxb.dev.java.net
> >> >> >
> >> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >>
> ---------------------------------------------------------------------
> >> > To unsubscribe, e-mail:
> >> users-unsubscribe_at_jaxb.dev.java.net
> >> > For additional commands, e-mail:
> >> users-help_at_jaxb.dev.java.net
> >> >
> >> >
> >>
> >>
> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail:
> users-unsubscribe_at_jaxb.dev.java.net
> >> For additional commands, e-mail:
> >> users-help_at_jaxb.dev.java.net
> >
> >
> >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> users-unsubscribe_at_jaxb.dev.java.net
> > For additional commands, e-mail:
> users-help_at_jaxb.dev.java.net
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> For additional commands, e-mail:
> users-help_at_jaxb.dev.java.net