本文整理汇总了C#中System.Xml.XPath.XPathNavigator类的典型用法代码示例。如果您正苦于以下问题:C# XPathNavigator类的具体用法?C# XPathNavigator怎么用?C# XPathNavigator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XPathNavigator类属于System.Xml.XPath命名空间,在下文中一共展示了XPathNavigator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: XPathAxisIterator
public XPathAxisIterator(XPathNavigator nav, string name, string namespaceURI, bool matchSelf) : this(nav, matchSelf) {
if (name == null) throw new ArgumentNullException("name");
if (namespaceURI == null) throw new ArgumentNullException("namespaceURI");
this.name = name;
this.uri = namespaceURI;
}
示例2: SchematronValidationEventArgs
/// <summary>
/// Creates a new instance of the <see cref="SchematronValidationEventArgs"/>.
/// </summary>
/// <param name="schematron">The <see cref="SchematronDocument"/> that detected the event.</param>
/// <param name="queryEngine">The <see cref="IQueryLanguage"/> that detected the event.</param>
/// <param name="pattern">The active <see cref="Pattern"/>.</param>
/// <param name="rule">The <see cref="Sepia.Schematron.Rule"/> that caused the event to be raised.</param>
/// <param name="assertion">The <see cref="Sepia.Schematron.Assertion"/> that caused the event to be raised.</param>
/// <param name="context">An <see cref="object"/> that provides the context for the <paramref name="rule"/> and <paramref name="assertion"/>.</param>
/// <param name="instance">An <see cref="XPathNavigator"/> to the document node that cause the event to be raised.</param>
public SchematronValidationEventArgs(SchematronDocument schematron, IQueryLanguage queryEngine, Pattern pattern, Rule rule, Assertion assertion, object context, XPathNavigator instance)
{
this.schematron = schematron;
this.queryEngine = queryEngine;
this.pattern = pattern;
this.rule = rule;
this.assertion = assertion;
this.instance = instance.Clone();
if (assertion == null)
{
message = "A schematron validation event occured.";
}
else
{
message = assertion.Message.ToString(instance, context);
}
List<string> diagnostics = new List<string>();
if (assertion != null && !string.IsNullOrEmpty(assertion.Diagnostics))
{
foreach (string id in assertion.Diagnostics.Split(' '))
{
Diagnostic diagnostic = schematron.Diagnostics[id];
diagnostics.Add(diagnostic.Message.ToString(instance, context));
}
}
this.diagnostics = diagnostics.ToArray();
}
示例3: GenericSeekableNavigator
internal GenericSeekableNavigator(XPathNavigator navigator)
{
this.navigator = navigator;
this.nodes = new QueryBuffer<XPathNavigator>(4);
this.currentPosition = -1L;
this.dom = this;
}
示例4: XPathSingletonIterator
public XPathSingletonIterator(XPathNavigator nav, bool moved) : this(nav)
{
if (moved)
{
_position = 1;
}
}
示例5: Atom03SyndicationResourceAdapter
/// <summary>
/// Initializes a new instance of the <see cref="Atom03SyndicationResourceAdapter"/> class using the supplied <see cref="XPathNavigator"/> and <see cref="SyndicationResourceLoadSettings"/>.
/// </summary>
/// <param name="navigator">A read-only <see cref="XPathNavigator"/> object for navigating through the syndication feed information.</param>
/// <param name="settings">The <see cref="SyndicationResourceLoadSettings"/> object used to configure the load operation of the <see cref="AtomFeed"/>.</param>
/// <remarks>
/// This class expects the supplied <paramref name="navigator"/> to be positioned on the XML element that represents a <see cref="AtomFeed"/>.
/// </remarks>
/// <exception cref="ArgumentNullException">The <paramref name="navigator"/> is a null reference (Nothing in Visual Basic).</exception>
/// <exception cref="ArgumentNullException">The <paramref name="settings"/> is a null reference (Nothing in Visual Basic).</exception>
public Atom03SyndicationResourceAdapter(XPathNavigator navigator, SyndicationResourceLoadSettings settings)
: base(navigator, settings)
{
//------------------------------------------------------------
// Initialization and argument validation handled by base class
//------------------------------------------------------------
}
示例6: AxisElement
internal AxisElement(GanttView view, XPathNavigator node)
: base(view, node)
{
_scale = (ScaleLevel)Enum.Parse(typeof(ScaleLevel), Attributes[ScaleName].Value);
_interval = int.Parse(Attributes[IntervalName].Value, CultureInfo.InvariantCulture);
_format = Attributes[FormatName].Value;
if(_scale == ScaleLevel.Week)
_firstDay = (DayOfWeek)Enum.Parse(typeof(DayOfWeek), Attributes[FirstDayName].Value);
if (Attributes.ContainsKey(TitleTypeName))
{
string titleTypeValue = Attributes[TitleTypeName].Value;
if (!string.IsNullOrEmpty(titleTypeValue))
{
_titleType = (TitleType)Enum.Parse(typeof(TitleType), titleTypeValue);
}
}
if (Attributes.ContainsKey(WidthName))
{
string widthValue = Attributes[WidthName].Value;
if (!string.IsNullOrEmpty(widthValue))
{
this.Width = int.Parse(widthValue, NumberStyles.Integer, CultureInfo.InvariantCulture);
}
}
}
示例7: AssertSequencePoints
protected override void AssertSequencePoints(XPathNavigator navigator)
{
var entries = navigator.Select(
"./symbols/methods/method[@name=\"MethodThatCreatesSwitch.SimpleClass.GenerateSwitch\"]/sequencepoints/entry");
Assert.Equal(8, entries.Count);
int visitedCount = 0;
foreach (XPathNavigator entry in entries)
{
if (entry.GetAttribute("il_offset", string.Empty) == "0x0")
{
Assert.Equal("16", entry.GetAttribute("start_row", string.Empty));
Assert.Equal("16", entry.GetAttribute("end_row", string.Empty));
Assert.Equal("4", entry.GetAttribute("start_column", string.Empty));
Assert.Equal("21", entry.GetAttribute("end_column", string.Empty));
visitedCount++;
}
else if (entry.GetAttribute("il_offset", string.Empty) == "0x23")
{
Assert.Equal("24", entry.GetAttribute("start_row", string.Empty));
Assert.Equal("24", entry.GetAttribute("end_row", string.Empty));
Assert.Equal("4", entry.GetAttribute("start_column", string.Empty));
Assert.Equal("17", entry.GetAttribute("end_column", string.Empty));
visitedCount++;
}
}
Assert.Equal(2, visitedCount);
}
示例8: LoadFromXPathNavigator
public static MaterialDefinition LoadFromXPathNavigator(XPathNavigator navigator)
{
if (navigator == null)
{
return null;
}
MaterialDefinition materialDefinition = new MaterialDefinition();
//name
materialDefinition.Name = navigator.GetAttribute("Name", string.Empty);
materialDefinition.NameHash = Cryptography.JenkinsOneAtATime(materialDefinition.Name);
//type
materialDefinition.Type = navigator.GetAttribute("Type", string.Empty);
materialDefinition.TypeHash = Cryptography.JenkinsOneAtATime(materialDefinition.Type);
//draw styles
XPathNodeIterator entries = navigator.Select("./Array[@Name='DrawStyles']/Object[@Class='DrawStyle']");
while (entries.MoveNext())
{
DrawStyle drawStyle = DrawStyle.LoadFromXPathNavigator(entries.Current);
if (drawStyle != null)
{
materialDefinition.DrawStyles.Add(drawStyle);
}
}
return materialDefinition;
}
示例9: XmlNodeTaskItem
/// <summary>
/// Initializes a new instance of an XmlNodeTaskItem
/// </summary>
/// <param name="xpathNavigator">The selected XmlNode</param>
/// <param name="reservedMetaDataPrefix">The prefix to attach to the reserved metadata properties.</param>
public XmlNodeTaskItem(XPathNavigator xpathNavigator, string reservedMetaDataPrefix)
{
this.ReservedMetaDataPrefix = reservedMetaDataPrefix;
switch (xpathNavigator.NodeType)
{
case XPathNodeType.Attribute:
itemSpec = xpathNavigator.Value;
break;
default:
itemSpec = xpathNavigator.Name;
break;
}
metaData.Add(ReservedMetaDataPrefix + "value", xpathNavigator.Value);
metaData.Add(ReservedMetaDataPrefix + "innerXml", xpathNavigator.InnerXml);
metaData.Add(ReservedMetaDataPrefix + "outerXml", xpathNavigator.OuterXml);
if (xpathNavigator.MoveToFirstAttribute())
{
do
{
metaData.Add(xpathNavigator.Name, xpathNavigator.Value);
} while (xpathNavigator.MoveToNextAttribute());
}
}
示例10: AssertSequencePointsInFirstType
private static void AssertSequencePointsInFirstType(XPathNavigator navigator)
{
var entries = navigator.Select(
"./symbols/methods/method[@name=\"AssemblyWithTwoTypes.FirstClass.ReflectArgument\"]/sequencepoints/entry");
Assert.Equal(2, entries.Count);
int visitedCount = 0;
foreach (XPathNavigator entry in entries)
{
if (entry.GetAttribute("il_offset", string.Empty) == "0x0")
{
Assert.Equal("16", entry.GetAttribute("start_row", string.Empty));
Assert.Equal("16", entry.GetAttribute("end_row", string.Empty));
Assert.Equal("4", entry.GetAttribute("start_column", string.Empty));
Assert.Equal("21", entry.GetAttribute("end_column", string.Empty));
visitedCount++;
}
else if (entry.GetAttribute("il_offset", string.Empty) == "0x1")
{
Assert.Equal("17", entry.GetAttribute("start_row", string.Empty));
Assert.Equal("17", entry.GetAttribute("end_row", string.Empty));
Assert.Equal("4", entry.GetAttribute("start_column", string.Empty));
Assert.Equal("17", entry.GetAttribute("end_column", string.Empty));
visitedCount++;
}
}
Assert.Equal(2, visitedCount);
}
示例11: ApplyTransformPipeline
public static CardViewModel ApplyTransformPipeline(XPathNavigator powerElement,
IEnumerable<Func<PowerPipelineState, PowerPipelineState>> pipeline, XmlDocument character)
{
var state = new PowerPipelineState(powerElement, character.CreateNavigator());
state = pipeline.Aggregate(state, (current, op) => op(current));
return state.ViewModel;
}
示例12: Parse
public static ChannelLink Parse(XPathNavigator navigator)
{
ChannelLink result = null;
Guid channelId = Guid.Empty;
string id = navigator.GetAttribute("id", String.Empty);
if (!String.IsNullOrEmpty(id))
{
channelId = new Guid(id);
}
int mpChannelId = -1;
string mpId = navigator.GetAttribute("mpId", String.Empty);
if (!String.IsNullOrEmpty(id))
{
mpChannelId = Int32.Parse(mpId);
}
if (channelId != Guid.Empty
&& mpChannelId >= 0)
{
string channelName = navigator.GetAttribute("name", String.Empty);
ChannelType channelType;
string type = navigator.GetAttribute("type", String.Empty);
if (String.IsNullOrEmpty(type))
{
channelType = ChannelType.Television;
}
else
{
channelType = (ChannelType)Enum.Parse(typeof(ChannelType), type);
}
string mpChannelName = navigator.GetAttribute("mpName", String.Empty);
result = new ChannelLink(channelType, channelId, channelName, mpChannelId, mpChannelName);
}
return result;
}
示例13: Initialize
//=====================================================================
/// <inheritdoc />
/// <remarks>Multiple <c>branch</c> elements are specified as the configuration. Each <c>branch</c>
/// element can contain one or more <c>component</c> definitions that will be created and executed when
/// this component is applied. Each branch receives a clone of the document. This may be useful for
/// generating multiple help output formats in one build configuration.</remarks>
public override void Initialize(XPathNavigator configuration)
{
XPathNodeIterator branchNodes = configuration.Select("branch");
foreach(XPathNavigator branchNode in branchNodes)
branches.Add(this.BuildAssembler.LoadComponents(branchNode));
}
示例14: LoadTheme
public bool LoadTheme(string XmlPath, string ElementName, XPathNavigator navigator, int SkinIndex)
{
string item = XmlPath + "/" + ElementName;
_ThemeLoaded = true;
_ThemeLoaded &= CHelper.TryGetEnumValueFromXML<EBackgroundTypes>(item + "/Type", navigator, ref _Theme.Type);
bool vid = CHelper.GetValueFromXML(item + "/Video", navigator, ref _Theme.VideoName, String.Empty);
bool tex = CHelper.GetValueFromXML(item + "/Skin", navigator, ref _Theme.TextureName, String.Empty);
_ThemeLoaded &= vid || tex || _Theme.Type == EBackgroundTypes.None;
if (CHelper.GetValueFromXML(item + "/Color", navigator, ref _Theme.ColorName, String.Empty))
{
_ThemeLoaded &= CTheme.GetColor(_Theme.ColorName, SkinIndex, ref Color);
}
else
{
bool success = true;
success &= CHelper.TryGetFloatValueFromXML(item + "/R", navigator, ref Color.R);
success &= CHelper.TryGetFloatValueFromXML(item + "/G", navigator, ref Color.G);
success &= CHelper.TryGetFloatValueFromXML(item + "/B", navigator, ref Color.B);
success &= CHelper.TryGetFloatValueFromXML(item + "/A", navigator, ref Color.A);
if (_Theme.Type != EBackgroundTypes.None)
_ThemeLoaded &= success;
}
if (_ThemeLoaded)
{
_Theme.Name = ElementName;
LoadTextures();
}
return _ThemeLoaded;
}
示例15: Create
static public XPathNavigatorReader Create(XPathNavigator navToRead)
{
XPathNavigator nav = navToRead.Clone();
IXmlLineInfo xli = nav as IXmlLineInfo;
IXmlSchemaInfo xsi = nav as IXmlSchemaInfo;
#if NAVREADER_SUPPORTSLINEINFO
if (null == xsi) {
if (null == xli) {
return new XPathNavigatorReader(nav, xli, xsi);
}
else {
return new XPathNavigatorReaderWithLI(nav, xli, xsi);
}
}
else {
if (null == xli) {
return new XPathNavigatorReaderWithSI(nav, xli, xsi);
}
else {
return new XPathNavigatorReaderWithLIAndSI(nav, xli, xsi);
}
}
#else
if (null == xsi)
{
return new XPathNavigatorReader(nav, xli, xsi);
}
else
{
return new XPathNavigatorReaderWithSI(nav, xli, xsi);
}
#endif
}