本文整理汇总了C#中System.Xml.XmlReader.Skip方法的典型用法代码示例。如果您正苦于以下问题:C# XmlReader.Skip方法的具体用法?C# XmlReader.Skip怎么用?C# XmlReader.Skip使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.XmlReader
的用法示例。
在下文中一共展示了XmlReader.Skip方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Load
internal static LoggingConfig Load(XmlReader reader)
{
if (reader == null)
throw new ArgumentNullException("reader");
LoggingConfig result = new LoggingConfig();
reader.GoToElement();
if (!reader.IsEmptyElement)
{
reader.ReadStartElement();
while (reader.GoToSibling())
{
switch (reader.LocalName)
{
default:
reader.Skip();
break;
}
}
reader.ReadEndElement();
}
else
reader.Skip();
return result;
}
示例2: ParseXml
internal static ApplicationManifestTaskNodeBase ParseXml(XmlReader reader)
{
switch (reader.Name)
{
case "DefaultTask":
var node = new ApplicationManifestDefaultTaskNode()
{
Name = reader.GetAttribute("Name"),
NavigationPage = reader.GetAttribute("NavigationPage")
};
reader.Skip();
return node;
case "ExtendedTask":
var node2 = new ApplicationManifestExtendedTaskNode
{
Name = reader.GetAttribute("Name"),
BackgroundServiceAgents = reader.ReadElementContentAsArray(ApplicationManifestBackgroundServiceAgentNode.ParseXml)
};
return node2;
default:
reader.Skip();
return null;
}
}
示例3: ParseXml
internal static WindowsPhoneStoreServiceAppImageNode ParseXml(XmlReader reader)
{
var node = new WindowsPhoneStoreServiceAppImageNode();
if (reader.IsEmptyElement)
{
reader.Skip();
}
else
{
reader.ReadStartElement();
while (reader.NodeType != XmlNodeType.EndElement)
{
switch (reader.LocalName)
{
case "id":
node.Id = reader.ReadElementContentAsUrn();
break;
case "orientation":
node.Orientation = reader.ReadElementContentAsInt();
break;
default:
reader.Skip();
break;
}
}
reader.ReadEndElement();
}
return node;
}
示例4: AddXmlDocumentation
public void AddXmlDocumentation(XmlReader xml)
{
while (xml.Read()) {
if (xml.NodeType == XmlNodeType.Element) {
string elname = xml.Name.ToLowerInvariant();
switch (elname) {
case "filterpriority":
case "remarks":
xml.Skip();
break;
case "example":
ret.Append(Environment.NewLine);
ret.Append("Example:");
ret.Append(Environment.NewLine);
break;
case "exception":
ret.Append(Environment.NewLine);
ret.Append(GetCref(xml["cref"]));
ret.Append(": ");
break;
case "returns":
xml.Skip();
break;
case "see":
ret.Append(GetCref(xml["cref"]));
ret.Append(xml["langword"]);
break;
case "seealso":
ret.Append(Environment.NewLine);
ret.Append("See also: ");
ret.Append(GetCref(xml["cref"]));
break;
case "paramref":
ret.Append(xml["name"]);
break;
case "param":
ret.Append(Environment.NewLine);
ret.Append(whitespace.Replace(xml["name"].Trim()," "));
ret.Append(": ");
break;
case "typeparam":
ret.Append(Environment.NewLine);
ret.Append(whitespace.Replace(xml["name"].Trim()," "));
ret.Append(": ");
break;
case "value":
ret.Append(Environment.NewLine);
ret.Append("Value: ");
ret.Append(Environment.NewLine);
break;
case "br":
case "para":
ret.Append(Environment.NewLine);
break;
}
} else if (xml.NodeType == XmlNodeType.Text) {
ret.Append(whitespace.Replace(xml.Value, " "));
}
}
}
示例5: ParseElement
/// <summary>
/// Parses the WDDX element and returns the deserialized
/// content as a <see cref="System.String"/> object, advancing the reader to the next
/// element.
/// </summary>
/// <param name="input">The pre-initialized <see cref="System.Xml.XmlTextReader"/> pointing to the WDDX to be parsed.</param>
public object ParseElement(XmlReader input)
{
if (input.IsEmptyElement)
{
input.Skip();
return String.Empty;
}
StringBuilder output = new StringBuilder();
input.Read();
while (!(input.Name == "string" && input.NodeType == XmlNodeType.EndElement))
{
if (input.NodeType == XmlNodeType.Text || input.NodeType == XmlNodeType.Whitespace)
{
output.Append(input.ReadString());
}
else if (input.Name == "char")
{
// parse out the <char code="xx"/> tag
output.Append((char)Int32.Parse(input.GetAttribute("code"), NumberStyles.AllowHexSpecifier));
input.Skip();
}
}
input.ReadEndElement();
return output.ToString();
}
示例6: Deserialize
//public static Oids.Oid Deserialize(XmlReader reader, Oids.Oid oid)
/// <summary>
/// Deserializes Oid from an XML stream.
/// </summary>
/// <param name="reader">XML stream.</param>
/// <returns>Oid.</returns>
public static Oids.Oid Deserialize(XmlReader reader)
{
Oids.Oid lResult = null;
if (reader.IsStartElement(DTD.TagOID))
{
string lClassName = reader.GetAttribute(DTD.OID.TagClass);
List<KeyValuePair<ModelType,object>> lFields = new List<KeyValuePair<ModelType,object>>();
if (!reader.IsEmptyElement)
{
reader.ReadStartElement();
do
{
#region Process tag <OID.Field>.
if (reader.IsStartElement(DTD.OID.TagOIDField))
{
if (!reader.IsEmptyElement)
{
ModelType lType = Convert.StringTypeToMODELType(reader.GetAttribute(DTD.OID.TagType));
lFields.Add(new KeyValuePair<ModelType, object>(lType, Convert.XmlToType(lType, reader.ReadString())));
}
else
{
throw new ArgumentException("Xml Reader have one OID.Field with empty Element.", "XmlReader reader");
}
}
#endregion Process tag <OID.Field>.
else
{
#region Process tag <?>
reader.Skip();
if (reader.NodeType == XmlNodeType.None)
{
break;
}
else
{
continue;
}
#endregion Process tag <?>
}
} while (reader.Read());
}
else
{
reader.Skip();
}
if(lClassName.Length > 0)
{
lResult = ServerConnection.CreateOid(lClassName,lFields);
}
}
else
{
throw new ArgumentException("Xml Reader don't have the OID in Start Element.", "XmlReader reader");
}
return lResult;
}
示例7: Deserialize
public static ServiceResponse Deserialize(XmlReader reader, ServiceResponse serviceResponse)
{
if (reader.IsStartElement(DTD.Response.TagServiceResponse))
{
if (serviceResponse == null)
{
serviceResponse = new ServiceResponse();
}
if (!reader.IsEmptyElement)
{
reader.ReadStartElement();
do
{
#region <ERROR>
if (reader.IsStartElement(DTD.Response.ServiceResponse.TagError))
{
if(int.Parse(reader.GetAttribute(DTD.Error.TagNumber))!=0)
{
throw XMLErrorSerializer.Deserialize(reader.ReadSubtree());
}
else
{
reader.Skip();
}
}
#endregion <ERROR>
#region <OID>
if (reader.IsStartElement(DTD.TagOID))
{
serviceResponse.Oid = XMLAdaptorOIDSerializer.Deserialize(reader.ReadSubtree());
}
#endregion <OID>
#region <Arguments>
if (reader.IsStartElement(DTD.Response.ServiceResponse.TagArguments))
{
serviceResponse.Arguments = XMLArgumentsSerializer.Deserialize(reader.ReadSubtree());
}
#endregion <Arguments>
} while (reader.Read());
}
else
{
reader.Skip();
}
}
else
{
throw new ArgumentException("Xml Reader don't have the Service.Response in Start Element.", "XmlReader reader");
}
return serviceResponse;
}
示例8: ReadXml
/// <summary>
/// Generates a serializable continuation token from its XML representation.
/// </summary>
/// <param name="reader">The <see cref="T:System.Xml.XmlReader"/> stream from which the continuation token is deserialized.</param>
public void ReadXml(XmlReader reader)
{
CommonUtility.AssertNotNull("reader", reader);
reader.MoveToContent();
if (reader.IsEmptyElement)
{
reader.Skip();
}
else
{
reader.ReadStartElement();
while (reader.IsStartElement())
{
if (reader.IsEmptyElement)
{
reader.Skip();
}
else
{
switch (reader.Name)
{
case Constants.ContinuationConstants.VersionElement:
string version = reader.ReadElementContentAsString();
if (version != Constants.ContinuationConstants.CurrentVersion)
{
throw new XmlException(string.Format(CultureInfo.InvariantCulture, SR.UnexpectedElement, version));
}
break;
case Constants.ContinuationConstants.NextMarkerElement:
this.NextMarker = reader.ReadElementContentAsString();
break;
case Constants.ContinuationConstants.TypeElement:
string continuationType = reader.ReadElementContentAsString();
if (Constants.ContinuationConstants.QueueType != continuationType)
{
throw new XmlException(SR.UnexpectedContinuationType);
}
break;
default:
throw new XmlException(string.Format(CultureInfo.InvariantCulture, SR.UnexpectedElement, reader.Name));
}
}
}
reader.ReadEndElement();
}
}
示例9: ReadXml
public override void ReadXml(XmlReader reader)
{
if (CheckEmptyNode(reader, "ContactPersonPrimary", Namespace))
return;
while (!reader.EOF)
{
if (reader.IsStartElement())
{
var isEmpty = reader.IsEmptyElement;
switch (reader.LocalName)
{
case "ContactPerson":
ContactPerson = isEmpty ? string.Empty : reader.ReadElementContentAsString();
break;
case "ContactOrganization":
ContactOrganization = isEmpty ? string.Empty : reader.ReadElementContentAsString();
break;
default:
reader.Skip();
break;
}
}
else if (reader.NodeType == XmlNodeType.EndElement)
{
reader.ReadEndElement();
return;
}
else
{
reader.Read();
}
}
}
示例10: ReadXml
protected virtual void ReadXml(XmlReader reader, SyndicationFeed result)
{
if (result == null)
throw new ArgumentNullException("result");
else if (reader == null)
throw new ArgumentNullException("reader");
reader.ReadStartElement(); // Read in <RDF>
reader.ReadStartElement("channel"); // Read in <channel>
while (reader.IsStartElement()) // Process <channel> children
{
if (reader.IsStartElement("title"))
result.Title = new TextSyndicationContent(reader.ReadElementString());
else if (reader.IsStartElement("link"))
result.Links.Add(new SyndicationLink(new Uri(reader.ReadElementString())));
else if (reader.IsStartElement("description"))
result.Description = new TextSyndicationContent(reader.ReadElementString());
else
reader.Skip();
}
reader.ReadEndElement(); // Read in </channel>
while (reader.IsStartElement())
{
if (reader.IsStartElement("item"))
{
result.Items = this.ReadItems(reader, result);
break;
}
else
reader.Skip();
}
}
示例11: while
void IFlickrParsable.Load(XmlReader reader)
{
reader.Read();
while (reader.LocalName != "photos")
{
switch (reader.LocalName)
{
case "firstdatetaken":
this.FirstTakenDate = UtilityMethods.ParseDateWithGranularity(reader.ReadElementContentAsString());
continue;
case "firstdate":
this.FirstDate = UtilityMethods.UnixTimestampToDate(reader.ReadElementContentAsString());
continue;
case "count":
this.PhotoCount = reader.ReadElementContentAsInt();
continue;
case "views":
this.Views = reader.ReadElementContentAsInt();
continue;
default:
reader.Skip();
continue;
}
}
reader.Read();
}
示例12: ParseElement
/// <summary>
/// Parses the WDDX element and returns the deserialized
/// content as a <see cref="Hashtable"/> object, advancing the reader to the next
/// element.
/// </summary>
/// <param name="input">The pre-initialized <see cref="System.Xml.XmlTextReader"/> pointing to the WDDX to be parsed.</param>
public object ParseElement(XmlReader input)
{
Hashtable thisTable = new Hashtable();
if (input.IsEmptyElement)
{
input.Skip();
return thisTable;
}
string elementName;
object elementValue;
IWddxElementDeserializer deserializer;
while (input.Read() && (!(input.Name == "struct" && input.NodeType == XmlNodeType.EndElement)))
{
if (input.Name == "var" && input.NodeType != XmlNodeType.EndElement)
{
elementName = input.GetAttribute("name");
input.Read(); // move to contents of <var>
deserializer = WddxElementDeserializerFactory.GetDeserializer(input.Name);
elementValue = deserializer.ParseElement(input);
thisTable.Add(elementName, elementValue);
}
}
input.ReadEndElement();
return thisTable;
}
示例13: Deserialize
/// <summary>
/// Obtains the type and value of a parameter from an XML Error file.
/// </summary>
/// <param name="reader">XML Error file.</param>
/// <param name="parameter">Parameter to obtain.</param>
/// <returns>Parameter.</returns>
public static Parameter Deserialize(XmlReader reader, Parameter parameter)
{
if (reader.IsStartElement(DTD.Error.ErrorParams.TagErrorParam))
{
if (parameter == null)
{
parameter = new Parameter();
}
// Read Attributes of Node.
parameter.Key = reader.GetAttribute(DTD.Error.ErrorParams.TagKey);
switch (reader.GetAttribute(DTD.Error.ErrorParams.TagType))
{
case ResponseException.ErrorKey:
parameter.Type = ErrorParamType.Key;
break;
case ResponseException.ErrorLiteral:
parameter.Type = ErrorParamType.Literal;
break;
}
if (!reader.IsEmptyElement)
{
parameter.Text = reader.ReadString();
}
else
{
reader.Skip();
}
}
return parameter;
}
示例14: ReadXml
public void ReadXml(XmlReader reader)
{
reader.MoveToContent();
DefaultAnimation = reader["DefaultAnimation"];
if (reader.IsEmptyElement) {
reader.ReadStartElement();
return;
}
reader.ReadStartElement();
while (!reader.EOF) {
if (reader.IsStartElement()) {
switch (reader.Name) {
case "Activity":
XmlActivityElement activity = new XmlActivityElement();
activity.ReadXml(reader);
Activities.Add(activity);
break;
default:
reader.Skip();
break;
}
}
else if (reader.NodeType == XmlNodeType.EndElement) {
reader.ReadEndElement();
break;
}
else
reader.Read();
}
}
示例15: while
void IFlickrParsable.Load(XmlReader reader)
{
if (reader.LocalName != "set")
UtilityMethods.CheckParsingException(reader);
while (reader.MoveToNextAttribute())
{
switch (reader.LocalName)
{
case "id":
SetId = reader.Value;
break;
case "title":
Title = reader.Value;
break;
case "description":
Description = reader.Value;
break;
default:
UtilityMethods.CheckParsingException(reader);
break;
}
}
reader.Skip();
}