CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 1 of 4 1234 LastLast
Results 1 to 15 of 50

Thread: .xml to .txt

  1. #1
    Join Date
    Apr 2012
    Location
    Slovenia
    Posts
    259

    .xml to .txt

    This is how my .xml page looks in a web browser. Is there a way to transform my .xml file into .txt file so that the text file would look like this?
    Last edited by flex567; April 14th, 2015 at 09:30 AM.

  2. #2
    Join Date
    Jan 2006
    Location
    Singapore
    Posts
    6,765

    Re: .xml to .txt

    An XML document is essentially already "text" though, so I am not sure what you are asking.
    C + C++ Compiler: MinGW port of GCC
    Build + Version Control System: SCons + Bazaar

    Look up a C/C++ Reference and learn How To Ask Questions The Smart Way
    Kindly rate my posts if you found them useful

  3. #3
    Join Date
    Apr 2012
    Location
    Slovenia
    Posts
    259

    Re: .xml to .txt

    An XML document is essentially already "text" though, so I am not sure what you are asking.
    I am not saying that .xml is not text.

  4. #4
    Join Date
    Jan 2006
    Location
    Singapore
    Posts
    6,765

    Re: .xml to .txt

    So what are you saying? Sorry, but the image you linked to is too blurred for me to make out what you are trying to do.
    C + C++ Compiler: MinGW port of GCC
    Build + Version Control System: SCons + Bazaar

    Look up a C/C++ Reference and learn How To Ask Questions The Smart Way
    Kindly rate my posts if you found them useful

  5. #5
    Join Date
    Apr 2012
    Location
    Slovenia
    Posts
    259

    Re: .xml to .txt

    click on the image and it will show the image in bigger size

  6. #6
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,635

    Re: .xml to .txt

    I'm not sure what you'd expect to get out of the file either. What would you expect that file to look like as a ".txt" file?

  7. #7
    Join Date
    Apr 2012
    Location
    Slovenia
    Posts
    259

    Re: .xml to .txt

    I would like the .txt to look like this.
    [img=http://s23.postimg.org/9qq9vj4fr/image.jpg]

    I'm not sure what you'd expect to get out of the file either. What would you expect that file to look like as a ".txt" file?
    It would be easier to parse the file, I could use the getline() function for example.
    Last edited by flex567; April 14th, 2015 at 10:13 AM.

  8. #8
    Join Date
    Jan 2006
    Location
    Singapore
    Posts
    6,765

    Re: .xml to .txt

    Why don't you just use an existing XML parser library?
    C + C++ Compiler: MinGW port of GCC
    Build + Version Control System: SCons + Bazaar

    Look up a C/C++ Reference and learn How To Ask Questions The Smart Way
    Kindly rate my posts if you found them useful

  9. #9
    Join Date
    Apr 2012
    Location
    Slovenia
    Posts
    259

    Re: .xml to .txt

    I can use just STD

  10. #10
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,635

    Re: .xml to .txt

    If you want help, you'll need to explain yourself. How is your txt file different from your xml file?

  11. #11
    Join Date
    Apr 2012
    Location
    Slovenia
    Posts
    259

    Re: .xml to .txt

    I don't have any text file. There is just the .xml file. I would like to create the text file from the .xml that would look like this:

  12. #12
    Join Date
    Jan 2006
    Location
    Singapore
    Posts
    6,765

    Re: .xml to .txt

    Okay, if I get this right: you have an XML document that you find hard to parse with getline. You want to transform it into a ".txt file" that is essentially the XML document formatted nicely for you to parse with getline to extract tag by tag and element by element. You only want to use standard library facilities. If so, this is a chicken and egg scenario: you cannot have your program format the XML document without reading and parsing it, but if your program can read and parse it, then you don't need it formatted nicely for reading.
    C + C++ Compiler: MinGW port of GCC
    Build + Version Control System: SCons + Bazaar

    Look up a C/C++ Reference and learn How To Ask Questions The Smart Way
    Kindly rate my posts if you found them useful

  13. #13
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,635

    Re: .xml to .txt

    Quote Originally Posted by flex567 View Post
    I don't have any text file. There is just the .xml file. I would like to create the text file from the .xml that would look like this:
    You're not making this easy. What is different between the two files?

  14. #14
    Join Date
    Apr 2012
    Location
    Slovenia
    Posts
    259

    Re: .xml to .txt

    It would be easier to parse it. I could you getline function for example. I already manage to create a .txt file, it took me 10 min to manually select it all.

  15. #15
    Join Date
    Jan 2006
    Location
    Singapore
    Posts
    6,765

    Re: .xml to .txt

    Post the contents of both example files here in [code][/code] bbcode tags and explain what exactly is the difference between them. Note that "easier to parse" it is not a difference that matters to us: what matters is what it is about the format that makes one "easier to parse" according to you.
    C + C++ Compiler: MinGW port of GCC
    Build + Version Control System: SCons + Bazaar

    Look up a C/C++ Reference and learn How To Ask Questions The Smart Way
    Kindly rate my posts if you found them useful

Page 1 of 4 1234 LastLast

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

Featured