本文整理汇总了C#中System.Xml.XmlReader类的典型用法代码示例。如果您正苦于以下问题:C# XmlReader类的具体用法?C# XmlReader怎么用?C# XmlReader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XmlReader类属于System.Xml命名空间,在下文中一共展示了XmlReader类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Transform
/// <summary>
/// Applies the transformation from the reader to the writer
/// </summary>
/// <param name="reader"></param>
/// <param name="writer"></param>
public void Transform(XmlReader reader, XmlWriter writer) {
Contract.Requires(reader != null);
Contract.Requires(writer != null);
while (reader.Read())
this.WriteNodeSingle(reader, writer);
}
开发者ID:asvishnyakov,项目名称:CodeContracts,代码行数:12,代码来源:XmlTraverserBase.cs
示例2: while
void IFlickrParsable.Load(XmlReader reader)
{
while (reader.MoveToNextAttribute())
{
switch (reader.LocalName)
{
case "id":
PhotoId = reader.Value;
break;
case "ispublic":
IsPublic = reader.Value == "1";
break;
case "iscontact":
IsContact = reader.Value == "1";
break;
case "isfamily":
IsFamily = reader.Value == "1";
break;
case "isfriend":
IsFriend = reader.Value == "1";
break;
}
}
reader.Read();
}
开发者ID:ghostnguyen,项目名称:f503cd14-7a08-48cb-a2b6-d607c618743e,代码行数:25,代码来源:GeoPermissions.cs
示例3: DeserializeNetwork
public override void DeserializeNetwork(XmlReader xmlReader)
{
base.DeserializeNetwork(xmlReader);
var expander = ControlElements[0] as SliderExpanderDouble;
if (expander == null) return;
var attribute = xmlReader.GetAttribute("SliderMax");
if (attribute != null)
expander.SliderMax = Convert.ToDouble(attribute.Replace(".", ","));
var attribute1 = xmlReader.GetAttribute("SliderMin");
if (attribute1 != null)
expander.SliderMin = Convert.ToDouble(attribute1.Replace(".", ","));
var attribute2 = xmlReader.GetAttribute("SliderValue");
if (attribute2 != null)
expander.SliderValue = Convert.ToDouble(attribute2.Replace(".", ","));
var attribute3 = xmlReader.GetAttribute("SliderStep");
if (attribute3 != null)
expander.SliderStep = Convert.ToDouble(attribute3.Replace(".", ","));
var attribute4 = xmlReader.GetAttribute("IsExpanded");
if (attribute4 != null)
expander.IsExpanded = Convert.ToBoolean(attribute4.Replace(".", ","));
}
开发者ID:aquarius20th,项目名称:CSharp_TUM.CMS.VPLControl,代码行数:27,代码来源:DoubleSlider.cs
示例4: TokenizeFromXml
public object TokenizeFromXml(XmlReader reader)
{
reader.ReadStartElement();
Geometry geometry = GmlFormatter.Create().Read<Geometry>(reader);
reader.SkipInsignificantNodes();
return geometry;
}
开发者ID:nickchal,项目名称:pash,代码行数:7,代码来源:GeometryTypeConverter.cs
示例5: ReadTokenCore
protected override System.IdentityModel.Tokens.SecurityToken ReadTokenCore( XmlReader reader, SecurityTokenResolver tokenResolver )
{
if ( reader == null )
throw new ArgumentNullException( "reader" );
if ( reader.IsStartElement( Constants.UsernameTokenName, Constants.UsernameTokenNamespace ) )
{
//string id = reader.GetAttribute( Constants.IdAttributeName, Constants.WsUtilityNamespace );
reader.ReadStartElement();
// read the user name
string userName = reader.ReadElementString( Constants.UsernameElementName, Constants.UsernameTokenNamespace );
// read the password hash
string password = reader.ReadElementString( Constants.PasswordElementName, Constants.UsernameTokenNamespace );
// read nonce
string nonce = reader.ReadElementString( Constants.NonceElementName, Constants.UsernameTokenNamespace );
// read created
string created = reader.ReadElementString( Constants.CreatedElementName, Constants.WsUtilityNamespace );
reader.ReadEndElement();
var info = new Info( userName, password );
return new SecurityToken( info, nonce, created );
}
return DefaultInstance.ReadToken( reader, tokenResolver );
}
开发者ID:Sn3b,项目名称:Omniture-API,代码行数:32,代码来源:SecurityTokenSerializer.cs
示例6: ReadFromXml
public void ReadFromXml(XmlReader reader)
{
reader.MoveToContent();
if (reader.IsEmptyElement) { reader.Read(); return; }
num = int.Parse(reader.GetAttribute("number"));
reader.Read();
while (!reader.EOF)
{
if (reader.IsStartElement())
{
if (reader.Name == "class")
{
var sClass = new ScheduleClass();
sClass.ReadFromXml(reader);
classes.Add(sClass);
}
else
{
reader.Skip();
}
}
else
{
reader.Read();
break;
}
}
}
开发者ID:GorelH,项目名称:schedule-metro,代码行数:30,代码来源:ScheduleWeekday.cs
示例7: DoDeserializeValue
protected override object DoDeserializeValue(XmlReader reader, bool isSimpleValue)
{
reader.ReadStartElement(); // Read start of enclosing element
IFilter result = MediaItemQuery.DeserializeFilter(reader);
reader.ReadEndElement(); // End of enclosing element
return result;
}
开发者ID:joconno4,项目名称:MediaPortal-2,代码行数:7,代码来源:UPnPDtMediaItemsFilter.cs
示例8: HandleTypeAttribute
protected void HandleTypeAttribute(XmlReader reader)
{
DebugCheck.NotNull(reader);
string type;
if (!Utils.GetString(Schema, reader, out type))
{
return;
}
TypeModifier typeModifier;
Function.RemoveTypeModifier(ref type, out typeModifier, out _isRefType);
switch (typeModifier)
{
case TypeModifier.Array:
_collectionKind = CollectionKind.Bag;
break;
default:
Debug.Assert(
typeModifier == TypeModifier.None,
string.Format(
CultureInfo.CurrentCulture,
"Type is not valid for property {0}: {1}. The modifier for the type cannot be used in this context.", FQName,
reader.Value));
break;
}
if (!Utils.ValidateDottedName(Schema, reader, type))
{
return;
}
_unresolvedType = type;
}
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:35,代码来源:RowTypePropertyElement.cs
示例9: DeserializePropertyElement
protected override void DeserializePropertyElement(XmlReader reader)
{
if (reader == null) throw new ArgumentNullException ("reader");
if (reader.NamespaceURI == Schemas.UpnpSchema) {
switch (reader.LocalName) {
case "producer":
producer_list.Add (reader.ReadString ());
break;
default:
base.DeserializePropertyElement (reader);
break;
}
} else if (reader.NamespaceURI == Schemas.DublinCoreSchema) {
switch (reader.LocalName) {
case "contributor":
contributor_list.Add (reader.ReadString ());
break;
case "date":
Date = reader.ReadString ();
break;
default:
base.DeserializePropertyElement (reader);
break;
}
} else {
base.DeserializePropertyElement (reader);
}
}
开发者ID:MustafaUzumcuCom,项目名称:mono-upnp,代码行数:29,代码来源:AudioBook.cs
示例10: XmlDecoder
/// <summary>
/// Initializes the object with a XML reader.
/// </summary>
public XmlDecoder(System.Type systemType, XmlReader reader, ServiceMessageContext context)
{
Initialize();
m_reader = reader;
m_context = context;
string ns = null;
string name = null;
if (systemType != null)
{
XmlQualifiedName typeName = EncodeableFactory.GetXmlName(systemType);
ns = typeName.Namespace;
name = typeName.Name;
}
if (ns == null)
{
m_reader.MoveToContent();
ns = m_reader.NamespaceURI;
name = m_reader.Name;
}
int index = name.IndexOf(':');
if (index != -1)
{
name = name.Substring(index + 1);
}
PushNamespace(ns);
BeginField(name, false);
}
开发者ID:yuriik83,项目名称:UA-.NET,代码行数:37,代码来源:XmlDecoder.cs
示例11: FromXml
public bool FromXml(XmlReader reader)
{
if (reader == null || reader.Name != "Lib")
{
return false;
}
if (reader.Name == "Order" || reader.ReadToDescendant("Order"))
{
Order = reader.ReadElementContentAsInt();
}
if (reader.Name == "Id" || reader.ReadToNextSibling("Id"))
{
Id = reader.ReadElementContentAsString();
}
if (reader.Name == "Name" || reader.ReadToNextSibling("Name"))
{
Name = reader.ReadElementContentAsString();
}
if (reader.Name == "Text" || reader.ReadToNextSibling("Text"))
{
Text = reader.ReadElementContentAsString();
}
if (reader.Name == "Memo" || reader.ReadToNextSibling("Memo"))
{
Memo = reader.ReadElementContentAsString();
}
return true;
}
开发者ID:burstas,项目名称:rmps,代码行数:29,代码来源:LibHeader.cs
示例12: while
void IFlickrParsable.Load(XmlReader reader)
{
if (reader.LocalName != "referrer")
UtilityMethods.CheckParsingException(reader);
while (reader.MoveToNextAttribute())
{
switch (reader.LocalName)
{
case "url":
Url = reader.Value;
break;
case "searchterm":
SearchTerm = reader.Value;
break;
case "views":
Views = int.Parse(reader.Value, NumberFormatInfo.InvariantInfo);
break;
default:
UtilityMethods.CheckParsingException(reader);
break;
}
}
reader.Skip();
}
开发者ID:JamieKitson,项目名称:flickrnet-experimental,代码行数:26,代码来源:StatReferrer.cs
示例13: OrnamentsForm
public OrnamentsForm(XmlReader r, PaletteForm paletteForm, IPaletteFormsHostForm acForm, FormStateFunctions fsf)
{
_isLoading = true;
InitializeOrnamentSettingsForm(r, paletteForm, acForm, fsf);
_fsf.SetSettingsAreSaved(this, M.HasError(_allTextBoxes), ConfirmButton, RevertToSavedButton);
_isLoading = false;
}
开发者ID:suvjunmd,项目名称:Moritz,代码行数:7,代码来源:OrnamentsForm.cs
示例14: PolicyIdReferenceElementReadWrite
/// <summary>
/// Creates a new PolicyIdReference using the XmlReader instance provided.
/// </summary>
/// <param name="reader">The XmlReader positioned at the PolicyIdReference element.</param>
/// <param name="schemaVersion">The version of the schema that was used to validate.</param>
public PolicyIdReferenceElementReadWrite( XmlReader reader, XacmlVersion schemaVersion )
: base( XacmlSchema.Policy, schemaVersion )
{
if (reader == null) throw new ArgumentNullException("reader");
if( reader.LocalName == PolicySchema1.PolicyIdReferenceElement.PolicyIdReference &&
ValidateSchema( reader, schemaVersion ) )
{
if( reader.HasAttributes )
{
// Load all the attributes
while( reader.MoveToNextAttribute() )
{
if( reader.LocalName == PolicyReferenceElement.Version )
{
_version = reader.GetAttribute( PolicyReferenceElement.Version );
}
else if( reader.LocalName == PolicyReferenceElement.EarliestVersion )
{
_earliestVersion = reader.GetAttribute( PolicyReferenceElement.EarliestVersion );
}
else if( reader.LocalName == PolicyReferenceElement.LatestVersion )
{
_latestVersion = reader.GetAttribute( PolicyReferenceElement.LatestVersion );
}
}
reader.MoveToElement();
}
_policyIdReference = reader.ReadElementString();
}
else
{
throw new Exception( Resource.ResourceManager[ Resource.MessageKey.exc_invalid_node_name, reader.LocalName ] );
}
}
开发者ID:Condeti,项目名称:XACML.NET,代码行数:39,代码来源:PolicyIdReferenceElementReadWrite.cs
示例15: ReadXml
public void ReadXml(XmlReader reader)
{
var s = reader.ReadOuterXml();
var x = XDocument.Parse(s);
if (x.Root == null) return;
foreach (var e in x.Root.Elements())
{
var name = e.Name.ToString();
switch (name)
{
case "List":
foreach (var ee in e.Elements())
_list.Add(Util.DeSerialize<OnlineRegPersonModel>(ee.ToString()));
break;
case "History":
foreach (var ee in e.Elements())
_history.Add(ee.Value);
break;
default:
Util.SetPropertyFromText(this, name, e.Value);
break;
}
}
}
开发者ID:stevesloka,项目名称:bvcms,代码行数:25,代码来源:ReadWriteXml.cs
示例16: DoSetUp
void DoSetUp(XmlReader reader, string endElement)
{
Stack<ICondition> conditionStack = new Stack<ICondition>();
List<Codon> innerCodons = new List<Codon>();
while (reader.Read()) {
switch (reader.NodeType) {
case XmlNodeType.EndElement:
if (reader.LocalName == "Condition" || reader.LocalName == "ComplexCondition") {
conditionStack.Pop();
} else if (reader.LocalName == endElement) {
if (innerCodons.Count > 0)
this.codons.Add(innerCodons);
return;
}
break;
case XmlNodeType.Element:
string elementName = reader.LocalName;
if (elementName == "Condition") {
conditionStack.Push(Condition.Read(reader));
} else if (elementName == "ComplexCondition") {
conditionStack.Push(Condition.ReadComplexCondition(reader));
} else {
Codon newCodon = new Codon(this.AddIn, elementName, Properties.ReadFromAttributes(reader), conditionStack.ToArray());
innerCodons.Add(newCodon);
if (!reader.IsEmptyElement) {
ExtensionPath subPath = this.AddIn.GetExtensionPath(this.Name + "/" + newCodon.Id);
subPath.DoSetUp(reader, elementName);
}
}
break;
}
}
if (innerCodons.Count > 0)
this.codons.Add(innerCodons);
}
开发者ID:lisiynos,项目名称:pascalabcnet,代码行数:35,代码来源:ExtensionPath.cs
示例17: ReadNodes
public static XmlNode[] ReadNodes(XmlReader xmlReader)
{
if (xmlReader == null)
throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("xmlReader");
XmlDocument doc = new XmlDocument();
List<XmlNode> nodeList = new List<XmlNode>();
if (xmlReader.MoveToFirstAttribute())
{
do
{
if (IsValidAttribute(xmlReader))
{
XmlNode node = doc.ReadNode(xmlReader);
if (node == null)
throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(XmlObjectSerializer.CreateSerializationException(SR.GetString(SR.UnexpectedEndOfFile)));
nodeList.Add(node);
}
} while (xmlReader.MoveToNextAttribute());
}
xmlReader.MoveToElement();
if (!xmlReader.IsEmptyElement)
{
int startDepth = xmlReader.Depth;
xmlReader.Read();
while (xmlReader.Depth > startDepth && xmlReader.NodeType != XmlNodeType.EndElement)
{
XmlNode node = doc.ReadNode(xmlReader);
if (node == null)
throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(XmlObjectSerializer.CreateSerializationException(SR.GetString(SR.UnexpectedEndOfFile)));
nodeList.Add(node);
}
}
return nodeList.ToArray();
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:34,代码来源:XmlSerializableServices.cs
示例18: while
void IFlickrParsable.Load(XmlReader reader)
{
if (reader.LocalName != "user")
UtilityMethods.CheckParsingException(reader);
while (reader.MoveToNextAttribute())
{
switch (reader.LocalName)
{
case "nsid":
case "id":
UserId = reader.Value;
break;
case "username":
UserName = reader.Value;
break;
case "fullname":
FullName = reader.Value;
break;
default:
UtilityMethods.CheckParsingException(reader);
break;
}
}
reader.Read();
if (reader.NodeType != XmlNodeType.EndElement)
{
UserName = reader.ReadElementContentAsString();
reader.Skip();
}
}
开发者ID:liquidboy,项目名称:X,代码行数:33,代码来源:User.cs
示例19: IsValidAttribute
private static bool IsValidAttribute(XmlReader xmlReader)
{
return xmlReader.NamespaceURI != Globals.SerializationNamespace &&
xmlReader.NamespaceURI != Globals.SchemaInstanceNamespace &&
xmlReader.Prefix != "xmlns" &&
xmlReader.LocalName != "xmlns";
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:7,代码来源:XmlSerializableServices.cs
示例20: ReadXml
/// <summary>Generates an object from its XML representation.</summary>
/// <param name="reader">The <see cref="T:System.Xml.XmlReader" /> stream from which the object is
/// deserialized.</param>
public override void ReadXml(XmlReader reader)
{
reader.MoveToContent();
reader.ReadStartElement();
Descriptor = Xml.Read<Descriptor>(reader);
Root = Xml.Read<Measure>(reader);
}
开发者ID:m-abubakar,项目名称:numl,代码行数:10,代码来源:NaiveBayesModel.cs
注:本文中的System.Xml.XmlReader类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论