douxiuyu2028
2014-05-08 21:58 阅读 60

php DOMDocument() - > loadXML()无效

I have this XML automatically produced by GPAC MP4Box.

<?xml version="1.0"?>

<!-- MPD file Generated with GPAC version 0.5.1-DEV-rev5223M  on 2014-05-08T02:46:28Z-->
<MPD 
    xmlns="urn:mpeg:dash:schema:mpd:2011" minBufferTime="PT1.500000S" type="dynamic" availabilityStartTime="2014-05-07T22:02:08Z" 
    timeShiftBufferDepth="PT0H0M0.00S" profiles="urn:mpeg:dash:profile:isoff-live:2011">
    <ProgramInformation 
        moreInformationURL="http://gpac.sourceforge.net">
        <Title>session.mpd generated by GPAC</Title>

    </ProgramInformation>

    <Period id="GENID_DEF" start="PT0H0M0.00S">
        <AdaptationSet segmentAlignment="true" maxWidth="352" 
                       maxHeight="288" maxFrameRate="5" par="352:288">
            <SegmentTemplate timescale="10240" media="stream$Number$.m4s" 
                             startNumber="1" duration="20480" initialization="streaminit.mp4"/>
            <Representation id="1" mimeType="video/mp4" 
                            codecs="avc1.42e014" width="352" height="288" frameRate="5" sar="1:1" startWithSAP="1" bandwidth="192548">
            </Representation>

        </AdaptationSet>
    </Period>
</MPD>

And

$x = new DOMDocument();
$x->loadXML('session.mpd');

Results in:

Warning: DOMDocument::loadXML(): Start tag expected, '<' not found in Entity, line: 1

Does any one see what is wrong?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

1条回答 默认 最新

  • 已采纳
    douhuan4699 douhuan4699 2014-05-08 22:45

    DOMDocument::loadXML expects XML source as an argument, if you are going to use file path, use DOMDocument::load

    点赞 评论 复制链接分享

相关推荐