Inheritance: XPathItem, ICloneable, IXPathNavigable, IXmlNamespaceResolver
        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;
        }
        /// <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();
        }
Example #3
0
        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 XPathSingletonIterator(XPathNavigator nav, bool moved) : this(nav)
 {
     if (moved)
     {
         _position = 1;
     }
 }
 /// <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
     //------------------------------------------------------------
 }
Example #7
0
        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);
                }
            }
        }
Example #8
0
        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);
        }
        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);
        }
Example #10
0
 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");
 }
Example #11
0
        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;
        }
Example #12
0
        /// <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());
            }
        }
        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);
        }
      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;
      }
Example #15
0
 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;
 }
Example #16
0
        //=====================================================================

        /// <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));
        }
Example #17
0
        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;
        }
Example #18
0
 public override void Reset() {
     qy1.Reset();
     qy2.Reset();
     advance1 = true;
     advance2 = true;
     nextNode = null;
 }
Example #19
0
        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
        }
Example #20
0
 private XPathNavigator ProcessBeforePosition(XPathNavigator res1, XPathNavigator res2){
     nextNode = res2;
     advance2 = false;
     advance1 = true;
     currentNode = res1;
     return res1;
 }
 internal GenericSeekableNavigator(GenericSeekableNavigator navigator)
 {
     this.navigator = navigator.navigator.Clone();
     this.nodes = new QueryBuffer<XPathNavigator>();
     this.currentPosition = navigator.currentPosition;
     this.dom = navigator.dom;
 }
Example #22
0
 private XPathNavigator ProcessAfterPosition(XPathNavigator res1, XPathNavigator res2){
     nextNode = res1;
     advance1 = false;
     advance2 = true;
     currentNode = res2;
     return res2;
 } 
	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);
	}
 public ResinConf(String file)
 {
   _xPathDoc = new XPathDocument(file);
   _docNavigator = _xPathDoc.CreateNavigator();
   _xmlnsMgr = new XmlNamespaceManager(_docNavigator.NameTable);
   _xmlnsMgr.AddNamespace("caucho", "http://caucho.com/ns/resin");
 }
Example #25
0
		/// <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 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 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;
        }
Example #28
0
        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 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);

        }
Example #30
0
 /// <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);
 }