Plz help

P

pnd1234

Hi, i am doing a project which represent message attachments in a xml
view.I currently
implemented the system in a tree view.Like if a message contains word
file, zip file,image file
, swf file as attachment then it represents the over all attachments
in a tree node like message
in root node with attachments doc, image file and swf as its child
node. Further, if there are image or charts inside word document i
have to represent this as a child node of a word
document.This relation ship can go down to N- level like a zip file
can contain N-zips inside
each of them.My concern is to convert this relation ship in xml
document. I am actually looking
to use xml serialising in tree node or designing a new class which can
simply reflect my problem
domain and serialise when required.I need a xml file much like this

<personal_folder>
<message message_id="1">
<attachments attachment_id="1.1">
<attachment_name>MyWordDocument.doc</attachment_name>

<attachment_size>32MB</attachment_size>
</attachments>

<attachments atachment_id="2">
<attachment_name>MyPowerPoing.ppt</attachment_name>
<attachment_size>32MB</attachment_size>

<attacments attachment_id="2.1"> //ppt contains bmp inside
<attachment_name>abc.bmp</attachment_name>
<attachment_size>2MB</attachment_size>
</attacments>
</attachments>
</message>
</personal_folder>

<inbox>
<attachments attachment_id="3">
<attachment_name>MyWordDocument.doc</attachment_name>

<attachment_size>32MB</attachment_size>
<attachments attachment_id="3.1">
<attachment_name>MyPPTDocument.ppt</attachment_name>

<attachment_size>2MB</attachment_size>
<attachments attachment_id="3.1.1"> //bmp is contained inside ppt
inside word
<attachment_name>MyBitmap.bmp</attachment_name>
<attachment_size>32MB</attachment_size>
</attachments>
</attachments>
</attachments>
</inbox>

<deleteditems /> and so on

what i am looking for is a class which i can xml serialise to
genereate this xml file as shown
..I am having problem to design class so as to generate the required
xml file.Can i "seriliaze
tree view class" ?? that i have implemented to generated xml file as i
have associated each tree node tag with related information.The main
problem i am facing is reflecting the attachment depth to N level.Plz
suggest me a better idea to solve my problem.
 
M

Marc Gravell

xsd.exe (from VS command prompt) may be able to help:

put the desired xml into a file, for example my.xml (noting that you
should have a single root element - I've used <xml>...</xml> for
simplicity); then enter:

xsd my.xml
xsd my.xsd /classes

The first command generates an xsd from the sample xml. The second
command generates C# from the xsd.

There are various switches to tweak the output, or you can hand-edit
it afterwards (swapping arrays for lists, etc), or just use it to see
which attributes are interesting.

Marc
 
M

Marc Gravell

Note; if you hand-craft an xsd to represent your data, the tooling
will probably make a better job of things...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top