<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body bgcolor="#ffffff" text="#000000">
<br>
Hello All,<br>
<br>
I want to build some classes by optimizing their design.<br>
But I want to keep quite 'simples'. I have a XML document <br>
which represents let's say some rules (id, description, value).<br>
<br>
My first idea is to create an <b>docrules</b> class which holds my
document.<br>
This class will use 2 other instances from 2 respectives classes<br>
reader and writer. The main method of reader is get().<br>
The main method of writer is write(). To resume I have:<br>
------------------------------
-----------------------<br>
- docrules
----------------------------------- reader -<br>
------------------------------
-----------------------<br>
- filename
- - file -<br>
-
----------------------------
-----------------------<br>
-
- - get() -<br>
-
------- -----------------------<br>
------------------------------ -<br>
-<br>
- ------------------------<br>
------------------------------- writer -<br>
------------------------<br>
- file -<br>
------------------------<br>
- write() -<br>
------------------------<br>
<br>
The <b>docrules</b> will do the parsing (<b>xml.etree</b> very
effective)<br>
and create the reader and the writer instance.<br>
I want to create 2 others classes (or more) more specific which have<br>
more the knowledge about the XML documents structures.<br>
<b>SpecificRuleReader</b>, <b>SpecificRuleWriter</b> which are
deriving resp.<br>
from Reader and Writer which hold resp. <b>getSpecificRules</b>() (use
of get('/tag1/tag2/tag3/specificTagRules') and a<b> writeSpecificRules</b>():<br>
<br>
-----------------------------
---------------------------------<br>
reader writer<br>
-----------------------------
---------------------------------<br>
^ ^<br>
| |
<br>
-------------------------------
-----------------------------------<br>
<b>SpecificRuleReader</b> <b>SpecificRulesWriter</b><br>
-------------------------------
-----------------------------------<br>
<b>getSpecificRules</b>() <b>writeSpecificRules()</b><br>
--------------------------------
--------------------------------------<br>
<br>
My purpose is to separate as far as possible XML representation from<br>
core classes. I will have certainly more SpecificrulesReader/Writer<br>
classes becauses the document is huge and several discipline rules<br>
will be adressed. I don't want necessarily have 2 big classes which<br>
know everything about XML document because I will have too many<br>
methods.<br>
<br>
So, for if anybody has this kind of experience or any design pattern
idea,<br>
I will be enchanté.<br>
<br>
Regards<br>
Karim<br>
<br>
</body>
</html>