Plz help

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • pnd1234@gmail.com

    Plz help

    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_folde r>
    <message message_id="1">
    <attachments attachment_id=" 1.1">
    <attachment_nam e>MyWordDocumen t.doc</attachment_name >

    <attachment_siz e>32MB</attachment_size >
    </attachments>

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

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

    <inbox>
    <attachments attachment_id=" 3">
    <attachment_nam e>MyWordDocumen t.doc</attachment_name >

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

    <attachment_siz e>2MB</attachment_size >
    <attachments attachment_id=" 3.1.1" //bmp is contained inside ppt
    inside word
    <attachment_nam e>MyBitmap.bmp </attachment_name >
    <attachment_siz e>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.

  • Marc Gravell

    #2
    Re: Plz help

    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>...</xmlfor
    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

    Comment

    • Marc Gravell

      #3
      Re: Plz help

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

      Comment

      Working...