Parsing text with separated scheme-file



  • Hi comunity!

    I'm facing the following problem for which i'm looking for some hints. I'm a bit stucked and don't get the idea how to solve the problem...

    • I have a text file (input-file). This file is formated according a certain scheme. The scheme will change in the futur!
    • i want to read that text file into my program, edit it and write a new text-file with the same scheme.

    I thought i will use XML (or XSD?) to define the scheme. Whenever the schemes would change, a new XML-File needs to be created.
    So that i don't have to change the source code.

    Example:
    testtextfile.txt

    @Miller

    3 PERSONS
    1 Hugo 46 1.80
    2 Marie 42 1.60
    3 Baby 2 0.4@

    And then the XML-Template-File would look like

    @<Family>
    <FamilyName>
    <NumberOfMembers>PERSONS
    <Person>
    <ReferenceNumber/>
    <Name/>
    <Age/>
    <Height/>
    </Person>
    </Family>@

    I think i'm able to write a correct XML or XSD Template file, but is that the correct way to face the problem?
    When the scheme changes the user will have to adapt the template so my program still understands his input files.

    Thanks for any help!


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.