Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Parsing FCPXML in PHP

Status
Not open for further replies.

PCHomepage

Programmer
Feb 24, 2009
609
US
Using PHP I'm trying to figure out how to parse a Final Cut Pro X XML file, which seems to be different than standard XML, and have had no success so far. Ultimately I need to more finely tune the results but for now, just getting any results would be helpful! This gives nothing useful even though it seems to work on other XML files:

Code:
<?php
 $xml = simplexml_load_file("filename.fcpxml");
echo $xml->getName() . "<br />";
foreach($xml->children() as $child) {
   echo $child->getName() . ": " . $child . "<br />";
   }
 ?>

Has anyone worked with FCPXML who can offer help? It is mainly the <title> area I want to fetch but getting any results is a good start. Ideas?

Thanks.

Don
 
Can you show s an example of kind of file you are working with?

Even if we haven't directly used FCPXML, we may be able to help you get the contents if we knew the file structure.



----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Web & Tech
 
Yes, I was just about to do just that. Basically I am trying to come up with some output that is usable outside of Final Cut Pro X in an SRT type format (file format used for video subtitles) so what I am really after isn't the entire file. I need only the portions between the title tags where the role="Subtitles" along with the text, offset, duration and start values:

Code:
<title lane="6" offset="3671668/60000s" ref="r6" name="Some text here," duration="412412/60000s" start="215999784/60000s" role="Subtitles">
<adjust-transform position="0.267518 -32.3158"/>
<text>Some text here," </text>
</title>

<title lane="6" offset="4130126/60000s" ref="r6" name="more text," duration="288288/60000s" start="216003788/60000s" role="Subtitles">
<adjust-transform position="0.267518 -32.3158"/>
<text>more text,</text>
</title>

There are other title tags without role="Subtitles" or with no role at all but I do not need those. The actual format needed is somewhat specific and I am totally unclear now how to convert the start, offset and duration to values I can actually use but this is what the end result should look like in general:

Code:
1
00:00:11,000 --> 00:00:15,000
Some text here,
 
2
00:00:50,000 --> 00:00:56,000
more text

If the general output can be done something like this, I can research to try to find out how to do the conversion to the time format needed for the beginning and ending of each one so any help to get started is appreciated.
 
I was referring to the general layout of the file itself. What context the <title> tags are in. Not just how the title tags look.

XML parsing at its most basic turns each tag into an object. The tag properties become array keys of the main object. While contents take on their general structure. If there more tags inside its an object each tag becomes an additional object. If its text its a standard string.

So for instance

An XML file like this:

Code:
<fcpxml version="1.0">
<project name="MyProject">
<!-- Project Resources -->
<resources>
<title lane="6" offset="3671668/60000s" ref="r6" name="Some text here," duration="412412/60000s" start="215999784/60000s" role="Subtitles">
<adjust-transform position="0.267518 -32.3158"/>
<text>Some text here," </text>
</title>

<title lane="6" offset="3671668/60000s" ref="r6" name="Some text here," duration="412412/60000s" start="215999784/60000s" role="Subtitles">
<adjust-transform position="0.267518 -32.3158"/>
<text>Some text here," </text>
</title>

<title lane="6" offset="3671668/60000s" ref="r6" name="Some text here," duration="412412/60000s" start="215999784/60000s" role="Subtitles">
<adjust-transform position="0.267518 -32.3158"/>
<text>Some text here," </text>
</title>

<title lane="6" offset="4130126/60000s" ref="r6" name="more text," duration="288288/60000s" start="216003788/60000s" role="else">
<adjust-transform position="0.267518 -32.3158"/>
<text>more text,</text>
</title> 

<title lane="6" offset="4130126/60000s" ref="r6" name="more text," duration="288288/60000s" start="216003788/60000s">
<adjust-transform position="0.267518 -32.3158"/>
<text>more text,</text>
</title> 
</resources>
<!-- Project Story Elements -->
<sequence format="r3">
<spine>
<video ref="r2" duration="5s">
<audio lane="-1" ref="r2" duration="5s"/>
</video>
</spine>
</sequence>
</project>
<project name="Project2">
<resources>
<title lane="6">
<text>This is my title</text>
</title>
</resources>
</project>


Can be parsed to obtain the title tags of a project within like this:

Code:
foreach($xml->children()->project->resources->title as $title) 
{

   if(isset($title['role']) && $title['role'] == 'Subtitles')
   { 
	echo $title['name'] . "<br/>" . $title['role'] . " ," .  $title['duration'] . "," .  $title->text . "<br/>" ;
   }
}

If you have more than one project, and you need title tags from each project, then perhaps:

Code:
foreach ($sml->children()->project as $project)
{
   foreach($project->resources->title as $title)
   {
     echo $project['name'] . "," . "$title['name'] . "," . $title['role'] . "," . "$title['duration'] . "," . "$title->text . "<br/>";
   }
}

----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Web & Tech
 
Thanks for the ideas! I tried to simplify my question but if it helps to see the entire FCPXML, it is below.

It seems I need only the start, duration and text and from there, I should be able to come up with the formatted output. I do somehow need to number sequentially each one too and some of the text contains line breaks that need preserving.

Code:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE fcpxml>

<fcpxml version="1.1">
    <project name=" LIVE in City" uid="C1E80D31-57D4-4E6C-84F6-86A75DCB7A54" eventID="B5C98F73-1D7E-4205-AEF3-1485842EB191" location="file:LIVE%20in%20City/">
        <resources>
            <format id="r1" name="FFVideoFormatDV720x480i5994" frameDuration="2002/60000s" fieldOrder="lower first" width="720" height="480" paspH="10" paspV="11"/>
            <projectRef id="r2" name=" DVD" uid="B5C98F73-1D7E-4205-AEF3-1485842EB191"/>
            <asset id="r3" name="Project NameMERGED-quicktime" uid="E2951D8A4091478C718D981E70B29220" projectRef="r2" src="file:Live%20In%20City%20MERGED-quicktime.mov" start="0s" duration="128865737/30000s" hasVideo="1"/>
            <format id="r4" name="FFVideoFormatRateUndefined" width="640" height="480"/>
            <asset id="r5" name="City opening credit frame 2" uid="492B77C679B1EEDA87E214703CD9B236" projectRef="r2" src="file:City%20opening%20credit%20frame%202.png" start="0s" duration="0s" hasVideo="1"/>
            <effect id="r6" name="Custom" uid=".../Titles.localized/Build In:Out.localized/Custom.localized/Custom.moti"/>
            <format id="r7" name="FFVideoFormatRateUndefined" width="640" height="480"/>
            <asset id="r8" name="City opening credit frame" uid="F6B254957889B664BF2D8E26DA16E974" projectRef="r2" src="file:City%20opening%20credit%20frame.png" start="0s" duration="0s" hasVideo="1"/>
            <effect id="r9" name="Shapes" uid=".../Generators.localized/Elements.localized/Shapes.localized/Shapes.motn"/>
            <effect id="r10" name="Gaussian" uid=".../Effects.localized/Blur.localized/Gaussian.localized/Gaussian.moef"/>
            <effect id="r11" name="Prism" uid=".../Effects.localized/Blur.localized/Prism.localized/Prism.moef"/>
            <format id="r12" name="FFVideoFormatRateUndefined" width="479" height="359"/>
            <asset id="r13" name="CoverArt 4-3" uid="1D3A1205DD4ADDBCB8B751AEBBCEAA2D" projectRef="r2" src="file:CoverArt%204-3.png" start="0s" duration="0s" hasVideo="1"/>
            <format id="r14" name="FFVideoFormatRateUndefined" width="360" height="360"/>
            <asset id="r15" name="Themed Stamp for B Blockage" uid="6A0E5019A7D4A3B1A62DD55F4F4E38AA" projectRef="r2" src="file:Themed%20Stamp%20for%20B%20Blockage%20(fcp1).png" start="0s" duration="0s" hasVideo="1"/>
            <format id="r16" name="FFVideoFormatRateUndefined" width="447" height="114"/>
            <asset id="r17" name="Year Mask PLAIN II" uid="779AB5B3AEE610941036A2C30BBDC308" projectRef="r2" src="file:Year%20Mask%20PLAIN%20II.png" start="0s" duration="0s" hasVideo="1"/>
            <effect id="r18" name="Black &amp; White" uid=".../Effects.localized/Basics.localized/Black &amp; White.localized/Black &amp; White.moef"/>
            <format id="r19" name="FFVideoFormatRateUndefined"/>
            <asset id="r20" name="OPENING FOOTSTEPS 48k 16bit STEREO" uid="4CBE94E4FC15596B2B4E2E368A281F8E" projectRef="r2" src="file:OPENING%20FOOTSTEPS%2048k%2016bit%20STEREO.wav" start="0s" duration="1266136/48000s" hasAudio="1" audioSources="1" audioChannels="2" audioRate="48000"/>
            <effect id="r21" name="Small Room" uid="Small Room.Spaces.audio.effectBundle"/>
            <effect id="r22" name="Denoiser" uid="AudioUnit: 0x61756678000000c3454d4147"/>
            <asset id="r23" name="Project Name 48k 16bit STEREO AUDIO TO USE" uid="620A1EFBAB53CE63F9F826891EA53F15" projectRef="r2" src="file:Live%20In%20City%2048k%2016bit%20STEREO%20AUDIO%20TO%20USE.wav" start="0s" duration="206188103/48000s" hasAudio="1" audioSources="1" audioChannels="2" audioRate="48000"/>
            <effect id="r24" name="AUGraphicEQ" uid="AudioUnit: 0x61756678677265716170706c"/>
            <asset id="r25" name=" DVD (fcp1) 14.27.02" uid="3C0ADD053765B86B19E2D0FDAF432E7C" projectRef="r2" src="file:%20DVD%20(fcp1)%2014.27.02.png" start="0s" duration="0s" hasVideo="1"/>
            <effect id="r26" name="AUFilter" uid="AudioUnit: 0x6175667866696c746170706c"/>
        </resources>
        <sequence duration="10282752480/2400000s" format="r1" tcStart="0s" tcFormat="NDF" audioLayout="stereo" audioRate="48k">
            <spine>
                <audition>
                    <clip name="Project NameMERGED-quicktime" duration="9529520/2400000s" start="1201200/2400000s" audioStart="0s" audioDuration="10730720/2400000s" tcFormat="NDF">
                        <timeMap>
                            <timept time="0s" value="0s" interp="smooth"/>
                            <timept time="1081926736/60000s" value="4295524566666/1000000000s" interp="smooth"/>
                        </timeMap>
                        <adjust-blend amount="0">
                            <param name="amount" keyValues="0; 1" keyTimes="1201200/2400000s; 4404400/2400000s"/>
                        </adjust-blend>
                        <video ref="r3" duration="257731474/60000s"/>
                    </clip>
                    <clip name="City opening credit frame 2" duration="29709680/2400000s" start="8639991360/2400000s" format="r4" tcFormat="NDF">
                        <adjust-blend>
                            <param name="amount" keyValues="0; 0" keyTimes="25930544580/7200000s; 25965139200/7200000s">
                                <fadeIn type="linear" duration="375592/262144s"/>
                                <fadeOut type="linear" duration="3715806252/1000000000s"/>
                            </param>
                        </adjust-blend>
                        <video ref="r5" duration="86400s"/>
                        <spine lane="2" offset="35999964/10000s" format="r1">
                            <title ref="r6" name=" 
LIVE in City" duration="514514/60000s" start="216031816/60000s">
                                <adjust-transform position="-0.0924636 0.77132" scale="1 1.03087"/>
                                <adjust-blend>
                                    <param name="amount" keyValues="1; 1; 0" keyTimes="25934388420/7200000s; 216408192/60000s; 216568352/60000s">
                                        <fadeIn type="linear" duration="371005/262144s"/>
                                    </param>
                                </adjust-blend>
                                <text> 
LIVE in City</text>
                            </title>
                        </spine>
                        <title lane="1" offset="216514298/60000s" ref="r6" name="1960" duration="228228/60000s" start="215951736/60000s">
                            <adjust-transform position="-0.0249084 1.49152"/>
                            <adjust-blend amount="0.69">
                                <param name="amount">
                                    <fadeOut type="linear" duration="9049040/2400000s"/>
                                </param>
                            </adjust-blend>
                            <text>1960</text>
                        </title>
                    </clip>
                    <clip name="City opening credit frame 2 - copy 1" duration="29709680/2400000s" start="8639991360/2400000s" format="r4" tcFormat="NDF">
                        <adjust-blend>
                            <param name="amount" keyValues="0; 0" keyTimes="25930544580/7200000s; 25965139200/7200000s">
                                <fadeIn type="linear" duration="375592/262144s"/>
                                <fadeOut type="linear" duration="3715806252/1000000000s"/>
                            </param>
                        </adjust-blend>
                        <video ref="r5" name="City opening credit frame 2 - still" duration="86400s"/>
                        <spine lane="2" offset="35999964/10000s" format="r1">
                            <title ref="r6" name=" 
LIVE in City" duration="514514/60000s" start="216031816/60000s">
                                <adjust-transform position="-0.0924636 0.77132" scale="1 1.03087"/>
                                <adjust-blend>
                                    <param name="amount" keyValues="1; 1; 0" keyTimes="25934388420/7200000s; 216408192/60000s; 216568352/60000s">
                                        <fadeIn type="linear" duration="371005/262144s"/>
                                    </param>
                                </adjust-blend>
                                <text> 
LIVE in City</text>
                            </title>
                        </spine>
                        <title lane="1" offset="216514298/60000s" ref="r6" name="1960" duration="228228/60000s" start="215951736/60000s">
                            <adjust-transform position="-0.0249084 1.49152"/>
                            <adjust-blend amount="0.69">
                                <param name="amount">
                                    <fadeOut type="linear" duration="9049040/2400000s"/>
                                </param>
                            </adjust-blend>
                            <text>1960</text>
                        </title>
                    </clip>
                </audition>
                <clip offset="9529520/2400000s" name="Compound Clip" duration="105945840/2400000s" start="19779760/2400000s">
                    <spine>
                        <clip name="City opening credit frame" duration="13693680/2400000s" start="8642393760/2400000s" format="r7" tcFormat="NDF">
                            <adjust-blend amount="0">
                                <param name="amount" keyValues="0; 0; 1" keyTimes="8642433800/2400000s; 8648640000/2400000s; 8656007360/2400000s"/>
                            </adjust-blend>
                            <video ref="r8" duration="86400s"/>
                            <marker start="27028001/7500s" duration="2002/60000s" value="Marker 9"/>
                        </clip>
                        <gap offset="13693680/2400000s" name="Gap" duration="5685680/2400000s" start="215999784/60000s"/>
                        <clip offset="19379360/2400000s" name="Project NameMERGED-quicktime" duration="2054772720/2400000s" start="44364320/2400000s" tcFormat="NDF">
                            <video ref="r3" duration="257731474/60000s"/>
                            <marker start="71071/30000s" duration="2002/60000s" value="Marker 6"/>
                            <marker start="457457/7500s" duration="2002/60000s" value="Chapter 1"/>
                            <marker start="1842841/6000s" duration="2002/60000s" value="Chapter 2"/>
                            <marker start="289289/500s" duration="2002/60000s" value="Chapter 3"/>
                            <marker start="12293281/15000s" duration="2002/60000s" value="Chapter 4"/>
                        </clip>
                        <gap offset="2074152080/2400000s" name="Gap" duration="80080/2400000s" start="215999784/60000s"/>
                        <clip offset="2074232160/2400000s" name="Project NameMERGED-quicktime" duration="26986960/2400000s" start="2099217120/2400000s" tcFormat="NDF">
                            <video ref="r3" duration="257731474/60000s"/>
                            <marker start="71071/30000s" duration="2002/60000s" value="Marker 6"/>
                            <marker start="457457/7500s" duration="2002/60000s" value="Chapter 1"/>
                            <marker start="1842841/6000s" duration="2002/60000s" value="Chapter 2"/>
                            <marker start="289289/500s" duration="2002/60000s" value="Chapter 3"/>
                            <marker start="12293281/15000s" duration="2002/60000s" value="Chapter 4"/>
                        </clip>
                        <gap offset="2101219120/2400000s" name="Gap" duration="880880/2400000s" start="215999784/60000s"/>
                        <clip offset="2102100000/2400000s" name="Project NameMERGED-quicktime" duration="8182174000/2400000s" start="2127084960/2400000s" tcFormat="NDF">
                            <video ref="r3" duration="257731474/60000s"/>
                            <marker start="71071/30000s" duration="2002/60000s" value="Marker 6"/>
                            <marker start="457457/7500s" duration="2002/60000s" value="Chapter 1"/>
                            <marker start="1842841/6000s" duration="2002/60000s" value="Chapter 2"/>
                            <marker start="289289/500s" duration="2002/60000s" value="Chapter 3"/>
                            <marker start="12293281/15000s" duration="2002/60000s" value="Chapter 4"/>
                            <marker start="12251239/10000s" duration="2002/60000s" value="Chapter 5"/>
                            <marker start="16006991/10000s" duration="2002/60000s" value="Chapter 6"/>
                            <marker start="27916889/15000s" duration="2002/60000s" value="Chapter 7"/>
                            <marker start="67374307/30000s" duration="2002/60000s" value="Chapter 8"/>
                            <marker start="377377/150s" duration="2002/60000s" value="Chapter 9"/>
                            <marker start="27017991/10000s" duration="2002/60000s" value="Chapter 10"/>
                            <marker start="17826809/6000s" duration="2002/60000s" value="Chapter 11"/>
                            <marker start="32203171/10000s" duration="2002/60000s" value="Chapter 12"/>
                            <marker start="105266161/30000s" duration="2002/60000s" value="Chapter 13"/>
                            <marker start="113190077/30000s" duration="2002/60000s" value="Chapter 14"/>
                            <marker start="120557437/30000s" duration="2002/60000s" value="Chapter 15"/>
                        </clip>
                    </spine>
                    <video lane="2" offset="256256/60000s" ref="r9" name="Shapes" duration="115475360/2400000s" start="216256040/60000s">
                        <adjust-transform position="55.8439 -40.0127" scale="0.243409 0.230699"/>
                        <adjust-blend amount="0.9899" mode="4 (Multiply)">
                            <param name="amount">
                                <fadeIn type="linear" duration="70361/262144s"/>
                            </param>
                        </adjust-blend>
                        <filter ref="r10" name="Gaussian"/>
                    </video>
                    <video lane="3" offset="256256/60000s" ref="r9" name="Shapes" duration="256816560/60000s" start="215026812/60000s">
                        <adjust-transform position="53.1044 41.8883" rotation="2.73043" scale="0.168022 0.589353"/>
                        <adjust-blend>
                            <param name="amount">
                                <fadeIn type="linear" duration="67886/262144s"/>
                            </param>
                        </adjust-blend>
                        <filter ref="r10" name="Gaussian"/>
                        <filter ref="r11" name="Prism" enabled="0"/>
                    </video>
                    <audition lane="4" offset="256256/60000s">
                        <clip name="CoverArt 4-3" duration="256808552/60000s" start="215627412/60000s" format="r12" tcFormat="NDF">
                            <adjust-transform position="53.0804 42.0614" scale="0.0880223 0.0880223"/>
                            <adjust-blend amount="0.3274">
                                <param name="amount">
                                    <fadeIn type="linear" duration="70695/262144s"/>
                                </param>
                            </adjust-blend>
                            <video ref="r13" duration="86400s"/>
                        </clip>
                        <clip name="Themed Stamp for B Blockage" duration="256568312/60000s" start="215299084/60000s" format="r14" tcFormat="NDF">
                            <adjust-transform position="53.2142 41.9841" scale="0.124203 0.0928982"/>
                            <adjust-blend amount="0.3356"/>
                            <video ref="r15" duration="86400s"/>
                        </clip>
                    </audition>
                    <clip lane="7" offset="256256/60000s" name="Year Mask PLAIN II" duration="256808552/60000s" start="215989774/60000s" format="r16" tcFormat="NDF">
                        <adjust-transform position="55.8512 -40.2937" scale="0.138192 0.154738"/>
                        <adjust-blend>
                            <param name="amount">
                                <fadeIn type="linear" duration="146986/262144s"/>
                            </param>
                        </adjust-blend>
                        <video ref="r17" duration="86400s"/>
                        <filter ref="r18" name="Black &amp; White"/>
                    </clip>
                    <title lane="8" offset="256256/60000s" ref="r6" name="1960" duration="256808552/60000s" start="215761546/60000s" role="video">
                        <adjust-transform position="54.0264 -41.5923" scale="0.145276 0.138197"/>
                        <adjust-blend amount="0.75">
                            <param name="amount">
                                <fadeIn type="linear" duration="129040/262144s"/>
                            </param>
                        </adjust-blend>
                        <text>1960</text>
                    </title>
                    <clip lane="-1" offset="18635370/2400000s" name="OPENING FOOTSTEPS 48k 16bit STEREO" duration="19646160/2400000s" start="43660640/2400000s" format="r19">
                        <adjust-volume amount="12dB">
                            <param name="amount">
                                <fadeIn type="easeIn" duration="317001/262144s"/>
                            </param>
                        </adjust-volume>
                        <audio ref="r20" duration="1266136/48000s" role="dialogue"/>
                        <marker start="71071/30000s" duration="1/48000s" value="Marker 8"/>
                        <filter ref="r21" name="Small Room" enabled="0"/>
                        <filter ref="r22" name="Denoiser"/>
                    </clip>
                    <clip lane="-2" offset="10801484375/750000000s" name="Project Name 48k 16bit STEREO AUDIO TO USE" duration="1823217/48000s" start="18711314064/750000000s">
                        <adjust-volume>
                            <param name="amount" keyValues="0dB; -7dB; -7dB; 0dB" keyTimes="615541867189/750000000s; 615577382814/750000000s; 821622234029/1000000000s; 821669588196/1000000000s"/>
                        </adjust-volume>
                        <audio ref="r23" duration="206188103/48000s" role="dialogue"/>
                    </clip>
                    <title lane="1" offset="956956/60000s" ref="r6" name=" will now sing" duration="220220/60000s" start="216073858/60000s" role="Subtitles">
                        <adjust-transform position="0.267518 -32.3158" scale="1 1.03087"/>
                        <text> will now sing</text>
                    </title>
                    <marker start="433433/30000s" duration="2002/60000s" value="1. Introduction"/>
                    <marker start="31031/625s" duration="2002/60000s" value="2. Chapter 1"/>
                    <marker start="157157/3000s" duration="2002/60000s" value="2. Chapter 1"/>
                    <marker start="741741/2500s" duration="2002/60000s" value="3. Chapter 2"/>
                    <marker start="17026009/30000s" duration="2002/60000s" value="4. Chapter 3"/>
                    <marker start="12131119/15000s" duration="2002/60000s" value="5. Chapter 4"/>
                    <marker start="18329311/15000s" duration="2002/60000s" value="Chapter 5"/>
                </clip>
                <clip offset="115475360/2400000s" name="Compound Clip" duration="586265680/2400000s" start="125725600/2400000s">
                    <spine>
                        <clip name="City opening credit frame" duration="13693680/2400000s" start="8642393760/2400000s" format="r7" tcFormat="NDF">
                            <adjust-blend amount="0">
                                <param name="amount" keyValues="0; 0; 1" keyTimes="8642433800/2400000s; 8648640000/2400000s; 8656007360/2400000s"/>
                            </adjust-blend>
                            <video ref="r8" duration="86400s"/>
                            <marker start="27028001/7500s" duration="2002/60000s" value="Marker 9"/>
                        </clip>
                        <gap offset="13693680/2400000s" name="Gap" duration="5685680/2400000s" start="215999784/60000s"/>
                        <clip offset="19379360/2400000s" name="Project NameMERGED-quicktime" duration="2054772720/2400000s" start="44364320/2400000s" tcFormat="NDF">
                            <video ref="r3" duration="257731474/60000s"/>
                            <marker start="71071/30000s" duration="2002/60000s" value="Marker 6"/>
                            <marker start="457457/7500s" duration="2002/60000s" value="Chapter 1"/>
                            <marker start="1842841/6000s" duration="2002/60000s" value="Chapter 2"/>
                            <marker start="289289/500s" duration="2002/60000s" value="Chapter 3"/>
                            <marker start="12293281/15000s" duration="2002/60000s" value="Chapter 4"/>
                        </clip>
                        <gap offset="2074152080/2400000s" name="Gap" duration="80080/2400000s" start="215999784/60000s"/>
                        <clip offset="2074232160/2400000s" name="Project NameMERGED-quicktime" duration="26986960/2400000s" start="2099217120/2400000s" tcFormat="NDF">
                            <video ref="r3" duration="257731474/60000s"/>
                            <marker start="71071/30000s" duration="2002/60000s" value="Marker 6"/>
                            <marker start="457457/7500s" duration="2002/60000s" value="Chapter 1"/>
                            <marker start="1842841/6000s" duration="2002/60000s" value="Chapter 2"/>
                            <marker start="289289/500s" duration="2002/60000s" value="Chapter 3"/>
                            <marker start="12293281/15000s" duration="2002/60000s" value="Chapter 4"/>
                        </clip>
                        <gap offset="2101219120/2400000s" name="Gap" duration="880880/2400000s" start="215999784/60000s"/>
                        <clip offset="2102100000/2400000s" name="Project NameMERGED-quicktime" duration="8182174000/2400000s" start="2127084960/2400000s" tcFormat="NDF">
                            <video ref="r3" duration="257731474/60000s"/>
                            <marker start="71071/30000s" duration="2002/60000s" value="Marker 6"/>
                            <marker start="457457/7500s" duration="2002/60000s" value="Chapter 1"/>
                            <marker start="1842841/6000s" duration="2002/60000s" value="Chapter 2"/>
                            <marker start="289289/500s" duration="2002/60000s" value="Chapter 3"/>
                            <marker start="12293281/15000s" duration="2002/60000s" value="Chapter 4"/>
                            <marker start="12251239/10000s" duration="2002/60000s" value="Chapter 5"/>
                            <marker start="16006991/10000s" duration="2002/60000s" value="Chapter 6"/>
                            <marker start="27916889/15000s" duration="2002/60000s" value="Chapter 7"/>
                            <marker start="67374307/30000s" duration="2002/60000s" value="Chapter 8"/>
                            <marker start="377377/150s" duration="2002/60000s" value="Chapter 9"/>
                            <marker start="27017991/10000s" duration="2002/60000s" value="Chapter 10"/>
                            <marker start="17826809/6000s" duration="2002/60000s" value="Chapter 11"/>
                            <marker start="32203171/10000s" duration="2002/60000s" value="Chapter 12"/>
                            <marker start="105266161/30000s" duration="2002/60000s" value="Chapter 13"/>
                            <marker start="113190077/30000s" duration="2002/60000s" value="Chapter 14"/>
                            <marker start="120557437/30000s" duration="2002/60000s" value="Chapter 15"/>
                        </clip>
                    </spine>
                    <clip lane="-1" offset="78578500000/1500000000s" name="Project Name 48k 16bit STEREO AUDIO TO USE" duration="366466075000/1500000000s" start="94398184378/1500000000s">
                        <adjust-volume>
                            <param name="amount" keyValues="0dB; -7dB; -7dB; 0dB" keyTimes="615541867189/750000000s; 615577382814/750000000s; 821622234029/1000000000s; 821669588196/1000000000s"/>
                        </adjust-volume>
                        <audio ref="r23" duration="206188103/48000s" role="dialogue"/>
                    </clip>
                    <video lane="2" offset="125725600/2400000s" ref="r9" name="Shapes" duration="1236355120/2400000s" start="8773004240/2400000s">
                        <adjust-transform position="55.8439 -40.0127" scale="0.243409 0.230699"/>
                        <adjust-blend amount="0.9899" mode="4 (Multiply)"/>
                        <filter ref="r10" name="Gaussian"/>
                    </video>
                    <title lane="6" offset="3305302/60000s" ref="r6" name="Composer, &quot;Chapter 1&quot; 
Voice of the Andes-" duration="320320/60000s" start="216073858/60000s" role="Subtitles">
                        <adjust-transform position="0.267518 -32.3158" scale="1 1.03087"/>
                        <text>Composer, "Chapter 1" 
Voice of the Andes-</text>
                    </title>
                    <title lane="6" offset="3671668/60000s" ref="r6" name="Andes, stately and vast. Their 
summits concealed by clouds," duration="412412/60000s" start="215999784/60000s" role="Subtitles">
                        <adjust-transform position="0.267518 -32.3158"/>
                        <text>Andes, stately and vast. Their 
summits concealed by clouds,</text>
                    </title>
                    <title lane="6" offset="4130126/60000s" ref="r6" name="and when the evening mist and 
wind drive the sand on the slopes," duration="288288/60000s" start="216003788/60000s" role="Subtitles">
                        <adjust-transform position="0.267518 -32.3158"/>
                        <text>and when the evening mist and 
wind drive the sand on the slopes,</text>
                    </title>
                    <title lane="1" offset="4472468/60000s" ref="r6" name="the mysterious voices of the mountains 
are heard in the dark canyons." duration="412412/60000s" start="215981766/60000s" role="Subtitles">
                        <adjust-transform position="0.267518 -32.3158"/>
                        <text>the mysterious voices of the mountains 
are heard in the dark canyons.</text>
                    </title>
                    <title lane="6" offset="4928924/60000s" ref="r6" name="The brave descendants of the Incas" duration="156156/60000s" start="216007792/60000s" role="Subtitles">
                        <adjust-transform position="0.267518 -32.3158"/>
                        <text>The brave descendants of the Incas</text>
                    </title>
                    <title lane="6" offset="5135130/60000s" ref="r6" name="weave their song into a 
symphony of wildlife" duration="306306/60000s" start="216007792/60000s" role="Subtitles">
                        <adjust-transform position="0.267518 -32.3158"/>
                        <text>weave their song into a 
symphony of wildlife</text>
                    </title>
                    <title lane="6" offset="5463458/60000s" ref="r6" name="and the mountains echo them." duration="236236/60000s" start="216005790/60000s" role="Subtitles">
                        <adjust-transform position="0.267518 -32.3158"/>
                        <text>and the mountains echo them.</text>
                    </title>
                    <clip lane="-2" offset="141757018749/1500000000s" name="Project Name 48k 16bit STEREO AUDIO TO USE" duration="124303/48000s" start="94398184378/1500000000s">
                        <adjust-volume>
                            <param name="amount" keyValues="0dB; -7dB; -7dB; 0dB" keyTimes="615541867189/750000000s; 615577382814/750000000s; 821622234029/1000000000s; 821669588196/1000000000s"/>
                        </adjust-volume>
                        <audio ref="r23" duration="206188103/48000s" role="dialogue"/>
                    </clip>
                    <clip lane="-2" offset="145654020833/1500000000s" name="Project Name 48k 16bit STEREO AUDIO TO USE" duration="120273/48000s" start="91985403128/1500000000s">
                        <adjust-volume>
                            <param name="amount" keyValues="0dB; -7dB; -7dB; 0dB" keyTimes="615541867189/750000000s; 615577382814/750000000s; 821622234029/1000000000s; 821669588196/1000000000s"/>
                        </adjust-volume>
                        <audio ref="r23" duration="206188103/48000s" role="dialogue"/>
                    </clip>
                    <clip lane="-2" offset="149530060416/1500000000s" name="Project Name 48k 16bit STEREO AUDIO TO USE" duration="76024/48000s" start="93931434378/1500000000s">
                        <adjust-volume>
                            <param name="amount" keyValues="0dB; -7dB; -7dB; 0dB" keyTimes="615541867189/750000000s; 615577382814/750000000s; 821622234029/1000000000s; 821669588196/1000000000s"/>
                        </adjust-volume>
                        <audio ref="r23" duration="206188103/48000s" role="dialogue"/>
                    </clip>
                    <marker start="433433/30000s" duration="2002/60000s" value="1. Introduction"/>
                    <marker start="1098097/3750s" duration="2002/60000s" value="3. Chapter 2"/>
                    <marker start="741741/2500s" duration="2002/60000s" value="3. Chapter 2"/>
                    <marker start="17026009/30000s" duration="2002/60000s" value="4. Chapter 3"/>
                    <marker start="12131119/15000s" duration="2002/60000s" value="5. Chapter 4"/>
                    <marker start="18329311/15000s" duration="2002/60000s" value="Chapter 5"/>
                </clip>
                <clip offset="701741040/2400000s" name="Compound Clip" duration="80080/2400000s" start="711991280/2400000s">
                    <spine>
                        <clip name="City opening credit frame" duration="13693680/2400000s" start="8642393760/2400000s" format="r7" tcFormat="NDF">
                            <adjust-blend amount="0">
                                <param name="amount" keyValues="0; 0; 1" keyTimes="8642433800/2400000s; 8648640000/2400000s; 8656007360/2400000s"/>
                            </adjust-blend>
                            <video ref="r8" duration="86400s"/>
                            <marker start="27028001/7500s" duration="2002/60000s" value="Marker 9"/>
                        </clip>
                        <gap offset="13693680/2400000s" name="Gap" duration="5685680/2400000s" start="215999784/60000s"/>
                        <clip offset="19379360/2400000s" name="Project NameMERGED-quicktime" duration="2054772720/2400000s" start="44364320/2400000s" tcFormat="NDF">
                            <video ref="r3" duration="257731474/60000s"/>
                            <marker start="71071/30000s" duration="2002/60000s" value="Marker 6"/>
                            <marker start="457457/7500s" duration="2002/60000s" value="Chapter 1"/>
                            <marker start="1842841/6000s" duration="2002/60000s" value="Chapter 2"/>
                            <marker start="289289/500s" duration="2002/60000s" value="Chapter 3"/>
                            <marker start="12293281/15000s" duration="2002/60000s" value="Chapter 4"/>
                        </clip>
                        <gap offset="2074152080/2400000s" name="Gap" duration="80080/2400000s" start="215999784/60000s"/>
                        <clip offset="2074232160/2400000s" name="Project NameMERGED-quicktime" duration="26986960/2400000s" start="2099217120/2400000s" tcFormat="NDF">
                            <video ref="r3" duration="257731474/60000s"/>
                            <marker start="71071/30000s" duration="2002/60000s" value="Marker 6"/>
                            <marker start="457457/7500s" duration="2002/60000s" value="Chapter 1"/>
                            <marker start="1842841/6000s" duration="2002/60000s" value="Chapter 2"/>
                            <marker start="289289/500s" duration="2002/60000s" value="Chapter 3"/>
                            <marker start="12293281/15000s" duration="2002/60000s" value="Chapter 4"/>
                        </clip>
                        <gap offset="2101219120/2400000s" name="Gap" duration="880880/2400000s" start="215999784/60000s"/>
                        <clip offset="2102100000/2400000s" name="Project NameMERGED-quicktime" duration="8182174000/2400000s" start="2127084960/2400000s" tcFormat="NDF">
                            <video ref="r3" duration="257731474/60000s"/>
                            <marker start="71071/30000s" duration="2002/60000s" value="Marker 6"/>
                            <marker start="457457/7500s" duration="2002/60000s" value="Chapter 1"/>
                            <marker start="1842841/6000s" duration="2002/60000s" value="Chapter 2"/>
                            <marker start="289289/500s" duration="2002/60000s" value="Chapter 3"/>
                            <marker start="12293281/15000s" duration="2002/60000s" value="Chapter 4"/>
                            <marker start="12251239/10000s" duration="2002/60000s" value="Chapter 5"/>
                            <marker start="16006991/10000s" duration="2002/60000s" value="Chapter 6"/>
                            <marker start="27916889/15000s" duration="2002/60000s" value="Chapter 7"/>
                            <marker start="67374307/30000s" duration="2002/60000s" value="Chapter 8"/>
                            <marker start="377377/150s" duration="2002/60000s" value="Chapter 9"/>
                            <marker start="27017991/10000s" duration="2002/60000s" value="Chapter 10"/>
                            <marker start="17826809/6000s" duration="2002/60000s" value="Chapter 11"/>
                            <marker start="32203171/10000s" duration="2002/60000s" value="Chapter 12"/>
                            <marker start="105266161/30000s" duration="2002/60000s" value="Chapter 13"/>
                            <marker start="113190077/30000s" duration="2002/60000s" value="Chapter 14"/>
                            <marker start="120557437/30000s" duration="2002/60000s" value="Chapter 15"/>
                        </clip>
                    </spine>
                    <clip lane="-2" offset="445044575000/1500000000s" name="Project Name 48k 16bit STEREO AUDIO TO USE" duration="406255875000/1500000000s" start="460864259378/1500000000s">
                        <adjust-volume>
                            <param name="amount" keyValues="0dB; -7dB; -7dB; 0dB" keyTimes="615541867189/750000000s; 615577382814/750000000s; 821622234029/1000000000s; 821669588196/1000000000s"/>
                        </adjust-volume>
                        <audio ref="r23" duration="206188103/48000s" role="dialogue"/>
                    </clip>
                    <marker start="433433/30000s" duration="2002/60000s" value="1. Introduction"/>
                    <marker start="741741/2500s" duration="2002/60000s" value="3. Chapter 2"/>
                    <marker start="17026009/30000s" duration="2002/60000s" value="4. Chapter 3"/>
                    <marker start="12131119/15000s" duration="2002/60000s" value="5. Chapter 4"/>
                    <marker start="18329311/15000s" duration="2002/60000s" value="Chapter 5"/>
                </clip>
                <clip offset="701821120/2400000s" name="Compound Clip" duration="650009360/2400000s" start="712071360/2400000s">
                    <spine>
                        <clip name="City opening credit frame" duration="13693680/2400000s" start="8642393760/2400000s" format="r7" tcFormat="NDF">
                            <adjust-blend amount="0">
                                <param name="amount" keyValues="0; 0; 1" keyTimes="8642433800/2400000s; 8648640000/2400000s; 8656007360/2400000s"/>
                            </adjust-blend>
                            <video ref="r8" duration="86400s"/>
                            <marker start="27028001/7500s" duration="2002/60000s" value="Marker 9"/>
                        </clip>
                        <gap offset="13693680/2400000s" name="Gap" duration="5685680/2400000s" start="215999784/60000s"/>
                        <clip offset="19379360/2400000s" name="Project NameMERGED-quicktime" duration="2054772720/2400000s" start="44364320/2400000s" tcFormat="NDF">
                            <video ref="r3" duration="257731474/60000s"/>
                            <marker start="71071/30000s" duration="2002/60000s" value="Marker 6"/>
                            <marker start="457457/7500s" duration="2002/60000s" value="Chapter 1"/>
                            <marker start="1842841/6000s" duration="2002/60000s" value="Chapter 2"/>
                            <marker start="289289/500s" duration="2002/60000s" value="Chapter 3"/>
                            <marker start="12293281/15000s" duration="2002/60000s" value="Chapter 4"/>
                        </clip>
                        <gap offset="2074152080/2400000s" name="Gap" duration="80080/2400000s" start="215999784/60000s"/>
                        <clip offset="2074232160/2400000s" name="Project NameMERGED-quicktime" duration="26986960/2400000s" start="2099217120/2400000s" tcFormat="NDF">
                            <video ref="r3" duration="257731474/60000s"/>
                            <marker start="71071/30000s" duration="2002/60000s" value="Marker 6"/>
                            <marker start="457457/7500s" duration="2002/60000s" value="Chapter 1"/>
                            <marker start="1842841/6000s" duration="2002/60000s" value="Chapter 2"/>
                            <marker start="289289/500s" duration="2002/60000s" value="Chapter 3"/>
                            <marker start="12293281/15000s" duration="2002/60000s" value="Chapter 4"/>
                        </clip>
                        <gap offset="2101219120/2400000s" name="Gap" duration="880880/2400000s" start="215999784/60000s"/>
                        <clip offset="2102100000/2400000s" name="Project NameMERGED-quicktime" duration="8182174000/2400000s" start="2127084960/2400000s" tcFormat="NDF">
                            <video ref="r3" duration="257731474/60000s"/>
                            <marker start="71071/30000s" duration="2002/60000s" value="Marker 6"/>
                            <marker start="457457/7500s" duration="2002/60000s" value="Chapter 1"/>
                            <marker start="1842841/6000s" duration="2002/60000s" value="Chapter 2"/>
                            <marker start="289289/500s" duration="2002/60000s" value="Chapter 3"/>
                            <marker start="12293281/15000s" duration="2002/60000s" value="Chapter 4"/>
                            <marker start="12251239/10000s" duration="2002/60000s" value="Chapter 5"/>
                            <marker start="16006991/10000s" duration="2002/60000s" value="Chapter 6"/>
                            <marker start="27916889/15000s" duration="2002/60000s" value="Chapter 7"/>
                            <marker start="67374307/30000s" duration="2002/60000s" value="Chapter 8"/>
                            <marker start="377377/150s" duration="2002/60000s" value="Chapter 9"/>
                            <marker start="27017991/10000s" duration="2002/60000s" value="Chapter 10"/>
                            <marker start="17826809/6000s" duration="2002/60000s" value="Chapter 11"/>
                            <marker start="32203171/10000s" duration="2002/60000s" value="Chapter 12"/>
                            <marker start="105266161/30000s" duration="2002/60000s" value="Chapter 13"/>
                            <marker start="113190077/30000s" duration="2002/60000s" value="Chapter 14"/>
                            <marker start="120557437/30000s" duration="2002/60000s" value="Chapter 15"/>
                        </clip>
                    </spine>
                    <title lane="1" offset="17847830/60000s" ref="r6" name="Composer - Lullaby &quot;Chapter 2 Mama&quot;" duration="314314/60000s" start="215999784/60000s" role="Subtitles">
                        <adjust-transform position="0.267518 -32.3158"/>
                        <text>Composer - Lullaby "Chapter 2 Mama"</text>
                    </title>
                    <title lane="1" offset="18244226/60000s" ref="r6" name="Lulling her son, the Peruvian 
singer describes the mountain as our mother." duration="276276/60000s" start="216025810/60000s" role="Subtitles">
                        <adjust-transform position="0.267518 -32.3158"/>
                        <text>Lulling her son, the Peruvian 
singer describes the mountain as our mother.</text>
                    </title>
                    <title lane="1" offset="18528510/60000s" ref="r6" name="From her slopes run down creeks, 
giving us the water we drink. " duration="292292/60000s" start="216021806/60000s" role="Subtitles">
                        <adjust-transform position="0.267518 -32.3158"/>
                        <text>From her slopes run down creeks, 
giving us the water we drink. </text>
                    </title>
                    <title lane="1" offset="18874856/60000s" ref="r6" name="In the foothills grow fruit trees, giving us fruit. " duration="256256/60000s" start="216029814/60000s" role="Subtitles">
                        <adjust-transform position="0.267518 -32.3158"/>
                        <text>In the foothills grow fruit trees, giving us fruit. </text>
                    </title>
                    <title lane="1" offset="19199180/60000s" ref="r6" name="In mountain meadows are herds of deer, 
giving us meat we eat and skins 
with which to sew for our clothing." duration="308308/60000s" start="216031816/60000s" role="Subtitles">
                        <adjust-transform position="0.267518 -32.3158"/>
                        <text>In mountain meadows are herds of deer, 
giving us meat we eat and skins 
with which to sew for our clothing.</text>
                    </title>
                    <title lane="1" offset="19529510/60000s" ref="r6" name="That's all that we have. " duration="224224/60000s" start="215993778/60000s" role="Subtitles">
                        <adjust-transform position="0.267518 -32.3158"/>
                        <text>That's all that we have. </text>
                    </title>
                    <title lane="1" offset="19783764/60000s" ref="r6" name="We are poor and our life is hard. " duration="196196/60000s" start="215993778/60000s" role="Subtitles">
                        <adjust-transform position="0.267518 -32.3158"/>
                        <text>We are poor and our life is hard. </text>
                    </title>
                    <title lane="1" offset="19985966/60000s" ref="r6" name="Grow quickly, my son." duration="260260/60000s" start="215993778/60000s" role="Subtitles">
                        <adjust-transform position="0.267518 -32.3158"/>
                        <text>Grow quickly, my son.</text>
                    </title>
                    <title lane="1" offset="20358338/60000s" ref="r6" name="You'll be brave, handsome, intelligent. " duration="250250/60000s" start="215993778/60000s" role="Subtitles">
                        <adjust-transform position="0.267518 -32.3158"/>
                        <text>You'll be brave, handsome, intelligent. </text>
                    </title>
                    <title lane="1" offset="20618598/60000s" ref="r6" name="You will help your people 
find their way to happiness." duration="358358/60000s" start="216053838/60000s" role="Subtitles">
                        <adjust-transform position="0.267518 -32.3158"/>
                        <text>You will help your people 
find their way to happiness.</text>
                    </title>
                    <clip lane="-1" offset="561401650000/1000000000s" name="Project Name 48k 16bit STEREO AUDIO TO USE" duration="1421173604/1000000000s" start="569638303481/1000000000s">
                        <adjust-volume>
                            <param name="amount">
                                <fadeIn type="easeIn" duration="79057/262144s"/>
                            </param>
                        </adjust-volume>
                        <audio ref="r23" duration="206188103/48000s" role="dialogue"/>
                    </clip>
                    <marker start="433433/30000s" duration="2002/60000s" value="1. Introduction"/>
                    <marker start="17026009/30000s" duration="2002/60000s" value="4. Chapter 3"/>
                    <marker start="12131119/15000s" duration="2002/60000s" value="5. Chapter 4"/>
                    <marker start="18329311/15000s" duration="2002/60000s" value="Chapter 5"/>
                </clip>
                <clip offset="1351830480/2400000s" name="Compound Clip" duration="310550240/2400000s" start="1362080720/2400000s">
                    <spine>
                        <clip name="City opening credit frame" duration="13693680/2400000s" start="8642393760/2400000s" format="r7" tcFormat="NDF">
                            <adjust-blend amount="0">
                                <param name="amount" keyValues="0; 0; 1" keyTimes="8642433800/2400000s; 8648640000/2400000s; 8656007360/2400000s"/>
                            </adjust-blend>
                            <video ref="r8" duration="86400s"/>
                            <marker start="27028001/7500s" duration="2002/60000s" value="Marker 9"/>
                        </clip>
                        <gap offset="13693680/2400000s" name="Gap" duration="5685680/2400000s" start="215999784/60000s"/>
                        <clip offset="19379360/2400000s" name="Project NameMERGED-quicktime" duration="2054772720/2400000s" start="44364320/2400000s" tcFormat="NDF">
                            <video ref="r3" duration="257731474/60000s"/>
                            <marker start="71071/30000s" duration="2002/60000s" value="Marker 6"/>
                            <marker start="457457/7500s" duration="2002/60000s" value="Chapter 1"/>
                            <marker start="1842841/6000s" duration="2002/60000s" value="Chapter 2"/>
                            <marker start="289289/500s" duration="2002/60000s" value="Chapter 3"/>
                            <marker start="12293281/15000s" duration="2002/60000s" value="Chapter 4"/>
                        </clip>
                        <gap offset="2074152080/2400000s" name="Gap" duration="80080/2400000s" start="215999784/60000s"/>
                        <clip offset="2074232160/2400000s" name="Project NameMERGED-quicktime" duration="26986960/2400000s" start="2099217120/2400000s" tcFormat="NDF">
                            <video ref="r3" duration="257731474/60000s"/>
                            <marker start="71071/30000s" duration="2002/60000s" value="Marker 6"/>
                            <marker start="457457/7500s" duration="2002/60000s" value="Chapter 1"/>
                            <marker start="1842841/6000s" duration="2002/60000s" value="Chapter 2"/>
                            <marker start="289289/500s" duration="2002/60000s" value="Chapter 3"/>
                            <marker start="12293281/15000s" duration="2002/60000s" value="Chapter 4"/>
                        </clip>
                        <gap offset="2101219120/2400000s" name="Gap" duration="880880/2400000s" start="215999784/60000s"/>
                        <clip offset="2102100000/2400000s" name="Project NameMERGED-quicktime" duration="8182174000/2400000s" start="2127084960/2400000s" tcFormat="NDF">
                            <video ref="r3" duration="257731474/60000s"/>
                            <marker start="71071/30000s" duration="2002/60000s" value="Marker 6"/>
                            <marker start="457457/7500s" duration="2002/60000s" value="Chapter 1"/>
                            <marker start="1842841/6000s" duration="2002/60000s" value="Chapter 2"/>
                            <marker start="289289/500s" duration="2002/60000s" value="Chapter 3"/>
                            <marker start="12293281/15000s" duration="2002/60000s" value="Chapter 4"/>
                            <marker start="12251239/10000s" duration="2002/60000s" value="Chapter 5"/>
                            <marker start="16006991/10000s" duration="2002/60000s" value="Chapter 6"/>
                            <marker start="27916889/15000s" duration="2002/60000s" value="Chapter 7"/>
                            <marker start="67374307/30000s" duration="2002/60000s" value="Chapter 8"/>
                            <marker start="377377/150s" duration="2002/60000s" value="Chapter 9"/>
                            <marker start="27017991/10000s" duration="2002/60000s" value="Chapter 10"/>
                            <marker start="17826809/6000s" duration="2002/60000s" value="Chapter 11"/>
                            <marker start="32203171/10000s" duration="2002/60000s" value="Chapter 12"/>
                            <marker start="105266161/30000s" duration="2002/60000s" value="Chapter 13"/>
                            <marker start="113190077/30000s" duration="2002/60000s" value="Chapter 14"/>
                            <marker start="120557437/30000s" duration="2002/60000s" value="Chapter 15"/>
                        </clip>
                    </spine>
                    <clip lane="-1" offset="851300450000/1500000000s" name="Project Name 48k 16bit STEREO AUDIO TO USE" duration="10309187500/1500000000s" start="867120134378/1500000000s">
                        <adjust-volume>
                            <param name="amount" keyValues="0dB; -7dB; -7dB; 0dB" keyTimes="615541867189/750000000s; 615577382814/750000000s; 821622234029/1000000000s; 821669588196/1000000000s"/>
                        </adjust-volume>
                        <audio ref="r23" duration="206188103/48000s" role="dialogue"/>
                        <filter ref="r24" name="AUGraphicEQ"/>
                    </clip>
                    <video lane="1" offset="1362080720/2400000s" ref="r9" name="Shapes" duration="578898320/2400000s" start="10009359360/2400000s">
                        <adjust-transform position="55.8439 -40.0127" scale="0.243409 0.230699"/>
                        <adjust-blend amount="0.9899" mode="4 (Multiply)"/>
                        <filter ref="r10" name="Gaussian"/>
                    </video>
                    <title lane="2" offset="34174140/60000s" ref="r6" name="Composer - Indian Magic Flute" duration="268268/60000s" start="216077862/60000s" role="Subtitles">
                        <adjust-transform position="0.267518 -32.3158"/>
                        <text>Composer - Indian Magic Flute</text>
                    </title>
                    <clip lane="-1" offset="861609637500/1500000000s" name="Project Name 48k 16bit STEREO AUDIO TO USE" duration="351502250000/1500000000s" start="877429321878/1500000000s">
                        <adjust-volume>
                            <param name="amount" keyValues="0dB; -7dB; -7dB; 0dB" keyTimes="615541867189/750000000s; 615577382814/750000000s; 821622234029/1000000000s; 821669588196/1000000000s"/>
                        </adjust-volume>
                        <audio ref="r23" duration="206188103/48000s" role="dialogue"/>
                    </clip>
                    <title lane="2" offset="34464430/60000s" ref="r6" name="This song mimics the sound of ancient flutes." duration="274274/60000s" start="216053838/60000s" role="Subtitles">
                        <adjust-transform position="0.267518 -32.3158"/>
                        <text>This song mimics the sound of ancient flutes.</text>
                    </title>
                    <title lane="2" offset="34752718/60000s" ref="r6" name="Flute played by Joseph Yutson,
winner of national musicians contest." duration="356356/60000s" start="216053838/60000s" role="Subtitles">
                        <adjust-transform position="0.267518 -32.3158"/>
                        <text>Flute played by Joseph Yutson,
winner of national musicians contest.</text>
                    </title>
                    <marker start="433433/30000s" duration="2002/60000s" value="1. Introduction"/>
                    <marker start="741741/2500s" duration="2002/60000s" value="3. Chapter 2"/>
                    <marker start="17026009/30000s" duration="2002/60000s" value="4. Chapter 3"/>
                    <marker start="12131119/15000s" duration="2002/60000s" value="5. Chapter 4"/>
                    <marker start="18329311/15000s" duration="2002/60000s" value="Chapter 5"/>
                </clip>
                <clip offset="1662380720/2400000s" name="Compound Clip" duration="4164160/2400000s" start="1672630960/2400000s">
                    <info-asc-cdl slope="1.85698 1.85698 1.85698" offset="-0.323118 -0.323118 -0.323118" power="0.560694 0.560694 0.560694"/>
                    <spine>
                        <clip name="City opening credit frame" duration="13693680/2400000s" start="8642393760/2400000s" format="r7" tcFormat="NDF">
                            <adjust-blend amount="0">
                                <param name="amount" keyValues="0; 0; 1" keyTimes="8642433800/2400000s; 8648640000/2400000s; 8656007360/2400000s"/>
                            </adjust-blend>
                            <video ref="r8" duration="86400s"/>
                            <marker start="27028001/7500s" duration="2002/60000s" value="Marker 9"/>
                        </clip>
                        <gap offset="13693680/2400000s" name="Gap" duration="5685680/2400000s" start="215999784/60000s"/>
                        <clip offset="19379360/2400000s" name="Project NameMERGED-quicktime" duration="2054772720/2400000s" start="44364320/2400000s" tcFormat="NDF">
                            <video ref="r3" duration="257731474/60000s"/>
                            <marker start="71071/30000s" duration="2002/60000s" value="Marker 6"/>
                            <marker start="457457/7500s" duration="2002/60000s" value="Chapter 1"/>
                            <marker start="1842841/6000s" duration="2002/60000s" value="Chapter 2"/>
                            <marker start="289289/500s" duration="2002/60000s" value="Chapter 3"/>
                            <marker start="12293281/15000s" duration="2002/60000s" value="Chapter 4"/>
                        </clip>
                        <gap offset="2074152080/2400000s" name="Gap" duration="80080/2400000s" start="215999784/60000s"/>
                        <clip offset="2074232160/2400000s" name="Project NameMERGED-quicktime" duration="26986960/2400000s" start="2099217120/2400000s" tcFormat="NDF">
                            <video ref="r3" duration="257731474/60000s"/>
                            <marker start="71071/30000s" duration="2002/60000s" value="Marker 6"/>
                            <marker start="457457/7500s" duration="2002/60000s" value="Chapter 1"/>
                            <marker start="1842841/6000s" duration="2002/60000s" value="Chapter 2"/>
                            <marker start="289289/500s" duration="2002/60000s" value="Chapter 3"/>
                            <marker start="12293281/15000s" duration="2002/60000s" value="Chapter 4"/>
                        </clip>
                        <gap offset="2101219120/2400000s" name="Gap" duration="880880/2400000s" start="215999784/60000s"/>
                        <clip offset="2102100000/2400000s" name="Project NameMERGED-quicktime" duration="8182174000/2400000s" start="2127084960/2400000s" tcFormat="NDF">
                            <video ref="r3" duration="257731474/60000s"/>
                            <marker start="71071/30000s" duration="2002/60000s" value="Marker 6"/>
                            <marker start="457457/7500s" duration="2002/60000s" value="Chapter 1"/>
                            <marker start="1842841/6000s" duration="2002/60000s" value="Chapter 2"/>
                            <marker start="289289/500s" duration="2002/60000s" value="Chapter 3"/>
                            <marker start="12293281/15000s" duration="2002/60000s" value="Chapter 4"/>
                            <marker start="12251239/10000s" duration="2002/60000s" value="Chapter 5"/>
                            <marker start="16006991/10000s" duration="2002/60000s" value="Chapter 6"/>
                            <marker start="27916889/15000s" duration="2002/60000s" value="Chapter 7"/>
                            <marker start="67374307/30000s" duration="2002/60000s" value="Chapter 8"/>
                            <marker start="377377/150s" duration="2002/60000s" value="Chapter 9"/>
                            <marker start="27017991/10000s" duration="2002/60000s" value="Chapter 10"/>
                            <marker start="17826809/6000s" duration="2002/60000s" value="Chapter 11"/>
                            <marker start="32203171/10000s" duration="2002/60000s" value="Chapter 12"/>
                            <marker start="105266161/30000s" duration="2002/60000s" value="Chapter 13"/>
                            <marker start="113190077/30000s" duration="2002/60000s" value="Chapter 14"/>
                            <marker start="120557437/30000s" duration="2002/60000s" value="Chapter 15"/>
                        </clip>
                    </spine>
                    <marker start="433433/30000s" duration="2002/60000s" value="1. Introduction"/>
                    <marker start="741741/2500s" duration="2002/60000s" value="3. Chapter 2"/>
                    <marker start="17026009/30000s" duration="2002/60000s" value="4. Chapter 3"/>
                    <marker start="12131119/15000s" duration="2002/60000s" value="5. Chapter 4"/>
                    <marker start="18329311/15000s" duration="2002/60000s" value="Chapter 5"/>
                </clip>
                <clip offset="1666544880/2400000s" name="Compound Clip" duration="105625520/2400000s" start="1676795120/2400000s">
                    <info-asc-cdl slope="1.85698 1.85698 1.85698" offset="-0.323118 -0.323118 -0.323118" power="0.560694 0.560694 0.560694"/>
                    <spine>
                        <clip name="City opening credit frame" duration="13693680/2400000s" start="8642393760/2400000s" format="r7" tcFormat="NDF">
                            <adjust-blend amount="0">
                                <param name="amount" keyValues="0; 0; 1" keyTimes="8642433800/2400000s; 8648640000/2400000s; 8656007360/2400000s"/>
                            </adjust-blend>
                            <video ref="r8" duration="86400s"/>
                            <marker start="27028001/7500s" duration="2002/60000s" value="Marker 9"/>
                        </clip>
                        <gap offset="13693680/2400000s" name="Gap" duration="5685680/2400000s" start="215999784/60000s"/>
                        <clip offset="19379360/2400000s" name="Project NameMERGED-quicktime" duration="2054772720/2400000s" start="44364320/2400000s" tcFormat="NDF">
                            <video ref="r3" duration="257731474/60000s"/>
                            <marker start="71071/30000s" duration="2002/60000s" value="Marker 6"/>
                            <marker start="457457/7500s" duration="2002/60000s" value="Chapter 1"/>
                            <marker start="1842841/6000s" duration="2002/60000s" value="Chapter 2"/>
                            <marker start="289289/500s" duration="2002/60000s" value="Chapter 3"/>
                            <marker start="12293281/15000s" duration="2002/60000s" value="Chapter 4"/>
                        </clip>
                        <gap offset="2074152080/2400000s" name="Gap" duration="80080/2400000s" start="215999784/60000s"/>
                        <clip offset="2074232160/2400000s" name="Project NameMERGED-quicktime" duration="26986960/2400000s" start="2099217120/2400000s" tcFormat="NDF">
                            <video ref="r3" duration="257731474/60000s"/>
                            <marker start="71071/30000s" duration="2002/60000s" value="Marker 6"/>
                            <marker start="457457/7500s" duration="2002/60000s" value="Chapter 1"/>
                            <marker start="1842841/6000s" duration="2002/60000s" value="Chapter 2"/>
                            <marker start="289289/500s" duration="2002/60000s" value="Chapter 3"/>
                            <marker start="12293281/15000s" duration="2002/60000s" value="Chapter 4"/>
                        </clip>
                        <gap offset="2101219120/2400000s" name="Gap" duration="880880/2400000s" start="215999784/60000s"/>
                        <clip offset="2102100000/2400000s" name="Project NameMERGED-quicktime" duration="8182174000/2400000s" start="2127084960/2400000s" tcFormat="NDF">
                            <video ref="r3" duration="257731474/60000s"/>
                            <marker start="71071/30000s" duration="2002/60000s" value="Marker 6"/>
                            <marker start="457457/7500s" duration="2002/60000s" value="Chapter 1"/>
                            <marker start="1842841/6000s" duration="2002/60000s" value="Chapter 2"/>
                            <marker start="289289/500s" duration="2002/60000s" value="Chapter 3"/>
                            <marker start="12293281/15000s" duration="2002/60000s" value="Chapter 4"/>
                            <marker start="12251239/10000s" duration="2002/60000s" value="Chapter 5"/>
                            <marker start="16006991/10000s" duration="2002/60000s" value="Chapter 6"/>
                            <marker start="27916889/15000s" duration="2002/60000s" value="Chapter 7"/>
                            <marker start="67374307/30000s" duration="2002/60000s" value="Chapter 8"/>
                            <marker start="377377/150s" duration="2002/60000s" value="Chapter 9"/>
                            <marker start="27017991/10000s" duration="2002/60000s" value="Chapter 10"/>
                            <marker start="17826809/6000s" duration="2002/60000s" value="Chapter 11"/>
                            <marker start="32203171/10000s" duration="2002/60000s" value="Chapter 12"/>
                            <marker start="105266161/30000s" duration="2002/60000s" value="Chapter 13"/>
                            <marker start="113190077/30000s" duration="2002/60000s" value="Chapter 14"/>
                            <marker start="120557437/30000s" duration="2002/60000s" value="Chapter 15"/>
                        </clip>
                    </spine>
                    <marker start="433433/30000s" duration="2002/60000s" value="1. Introduction"/>
                    <marker start="741741/2500s" duration="2002/60000s" value="3. Chapter 2"/>
                    <marker start="17026009/30000s" duration="2002/60000s" value="4. Chapter 3"/>
                    <marker start="12131119/15000s" duration="2002/60000s" value="5. Chapter 4"/>
                    <marker start="18329311/15000s" duration="2002/60000s" value="Chapter 5"/>
                </clip>
                <clip offset="1772170400/2400000s" name="Compound Clip" duration="158558400/2400000s" start="1782420640/2400000s">
                    <spine>
                        <clip name="City opening credit frame" duration="13693680/2400000s" start="8642393760/2400000s" format="r7" tcFormat="NDF">
                            <adjust-blend amount="0">
                                <param name="amount" keyValues="0; 0; 1" keyTimes="8642433800/2400000s; 8648640000/2400000s; 8656007360/2400000s"/>
 
If you are familiar with the sizzle
Selector 'language' as employed in jquery and elsewhere then you can use phpquery to grab different bits of your XML. These is a performance overhead but not major. Phpquery acts as a neat abstraction layer to the XML functions (which I often find unhelpful when I don't know the precise dom structure in advance)
 
This is a tool that I'll be using primarily locally (here on my development system) for the times when I am working on video DVD authoring.

In the meantime, I've tried the code below but get a server 500 error as I wasn't sure if the $xml variable was to be the path to the file or the file's contents.

Code:
$xmlUrl = "LIVE in City.fcpxml";
$xml = simplexml_load_file($xmlUrl);

foreach($xml->children()->project->resources->title as $title) 
{

   if(isset($title['role']) && $title['role'] == 'Subtitles')
   { 
	echo $title['name'] . "<br/>" . $title['role'] . " ," .  $title['duration'] . "," .  $title->text . "<br/>" ;
   }
}
 
Look at the structure, your title tags aren't inside resources, they are inside <clips> which are inside <spines> inside <sequence>

The key to parsing xml is the structure.

If you understand the structure you can access the contents.

$xml should be the result of either using the simplexml_load_file, or of creating a new xml object using the xml class.

This is correct:
$xml = simplexml_load_file($xmlUrl);

Once you have the xml loaded into the variable, you can start to parse.

For instance if I wanted to get the names of the clips inside audition:

Code:
foreach($xml->children()->project->sequence->spine->audition->clip as $clip)
 {
	echo $clip['name'] ." <br/>"; 
 }

In your case the titles are inside clips inside spines inside other clips etc....

The parsing can get a little complex, but you'll need to play around with the objects to get the data out.

You are probably going to need nested foreach loops to get the data from the different spines, and clips out.

You can use the print_r function to print out the contents of an array or object so you know what the underlying structure is like. And you can construct the parser as you go.



----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Web & Tech
 
Thanks! Your sample actually gives some results even though they are for other tags:

Code:
Live In City MERGED-quicktime
 City opening credit frame 2
 City opening credit frame 2 - copy 1

Although I understand XML in general, it's been several years since I've worked with it and never on a file as seemingly non-standard as this. To try to better understand the structure, I found some code that appears should help but it gives no results (I didn't write it):

Code:
function parseTree($tree, $root = null) {
    $return = array();
    # Traverse the tree and search for direct children of the root
    foreach($tree as $child => $parent) {
        # A direct child is found
        if($parent == $root) {
            # Remove item from tree (we don't need to traverse this again)
            unset($tree[$child]);
            # Append the child into result array and parse its children
            $return[] = array(
                'name' => $child,
                'children' => parseTree($tree, $child)
            );
        }
    }
    return empty($return) ? null : $return;    
}

function printTree($tree) {
    if(!is_null($tree) && count($tree) > 0) {
        echo '<ul>';
        foreach($tree as $node) {
            echo '<li>'.$node['name'];
            printTree($node['children']);
            echo '</li>';
        }
        echo '</ul>';
    }
}

$xmlUrl = "LIVE in City.fcpxml";
$xml = simplexml_load_file($xmlUrl);

$result = parseTree($xml);
printTree($result);

 
using phpquery I used the following code

Code:
<?php
require_once 'phpQuery.php';
phpQuery::newDocumentFileXML('NewFile.xml');
foreach(pq('project') as $project):
	echo "Project name is " . pq($project)->attr('name') . "</br />";
	foreach(pq($project)->find('clip') as $clip):
		echo 'clip found.  Details follow:';
		echo '<br/>----------------------------<br/>';
		$t = pq($clip);
		echo 'Start Time: ' . $t->attr('start') . "<br/>";
		echo 'Duration: ' . $t->attr('duration') . "<br/>";
		echo 'Name:' . nl2br(htmlspecialchars($t->attr('name'))) . "<br/>";
		echo '<br/>----------------------------<br/>';
	endforeach;
endforeach;
?>
against a slightly modified version of the xml you posted above. the modifications:
1. finalised the unfinalised xml elements.
2. converted the & signs to the character refeferences to make valid xml.

anyway, using the above code I received the following results. Hopefully this is sufficient to evidence the usefulness of phpquery in approaching and traversing dynamic xml

Code:
Project name is LIVE in City
clip found. Details follow:
----------------------------
Start Time: 1201200/2400000s
Duration: 9529520/2400000s
Name:Project NameMERGED-quicktime

----------------------------
clip found. Details follow:
----------------------------
Start Time: 8639991360/2400000s
Duration: 29709680/2400000s
Name:City opening credit frame 2

----------------------------
clip found. Details follow:
----------------------------
Start Time: 8639991360/2400000s
Duration: 29709680/2400000s
Name:City opening credit frame 2 - copy 1

----------------------------
clip found. Details follow:
----------------------------
Start Time: 19779760/2400000s
Duration: 105945840/2400000s
Name:Compound Clip

----------------------------
clip found. Details follow:
----------------------------
Start Time: 8642393760/2400000s
Duration: 13693680/2400000s
Name:City opening credit frame

----------------------------
clip found. Details follow:
----------------------------
Start Time: 44364320/2400000s
Duration: 2054772720/2400000s
Name:Project NameMERGED-quicktime

----------------------------
clip found. Details follow:
----------------------------
Start Time: 2099217120/2400000s
Duration: 26986960/2400000s
Name:Project NameMERGED-quicktime

----------------------------
clip found. Details follow:
----------------------------
Start Time: 2127084960/2400000s
Duration: 8182174000/2400000s
Name:Project NameMERGED-quicktime

----------------------------
clip found. Details follow:
----------------------------
Start Time: 215627412/60000s
Duration: 256808552/60000s
Name:CoverArt 4-3

----------------------------
clip found. Details follow:
----------------------------
Start Time: 215299084/60000s
Duration: 256568312/60000s
Name:Themed Stamp for B Blockage

----------------------------
clip found. Details follow:
----------------------------
Start Time: 215989774/60000s
Duration: 256808552/60000s
Name:Year Mask PLAIN II

----------------------------
clip found. Details follow:
----------------------------
Start Time: 43660640/2400000s
Duration: 19646160/2400000s
Name:OPENING FOOTSTEPS 48k 16bit STEREO

----------------------------
clip found. Details follow:
----------------------------
Start Time: 18711314064/750000000s
Duration: 1823217/48000s
Name:Project Name 48k 16bit STEREO AUDIO TO USE

----------------------------
clip found. Details follow:
----------------------------
Start Time: 125725600/2400000s
Duration: 586265680/2400000s
Name:Compound Clip

----------------------------
clip found. Details follow:
----------------------------
Start Time: 8642393760/2400000s
Duration: 13693680/2400000s
Name:City opening credit frame

----------------------------
clip found. Details follow:
----------------------------
Start Time: 44364320/2400000s
Duration: 2054772720/2400000s
Name:Project NameMERGED-quicktime

----------------------------
clip found. Details follow:
----------------------------
Start Time: 2099217120/2400000s
Duration: 26986960/2400000s
Name:Project NameMERGED-quicktime

----------------------------
clip found. Details follow:
----------------------------
Start Time: 2127084960/2400000s
Duration: 8182174000/2400000s
Name:Project NameMERGED-quicktime

----------------------------
clip found. Details follow:
----------------------------
Start Time: 94398184378/1500000000s
Duration: 366466075000/1500000000s
Name:Project Name 48k 16bit STEREO AUDIO TO USE

----------------------------
clip found. Details follow:
----------------------------
Start Time: 94398184378/1500000000s
Duration: 124303/48000s
Name:Project Name 48k 16bit STEREO AUDIO TO USE

----------------------------
clip found. Details follow:
----------------------------
Start Time: 91985403128/1500000000s
Duration: 120273/48000s
Name:Project Name 48k 16bit STEREO AUDIO TO USE

----------------------------
clip found. Details follow:
----------------------------
Start Time: 93931434378/1500000000s
Duration: 76024/48000s
Name:Project Name 48k 16bit STEREO AUDIO TO USE

----------------------------
clip found. Details follow:
----------------------------
Start Time: 711991280/2400000s
Duration: 80080/2400000s
Name:Compound Clip

----------------------------
clip found. Details follow:
----------------------------
Start Time: 8642393760/2400000s
Duration: 13693680/2400000s
Name:City opening credit frame

----------------------------
clip found. Details follow:
----------------------------
Start Time: 44364320/2400000s
Duration: 2054772720/2400000s
Name:Project NameMERGED-quicktime

----------------------------
clip found. Details follow:
----------------------------
Start Time: 2099217120/2400000s
Duration: 26986960/2400000s
Name:Project NameMERGED-quicktime

----------------------------
clip found. Details follow:
----------------------------
Start Time: 2127084960/2400000s
Duration: 8182174000/2400000s
Name:Project NameMERGED-quicktime

----------------------------
clip found. Details follow:
----------------------------
Start Time: 460864259378/1500000000s
Duration: 406255875000/1500000000s
Name:Project Name 48k 16bit STEREO AUDIO TO USE

----------------------------

if you are after a different subset of data, and can't work out how to get hold of it, post back.

phpquery is found here
 
Thanks, that is quite helpful! Seeing it in a tree format would help even more but in the meantime I want to post an update. I have created a simple bit of code that seems to get the title tags without getting those that are not subtitles. I understand the hierarchy of standard XML but, as pointed out, this one seems to have subsections that also contain needed data. My code so far seems to grab only the first one although examining the XML seems to show others on the same level. Since I don't quite understand it, I've limited my code to only a single loop but maybe you see something I'm obviously missing.

Having said that, this code has the hierarchy hard-coded but I am hesitant doing it that way because it will then be usable only on this one file. Another might be quite different (although the tag names will be the same) so is there a way to do it where it will just find the title tags without specifying where they are in the hierarchy?

Code:
<?php

$xmlUrl = "LIVE in City.fcpxml"; // XML feed file/URL
$xml = simplexml_load_file($xmlUrl);

echo "<pre>";

$i = 1;
foreach ($xml->children()->project->sequence->spine->clip->title as $title) {
   if (isset($title['role']) && $title['role'] == 'Subtitles') {
	echo $i++ ."\r";
	echo $title['start'] ." --> "; 
	echo $title['duration'] ."\n";
	echo $title->text . "\n\n";
   }
}

echo "</pre>";
?>

This does not have any time conversions yet but it is otherwise giving me the results in the format I need:

Code:
1
216073858/60000s --> 220220/60000s
will now sing
 
Probably best to define what you require and how you require it.
Then work out how to achieve that.
The data is all there. Extracting it is very straightforward. But extracting it correctly is hit and miss until you define the parameters and format you require.
Flat file vs tree is simply how the array is built. But as the format appears to allow arbitrary depth of clips if you do have the output as a tree you will still need to built procedural code to parse that tree to an arbitrary depth. Hence back at square one.
Try posting the problem you are trying to solve as a statement of business logic rather than coding challenge.
 
Oddly, I posted these thanks along with the semi-final code but it seems to have disappeared! I really appreciate the help. Thanks also for your tips on posting a question. I don't have a business mind, though, so unfortunately that would be an added challenge to post that way.

I have it working and presenting the data exactly as I need it to do by leveraging the tree code above and some of my own. It is pulling out everything needed and nothing not needed but I can't figure out how to get it to show me the <text></text> value rather than the name= value. They are usually, but not necessarily always, the same so it's important to get the <title> itself just to be sure and they must be raw, exactly as they are in the XML. Any last thoughts?

Code:
<?php

echo "<pre>";
$xmlUrl = "LIVE in City.fcpxml"; // XML feed file/URL

$i = 1;

require_once 'phpQuery.php';
phpQuery::newDocumentFileXML($xmlUrl);
foreach(pq('project') as $project):
	foreach(pq($project)->find('title') as $title):
		$t = pq($title);
   		if ($t->attr('role') == 'Subtitles') {
			echo $i++ ."\r";
			echo $t->attr('start') . " --> ";
			echo $t->attr('duration') . "\n";
			echo $t->attr('name') . "\n\n";
			//echo $t->attr->text . "\n\n";
		}
	endforeach;
endforeach;

echo "</pre>";
 
the inner value of an element can be obtained just like jQuery
Code:
pq('text').text();

or if you want the inner value together with child nodes use
Code:
pq('text').html();
 
Thanks! I've always done all my programming manually without use of jQuery or phpQuery but am finding from this experience what I've been missing.

That said, your idea for pq('text').text(); looks to be exactly what I need but it seems to give a server 500 error and I'm not sure why.

Code:
$i = 1;

require_once 'phpQuery.php';
phpQuery::newDocumentFileXML($xmlUrl, $charset='utf-8');
foreach (pq('project') as $project):
	foreach(pq($project)->find('title') as $title):
		$t = pq($title);
   		if ($t->attr('role') == 'Subtitles') {
			echo $i++ ."\r";
			echo $t->attr('start') . " --> ";
			echo $t->attr('duration') . "\n";
			echo pq('text').text() . "\n\n";
		}
	endforeach;
endforeach;

Also, the original file has carriage returns in the text tags that seem to be getting replaced by a space. Normally I would use the nl2br() PHP function to fix it but in this case it seems to be that it is an actual space being added rather than just simply a hidden \n or \r so I worked around it by using (space needed to make it show up here)

Code:
echo str_replace("  ","& #10;", $t->attr('name')) . "\n\n";

but this does not seem to be a good fix even though it works after a fashion. The original file does have the carriage returns so are there any switches of parameters to preserve them?

Thanks again.

Don
 
my bad. i gave the jquery object notation and not the php object notation.

you will need
Code:
pq('text')->text();

however your code above won't do what you want it to as it will look at all the text nodes in the currently specified 'document'.

something like this should work

Code:
foreach(pq($project)->find('title') as $title):
    $t = pq($title);
    if ($t->attr('role') == 'Subtitles'):
	echo $i++ ."\r";
	echo $t->attr('start') . " --> ";
	echo $t->attr('duration') . "\n";
	echo count($t->find('text')) > 0 ? htmlspecialchars($t->find('text')->text()) ? 'No text node';
        echo "\n\n";
    endif; 
endforeach;

i have not tested this code and it may be that the ->find() method does not return a true array, in which case the count function may not work as expected. but anyway the point is that you need to be looking for the node within the snip that you have, thus use ->find().

 
Thanks for the clarification and you're right that

Code:
pq('text')->text();

gives all the text nodes and not just those within the conditional.

Although this

Code:
echo count($t->find('text')) > 0 ? $t->find('text')->text() ? 'No text node';

gives a server 500 error, I've looked through the phpQuery documentation in order to try to understand it better and your count and ->find() comment helped in that direction. It works with this and even no longer seems to be losing the carriage returns now that it's getting the proper 'text' values rather than the 'name' values:

Code:
foreach (pq('project') as $project) {
	foreach(pq($project)->find('title') as $title) {
		$t = pq($title);
   		if ($t->attr('role') == 'Subtitles') {
			echo $i++ ."\r";
			echo $t->attr('start') . " --> ";
			echo $t->attr('duration') . "\n";
			echo $t->find('text')->text() . "\n\n";
		}
	}
}

One thing I should clarify is that I am currently outputting this to the browser just for the sake of testing but ultimately the output will be to a .SRT file, which is a text file used in some DVD authoring applications for the subtitles. Since it needs to be plain text, I don't think I need to use the htmlspecialchars() function because there can be no HTML in it.

I still need to try to come up with formulas for the 'start' and 'duration' values but that's unrelated to the problem here (although I don't see a Final Cut Pro forum on tek-tips), which now seems to have been solved.

Thanks to all who helped!

Don
 
The second question mark should have been a colon
 
Thanks, yes, I discovered that after posting. I have it working as needed with the code I posted above but this:

Code:
echo count($t->find('text')) > 0 ? $t->find('text')->text() : 'No text node' . "\n\n";

seems to strip out all line breaks. Anyway, as it's working now, there is no need to solve this issue but thank you for pointing out the error.

Don
 
it should not strip out the line breaks, but might strip out html entities like <br/>. If you want the raw content then change ->text() for ->html()
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top