Noob question on how to use Scales to split a large XML file into separate files

27 views
Skip to first unread message

Todd Nash

unread,
Nov 5, 2014, 6:25:06 PM11/5/14
to scale...@googlegroups.com
I have a large XML file with repeating <cfb-score> elements that I need to split into separate files for each <cfb-score> entry. The top level elements (<sports-statistics> ... <cfb-scores>) need to be in each new file. How do I use Scales to best perform this?

An example of the XML file is:

<sports-statistics>
    <sports-scores>
        <date year="2014" month="10" date="4" day="6"/>
        <time hour="17" minute="36" second="25" timezone="Eastern" utc-hour="-4" utc-minute="00"/>
        <version number="5"/>
        <season season="2014"/>
        <cfb-scores>
            <cfb-score>
                <date year="2014" month="10" date="2" day="4"/>
                <time hour="19" minute="00" timezone="Eastern" utc-hour="-4" utc-minute="00"/>
                <local-game-date year="2014" month="10" date="2" day="4"/>
                <local-time hour="19" minute="00"/>
                <week week="7"/>
                <gamecode code="201410022307" global-id="1410051"/>
                <coverage level="30"/>
                <source id="2"/>
                <gametype id="1" type="Regular Season" detail="" round="" round-name=""/>
                <stadium name="FIU Stadium" city="Miami" state="Florida" state-id="9" country-name="United States"
                         country-id="1" id="2060" global-id="3204"/>
                <bowl id="0" name="" full-name=""/>
                <gamestate status-id="4" status="Final" quarter="4" minutes="" seconds="" team-possession-id=""
                           yards-from-goal="" down="" distance="" segment-number="4" active-state="false"/>
                <outcome-visit outcome-id="2" outcome="Loss" conf-outcome-id="2" conference-outcome="Loss"/>
                <outcome-home outcome-id="1" outcome="Win" conf-outcome-id="1" conference-outcome="Win"/>
                <visiting-team>
                    <team-name name="Owls" alias="FlaAtl"/>
                    <team-city city="Florida Atlantic"/>
                    <team-code id="2294" global-id="4947" division="1"/>
                    <team-conference conference="Conference USA" id="72"/>
                    <team-rank rank="0" bcs-rank=""/>
                    <record wins="2" losses="4" ties="0" pct=".333"/>
                </visiting-team>
                <home-team>
                    <team-name name="Golden Panthers" alias="FIU"/>
                    <team-city city="FIU"/>
                    <team-code id="2307" global-id="5090" division="1"/>
                    <team-conference conference="Conference USA" id="72"/>
                    <team-rank rank="0" bcs-rank=""/>
                    <record wins="3" losses="3" ties="0" pct=".500"/>
                </home-team>
            </cfb-score>
            <cfb-score>
                <date year="2014" month="10" date="2" day="4"/>
                <time hour="19" minute="00" timezone="Eastern" utc-hour="-4" utc-minute="00"/>
                <local-game-date year="2014" month="10" date="2" day="4"/>
                <local-time hour="18" minute="00"/>
                <week week="7"/>
                <gamecode code="201410020080" global-id="1416218"/>
                <coverage level="30"/>
                <source id="1"/>
                <gametype id="1" type="Regular Season" detail="" round="" round-name=""/>
                <stadium name="TDECU Stadium" city="Houston" state="Texas" state-id="43" country-name="United States"
                         country-id="1" id="2302" global-id="13693"/>
                <bowl id="0" name="" full-name=""/>
                <gamestate status-id="4" status="Final" quarter="4" minutes="" seconds="" team-possession-id=""
                           yards-from-goal="" down="" distance="" segment-number="4" active-state="false"/>
                <outcome-visit outcome-id="1" outcome="Win" conf-outcome-id="1" conference-outcome="Win"/>
                <outcome-home outcome-id="2" outcome="Loss" conf-outcome-id="2" conference-outcome="Loss"/>
                <visiting-team>
                    <team-name name="Knights" alias="UCF"/>
                    <team-city city="UCF"/>
                    <team-code id="210" global-id="3615" division="1"/>
                    <team-conference conference="American Athletic Conference" id="122"/>
                    <team-rank rank="0" bcs-rank=""/>
                    <record wins="2" losses="2" ties="0" pct=".500"/>
                </visiting-team>
                <home-team>
                    <team-name name="Cougars" alias="Hou"/>
                    <team-city city="Houston"/>
                    <team-code id="80" global-id="3485" division="1"/>
                    <team-conference conference="American Athletic Conference" id="122"/>
                    <team-rank rank="0" bcs-rank=""/>
                    <record wins="2" losses="3" ties="0" pct=".400"/>
                </home-team>
            </cfb-score>
        </cfb-scores>
    </sports-scores>
</sports-statistics>

Chris Twiner

unread,
Nov 17, 2014, 12:48:27 PM11/17/14
to scale...@googlegroups.com

Hi Todd,

There are quite a few examples on the documentation site for pull parsing documents like this.

What have you tried so far?

Cheers,
Chris

--
You received this message because you are subscribed to the Google Groups "scales-xml" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scales-xml+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages