Skip to content

xml2csv capable of processing two suggested scenarios? #296

Description

@mixpc

Is xml2csv capable of dealing with the following two scenarios?

Scenario #1 subtag Tag within Sport is not unique so only last occurrence is output. Could both be output to the csv?

<People>
    <Person>
        <Name>Maggie</Name>
        <Age>3</Age>
        <Gender>Female</Gender>
        <Siblings>
            <Brother>Bart</Brother>
            <Sister>Lisa</Sister>
        </Siblings>
        <Sport>
            <Tag>Football</Tag>
            <Tag>Basketball</Tag>
        </Sport>
    </Person>
    <Person>
        <Name>Marge</Name>
        <Age>45</Age>
        <Gender>Female</Gender>
    </Person>
</People>

results in

name,age,gender,brother,sister,sport
"Maggie",3,"Female","Bart","Lisa","Basketball"
"Marge",45,"Female",,,

Scenario #2 rootXMLElement Beings is a supra category, so how could that be coded under headerMap ?

<Beings>
     <People>
         <Person>
             <Name>Maggie</Name>
             <Age>3</Age>
             <Gender>Female</Gender>
             <Siblings>
                 <Brother>Bart</Brother>
                 <Sister>Lisa</Sister>
             </Siblings>
             <Sport>
                 <Tag>Football</Tag>
                 <Tag>Basketball</Tag>
             </Sport>
         </Person>
     </People>
     <Animals>
         <Pet>
             <Name>Snowball</Name>
         </Pet>
         <Pet>
             <Name>Santa's Little Helper</Name>
         </Pet>
     </Animals>
</Beings>

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions