object IXsltContextFunction.Invoke( XsltContext xsltContext, object[] args, System.Xml.XPath.XPathNavigator docContext) { return(this.Invoke(xsltContext, args, docContext)); }
public CreateCone(System.Xml.XPath.XPathNavigator navigator, GEMSSingle parent) : base(navigator, parent) { alineAxis = (Axis)Enum.Parse(typeof(Axis), navigator.GetAttribute("axis", string.Empty)); //Bottom radius of cylinder navigator.MoveToChild("BottomRadius", string.Empty); bottomRadius = new Length(navigator.GetAttribute("value", string.Empty), navigator.GetAttribute("unit", string.Empty)); navigator.MoveToParent( ); //Top radius of cylinder navigator.MoveToChild("TopRadius", string.Empty); topRadius = new Length(navigator.GetAttribute("value", string.Empty), navigator.GetAttribute("unit", string.Empty)); navigator.MoveToParent( ); //Height of cylinder navigator.MoveToChild("Height", string.Empty); height = new Length(navigator.GetAttribute("value", string.Empty), navigator.GetAttribute("unit", string.Empty)); navigator.MoveToParent( ); //Center of cylinder navigator.MoveToChild("Center", string.Empty); center = new Vector3WithUnit( ); center.X = new Length(navigator.GetAttribute("x", string.Empty), navigator.GetAttribute("ux", string.Empty)); center.Y = new Length(navigator.GetAttribute("y", string.Empty), navigator.GetAttribute("uy", string.Empty)); center.Z = new Length(navigator.GetAttribute("z", string.Empty), navigator.GetAttribute("uz", string.Empty)); navigator.MoveToParent( ); }
private SatoriDhcpOsFingerprinter(System.IO.Stream fingerprintXmlStream) { fingerprintList = new List <DhcpFingerprint>(); System.Xml.XmlDocument dhcpXml = new System.Xml.XmlDocument(); dhcpXml.Load(fingerprintXmlStream); XmlNode fingerprintsNode = dhcpXml.DocumentElement.FirstChild; //System.Xml.XPath.XPathNavigator navigator=dhcpXml.CreateNavigator(); System.Xml.XPath.XPathNavigator navigator = fingerprintsNode.CreateNavigator(); foreach (XPathNavigator fingerprintNavigator in navigator.Select("fingerprint")) { string osClass = fingerprintNavigator.GetAttribute("os_class", ""); string os = fingerprintNavigator.GetAttribute("os_name", ""); if (os == null || os.Length == 0) { os = fingerprintNavigator.GetAttribute("name", ""); } string deviceType = fingerprintNavigator.GetAttribute("device_type", ""); string deviceVendor = fingerprintNavigator.GetAttribute("device_vendor", ""); //string os=fingerprintNavigator.GetAttribute("os",""); DhcpFingerprint fingerprint = new DhcpFingerprint(os, osClass, deviceType, deviceVendor); this.fingerprintList.Add(fingerprint); foreach (XPathNavigator testNav in fingerprintNavigator.Select("dhcp_tests/test")) //used to be "tests/test" { fingerprint.AddTest(testNav.Clone()); } } }
public CreateCuboid(System.Xml.XPath.XPathNavigator navigator, GEMSSingle parent) : base(navigator, parent) { //Width of box navigator.MoveToChild("Width", string.Empty); width = new Length(navigator.GetAttribute("value", string.Empty), navigator.GetAttribute("unit", string.Empty)); navigator.MoveToParent(); //Depth of box navigator.MoveToChild("Depth", string.Empty); depth = new Length(navigator.GetAttribute("value", string.Empty), navigator.GetAttribute("unit", string.Empty)); navigator.MoveToParent(); //Height of box navigator.MoveToChild("Height", string.Empty); height = new Length(navigator.GetAttribute("value", string.Empty), navigator.GetAttribute("unit", string.Empty)); navigator.MoveToParent(); //Reference point of box navigator.MoveToChild("RefPoint", string.Empty); refPoint = new Vector3WithUnit(); refPoint.X = new Length(navigator.GetAttribute("x", string.Empty), navigator.GetAttribute("ux", string.Empty)); refPoint.Y = new Length(navigator.GetAttribute("y", string.Empty), navigator.GetAttribute("uy", string.Empty)); refPoint.Z = new Length(navigator.GetAttribute("z", string.Empty), navigator.GetAttribute("uz", string.Empty)); navigator.MoveToParent(); }
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); }
public override void WriteDelegateSyntax(XPathNavigator reflection, SyntaxWriter writer) { string name = (string)reflection.Evaluate(apiNameExpression); bool isSerializable = (bool)reflection.Evaluate(apiIsSerializableTypeExpression); if (isSerializable) WriteAttribute("T:System.SerializableAttribute", writer); WriteAttributes(reflection, writer); writer.WriteKeyword("type"); writer.WriteString(" "); writer.WriteIdentifier(name); writer.WriteString(" = "); writer.WriteLine(); writer.WriteString(" "); writer.WriteKeyword("delegate"); writer.WriteString(" "); writer.WriteKeyword("of"); writer.WriteString(" "); WriteParameters(reflection, writer); writer.WriteKeyword("->"); writer.WriteString(" "); WriteReturnValue(reflection, writer); }
public MSXslScript (XPathNavigator nav, Evidence evidence) { this.evidence = evidence; code = nav.Value; if (nav.MoveToFirstAttribute ()) { do { switch (nav.LocalName) { case "language": switch (nav.Value.ToLower (CultureInfo.InvariantCulture)) { case "jscript": case "javascript": language = ScriptingLanguage.JScript; break; case "vb": case "visualbasic": language = ScriptingLanguage.VisualBasic; break; case "c#": case "csharp": language = ScriptingLanguage.CSharp; break; default: throw new XsltException ("Invalid scripting language!", null); } break; case "implements-prefix": implementsPrefix = nav.Value; break; } } while (nav.MoveToNextAttribute ()); nav.MoveToParent (); } if (implementsPrefix == null) throw new XsltException ("need implements-prefix attr", null); }
// // implementation // #region protected override XPathNavigator LoadSourceXPathData(PDFDataContext context) /// <summary> /// Overrides the abstract base method to return the source data. /// </summary> /// <param name="context"></param> /// <returns></returns> /// <remarks> /// XPathNavData has the highest priority, if null then XmlNodeData will be checked, if this /// is also null then the SourcePath will be used. If this is also not set, then null will be /// retruned from this method. /// </remarks> protected override XPathDataSourceBase.XPathDataCacheItem LoadSourceXPathData(PDFDataContext context) { System.Xml.XPath.XPathNavigator nav = null; System.Data.DataSet dataSet = null; if (this.HasCommands) { if (!this.HasData(out dataSet)) { dataSet = this.CreateSet(); foreach (var cmd in this.Commands) { cmd.EnsureDataLoaded(this, dataSet, context); } } nav = this.ConvertDataSetToXPath(dataSet, dataSet.Tables[0].TableName, context); } if (null != this.XPathNavData) { nav = this.XPathNavData; } else if (null != this.XmlNodeData) { nav = this.XmlNodeData.CreateNavigator(); } else if (!string.IsNullOrEmpty(this.SourcePath)) { XmlDocument doc = this.LoadXMLDocument(this.SourcePath, context); nav = doc.CreateNavigator(); } return(new XPathDataCacheItem(dataSet, nav)); }
public XPathSingletonIterator(XPathNavigator nav, bool moved) : this(nav) { if (moved) { _position = 1; } }
/// <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(); }
/// <summary> /// Initializes a new instance of the <see cref="XrdsNode"/> class. /// </summary> /// <param name="document">The document's root node, which this instance represents.</param> protected XrdsNode(XPathNavigator document) { Requires.NotNull(document, "document"); Requires.True(document.NameTable != null, null); this.Node = document; this.XmlNamespaceResolver = new XmlNamespaceManager(document.NameTable); }
public LanguagePackWriter(XPathNavigator manifestNav, InstallerInfo installer) { _Language = new Locale(); XPathNavigator cultureNav = manifestNav.SelectSingleNode("Culture"); _Language.Text = Util.ReadAttribute(cultureNav, "DisplayName"); _Language.Code = Util.ReadAttribute(cultureNav, "Code"); _Language.Fallback = Localization.Localization.SystemLocale; //Create a Package Package = new PackageInfo(installer); Package.Name = Language.Text; Package.FriendlyName = Language.Text; Package.Description = Null.NullString; Package.Version = new Version(1, 0, 0); Package.License = Util.PACKAGE_NoLicense; ReadLegacyManifest(manifestNav); if (_IsCore) { Package.PackageType = "CoreLanguagePack"; } else { Package.PackageType = "ExtensionLanguagePack"; } BasePath = Null.NullString; }
internal SatoriTcpOsFingerprinter(string satoriTcpXmlFilename) { fingerprintList = new List <TcpFingerprint>(); System.IO.FileStream fileStream = new FileStream(satoriTcpXmlFilename, FileMode.Open, FileAccess.Read); System.Xml.XmlDocument tcpXml = new System.Xml.XmlDocument(); tcpXml.Load(fileStream); XmlNode fingerprintsNode = tcpXml.DocumentElement.FirstChild; //System.Xml.XPath.XPathNavigator navigator=tcpXml.CreateNavigator(); System.Xml.XPath.XPathNavigator navigator = fingerprintsNode.CreateNavigator(); foreach (XPathNavigator fingerprintNavigator in navigator.Select("fingerprint")) { string osClass = fingerprintNavigator.GetAttribute("os_class", ""); string os = fingerprintNavigator.GetAttribute("os_name", ""); if (os == null || os.Length == 0) { os = fingerprintNavigator.GetAttribute("name", ""); } //string os=fingerprintNavigator.GetAttribute("os",""); TcpFingerprint fingerprint = new TcpFingerprint(os, osClass); this.fingerprintList.Add(fingerprint); foreach (XPathNavigator testNav in fingerprintNavigator.Select("tcp_tests/test")) //used to be "tests/test" { fingerprint.AddTest(testNav.Clone()); } } }
internal XmlQueryContext(XmlQueryRuntime runtime, object defaultDataSource, XmlResolver dataSources, XsltArgumentList argList, WhitespaceRuleLookup wsRules) { this.runtime = runtime; this.dataSources = dataSources; this.dataSourceCache = new Hashtable(); this.argList = argList; this.wsRules = wsRules; if (defaultDataSource is XmlReader) { this.readerSettings = new QueryReaderSettings((XmlReader) defaultDataSource); } else { // Consider allowing users to set DefaultReaderSettings in XsltArgumentList // readerSettings = argList.DefaultReaderSettings; this.readerSettings = new QueryReaderSettings(new NameTable()); } if (defaultDataSource is string) { // Load the default document from a Uri this.defaultDataSource = GetDataSource(defaultDataSource as string, null); if (this.defaultDataSource == null) throw new XslTransformException(Res.XmlIl_UnknownDocument, defaultDataSource as string); } else if (defaultDataSource != null) { this.defaultDataSource = ConstructDocument(defaultDataSource, null, null); } }
internal GenericSeekableNavigator(XPathNavigator navigator) { this.navigator = navigator; this.nodes = new QueryBuffer<XPathNavigator>(4); this.currentPosition = -1L; this.dom = this; }
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; }
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; }
/// <summary> /// Evaluates the given expression and returns the typed result. /// </summary> public static object Evaluate(string expression, XPathNavigator source, XmlNamespaceManager context, params XPathVariable[] variables) { XPathExpression expr = GetCompiledExpression(expression, source); expr.SetContext(PrepareContext(source, context, null, variables)); return source.Evaluate(expr); }
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); } } }
public void Read(System.Xml.XPath.XPathNavigator navigator, ContentItem item, ReadingJournal journal) { foreach (XPathNavigator detailElement in EnumerateChildren(navigator)) { ReadProperty(detailElement, item, journal); } }
// Function to execute a specified user-defined XPath extension // function at run time. public object Invoke(System.Xml.Xsl.XsltContext xsltContext, object[] args, System.Xml.XPath.XPathNavigator docContext) { if (FunctionName == "CountChar") { return((Object)CountChar((XPathNodeIterator)args[0], Convert.ToChar(args[1]))); } if (FunctionName == "FindTaskBy") { return(FindTaskBy((XPathNodeIterator)args[0], Convert.ToString(args[1]))); } if (FunctionName == "Left") { return((Object)Left(Convert.ToString(args[0]), Convert.ToInt16(args[1]))); } if (FunctionName == "Right") { return((Object)Right(Convert.ToString(args[0]), Convert.ToInt16(args[1]))); } return(null); }
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; }
public Episode(FileInfo file, Season seasonparent) : base(file.Directory) { String xmlpath = file.Directory.FullName + "/metadata/" + Path.GetFileNameWithoutExtension(file.FullName) + ".xml"; if (!File.Exists(xmlpath)) { Valid = false; return; } EpisodeXml = new XPathDocument(xmlpath); EpisodeNav = EpisodeXml.CreateNavigator(); EpisodeFile = file; _season = seasonparent; transX = 200; transY = 100; backdropImage = _season.backdropImage; XPathNodeIterator nodes = EpisodeNav.Select("//EpisodeID"); nodes.MoveNext(); folderImage = file.Directory.FullName + "/metadata/" + nodes.Current.Value + ".jpg"; if (!File.Exists(folderImage)) folderImage = "/Images/nothumb.jpg"; title = this.asTitle(); videoURL = EpisodeFile.FullName; LoadImage(folderImage); }
private XPathNavigator ProcessBeforePosition(XPathNavigator res1, XPathNavigator res2){ nextNode = res2; advance2 = false; advance1 = true; currentNode = res1; return res1; }
public override void WriteSyntax(XPathNavigator reflection, SyntaxWriter writer) { writer.WriteStartBlock(Language); // Check the list of assemblies for which to generate XAML syntax string assemblyName = (string)reflection.Evaluate(apiContainingAssemblyExpression); string namespaceName = (string)reflection.Evaluate(apiContainingNamespaceNameExpression); if (!xamlAssemblies.ContainsKey(assemblyName.ToLower())) { WriteXamlBoilerplate(XamlBoilerplateID.nonXamlAssemblyBoilerplate, writer); } else { string group = (string)reflection.Evaluate(apiGroupExpression); switch (group) { case "namespace": WriteNamespaceSyntax(reflection, writer); break; case "type": WriteTypeSyntax(reflection, writer); break; case "member": WriteMemberSyntax(reflection, writer); break; } WriteXamlXmlnsUri(assemblyName, namespaceName, writer); } writer.WriteEndBlock(); }
public bool Load(XPathNavigator source, XmlNamespaceManager manager) { //------------------------------------------------------------ // Validate parameter //------------------------------------------------------------ Guard.ArgumentNotNull(source, "source"); //------------------------------------------------------------ // Attempt to extract syndication information //------------------------------------------------------------ ResourceName = source.LocalName; Namespace = source.NamespaceURI; string value; Key = source.TryGetAttribute("key", Framework.Common.SData.Namespace, out value) ? value : null; Uri = source.TryGetAttribute("uri", Framework.Common.SData.Namespace, out value) && !string.IsNullOrEmpty(value) ? new Uri(value) : null; Uuid = source.TryGetAttribute("uuid", Framework.Common.SData.Namespace, out value) && !string.IsNullOrEmpty(value) ? new Guid(value) : (Guid?) null; Descriptor = source.TryGetAttribute("descriptor", Framework.Common.SData.Namespace, out value) ? value : null; Lookup = source.TryGetAttribute("lookup", Framework.Common.SData.Namespace, out value) ? value : null; IsDeleted = source.TryGetAttribute("isDeleted", Framework.Common.SData.Namespace, out value) && !string.IsNullOrEmpty(value) ? XmlConvert.ToBoolean(value) : (bool?) null; return source.SelectChildren(XPathNodeType.Element) .Cast<XPathNavigator>() .GroupBy(item => item.LocalName) .All(group => LoadItem(group.Key, group, manager)); }
public ResinConf(String file) { _xPathDoc = new XPathDocument(file); _docNavigator = _xPathDoc.CreateNavigator(); _xmlnsMgr = new XmlNamespaceManager(_docNavigator.NameTable); _xmlnsMgr.AddNamespace("caucho", "http://caucho.com/ns/resin"); }
/// <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 //------------------------------------------------------------ }
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); }
private XPathNavigator ProcessAfterPosition(XPathNavigator res1, XPathNavigator res2){ nextNode = res1; advance1 = false; advance2 = true; currentNode = res2; return res2; }
//===================================================================== /// <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)); }
public override void Reset() { qy1.Reset(); qy2.Reset(); advance1 = true; advance2 = true; nextNode = null; }
internal GenericSeekableNavigator(GenericSeekableNavigator navigator) { this.navigator = navigator.navigator.Clone(); this.nodes = new QueryBuffer<XPathNavigator>(); this.currentPosition = navigator.currentPosition; this.dom = navigator.dom; }
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 }
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; }
public Feed(IXPathNavigable navigable) { navigator = navigable.CreateNavigator(); manager = new XmlNamespaceManager(navigator.NameTable); manager.AddNamespace("f", "http://hl7.org/fhir"); manager.AddNamespace("atom", "http://www.w3.org/2005/Atom"); }
/// <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()); } }
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; }
[Test] //ExSkip public void NodeXPathNavigator() { // Create a blank document Document doc = new Document(); // A document is a composite node so we can make a navigator straight away System.Xml.XPath.XPathNavigator navigator = doc.CreateNavigator(); // Our root is the document node with 1 child, which is the first section Assert.AreEqual("Document", navigator.Name); Assert.AreEqual(false, navigator.MoveToNext()); Assert.AreEqual(1, navigator.SelectChildren(XPathNodeType.All).Count); // The document tree has the document, first section, body and first paragraph as nodes, with each being an only child of the previous // We can add a few more to give the tree some branches for the navigator to traverse DocumentBuilder docBuilder = new DocumentBuilder(doc); docBuilder.Write("Section 1, Paragraph 1. "); docBuilder.InsertParagraph(); docBuilder.Write("Section 1, Paragraph 2. "); doc.AppendChild(new Section(doc)); docBuilder.MoveToSection(1); docBuilder.Write("Section 2, Paragraph 1. "); // Use our navigator to print a map of all the nodes in the document to the console StringBuilder stringBuilder = new StringBuilder(); MapDocument(navigator, stringBuilder, 0); Console.Write(stringBuilder.ToString()); }
public CreatePoint(System.Xml.XPath.XPathNavigator navigator, GEMSSingle parent) : base(navigator, parent) { //Position of Point navigator.MoveToChild("Position", string.Empty); position = new Vector3WithUnit(); position.X = new Length(navigator.GetAttribute("x", string.Empty), navigator.GetAttribute("ux", string.Empty)); position.Y = new Length(navigator.GetAttribute("y", string.Empty), navigator.GetAttribute("uy", string.Empty)); position.Z = new Length(navigator.GetAttribute("z", string.Empty), navigator.GetAttribute("uz", string.Empty)); navigator.MoveToParent(); }
public virtual object Invoke(XsltContext xsltContext, object[] args, System.Xml.XPath.XPathNavigator docContext) { if (Function != null) { return(Function(xsltContext, args, docContext)); } else { throw new NotImplementedException("Custom function not implemented. Supply a lamba, or override Invoke()"); } }
/// <summary> /// See <see cref="System.Xml.XPath.XPathNavigator.IsSamePosition" /> for details. /// </summary> public override bool IsSamePosition(System.Xml.XPath.XPathNavigator other) { Trace("IsSamePosition"); XPathObjectNavigator x = other as XPathObjectNavigator; if (null == x) { return(false); } return(_state.IsSamePosition(x._state)); }
protected override InstallFile ReadManifestItem(System.Xml.XPath.XPathNavigator nav, bool checkFileExists) { InstallFile insFile = base.ReadManifestItem(nav, checkFileExists); _Manifest = Util.ReadElement(nav, "manifest"); if (string.IsNullOrEmpty(_Manifest)) { _Manifest = insFile.FullName + DEFAULT_MANIFESTEXT; } return(base.ReadManifestItem(nav, checkFileExists)); }
/// <summary>See <see cref="IMatchedNodes.IsMatched"/>.</summary> public bool IsMatched(System.Xml.XPath.XPathNavigator node) { foreach (XPathNavigator nav in _matched) { if (node.IsSamePosition(nav)) { return(true); } } return(false); }
/// <summary> /// See <see cref="System.Xml.XPath.XPathNavigator.MoveTo" /> for details. /// </summary> public override bool MoveTo(System.Xml.XPath.XPathNavigator other) { Trace("MoveTo"); XPathObjectNavigator navigator = other as XPathObjectNavigator; if (null == other) { return(false); } _state = navigator._state; _root = navigator._root; _context = navigator._context; return(true); }
public CreateSphere(System.Xml.XPath.XPathNavigator navigator, GEMSSingle parent) : base(navigator, parent) { //Radius of sphere navigator.MoveToChild("Radius", string.Empty); radius = new Length(navigator.GetAttribute("value", string.Empty), navigator.GetAttribute("unit", string.Empty)); navigator.MoveToParent(); //Center of sphere navigator.MoveToChild("Center", string.Empty); center = new Vector3WithUnit(); center.X = new Length(navigator.GetAttribute("x", string.Empty), navigator.GetAttribute("ux", string.Empty)); center.Y = new Length(navigator.GetAttribute("y", string.Empty), navigator.GetAttribute("uy", string.Empty)); center.Z = new Length(navigator.GetAttribute("z", string.Empty), navigator.GetAttribute("uz", string.Empty)); navigator.MoveToParent(); }
protected override void ProcessFile(InstallFile file, System.Xml.XPath.XPathNavigator nav) { switch (file.Extension) { case "htm": case "html": case "ascx": case "css": if (file.Path.ToLower().IndexOf(Globals.glbAboutPage.ToLower()) < 0) { SkinFiles.Add(PhysicalBasePath + file.FullName); } break; } base.ProcessFile(file, nav); }
public XPathNodeIterator ReturnDataXml(string tableXml, string condi) { // 'data xml dans un dropdowlistnormal string val = ""; XPathNodeIterator xmlNI; XPathDocument xpathDoc = new XPathDocument(xmlpath + tableXml + ".xml"); System.Xml.XPath.XPathNavigator xmlNav = xpathDoc.CreateNavigator(); xmlNI = xmlNav.Select("//" + tableXml + "[" + condi + "]"); if (xmlNI.Count > 0) { return(xmlNI); } return(null); }
/// <summary>See <see cref="IMatchedNodes.AddMatched"/>.</summary> public void AddMatched(System.Xml.XPath.XPathNavigator node) { IXmlLineInfo info = (IXmlLineInfo)node; Int32Collection pos; if (!_matched.ContainsKey(info.LineNumber)) { pos = new Int32Collection(); _matched.Add(info.LineNumber, pos); } else { pos = (Int32Collection)_matched[info.LineNumber]; } pos.Add(info.LinePosition); }
/// <summary> /// Override method that performs the actual property setting from a Navigator result. /// </summary> /// <param name="component"></param> /// <param name="data"></param> /// <param name="context"></param> protected override void DoBindComponent(object component, object data, PDFDataContext context) { System.Xml.XPath.XPathExpression expr = this.GetExpression(data, context); if (data is System.Xml.XPath.XPathNodeIterator) { data = ((System.Xml.XPath.XPathNodeIterator)data).Current; } System.Xml.XPath.XPathNavigator nav = (System.Xml.XPath.XPathNavigator)data; if (null == this.Converter) { var iterator = nav.Select(expr); if (this.Property.PropertyType == typeof(XPathNavigator)) { this.Property.SetValue(component, iterator.Current); } else { this.Property.SetValue(component, iterator); } } else { System.Xml.XPath.XPathNodeIterator itter = nav.Select(expr); if (itter.CurrentPosition < 0) { itter.MoveNext(); } string value = itter.Current.Value; object converted = this.Converter(value, this.Property.PropertyType, System.Globalization.CultureInfo.CurrentCulture); if (context.ShouldLogVerbose) { context.TraceLog.Add(TraceLevel.Verbose, "Item Binding", "Setting property '" + this.Property.Name + "' with the XPath binding expression '" + expr.Expression + "' to value '" + ((null == value) ? "NULL" : value) + "'"); } this.Property.SetValue(component, converted, null); } }
static bool BuildWasSuccessful(System.Xml.XPath.XPathNavigator navigator) { bool valueAsBoolean = false; XPathNodeIterator iterator = navigator.Select("XnaContent/Asset/BuildSuccessful"); iterator.MoveNext(); try { valueAsBoolean = iterator.Current.ValueAsBoolean; } catch (FormatException) { } catch (InvalidCastException) { } return(valueAsBoolean); }
/// <summary>See <see cref="IMatchedNodes.IsMatched"/>.</summary> public bool IsMatched(System.Xml.XPath.XPathNavigator node) { IXmlLineInfo info = (IXmlLineInfo)node; if (!_matched.ContainsKey(info.LineNumber)) { return(false); } Int32Collection pos = (Int32Collection)_matched[info.LineNumber]; if (!pos.Contains(info.LinePosition)) { return(false); } return(true); }
public CreateRound(System.Xml.XPath.XPathNavigator navigator, GEMSSingle parent) : base(navigator, parent) { alineAxis = (Axis)Enum.Parse(typeof(Axis), navigator.GetAttribute("axis", string.Empty)); //Radius of circle navigator.MoveToChild("Radius", string.Empty); radius = new Length(navigator.GetAttribute("value", string.Empty), navigator.GetAttribute("unit", string.Empty)); navigator.MoveToParent(); //Center of circle navigator.MoveToChild("Center", string.Empty); center = new Vector3WithUnit(); center.X = new Length(navigator.GetAttribute("x", string.Empty), navigator.GetAttribute("ux", string.Empty)); center.Y = new Length(navigator.GetAttribute("y", string.Empty), navigator.GetAttribute("uy", string.Empty)); center.Z = new Length(navigator.GetAttribute("z", string.Empty), navigator.GetAttribute("uz", string.Empty)); navigator.MoveToParent(); }
protected override void ParseConfiguration(System.Xml.XPath.XPathNavigator configurationElement, System.Xml.IXmlNamespaceResolver xmlNamespaceResolver, Schema.ContentType contentType) { base.ParseConfiguration(configurationElement, xmlNamespaceResolver, contentType); foreach (XPathNavigator node in configurationElement.SelectChildren(XPathNodeType.Element)) { switch (node.LocalName) { case VisiblePermissionCountName: int visiblePermissionCount; if (Int32.TryParse(node.InnerXml, out visiblePermissionCount)) { _visiblePermissionCount = visiblePermissionCount; } break; } } _options = PermissionType.PermissionTypes.Select(t => new ChoiceOption((t.Name).ToString(), "$ Portal, Permission_" + t.Name)).Take(VisiblePermissionCount ?? DefaultVisiblePermissionCount).ToList(); }
public void Read(System.Xml.XPath.XPathNavigator navigator, ContentItem item, ReadingJournal journal) { foreach (XPathNavigator childElement in EnumerateChildren(navigator)) { var attributes = GetAttributes(childElement); int id; if (attributes.ContainsKey("id") && int.TryParse(attributes["id"], out id) && id != 0) { Handle(item, journal, id); } if (attributes.ContainsKey("versionOf") && int.TryParse(attributes["versionOf"], out id) && id != 0) { Handle(item, journal, id); } else if (attributes.ContainsKey("versionKey")) { Handle(item, journal, attributes["versionKey"]); } } }
public string GetDataXmlValue(string tableXml, string condi, string SelectedField, string ValueIfNull = "") { // 'data xml dans un dropdowlistnormal string val = ""; XPathNodeIterator xmlNI; XPathDocument xpathDoc = new XPathDocument(xmlpath + tableXml + ".xml"); System.Xml.XPath.XPathNavigator xmlNav = xpathDoc.CreateNavigator(); xmlNI = xmlNav.Select("//" + tableXml + "[" + condi + "]"); if (xmlNI.Count == 0) { val = ValueIfNull; } else { while (xmlNI.MoveNext()) { var bar = xmlNI.Current; if (bar.IsEmptyElement) { val = ValueIfNull; } else { val = bar.SelectSingleNode(SelectedField).Value; } } // 'cmb.Items.Add(New ListItem(.SelectSingleNode(libelle).Value, .SelectSingleNode(code).Value)) } if (val == null) { val = ""; } return(val); }
public CreateLine(System.Xml.XPath.XPathNavigator navigator, GEMSSingle parent) : base(navigator, parent) { navigator.MoveToChild("Positions", string.Empty); navigator.MoveToFirstChild(); //Start Point of line startPoint = new Vector3WithUnit(); startPoint.X = new Length(navigator.GetAttribute("x", string.Empty), navigator.GetAttribute("ux", string.Empty)); startPoint.Y = new Length(navigator.GetAttribute("y", string.Empty), navigator.GetAttribute("uy", string.Empty)); startPoint.Z = new Length(navigator.GetAttribute("z", string.Empty), navigator.GetAttribute("uz", string.Empty)); //End Point of line navigator.MoveToNext(); endPoint = new Vector3WithUnit(); endPoint.X = new Length(navigator.GetAttribute("x", string.Empty), navigator.GetAttribute("ux", string.Empty)); endPoint.Y = new Length(navigator.GetAttribute("y", string.Empty), navigator.GetAttribute("uy", string.Empty)); endPoint.Z = new Length(navigator.GetAttribute("z", string.Empty), navigator.GetAttribute("uz", string.Empty)); navigator.MoveToParent(); navigator.MoveToParent(); }
public CreateRectangle(System.Xml.XPath.XPathNavigator navigator, GEMSSingle parent) : base(navigator, parent) { alineAxis = (Axis)Enum.Parse(typeof(Axis), navigator.GetAttribute("axis", string.Empty)); //Width of rectangle navigator.MoveToChild("Width", string.Empty); width = new Length(navigator.GetAttribute("value", string.Empty), navigator.GetAttribute("unit", string.Empty)); navigator.MoveToParent(); //Height of rectangle navigator.MoveToChild("Height", string.Empty); height = new Length(navigator.GetAttribute("value", string.Empty), navigator.GetAttribute("unit", string.Empty)); navigator.MoveToParent(); //Reference point of rectangle navigator.MoveToChild("RefPoint", string.Empty); refPoint = new Vector3WithUnit(); refPoint.X = new Length(navigator.GetAttribute("x", string.Empty), navigator.GetAttribute("ux", string.Empty)); refPoint.Y = new Length(navigator.GetAttribute("y", string.Empty), navigator.GetAttribute("uy", string.Empty)); refPoint.Z = new Length(navigator.GetAttribute("z", string.Empty), navigator.GetAttribute("uz", string.Empty)); navigator.MoveToParent(); }
// Function to execute a specified user-defined XPath extension // function at run time. public object Invoke(System.Xml.Xsl.XsltContext xsltContext, object[] args, System.Xml.XPath.XPathNavigator docContext) { var result = GetMatchingFunction(this.FunctionName, this.GetType(), (method, xpathExtensionAttr) => { var methodArgs = args .Zip(method.GetParameters(), (arg, parameter) => xpathExtensionAttr.BindArgumentToParameter(arg, parameter)) .ToArray(); return(method.Invoke(this, methodArgs)); }, () => { var msgLine1 = $"`{this.GetType().FullName}` does not contain a method" + $" that implements `{this.FunctionName}` with an Attribute that extends {typeof(IExtendXPath).FullName}"; var msgLine2 = $"\nEnsure there is a single attribute extending {typeof(IExtendXPath).FullName} a method" + $" named, or with {typeof(IExtendXPath).FullName}.Name equal to `{this.FunctionName}` on {this.GetType().FullName}."; throw new Exception(msgLine1 + msgLine2); }); return(result); }
public override void WriteNode(System.Xml.XPath.XPathNavigator navigator, bool defattr) { throw new InvalidOperationException(SR.Xml_InvalidOperation); }