Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > developing for something that isn't there..

Reply
Thread Tools

developing for something that isn't there..

 
 
Elhanan
Guest
Posts: n/a
 
      01-10-2007
hi..

i've been taksed to create a framework that would read a complex xml
(do NOT say data-binding) and use the data to populate a java bean
tree..

problem that java bean tree has not been built yet.

i do have a concept of what to pull from the xml, what elements to read
in what order, what data to get from it. so i was thinking to create a
class that does so, but for every element (or chunk of data) pulled use
and interface to send messages about them (sorta like sax) the classes
which willl implement said interface, will get this data and build the
tree..

i was thinking that the messages will not contain an xml element itself
but rather 'convertes' as arguments.
the converted will implement an interface, that for now will simply
return another xml more formated. (just to see if my parsing works) but
will be replaced with another implmentation that will create an actuall
class.

i don't know exactly how tdd this as i don't even know the interfaces
of tree i just know my side, i don't even know if i'm on the right
path..

 
Reply With Quote
 
 
 
 
Daniel Pitts
Guest
Posts: n/a
 
      01-10-2007

Elhanan wrote:
> hi..
>
> i've been taksed to create a framework that would read a complex xml
> (do NOT say data-binding) and use the data to populate a java bean
> tree..
>
> problem that java bean tree has not been built yet.
>
> i do have a concept of what to pull from the xml, what elements to read
> in what order, what data to get from it. so i was thinking to create a
> class that does so, but for every element (or chunk of data) pulled use
> and interface to send messages about them (sorta like sax) the classes
> which willl implement said interface, will get this data and build the
> tree..
>
> i was thinking that the messages will not contain an xml element itself
> but rather 'convertes' as arguments.
> the converted will implement an interface, that for now will simply
> return another xml more formated. (just to see if my parsing works) but
> will be replaced with another implmentation that will create an actuall
> class.
>
> i don't know exactly how tdd this as i don't even know the interfaces
> of tree i just know my side, i don't even know if i'm on the right
> path..


Sounds like the requirements aren't complete. If you have to parse an
XML document and produce tree, do the simple thing and create a DOM
tree. Since you're requirements aren't more specific, there isn't
anything you can do.

However, I would instead insist that your task is BLOCKED by the lack
of interfaces. And that any thing you do before hand would be a waste
of time and money.

Good luck,
Daniel.

 
Reply With Quote
 
 
 
 
Christopher Benson-Manica
Guest
Posts: n/a
 
      01-10-2007
Elhanan <(E-Mail Removed)> wrote:

> i've been taksed to create a framework that would read a complex xml
> (do NOT say data-binding) and use the data to populate a java bean
> tree..


My first inclination is that Spring might be able to meet your
requirements. Have you looked at that possibility?

--
C. Benson Manica | I *should* know what I'm talking about - if I
cbmanica(at)gmail.com | don't, I need to know. Flames welcome.
 
Reply With Quote
 
Paul Davis
Guest
Posts: n/a
 
      01-11-2007
Do you have a schema for the "complex" xml document?
You may want to take a look at Apache's XMLBeans.

If not, just use JDOM. You should not have to do any parsing. There are
too many well established frameworks to do that for you.

On to the non-existent code. If you don't have a set interfaces to
develop to, then create the interfaces yourself and give them to the
implementors to implement. Be sure to deliver them with some JUnit
classes using EasyMock to verify that your code does what it should.

Elhanan wrote:
> hi..
>
> i've been taksed to create a framework that would read a complex xml
> (do NOT say data-binding) and use the data to populate a java bean
> tree..
>
> problem that java bean tree has not been built yet.
>
> i do have a concept of what to pull from the xml, what elements to read
> in what order, what data to get from it. so i was thinking to create a
> class that does so, but for every element (or chunk of data) pulled use
> and interface to send messages about them (sorta like sax) the classes
> which willl implement said interface, will get this data and build the
> tree..
>
> i was thinking that the messages will not contain an xml element itself
> but rather 'convertes' as arguments.
> the converted will implement an interface, that for now will simply
> return another xml more formated. (just to see if my parsing works) but
> will be replaced with another implmentation that will create an actuall
> class.
>
> i don't know exactly how tdd this as i don't even know the interfaces
> of tree i just know my side, i don't even know if i'm on the right
> path..


 
Reply With Quote
 
Elhanan
Guest
Posts: n/a
 
      01-11-2007
off course i'm not actually gonna parse it for this i'll be using
xom. the interfaces aren't set becouse there getter and setters are
being decided by the implenetors. the tree itself that is being builtg
is highly complext and it's composed of a data java bean (where i'll
populate) that will be contained inside a another node bean which will
be doing all the linkng to it's fathers and sons.

the schema for the complex xml will not reveal anything, trust me,
there is no static data there, almost everything is being decided by an
element's numeric attribute called TypeId.

Paul Davis wrote:
> Do you have a schema for the "complex" xml document?
> You may want to take a look at Apache's XMLBeans.
>
> If not, just use JDOM. You should not have to do any parsing. There are
> too many well established frameworks to do that for you.
>
> On to the non-existent code. If you don't have a set interfaces to
> develop to, then create the interfaces yourself and give them to the
> implementors to implement. Be sure to deliver them with some JUnit
> classes using EasyMock to verify that your code does what it should.
>
> Elhanan wrote:
> > hi..
> >
> > i've been taksed to create a framework that would read a complex xml
> > (do NOT say data-binding) and use the data to populate a java bean
> > tree..
> >
> > problem that java bean tree has not been built yet.
> >
> > i do have a concept of what to pull from the xml, what elements to read
> > in what order, what data to get from it. so i was thinking to create a
> > class that does so, but for every element (or chunk of data) pulled use
> > and interface to send messages about them (sorta like sax) the classes
> > which willl implement said interface, will get this data and build the
> > tree..
> >
> > i was thinking that the messages will not contain an xml element itself
> > but rather 'convertes' as arguments.
> > the converted will implement an interface, that for now will simply
> > return another xml more formated. (just to see if my parsing works) but
> > will be replaced with another implmentation that will create an actuall
> > class.
> >
> > i don't know exactly how tdd this as i don't even know the interfaces
> > of tree i just know my side, i don't even know if i'm on the right
> > path..


 
Reply With Quote
 
Elhanan
Guest
Posts: n/a
 
      01-11-2007
the requirmentes are more or less complete, but we are doing things
'xp' the tree itself is complext and althought the interfaces are sort
of there, the guy warned that they may change, (may be even
considrebly) so i didn't want to risk taking them out of CVS.

parsing will be done using xom, this i allready know.

Daniel Pitts wrote:
> Elhanan wrote:
> > hi..
> >
> > i've been taksed to create a framework that would read a complex xml
> > (do NOT say data-binding) and use the data to populate a java bean
> > tree..
> >
> > problem that java bean tree has not been built yet.
> >
> > i do have a concept of what to pull from the xml, what elements to read
> > in what order, what data to get from it. so i was thinking to create a
> > class that does so, but for every element (or chunk of data) pulled use
> > and interface to send messages about them (sorta like sax) the classes
> > which willl implement said interface, will get this data and build the
> > tree..
> >
> > i was thinking that the messages will not contain an xml element itself
> > but rather 'convertes' as arguments.
> > the converted will implement an interface, that for now will simply
> > return another xml more formated. (just to see if my parsing works) but
> > will be replaced with another implmentation that will create an actuall
> > class.
> >
> > i don't know exactly how tdd this as i don't even know the interfaces
> > of tree i just know my side, i don't even know if i'm on the right
> > path..

>
> Sounds like the requirements aren't complete. If you have to parse an
> XML document and produce tree, do the simple thing and create a DOM
> tree. Since you're requirements aren't more specific, there isn't
> anything you can do.
>
> However, I would instead insist that your task is BLOCKED by the lack
> of interfaces. And that any thing you do before hand would be a waste
> of time and money.
>
> Good luck,
> Daniel.


 
Reply With Quote
 
Elhanan
Guest
Posts: n/a
 
      01-11-2007
how will spring asist me , (again using xom to readxml).

Christopher Benson-Manica wrote:
> Elhanan <(E-Mail Removed)> wrote:
>
> > i've been taksed to create a framework that would read a complex xml
> > (do NOT say data-binding) and use the data to populate a java bean
> > tree..

>
> My first inclination is that Spring might be able to meet your
> requirements. Have you looked at that possibility?
>
> --
> C. Benson Manica | I *should* know what I'm talking about - if I
> cbmanica(at)gmail.com | don't, I need to know. Flames welcome.


 
Reply With Quote
 
Daniel Pitts
Guest
Posts: n/a
 
      01-11-2007

Elhanan wrote:
> Christopher Benson-Manica wrote:
> > Elhanan <(E-Mail Removed)> wrote:
> >
> > > i've been taksed to create a framework that would read a complex xml
> > > (do NOT say data-binding) and use the data to populate a java bean
> > > tree..

> >
> > My first inclination is that Spring might be able to meet your
> > requirements. Have you looked at that possibility?

> how will spring asist me , (again using xom to readxml).
>

The Spring Framework can utilize a (specific) XML file to create java
objects, and wire them together.

Its a really neat way to implement IoC and Dependency Injection.
Perhaps if you gave us a better idea of what the XML and bean graph is
supposed to represent, we could suggest other alternatives.

 
Reply With Quote
 
Daniel Pitts
Guest
Posts: n/a
 
      01-11-2007
[Top posting corrected]
Elhanan wrote:
> Daniel Pitts wrote:
> > Elhanan wrote:
> > > hi..
> > >
> > > i've been taksed to create a framework that would read a complex xml
> > > (do NOT say data-binding) and use the data to populate a java bean
> > > tree..
> > >
> > > problem that java bean tree has not been built yet.
> > >
> > > i do have a concept of what to pull from the xml, what elements to read
> > > in what order, what data to get from it. so i was thinking to create a
> > > class that does so, but for every element (or chunk of data) pulled use
> > > and interface to send messages about them (sorta like sax) the classes
> > > which willl implement said interface, will get this data and build the
> > > tree..
> > >
> > > i was thinking that the messages will not contain an xml element itself
> > > but rather 'convertes' as arguments.
> > > the converted will implement an interface, that for now will simply
> > > return another xml more formated. (just to see if my parsing works) but
> > > will be replaced with another implmentation that will create an actuall
> > > class.
> > >
> > > i don't know exactly how tdd this as i don't even know the interfaces
> > > of tree i just know my side, i don't even know if i'm on the right
> > > path..

> >
> > Sounds like the requirements aren't complete. If you have to parse an
> > XML document and produce tree, do the simple thing and create a DOM
> > tree. Since you're requirements aren't more specific, there isn't
> > anything you can do.
> >
> > However, I would instead insist that your task is BLOCKED by the lack
> > of interfaces. And that any thing you do before hand would be a waste
> > of time and money.
> >
> > Good luck,
> > Daniel.

> the requirmentes are more or less complete, but we are doing things
> 'xp' the tree itself is complext and althought the interfaces are sort
> of there, the guy warned that they may change, (may be even
> considrebly) so i didn't want to risk taking them out of CVS.
>
> parsing will be done using xom, this i allready know.
>


Please don't top post

Well, the the XP approach would be that you are all pair programming on
the same aspect, rather than all working on seperate aspects. If the
implementors can't give you a fixed interface, then you should do your
best with what the current interface is, and change it as needed. Its
okay if your code breaks because of their change, just be prepared to
update.

I have to say, from the window you've provided, I'm glad I don't work
at your shop. Sounds like a buzz-word-abuse orgy over there. "Lets
use JavaBeans, XML and Extreme Programming!" "Okay, what are we
making?" "Uh, User Stories?" "..."

<http://www.thedailywtf.com/>
Find a non-WTF job.

 
Reply With Quote
 
Elhanan
Guest
Posts: n/a
 
      01-11-2007
but spring's DI is meant to be for services not data, i could use it to
wire services that will read the xml , but anything else.
let me give you an example of the xml i'm dealign with:

<Result>
<CaseObject TypeId=23 Id=1>
<CaseAttribute TypeID=12>
<CaseAttributeValue Value="Elhanan"/>
</CaseAttribute
<... lots more case Attributes
</CaseObject>
<. lots more case Objects elements

<CaseRisk TypeID=113 id=0101>
<ResultRIsk TypeId =32 id=3>
<CaseAttributreResult ....>
2-3 attributes depedning on the TypeId
</ResultRisk>
</CaseRisk>
<CaseRelation To=0101 From=1/>
lots more caseRelations
<?Result>

so basically i would need to map each CaseRisk, read it's results, jump
to it's relation, from there jump to it's CaseObject, read that as
well, place each CaseRIsk and caseObject into a cohesive class and also
place the CaseRisk into a tree (becouse although they are not nested in
the xml, the collection of the caseRisk has a logical grouping of a
tree).

btw while searching for this thread to answer, i cam across this:
http://www.ivalidator.org/ivalidator...=2anmsm4sjjs4d

could it help me test these things?


Daniel Pitts wrote:
> Elhanan wrote:
> > Christopher Benson-Manica wrote:
> > > Elhanan <(E-Mail Removed)> wrote:
> > >
> > > > i've been taksed to create a framework that would read a complex xml
> > > > (do NOT say data-binding) and use the data to populate a java bean
> > > > tree..
> > >
> > > My first inclination is that Spring might be able to meet your
> > > requirements. Have you looked at that possibility?

> > how will spring asist me , (again using xom to readxml).
> >

> The Spring Framework can utilize a (specific) XML file to create java
> objects, and wire them together.
>
> Its a really neat way to implement IoC and Dependency Injection.
> Perhaps if you gave us a better idea of what the XML and bean graph is
> supposed to represent, we could suggest other alternatives.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
problem in running a basic code in python 3.3.0 that includes HTML file Satabdi Mukherjee Python 1 04-04-2013 07:48 PM
XPath query for <?define something="something" ?> Pekka Järvinen XML 2 04-29-2008 08:12 PM
How to find and replace something that is nested inside something else? alainfri@gmail.com Perl Misc 4 05-31-2007 11:50 PM
Credit card processing, how does one go about developing something like that for a website? levon ASP .Net Security 1 06-27-2005 03:52 PM
umm... something... template(s)... something else... pointer(s)... and such... 0.o yah, I'm hopeless and clueless o.0 C++ 4 10-13-2004 10:34 PM



Advertisments