locked
Storing the data and Editing the data RRS feed

  • Question

  • Dear All,

    According to my requirements I am able to parse the xml files and storing the parsed data in a linked list,but even I
    have a requirement of editing the data which I have parsed and those modifications(editing) should be reflected in the
    basic XML file,such that if I parse after editing It should reflect the modifications.

    I need some clarifications regarding following

    Q1: Is there any API is available to make my pursed data in to DOM model?

    Please do the need full.

    Regards,
    Sri Anu.

    Wednesday, May 27, 2009 11:20 AM

Answers

  • "Is there any API is available to make my pursed data in to DOM model?"

    It depends on how you design your linked list and what kind of data you stored into linked list node?

    Basically, if you hold a reference to the DOM Node and store the reference into your linked-list, then you can directly editing the node object's properties through IXMLDOMNode APIs (http://msdn.microsoft.com/en-us/library/ms761386(VS.85).aspx). And the edited data will reflect into DOM tree directly.

    If you do not hold any reference to DOM Node, then you need to use xpath OR IXMLDOMNode APIS to locate each DOM Node you edited and then update the DOM Node properties/values, etc...

    -haowei
    • Proposed as answer by Shuhai Wednesday, June 17, 2009 6:50 PM
    • Marked as answer by Shuhai Monday, June 22, 2009 5:30 PM
    Wednesday, May 27, 2009 2:05 PM
  • As haowei stated, if you design the node to hold reference of each element, your change will always be made into the DOM. Hope this helps.

    struct employee
    {
      IXMLDOMElement * pIName;
      IXMLDOMElement * PIPro;
      struct employee * pNext;
    };

    • Proposed as answer by Shuhai Wednesday, June 17, 2009 6:50 PM
    • Marked as answer by Shuhai Monday, June 22, 2009 5:30 PM
    Wednesday, June 17, 2009 2:54 PM

All replies

  • "Is there any API is available to make my pursed data in to DOM model?"

    It depends on how you design your linked list and what kind of data you stored into linked list node?

    Basically, if you hold a reference to the DOM Node and store the reference into your linked-list, then you can directly editing the node object's properties through IXMLDOMNode APIs (http://msdn.microsoft.com/en-us/library/ms761386(VS.85).aspx). And the edited data will reflect into DOM tree directly.

    If you do not hold any reference to DOM Node, then you need to use xpath OR IXMLDOMNode APIS to locate each DOM Node you edited and then update the DOM Node properties/values, etc...

    -haowei
    • Proposed as answer by Shuhai Wednesday, June 17, 2009 6:50 PM
    • Marked as answer by Shuhai Monday, June 22, 2009 5:30 PM
    Wednesday, May 27, 2009 2:05 PM
  • Dear haowei,

    Thank you for your info,But as I am not well experience with XML,It was not clear to me.
    Please can you provide some info regarding the above.

    My linked list details:

    all details regarding one records will be stored in a node i.e., each node represents a full record.

    like,

    <root>
    <employee>
        <name>"sri"<name/>
        <pro>"s/w"<pro/>
    <employee/>
    <employee>
        <name>"anu"<name/>
        <pro>"h/w"<pro/>
    <employee/>
    <root/>

    node1---->record1 contains 1t employee sri details
    node2---->record2 contains 1t employee anu details

    ---------               ---------
    -node1----------> -node2-
    ---------               ---------

    To represent entire data in the file a linked list of nodes(records) ll be created.

    Is above explanation providing sufficient info to my dear friend, else let me know
    once.

    Regards,
    Sri Anu.
    Thursday, May 28, 2009 5:37 AM
  • Could you please try this format:

    <root>
    <employee id="1" nextId="2">
        <name>"sri"<name/>
        <pro>"s/w"<pro/>
    <employee/>
    <employee id="2" nextId="3">
        <name>"anu"<name/>
        <pro>"h/w"<pro/>
    <employee/>
    <employee id="3">
        <name>"hao"<name/>
        <pro>"wei"<pro/>
    <employee/>
    <root/>
    Tuesday, June 9, 2009 5:57 AM
  • As haowei stated, if you design the node to hold reference of each element, your change will always be made into the DOM. Hope this helps.

    struct employee
    {
      IXMLDOMElement * pIName;
      IXMLDOMElement * PIPro;
      struct employee * pNext;
    };

    • Proposed as answer by Shuhai Wednesday, June 17, 2009 6:50 PM
    • Marked as answer by Shuhai Monday, June 22, 2009 5:30 PM
    Wednesday, June 17, 2009 2:54 PM