【发布时间】:2015-07-18 20:22:49
【问题描述】:
我需要通读这个 xml 文件并计算第一个 AdaptationSet 中有多少 Representation 元素,因为每次生成这个 xml 时,它的数量都可以从 1 到 10 不等。我是 powershell 的新手,以前是使用 xdoc 读取 xml 文件。
<?xml version="1.0" encoding="utf-8"?>
<MPD xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="111091661:1853125475:Ntsc" profiles="urn:mpeg:dash:profile:isoff-live:2011 urn:com:dashif:dash264" type="dynamic" availabilityStartTime="2015-07-09T18:47:42.8780481" publishTime="2015-07-09T18:47:41.7236461" minimumUpdatePeriod="PT3600S" minBufferTime="PT15S" timeShiftBufferDepth="PT60S" suggestedPresentationDelay="PT30S" maxSegmentDuration="PT1.000S" xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd" xmlns="urn:mpeg:dash:schema:mpd:2011">
<Period id="1" start="PT0S">
<AdaptationSet frameRate="30000/1001" mimeType="video/mp4" codecs="avc1.4D401E" startWithSAP="1" segmentAlignment="true">
<SegmentTemplate timescale="30000" duration="30030" startNumber="0" media="$Bandwidth$/$Number$.m4v" initialization="$Bandwidth$/0.m4s" />
<Representation width="314" height="210" id="v0" bandwidth="300000" />
<Representation width="614" height="414" id="v1" bandwidth="1150000" />
<Representation width="720" height="486" id="v2" bandwidth="2000000" />
</AdaptationSet>
<AdaptationSet mimeType="audio/mp4" codecs="mp4a.40.2" startWithSAP="1" segmentAlignment="true">
<SegmentTemplate timescale="48000" duration="48048" startNumber="0" media="audio/$Number$.m4a" initialization="audio/0.m4s" />
<Representation id="a0" bandwidth="448000" />
</AdaptationSet>
</Period>
</MPD>
【问题讨论】:
标签: xml powershell