update xml parsing

This commit is contained in:
Luke Pulverenti 2016-11-02 13:08:20 -04:00
parent 8ab5e5aca9
commit eefab227cc
9 changed files with 75 additions and 20 deletions

View File

@ -906,8 +906,10 @@ namespace MediaBrowser.LocalMetadata.Parsers
private void FetchFromTaglinesNode(XmlReader reader, T item)
{
reader.MoveToContent();
reader.Read();
while (reader.Read())
// Loop through each element
while (!reader.EOF)
{
if (reader.NodeType == XmlNodeType.Element)
{
@ -923,12 +925,15 @@ namespace MediaBrowser.LocalMetadata.Parsers
}
break;
}
default:
reader.Skip();
break;
}
}
else
{
reader.Read();
}
}
}

View File

@ -718,8 +718,10 @@ namespace MediaBrowser.LocalMetadata.Savers
return;
}
reader.Read();
// Loop through each element
while (reader.Read())
while (!reader.EOF)
{
if (reader.NodeType == XmlNodeType.Element)
{
@ -734,6 +736,10 @@ namespace MediaBrowser.LocalMetadata.Savers
reader.Skip();
}
}
else
{
reader.Read();
}
}
}
}

View File

@ -200,9 +200,10 @@ namespace MediaBrowser.MediaEncoding.Probing
using (var reader = XmlReader.Create(streamReader))
{
reader.MoveToContent();
reader.Read();
// Loop through each element
while (reader.Read())
while (!reader.EOF)
{
if (reader.NodeType == XmlNodeType.Element)
{
@ -219,6 +220,10 @@ namespace MediaBrowser.MediaEncoding.Probing
break;
}
}
else
{
reader.Read();
}
}
}
}
@ -227,13 +232,14 @@ namespace MediaBrowser.MediaEncoding.Probing
private void ReadFromDictNode(XmlReader reader, MediaInfo info)
{
reader.MoveToContent();
string currentKey = null;
List<NameValuePair> pairs = new List<NameValuePair>();
reader.MoveToContent();
reader.Read();
// Loop through each element
while (reader.Read())
while (!reader.EOF)
{
if (reader.NodeType == XmlNodeType.Element)
{
@ -272,17 +278,23 @@ namespace MediaBrowser.MediaEncoding.Probing
break;
}
}
else
{
reader.Read();
}
}
}
private List<NameValuePair> ReadValueArray(XmlReader reader)
{
reader.MoveToContent();
List<NameValuePair> pairs = new List<NameValuePair>();
reader.MoveToContent();
reader.Read();
// Loop through each element
while (reader.Read())
while (!reader.EOF)
{
if (reader.NodeType == XmlNodeType.Element)
{
@ -303,6 +315,10 @@ namespace MediaBrowser.MediaEncoding.Probing
break;
}
}
else
{
reader.Read();
}
}
return pairs;
@ -360,13 +376,14 @@ namespace MediaBrowser.MediaEncoding.Probing
private NameValuePair GetNameValuePair(XmlReader reader)
{
reader.MoveToContent();
string name = null;
string value = null;
reader.MoveToContent();
reader.Read();
// Loop through each element
while (reader.Read())
while (!reader.EOF)
{
if (reader.NodeType == XmlNodeType.Element)
{
@ -383,6 +400,10 @@ namespace MediaBrowser.MediaEncoding.Probing
break;
}
}
else
{
reader.Read();
}
}
if (string.IsNullOrWhiteSpace(name) ||

View File

@ -265,6 +265,7 @@ namespace MediaBrowser.Providers.Music
var list = new List<ReleaseResult>();
reader.MoveToContent();
reader.Read();
// Loop through each element
while (!reader.EOF)
@ -302,6 +303,7 @@ namespace MediaBrowser.Providers.Music
var list = new List<ReleaseResult>();
reader.MoveToContent();
reader.Read();
// Loop through each element
while (!reader.EOF)
@ -348,7 +350,6 @@ namespace MediaBrowser.Providers.Music
};
reader.MoveToContent();
reader.Read();
// http://stackoverflow.com/questions/2299632/why-does-xmlreader-skip-every-other-element-if-there-is-no-whitespace-separator
@ -428,6 +429,7 @@ namespace MediaBrowser.Providers.Music
using (var reader = XmlReader.Create(oReader, settings))
{
reader.MoveToContent();
reader.Read();
// Loop through each element
while (!reader.EOF)
@ -464,6 +466,7 @@ namespace MediaBrowser.Providers.Music
private string GetFirstReleaseGroupId(XmlReader reader)
{
reader.MoveToContent();
reader.Read();
// Loop through each element
while (!reader.EOF)

View File

@ -86,6 +86,7 @@ namespace MediaBrowser.Providers.Music
using (var reader = XmlReader.Create(oReader, settings))
{
reader.MoveToContent();
reader.Read();
// Loop through each element
while (!reader.EOF)
@ -124,6 +125,7 @@ namespace MediaBrowser.Providers.Music
var list = new List<RemoteSearchResult>();
reader.MoveToContent();
reader.Read();
// Loop through each element
while (!reader.EOF)

View File

@ -195,9 +195,10 @@ namespace MediaBrowser.Providers.TV
using (var reader = XmlReader.Create(streamReader, settings))
{
reader.MoveToContent();
reader.Read();
// Loop through each element
while (reader.Read())
while (!reader.EOF)
{
if (reader.NodeType == XmlNodeType.Element)
{
@ -212,6 +213,10 @@ namespace MediaBrowser.Providers.TV
break;
}
}
else
{
reader.Read();
}
}
}
}
@ -266,9 +271,10 @@ namespace MediaBrowser.Providers.TV
using (var reader = XmlReader.Create(streamReader, settings))
{
reader.MoveToContent();
reader.Read();
// Loop through each element
while (reader.Read())
while (!reader.EOF)
{
if (reader.NodeType == XmlNodeType.Element)
{
@ -290,6 +296,10 @@ namespace MediaBrowser.Providers.TV
break;
}
}
else
{
reader.Read();
}
}
}
}

View File

@ -334,9 +334,10 @@ namespace MediaBrowser.Providers.TV
private string FindSeriesId(XmlReader reader)
{
reader.MoveToContent();
reader.Read();
// Loop through each element
while (reader.Read())
while (!reader.EOF)
{
if (reader.NodeType == XmlNodeType.Element)
{
@ -359,6 +360,10 @@ namespace MediaBrowser.Providers.TV
break;
}
}
else
{
reader.Read();
}
}
return null;

View File

@ -71,9 +71,6 @@
<Reference Include="ServiceStack.Api.Swagger">
<HintPath>..\ThirdParty\ServiceStack\ServiceStack.Api.Swagger.dll</HintPath>
</Reference>
<Reference Include="ServiceStack.Common">
<HintPath>..\ThirdParty\ServiceStack\ServiceStack.Common.dll</HintPath>
</Reference>
<Reference Include="SharpCompress, Version=0.10.3.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\ThirdParty\SharpCompress\SharpCompress.dll</HintPath>

View File

@ -1057,8 +1057,10 @@ namespace MediaBrowser.XbmcMetadata.Savers
return;
}
reader.Read();
// Loop through each element
while (reader.Read())
while (!reader.EOF)
{
if (reader.NodeType == XmlNodeType.Element)
{
@ -1073,6 +1075,10 @@ namespace MediaBrowser.XbmcMetadata.Savers
reader.Skip();
}
}
else
{
reader.Read();
}
}
}
}