Results 1 to 14 of 14

Thread: Append/Replace XML section? [resolved]

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 1999
    Posts
    164

    Lightbulb Append/Replace XML section? [resolved]

    How can I append or replace a single section within my XML file?

    Currently, I am having to save the entire XML file when I make changes to my data. But I would like to be able to reduce the time, by only saving 1 section of the XML file.

    I would like to be able to save info to the user settings, without saving the entire user and data items, etc.

    PHP Code:
    ...
    <
    user>
       <
    settings .... />
    </
    user>
    <
    data>
       <
    item ... >
           ....
       </
    item>
       ...
    </
    data>
    ... 
    Reference: (This is how I am reading/writing XML)
    Read XML from a file
    Write XML to a file

    thanks,
    Last edited by Shurijo; Apr 4th, 2003 at 07:29 PM.
    -Shurijo

  2. #2

    Thread Starter
    Addicted Member
    Join Date
    Aug 1999
    Posts
    164
    Any ideas if this is even possible?
    -Shurijo

  3. #3
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    I don't think it is, sorry. I have never seen anything that can save or load only part of a file. You can break the xml tables up into seperate files and that would work.

  4. #4
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    From quick glance at this page , it says you can read XML Nodes . I don't know if it's right .

    If I were you , I would store all these info in database file !!
    I hope that helps !

  5. #5
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Yeah you can change it via nodes or read or write nodes but you will still need to load the xml file into an xmldocument first.

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Aug 1999
    Posts
    164
    Thanks for the help. I believe that the node reading (in the web page) still requires the app to loop through the document (I am bascially doing the same commands when I read/write the XML file.) I don't think it is possible either, but it seems like something that should .NET should be able to do.
    -Shurijo

  7. #7
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    How are you reading and writing the document now?

  8. #8
    Frenzied Member DevGrp's Avatar
    Join Date
    Nov 2001
    Location
    Charlotte, NC
    Posts
    1,256
    Read this article here.
    Dont gain the world and lose your soul

  9. #9
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Are you talking about Web XML Files ??

  10. #10
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Whats the difference between a web xml file and any other xml file? They are all the same.

  11. #11
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Yeah , I guess so . So he can use text file to append/replace . Is it easier ?

  12. #12
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    I guess thats just a matter of opinion. I think using either a Dataset or an XMlDocument objects is the best. I don't like using just text or the XMLTextWriter/Reader that seems like too much work.

  13. #13
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Yes Ed , I agree with you .

  14. #14

    Thread Starter
    Addicted Member
    Join Date
    Aug 1999
    Posts
    164
    The XMLdocument looks much better, I just haven't used it before. Looks like that would be better for me to start using instead of the XMLTextReader/Writer.

    Thanks all.

    -----------
    Update: I just changed all my read/write to XMLdocument and it worked great. I was able to just edit a certain section or even a certain element, etc.
    -----------
    Last edited by Shurijo; Apr 4th, 2003 at 07:30 PM.
    -Shurijo

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width