本文整理汇总了C#中System.Xml.XmlReader.MoveToAttribute方法的典型用法代码示例。如果您正苦于以下问题:C# XmlReader.MoveToAttribute方法的具体用法?C# XmlReader.MoveToAttribute怎么用?C# XmlReader.MoveToAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.XmlReader
的用法示例。
在下文中一共展示了XmlReader.MoveToAttribute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: read_microservices_client_details
private static void read_microservices_client_details(XmlReader readerXml, MicroservicesClient_Configuration config, string SystemBaseUrl)
{
// Just step through the subtree of this
while (readerXml.Read())
{
if (readerXml.NodeType == XmlNodeType.Element)
{
switch (readerXml.Name.ToLower())
{
case "add":
string key = String.Empty;
string url = String.Empty;
string protocol = "JSON";
if (readerXml.MoveToAttribute("Key"))
key = readerXml.Value;
if (readerXml.MoveToAttribute("URL"))
url = readerXml.Value.Replace("[BASEURL]", SystemBaseUrl);
if (readerXml.MoveToAttribute("Protocol"))
protocol = readerXml.Value;
if (( !String.IsNullOrEmpty(key)) && ( !String.IsNullOrEmpty(url)))
config.Add_Endpoint(key, url, protocol);
break;
}
}
}
}
示例2: ReadLog
public void ReadLog(XmlReader reader)
{
while (reader.Read() && reader.NodeType != XmlNodeType.EndElement)
{
Dictionary<string, string> attributes = new Dictionary<string, string>();
if (reader.Name == "ME")
{
if (reader.HasAttributes)
{
for (int i = 0; i < reader.AttributeCount; i++)
{
reader.MoveToAttribute(i);
attributes.Add(reader.Name, reader.Value);
}
}
MouseEvent e = new MouseEvent(attributes);
Evnts.AddLast(e);
//do shit here
}
else if (reader.Name == "Clickthrough")
{
if (reader.HasAttributes)
{
for (int i = 0; i < reader.AttributeCount; i++)
{
reader.MoveToAttribute(i);
attributes.Add(reader.Name, reader.Value);
}
}
Clickthrough c = new Clickthrough(attributes);
c.ReadLog(reader);
Evnts.AddLast(c);
}
}
}
示例3: Mass
public Mass(Model model, XmlReader xml) : base(model,xml) {//throws Exception {
//super(model, xml);
//foreach(XmlAttribute attribute in xml.Attributes)
//{
//string key = attribute.Name;
if (xml.MoveToAttribute("VX".ToLower()))
{
velocityX = double.Parse(xml.ReadContentAsString());
}
if (xml.MoveToAttribute("VY".ToLower()))
{
velocityY = double.Parse(xml.ReadContentAsString());
}
//}
//Enumeration enum = xml.enumerateAttributeNames();
//while (enum.hasMoreElements()) {
// String key = enum.nextElement().toString();
// if (key.equals("VX")) {
// velocityX = xml.getDoubleAttribute(key);
// }
// if (key.equals("VY")) {
// velocityY = xml.getDoubleAttribute(key);
// }
//}
}
示例4: ReadAscii
private static void ReadAscii(XmlReader reader, string name, uint offset, bool visible, IPluginVisitor visitor, uint pluginLine)
{
int size = 0;
if (reader.MoveToAttribute("size") || reader.MoveToAttribute("length"))
size = ParseInt(reader.Value);
visitor.VisitAscii(name, offset, visible, size, pluginLine);
}
示例5: MarkerModel
public MarkerModel(XmlReader reader, Set set)
{
reader.MoveToAttribute("name");
name = reader.Value;
reader.MoveToAttribute("id");
id = new Guid(reader.Value);
reader.Read(); // <marker />
this.set = set;
}
示例6: DeserializeElement
protected override void DeserializeElement(XmlReader reader, bool serializeCollectionKey)
{
reader.MoveToAttribute("name");
Name = reader.Value;
ConnectionStringName = reader.MoveToAttribute("connectionStringName") ? reader.Value : null;
while (reader.Read())
{
if (reader.NodeType == XmlNodeType.EndElement) break;
if (reader.NodeType == XmlNodeType.CDATA) Select = reader.Value;
}
}
示例7: BuildClassEntry
private static ClassEntry BuildClassEntry(XmlReader xmlReader, string fileName, string assemblyName, string @namespace, Assembly assembly)
{
xmlReader.MoveToAttribute("name");
string className = xmlReader.Value;
string extends = null;
if (xmlReader.MoveToAttribute("extends"))
{
extends = xmlReader.Value;
}
return new ClassEntry(extends, className, assemblyName, @namespace, fileName, assembly);
}
示例8: Load
public void Load (XmlReader x)
{
if(x.MoveToAttribute("ShowParameters"))
ShowFuncParams = Boolean.Parse(x.ReadContentAsString());
if(x.MoveToAttribute("ShowVariables"))
ShowFuncVariables = Boolean.Parse(x.ReadContentAsString());
if(x.MoveToAttribute("ShowTypes"))
ShowBaseTypes = Boolean.Parse(x.ReadContentAsString());
if(x.MoveToAttribute("GrayOutNonPublic"))
GrayOutNonPublic = Boolean.Parse(x.ReadContentAsString());
if(x.MoveToAttribute("ExpansionBehaviour"))
Enum.TryParse(x.ReadContentAsString(),out ExpansionBehaviour);
}
示例9: load
public static Firewall load(XmlReader reader)
{
while (reader.Name != "firewall")
reader.Read();
var complexity = 0;
string solution = null;
var additionalTime = 0.0f;
if (reader.MoveToAttribute("complexity"))
complexity = reader.ReadContentAsInt();
if (reader.MoveToAttribute("solution"))
solution = reader.ReadContentAsString();
if (reader.MoveToAttribute("additionalDelay"))
additionalTime = reader.ReadContentAsFloat();
return new Firewall(complexity, solution, additionalTime);
}
示例10: loadUserDetail
public static UserDetail loadUserDetail(XmlReader reader)
{
reader.MoveToAttribute("name");
var user = reader.ReadContentAsString();
reader.MoveToAttribute("pass");
var password = reader.ReadContentAsString();
reader.MoveToAttribute("type");
var accountType = (byte) reader.ReadContentAsInt();
reader.MoveToAttribute("known");
var flag = reader.ReadContentAsString().ToLower().Equals("true");
return new UserDetail(user, password, accountType)
{
known = flag
};
}
示例11: Restore
public void Restore(XmlReader reader)
{
int count = reader.AttributeCount;
for (int i = 0; i < count; ++i)
{
reader.MoveToAttribute(i);
switch (reader.Name)
{
case "top":
Top = reader.ReadContentAsDouble();
break;
case "left":
Left = reader.ReadContentAsDouble();
break;
case "width":
Width = reader.ReadContentAsDouble();
break;
case "height":
Height = reader.ReadContentAsDouble();
break;
case "state":
State = (WindowState) Enum.Parse(typeof (WindowState), reader.Value);
break;
}
}
}
示例12: HeightfieldTerrainGenerator
public HeightfieldTerrainGenerator(XmlReader r)
{
for (int i = 0; i < r.AttributeCount; i++)
{
r.MoveToAttribute(i);
switch (r.Name)
{
case "Type":
string type = r.Value;
Debug.Assert(type == "HeightfieldMosaic");
break;
case "MosaicName":
heightfieldName = r.Value;
break;
case "PreloadRadius":
preloadRadius = int.Parse(r.Value);
break;
case "OutsideHeight":
outsideHeight = float.Parse(r.Value);
break;
}
}
r.MoveToElement();
if (!r.IsEmptyElement)
{
do
{
r.Read();
} while (r.NodeType != XmlNodeType.EndElement);
}
Mosaic = new HeightfieldMosaic(heightfieldName, preloadRadius, outsideHeight);
Mosaic.MosaicModificationStateChanged += Mosaic_OnMosaicModificationStateChanged;
Mosaic.MosaicChanged += Mosaic_OnMosaicChanged;
}
示例13: ReadXml
public void ReadXml(XmlReader reader)
{
if (!reader.MoveToAttribute("State"))
throw new ArgumentException("State attribute not present");
InitFromString(reader.Value);
}
示例14: ArgumentException
void IXmlSerializable.ReadXml(XmlReader reader)
{
try
{
// First read attributes, then check for empty start element
if (!reader.MoveToAttribute("Id"))
throw new ArgumentException("Id attribute not present");
_id = new Guid(reader.Value);
if (reader.IsEmptyElement)
return;
}
finally
{
reader.ReadStartElement();
}
_additionalProperties = reader.DeserializeXml<Dictionary>();
_timeshiftContexes = reader.DeserializeXml<List<ITimeshiftContext>>();
while (reader.NodeType != XmlNodeType.EndElement)
{
MediaItemAspect mia = MediaItemAspect.Deserialize(reader);
_aspects[mia.Metadata.AspectId] = mia;
}
reader.ReadEndElement(); // MI
}
示例15: ParseQuaternion
public static Quaternion ParseQuaternion(XmlReader r)
{
float w = 0;
float x = 0;
float y = 0;
float z = 0;
for (int i = 0; i < r.AttributeCount; i++)
{
r.MoveToAttribute(i);
// set the field in this object based on the element we just read
switch (r.Name)
{
case "w":
w = float.Parse(r.Value);
break;
case "x":
x = float.Parse(r.Value);
break;
case "y":
y = float.Parse(r.Value);
break;
case "z":
z = float.Parse(r.Value);
break;
}
}
r.MoveToElement(); //Moves the reader back to the element node.
return new Quaternion(w, x, y, z);
}