本文整理汇总了C#中IXmlNode类的典型用法代码示例。如果您正苦于以下问题:C# IXmlNode类的具体用法?C# IXmlNode怎么用?C# IXmlNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IXmlNode类属于命名空间,在下文中一共展示了IXmlNode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetValue
public override void SetValue(IXmlNode node, IDictionaryAdapter parent, IXmlAccessor accessor, ref object value)
{
var source = (Array) value;
var target = (Array) null;
var itemType = source.GetType().GetElementType();
var subaccessor = accessor.GetCollectionAccessor(itemType);
var cursor = subaccessor.SelectCollectionItems(node, true);
var serializer = subaccessor.Serializer;
var references = XmlAdapter.For(parent).References;
for (var i = 0; i < source.Length; i++)
{
var originalItem = source.GetValue(i);
var assignedItem = originalItem;
subaccessor.SetValue(cursor, parent, references, cursor.MoveNext(), null /* TODO: Get Value */, ref assignedItem);
if (target != null)
{
target.SetValue(assignedItem, i);
}
else if (!Equals(assignedItem, originalItem))
{
target = Array.CreateInstance(itemType, source.Length);
Array.Copy(source, target, i);
target.SetValue(assignedItem, i);
}
}
cursor.RemoveAllNext();
if (target != null)
value = target;
}
示例2: GetValue
public override object GetValue(IXmlNode node, IDictionaryAdapter parent, IXmlAccessor accessor)
{
using (var reader = new XmlSubtreeReader(node, Root))
return serializer.CanDeserialize(reader)
? serializer.Deserialize(reader)
: null;
}
示例3: SelectPropertyNode
public override IXmlCursor SelectPropertyNode(IXmlNode node, bool mutable)
{
var flags = Serializer.Kind == XmlTypeKind.Simple
? CursorFlags.AllNodes
: CursorFlags.Elements;
return node.SelectChildren(KnownTypes, Context, flags.MutableIf(mutable));
}
示例4: SetValue
public override void SetValue(IXmlNode node, IDictionaryAdapter parent, IXmlAccessor accessor, object oldValue, ref object value)
{
if (node.ClrType != typeof(object))
XmlTypeSerializer.For(node.ClrType).SetValue(node, parent, accessor, oldValue, ref value);
else
node.Clear();
}
示例5: GetValueCore
private object GetValueCore(IXmlNode node, IDictionaryAdapter parent, IXmlAccessor accessor)
{
var itemType = node.ClrType.GetGenericArguments()[0];
var listType = ListTypeConstructor.MakeGenericType(itemType);
var subaccessor = accessor.GetCollectionAccessor(itemType);
return Activator.CreateInstance(listType, node, parent, subaccessor);
}
示例6: PushParentNamespaces
private void PushParentNamespaces(IXmlNode node, XmlNamespaceManager manager)
{
List<IXmlNode> list = (List<IXmlNode>) null;
IXmlNode xmlNode1 = node;
while ((xmlNode1 = xmlNode1.ParentNode) != null)
{
if (xmlNode1.NodeType == XmlNodeType.Element)
{
if (list == null)
list = new List<IXmlNode>();
list.Add(xmlNode1);
}
}
if (list == null)
return;
list.Reverse();
foreach (IXmlNode xmlNode2 in list)
{
manager.PushScope();
foreach (IXmlNode xmlNode3 in (IEnumerable<IXmlNode>) xmlNode2.Attributes)
{
if (xmlNode3.NamespaceUri == "http://www.w3.org/2000/xmlns/" && xmlNode3.LocalName != "xmlns")
manager.AddNamespace(xmlNode3.LocalName, xmlNode3.Value);
}
}
}
示例7: SetValue
public override void SetValue(IXmlNode node, IDictionaryAdapter parent, IXmlAccessor accessor, object oldValue, ref object value)
{
var newNode = (XmlNode) value;
using (var writer = new XmlSubtreeWriter(node))
newNode.WriteTo(writer);
}
示例8: XmlSubtreeWriter
public XmlSubtreeWriter(IXmlNode node)
{
if (node == null)
throw Error.ArgumentNull("node");
this.node = node;
}
示例9: ParsePartwise
private void ParsePartwise(IXmlNode element)
{
var version = element.GetAttribute("version");
if (!string.IsNullOrEmpty(version) && version != "2.0")
{
throw new UnsupportedFormatException();
}
element.IterateChildren(c =>
{
if (c.NodeType == XmlNodeType.Element)
{
switch (c.LocalName)
{
case "movement-title":
_score.Title = Std.GetNodeValue(c.FirstChild);
break;
case "identification":
ParseIdentification(c);
break;
case "part-list":
ParsePartList(c);
break;
case "part":
ParsePart(c);
break;
}
}
});
}
示例10: Parse
public static XmlRpcValue Parse(IXmlNode node)
{
switch (node.NodeName.ToLower())
{
case "array":
return new XmlRpcArray(node);
break;
case "struct":
return new XmlRpcStruct(node);
break;
case "boolean":
return new XmlRpcBoolean(node);
break;
case "int":
return new XmlRpcInt(node);
break;
case "i4":
return new XmlRpcInt(node);
break;
case "double":
return new XmlRpcDouble(node);
break;
case "datetime.iso8601":
return new XmlRpcDateTime(node);
break;
default:
return new XmlRpcString(node);
}
return null;
}
示例11: PopulateIdentity
private void PopulateIdentity(int id, IXmlNode node)
{
Entry entry;
if (!entriesById.TryGetValue(id, out entry))
entriesById.Add(id, new Entry(id, node));
if (nextId <= id)
nextId = ++id;
}
示例12: GetValue
public override object GetValue(IXmlNode node, IDictionaryAdapter parent, IXmlAccessor accessor)
{
var source = node.AsRealizable<XmlNode>();
return (source != null && source.IsReal)
? source.Value
: null;
}
示例13: XmlRpcDouble
public XmlRpcDouble(IXmlNode node)
{
double val = -1;
double.TryParse(node.InnerText, out val);
Value = val;
}
示例14: ResolveFullName
private string ResolveFullName(IXmlNode node, XmlNamespaceManager manager)
{
string str = node.NamespaceUri == null || node.LocalName == "xmlns" && node.NamespaceUri == "http://www.w3.org/2000/xmlns/" ? (string) null : manager.LookupPrefix(node.NamespaceUri);
if (!string.IsNullOrEmpty(str))
return str + ":" + node.LocalName;
else
return node.LocalName;
}
示例15: PopulateReference
private void PopulateReference(int id, IXmlNode node, ICollection<Reference> references)
{
Entry entry;
if (entriesById.TryGetValue(id, out entry))
entry.AddReference(node);
else
references.Add(new Reference(id, node));
}