处理非标准命名空间的属性读取

This commit is contained in:
nilaoda 2022-11-29 10:43:50 +08:00
parent 2cda1da5e6
commit f96d76d62f
1 changed files with 13 additions and 0 deletions

View File

@ -90,6 +90,12 @@ namespace Mp4SubtitleParser
{
var _begin = _p.GetAttribute("begin");
var _end = _p.GetAttribute("end");
//Handle namespace
foreach (XmlAttribute attr in _p.Attributes)
{
if (attr.LocalName == "begin") _begin = attr.Value;
else if (attr.LocalName == "end") _end = attr.Value;
}
_p.SetAttribute("begin", Add(_begin));
_p.SetAttribute("end", Add(_end));
//Console.WriteLine($"{_begin} {_p.GetAttribute("begin")}");
@ -278,6 +284,13 @@ namespace Mp4SubtitleParser
var _end = _p.GetAttribute("end");
var _region = _p.GetAttribute("region");
var _bgImg = _p.GetAttribute("smpte:backgroundImage");
//Handle namespace
foreach (XmlAttribute attr in _p.Attributes)
{
if (attr.LocalName == "begin") _begin = attr.Value;
else if (attr.LocalName == "end") _end = attr.Value;
else if (attr.LocalName == "region") _region = attr.Value;
}
var sub = new SubEntity
{
Begin = _begin,