Hi
Please suggest me a good solution (design) in C++ to represent an dd
elements of two tree . The scenario is mentioned below:
I have set of elements stored in XML tree as below:
First Tree
====================
Domain A
-------- Realm A
------- Rule A1
------- Rule A2
--------- Realm B
--------- Realm C
Second Tree
====================
Domain A
-------- Realm A
------- Rule A1
--------- Realm B
------- Rule B1
--------- Realm D
Here I need to add Tree1 to Tree2. The target Tree2 already has a
Domain A in place as you can see from the diagram above. Depending
upon a specified import type viz. "Add", "Overlay" or "Replace", I
need to do the import in the following way:
Add
If the import type is "Add", it means add only the extra components
and leave rest of the existing objects untouched. That means in the
above case, add "Rule A2" in Realm A, add "Rule B1" in Realm B and
add
Realm C
Overlay
In case of overlay, it means that add as well as update the existing
objects. In the above case it means that update "Realm A" and "Rule
A1", add "Rule A2", update "Realm B", add "Rule B1" and add "Realm
C"
Replace
Replace effectively means an overwrite. In the above case it means
that add "Realm A", add "Rule A1", add "Rule A2", remove "Rule B1",
remove "Realm D" and add "Realm C"
So as a whole I have following requirements:
1) Represent above structure in C++ class hierarchy.
2) Implement a function that will convert above XML tree to the C++
objects.
2) The class design should be such that above import operations(add/
overlay/replace) can be performed efficiently and elegantly.
Thanks
Devendra
--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
0
|
|
|
|
Reply
|
devendra.chandola (4)
|
7/17/2007 8:17:13 AM |
|