On 29/11/06, Jean-Sebastien Delfino <[EMAIL PROTECTED]> wrote:

We're starting to have pages of code in our various extensions (and
sometimes duplicate code) to just dig data out of an SDO graph.

This initially sounds pretty simple:
- I have an SDO that I loaded from an XML element
- I'd like to populate a C++ list with values of the child elements of
that XML for example.

like in:
<add>
   <op1>2</op1>
  <op2>3</op2>
</add>

I would populate a C++ list or array with 2 ints {2, 3}...

It turns out to be not so simple, as depending on how you've defined
your schema for that XML (if you have a schema at all) you need to check
for:
- SDO properties defined in your schema
- SDO instance properties (if your parent element is an open content)
- SDO sequences
- properties that are DataObjectLists
- properties that contain open content again...

I'm thinking about writing a generic utility class once for all, which
will implement a Visitor pattern to visit the SDO graph and gather the
interesting data... What do people think about this approach?

Can somebody point me to existing SDO navigation code that I could reuse
for this?

Or am I missing something and there is a simpler way to get child
elements out of an SDO without having to worry about all these cases?

Thanks,

--
Jean-Sebastien


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


There is code in

tuscany/sca/util/Utils.cpp
that prints DO contents. May be a starting point.

Cheers,

--
Pete

Reply via email to