public NetworkAttributeParameter(IXPathNavigable path) : base(path) { // Get Navigator XPathNavigator navigator = path.CreateNavigator(); // <Name> XPathNavigator navigatorName = navigator.SelectSingleNode("Name"); if (navigatorName != null) { this._name = navigatorName.Value; } // <VarType> XPathNavigator navigatorVarType = navigator.SelectSingleNode("VarType"); if (navigatorVarType != null) { this._varType = navigatorVarType.ValueAsInt; } // <Value> XPathNavigator navigatorValue = navigator.SelectSingleNode("Value"); if (navigatorValue != null) { this._value = navigatorValue.Value; } // <DefaultValue> XPathNavigator navigatorDefaultValue = navigator.SelectSingleNode("DefaultValue"); if (navigatorDefaultValue != null) { this._defaultValue = navigatorDefaultValue.Value; } }
public SubtypeField(IXPathNavigable path) : base(path) { XPathNavigator navigator = path.CreateNavigator(); // <FieldName></FieldName> XPathNavigator navigatorFieldName = navigator.SelectSingleNode("FieldName"); if (navigatorFieldName != null) { this._fieldName = navigatorFieldName.Value; } // <DomainName></DomainName> XPathNavigator navigatorDomainName = navigator.SelectSingleNode("DomainName"); if (navigatorDomainName != null) { this._domainName = navigatorDomainName.Value; } // <DefaultValue></DefaultValue> XPathNavigator navigatorDefaultValue = navigator.SelectSingleNode("DefaultValue"); if (navigatorDefaultValue != null) { this._defaultValue = navigatorDefaultValue.Value; } // Initialize this.UpdateText(); // Set Element Properties this.Image = new Crainiate.ERM4.Image("Resource.publicfield.gif", "Crainiate.ERM4.Component"); }
// // CONSTRUCTOR // public Subtype(IXPathNavigable path) : base(path) { // Get Navigator XPathNavigator navigator = path.CreateNavigator(); // <SubtypeName> XPathNavigator navigatorSubtypeName = navigator.SelectSingleNode("SubtypeName"); if (navigatorSubtypeName != null) { this._subtypeName = navigatorSubtypeName.Value; } // <SubtypeCode> XPathNavigator navigatorSubtypeCode = navigator.SelectSingleNode("SubtypeCode"); if (navigatorSubtypeCode != null) { this._subtypeCode = navigatorSubtypeCode.ValueAsInt; } // <FieldInfos><SubtypeFieldInfo> XPathNodeIterator interatorSubtypeFieldInfo = navigator.Select("FieldInfos/SubtypeFieldInfo"); while (interatorSubtypeFieldInfo.MoveNext()) { // Create Field XPathNavigator navigatorSubtypeFieldInfo = interatorSubtypeFieldInfo.Current; SubtypeField subtypeField = new SubtypeField(navigatorSubtypeFieldInfo); // Add Field To Group this.Rows.Add(subtypeField); } // Refresh this.Refresh(); }
public RasterDef(IXPathNavigable path) : base(path) { // Get Navigator XPathNavigator navigator = path.CreateNavigator(); // <Description></Description> XPathNavigator navigatorDescription = navigator.SelectSingleNode("Description"); if (navigatorDescription != null) { this._description = navigatorDescription.Value; } // <IsByRef></IsByRef> XPathNavigator navigatorIsByRef = navigator.SelectSingleNode("IsByRef"); if (navigatorIsByRef != null) { this._isByRef = navigatorIsByRef.ValueAsBoolean; } // <SpatialReference></SpatialReference> XPathNavigator navigatorSpatialReference = navigator.SelectSingleNode("SpatialReference"); if (navigatorSpatialReference != null) { this._spatialReference = new SpatialReference(navigatorSpatialReference); } else { this._spatialReference = new SpatialReference(); } }
// // CONSTRUCTOR // //public EdgeFeatureSource() : base() { } public EdgeFeatureSource(IXPathNavigable path) : base(path) { // Get Navigator XPathNavigator navigator = path.CreateNavigator(); // <FromElevationFieldName> XPathNavigator navigatorFromElevationFieldName = navigator.SelectSingleNode("FromElevationFieldName"); if (navigatorFromElevationFieldName != null) { this._fromElevationFieldName = navigatorFromElevationFieldName.Value; } // <ToElevationFieldName> XPathNavigator navigatorToElevationFieldName = navigator.SelectSingleNode("ToElevationFieldName"); if (navigatorToElevationFieldName != null) { this._toElevationFieldName = navigatorToElevationFieldName.Value; } // <Connectivity><PropertyArray><PropertySetProperty> this._connectivity = new List<Property>(); XPathNodeIterator interatorProperty = navigator.Select("Connectivity/PropertyArray/PropertySetProperty"); while (interatorProperty.MoveNext()) { // Get <Property> XPathNavigator navigatorProperty = interatorProperty.Current; // Add Property Property property = new Property(navigatorProperty); this._connectivity.Add(property); } }
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"); }
public NetWeight(IXPathNavigable path) : base(path) { // Get Navigator XPathNavigator navigator = path.CreateNavigator(); // <WeightID>0</WeightID> XPathNavigator navigatorWeightID = navigator.SelectSingleNode("WeightID"); if (navigatorWeightID != null) { this._weightID = navigatorWeightID.ValueAsInt; } // <WeightName>MMElectricTraceWeight</WeightName> XPathNavigator navigatorWeightName = navigator.SelectSingleNode("WeightName"); if (navigatorWeightName != null) { this._weightName = navigatorWeightName.Value; } // <WeightType>esriWTInteger</WeightType> XPathNavigator navigatorWeightType = navigator.SelectSingleNode("WeightType"); if (navigatorWeightType != null) { this._weightType = (esriWeightType)Enum.Parse(typeof(esriWeightType), navigatorWeightType.Value, true); } // <BitGateSize>0</BitGateSize> XPathNavigator navigatorBitGateSize = navigator.SelectSingleNode("BitGateSize"); if (navigatorBitGateSize != null) { this._bitGateSize = navigatorBitGateSize.ValueAsInt; } }
public GeometricNetworkControllerMembership(IXPathNavigable path) : base(path) { // Get Navigator XPathNavigator navigator = path.CreateNavigator(); // <GeometricNetworkName>Empty_Net</GeometricNetworkName> XPathNavigator navigatorGeometricNetworkName = navigator.SelectSingleNode("GeometricNetworkName"); if (navigatorGeometricNetworkName != null) { this._geometricNetworkName = navigatorGeometricNetworkName.Value; } // <EnabledFieldName>Enabled</EnabledFieldName> XPathNavigator navigatorEnabledFieldName = navigator.SelectSingleNode("EnabledFieldName"); if (navigatorEnabledFieldName != null) { this._enabledFieldName = navigatorEnabledFieldName.Value; } // <AncillaryRoleFieldName /> XPathNavigator navigatorAncillaryRoleFieldName = navigator.SelectSingleNode("AncillaryRoleFieldName"); if (navigatorAncillaryRoleFieldName != null) { this._ancillaryRoleFieldName = navigatorAncillaryRoleFieldName.Value; } // <NetworkClassAncillaryRole>esriNCARNone</NetworkClassAncillaryRole> XPathNavigator navigatorNetworkClassAncillaryRole = navigator.SelectSingleNode("NetworkClassAncillaryRole"); if (navigatorNetworkClassAncillaryRole != null) { this._networkClassAncillaryRole = (esriNetworkClassAncillaryRole)Enum.Parse(typeof(esriNetworkClassAncillaryRole), navigatorNetworkClassAncillaryRole.Value, true); } }
public IResourceActions ReadXml(IXPathNavigable idoc) { // Basic check on the input if (idoc == null) { Logger.LogError("XmlResourceReader.ReadXml: null XmlDoc input"); throw new ApplicationException(Properties.Resources.COULD_NOT_READ_RESOURCES); } XPathNavigator doc = idoc.CreateNavigator(); XPathNavigator rootNode = doc.SelectSingleNode(@"PolicySetResources"); if (rootNode == null) { XmlNode node = new XmlDocument().CreateElement("PolicySetResources"); rootNode = node.CreateNavigator(); doc.AppendChild(rootNode); } // Check if the document contains an actions node XPathNavigator actionsNode = rootNode.SelectSingleNode(@"Actions"); if (actionsNode == null) { // No actions already defined in the resources so nothing to read // Return an empty collection of resource actions return new ResourceActions(); } return ReadActions(actionsNode); }
public TerrainPyramid(IXPathNavigable path) : base(path) { // Get Navigator XPathNavigator navigator = path.CreateNavigator(); //<PyramidLevelStatus>1</PyramidLevelStatus> XPathNavigator navigatorPyramidLevelStatus = navigator.SelectSingleNode("PyramidLevelStatus"); if (navigatorPyramidLevelStatus != null) { this._pyramidLevelStatus = (TerrainElementStatus)Enum.Parse(typeof(TerrainElementStatus), navigatorPyramidLevelStatus.Value, true); } //<PointCount>-1</PointCount> XPathNavigator navigatorPointCount = navigator.SelectSingleNode("PointCount"); if (navigatorPointCount != null) { this._pointCount = navigatorPointCount.ValueAsInt; } //<MaxScale>1000</MaxScale> XPathNavigator navigatorMaxScale = navigator.SelectSingleNode("MaxScale"); if (navigatorMaxScale != null) { this._maxScale = navigatorMaxScale.ValueAsInt; } //<Resolution>2</Resolution> XPathNavigator navigatorSourceStatus = navigator.SelectSingleNode("Resolution"); if (navigatorSourceStatus != null) { this._resolution = navigatorSourceStatus.ValueAsDouble; } }
public Domain.ErrorCode Validate(IXPathNavigable configSectionNode) { log.Debug("Validating the configuration"); lock (syncLock) { try { isValid = true; //TODO: is there a better way to do this? var navigator = configSectionNode.CreateNavigator(); var doc = new XmlDocument(); doc.LoadXml(navigator.OuterXml); doc.Schemas.Add(Schema); doc.Validate(ValidationCallback); if (isValid) { log.Debug("The configuration is valid"); } else { log.Error("The configuration is invalid"); } } catch (XmlException ex) { log.Error("An error occurred when validating the configuration", ex); isValid = false; } return isValid ? Domain.ErrorCode.Ok : Domain.ErrorCode.InvalidConfig; } }
public Index(IXPathNavigable path): base(path) { // Suspend Events this.SuspendEvents = true; // Get Naviagator XPathNavigator navigator = path.CreateNavigator(); // <Name></Name> XPathNavigator navigatorIndexName = navigator.SelectSingleNode("Name"); if (navigatorIndexName != null) { this._name = navigatorIndexName.Value; } // <IsUnique></IsUnique> XPathNavigator navigatorIsUnique = navigator.SelectSingleNode("IsUnique"); if (navigatorIsUnique != null) { this._isUnique = navigatorIsUnique.ValueAsBoolean; } // <IsAscending></IsAscending> XPathNavigator navigatorIsAscending = navigator.SelectSingleNode("IsAscending"); if (navigatorIsAscending != null) { this._isAscending = navigatorIsAscending.ValueAsBoolean; } // Initialize Text this.UpdateText(); // Collapse group this.Expanded = false; // Resume Events this.SuspendEvents = false; }
// // CONSTRUCTOR // //public NetworkSourceDirections() : base() { } public NetworkSourceDirections(IXPathNavigable path) : base(path) { // Get Navigator XPathNavigator navigator = path.CreateNavigator(); // <AdminAreaFieldName> XPathNavigator navigatorAdminAreaFieldName = navigator.SelectSingleNode("AdminAreaFieldName"); if (navigatorAdminAreaFieldName != null) { this._adminAreaFieldName = navigatorAdminAreaFieldName.Value; } // <Shields> XPathNavigator navigatorShields = navigator.SelectSingleNode("Shields"); if (navigatorShields != null) { this._shields = new Shields(navigatorShields); } else { this._shields = new Shields(); } // <StreetNameFields><StreetNameFields> this._streetNameFields = new List<StreetNameFields>(); XPathNodeIterator interatorStreetNameFields = navigator.Select("StreetNameFields/StreetNameFields"); while (interatorStreetNameFields.MoveNext()) { // Get <StreetNameFields> XPathNavigator navigatorStreetNameFields = interatorStreetNameFields.Current; // Add StreetNameFields StreetNameFields streetNameFields = new StreetNameFields(navigatorStreetNameFields); this._streetNameFields.Add(streetNameFields); } }
public TopologyControllerMembership(IXPathNavigable path) : base(path) { // Get Navigator XPathNavigator navigator = path.CreateNavigator(); // <TopologyName>Landbase_Topology</TopologyName> XPathNavigator navigatorTopologyName = navigator.SelectSingleNode("TopologyName"); if (navigatorTopologyName != null) { this._topologyName = navigatorTopologyName.Value; } // <Weight>5</Weight> XPathNavigator navigatorWeight = navigator.SelectSingleNode("Weight"); if (navigatorWeight != null) { this._weight = navigatorWeight.ValueAsInt; } // <XYRank>1</XYRank> XPathNavigator navigatorXYRank = navigator.SelectSingleNode("XYRank"); if (navigatorXYRank != null) { this._xyRank = navigatorXYRank.ValueAsInt; } // <ZRank>1</ZRank> XPathNavigator navigatorZRank = navigator.SelectSingleNode("ZRank"); if (navigatorZRank != null) { this._zRank = navigatorZRank.ValueAsInt; } // <EventNotificationOnValidate>false</EventNotificationOnValidate> XPathNavigator navigatorEventNotificationOnValidate = navigator.SelectSingleNode("EventNotificationOnValidate"); if (navigatorEventNotificationOnValidate != null) { this._eventNotificationOnValidate = navigatorEventNotificationOnValidate.ValueAsBoolean; } }
public Property(IXPathNavigable path) : base(path) { // Get Navigator XPathNavigator navigator = path.CreateNavigator(); // Key XPathNavigator navigatorKey = navigator.SelectSingleNode("Key"); if (navigatorKey != null) { this._key = navigatorKey.Value; } // Type & Value XPathNavigator navigatorValue = navigator.SelectSingleNode("Value"); if (navigatorValue == null) { // Set VALUE to null if the node does not exist this._value = null; } else { // Type this._type = navigatorValue.GetAttribute(Xml._TYPE, Xml.XMLSCHEMAINSTANCE); // Value if (this._type == "esri:XMLPersistedObject") { XPathNavigator navigatorBytes = navigatorValue.SelectSingleNode("Bytes"); if (navigatorBytes != null) { this._value = navigatorBytes.Value; } } else { this._value = navigatorValue.Value; } } }
// // CONSTRUCTOR // public DomainRange(IXPathNavigable path): base(path) { // XPathNavigator navigator = path.CreateNavigator(); // Add Min/Max Row DomainRangeRow row = new DomainRangeRow(navigator); this.Rows.Add(row); }
public void Load(IXPathNavigable stylesheet, XmlResolver resolver) { if (stylesheet == null) { throw new ArgumentNullException(nameof(stylesheet)); } Load(stylesheet.CreateNavigator(), resolver); }
public JunctionConnectivityRule(IXPathNavigable path) : base(path) { // Get Navigator XPathNavigator navigator = path.CreateNavigator(); // <EdgeClassID></EdgeClassID> XPathNavigator navigatorEdgeClassID = navigator.SelectSingleNode("EdgeClassID"); if (navigatorEdgeClassID != null) { this._edgeClassId = navigatorEdgeClassID.ValueAsInt; } // <EdgeSubtypeCode></EdgeSubtypeCode> XPathNavigator navigatorEdgeSubtypeCode = navigator.SelectSingleNode("EdgeSubtypeCode"); if (navigatorEdgeSubtypeCode != null) { this._edgeSubtypeCode = navigatorEdgeSubtypeCode.ValueAsInt; } // <JunctionClassID></JunctionClassID> XPathNavigator navigatorJunctionClassID = navigator.SelectSingleNode("JunctionClassID"); if (navigatorJunctionClassID != null) { this._junctionClassId = navigatorJunctionClassID.ValueAsInt; } // <SubtypeCode></SubtypeCode> XPathNavigator navigatorSubtypeCode = navigator.SelectSingleNode("SubtypeCode"); if (navigatorSubtypeCode != null) { this._subtypeCode = navigatorSubtypeCode.ValueAsInt; } // <EdgeMinimumCardinality></EdgeMinimumCardinality> XPathNavigator navigatorEdgeMinimumCardinality = navigator.SelectSingleNode("EdgeMinimumCardinality"); if (navigatorEdgeMinimumCardinality != null) { this._edgeMinimumCardinality = navigatorEdgeMinimumCardinality.ValueAsInt; } // <EdgeMaximumCardinality></EdgeMaximumCardinality> XPathNavigator navigatorEdgeMaximumCardinality = navigator.SelectSingleNode("EdgeMaximumCardinality"); if (navigatorEdgeMaximumCardinality != null) { this._edgeMaximumCardinality = navigatorEdgeMaximumCardinality.ValueAsInt; } // <JunctionMinimumCardinality></JunctionMinimumCardinality> XPathNavigator navigatorJunctionMinimumCardinality = navigator.SelectSingleNode("JunctionMinimumCardinality"); if (navigatorJunctionMinimumCardinality != null) { this._junctionMinimumCardinality = navigatorJunctionMinimumCardinality.ValueAsInt; } // <JunctionMaximumCardinality></JunctionMaximumCardinality> XPathNavigator navigatorJunctionMaximumCardinality = navigator.SelectSingleNode("JunctionMaximumCardinality"); if (navigatorJunctionMaximumCardinality != null) { this._junctionMaximumCardinality = navigatorJunctionMaximumCardinality.ValueAsInt; } // <IsDefault></IsDefault> XPathNavigator navigatorIsDefault = navigator.SelectSingleNode("IsDefault"); if (navigatorIsDefault != null) { this._isDefault = navigatorIsDefault.ValueAsBoolean; } }
/// <summary> /// Initializes a new instance of the <see cref="ReBugContext"/> class. /// </summary> /// <param name="bug">The bug.</param> protected ReBugContext(IXPathNavigable bug) { XPathNavigator xml = bug.CreateNavigator(); _QueryString = HttpValueCollection.CreateCollectionFromXmlNode(xml.SelectSingleNode("/bugx/queryString")); _Form = HttpValueCollection.CreateCollectionFromXmlNode(xml.SelectSingleNode("/bugx/form")); XPathNavigator cookie = xml.SelectSingleNode("/bugx/headers/Cookie"); if (cookie != null) { _Cookies = HttpValueCollection.CreateCollectionFromCookieHeader(cookie.Value); } _Headers = HttpValueCollection.CreateCollectionFromXmlNode(xml.SelectSingleNode("/bugx/headers")); _Session = FillNameValue(xml.Select("/bugx/sessionVariables/add")); _Cache = FillNameValue(xml.Select("/bugx/cacheVariables/add")); _Application = FillNameValue(xml.Select("/bugx/applicationVariables/add")); _Context = FillHashtable(xml.Select("/bugx/contextVariables/add")); XPathNavigator exception = xml.SelectSingleNode("/bugx/exception"); if (exception != null) { try { _Exception = (Exception)BugSerializer.Deserialize(exception.Value); }catch(SerializationException){} } XPathNavigator url = xml.SelectSingleNode("/bugx/url"); if (url != null) { _Url = new Uri(url.Value); } XPathNavigator pathInfo = xml.SelectSingleNode("/bugx/pathInfo"); if (pathInfo != null) { _PathInfo = pathInfo.Value; } XPathNavigator machineName = xml.SelectSingleNode("/bugx/machineName"); if (machineName != null) { _MachineName = machineName.Value; } XPathNavigator scriptTimeout = xml.SelectSingleNode("/bugx/scriptTimeout"); if (scriptTimeout != null) { _ScriptTimeout = Convert.ToInt32(scriptTimeout.Value, CultureInfo.InvariantCulture); } XPathNavigator user = xml.SelectSingleNode("/bugx/user"); if (user != null) { try { _User = (IPrincipal)BugSerializer.Deserialize(user.Value); } catch(SerializationException){} catch(TargetInvocationException){} } }
// // CONSTRUCTOR // public NetworkAssignment(IXPathNavigable path) : base(path) { // Get Navigator XPathNavigator navigator = path.CreateNavigator(); // <IsDefault> XPathNavigator navigatorIsDefault = navigator.SelectSingleNode("IsDefault"); if (navigatorIsDefault != null) { this._isDefault = navigatorIsDefault.ValueAsBoolean; } // <ID> XPathNavigator navigatorID = navigator.SelectSingleNode("ID"); if (navigatorID != null) { this._id = navigatorID.ValueAsInt; } // <NetworkAttributeName> XPathNavigator navigatorNetworkAttributeName = navigator.SelectSingleNode("NetworkAttributeName"); if (navigatorNetworkAttributeName != null) { this._networkAttributeName = navigatorNetworkAttributeName.Value; } // <NetworkElementType> XPathNavigator navigatorNetworkElementType = navigator.SelectSingleNode("NetworkElementType"); if (navigatorNetworkElementType != null) { this._networkElementType = (esriNetworkElementType)Enum.Parse(typeof(esriNetworkElementType), navigatorNetworkElementType.Value, true); } // <NetworkSourceName> XPathNavigator navigatorNetworkSourceName = navigator.SelectSingleNode("NetworkSourceName"); if (navigatorNetworkSourceName != null) { this._networkSourceName = navigatorNetworkSourceName.Value; } // <NetworkEvaluatorCLSID> XPathNavigator navigatorNetworkEvaluatorCLSID = navigator.SelectSingleNode("NetworkEvaluatorCLSID"); if (navigatorNetworkEvaluatorCLSID != null) { this._networkEvaluatorCLSID = navigatorNetworkEvaluatorCLSID.Value; } // <NetworkEdgeDirection> XPathNavigator navigatorNetworkEdgeDirection = navigator.SelectSingleNode("NetworkEdgeDirection"); if (navigatorNetworkEdgeDirection != null) { this._networkEdgeDirection = (esriNetworkEdgeDirection)Enum.Parse(typeof(esriNetworkEdgeDirection), navigatorNetworkEdgeDirection.Value, true); } // <NetworkEvaluatorData><PropertyArray><PropertySetProperty> this._networkEvaluatorData = new List<Property>(); XPathNodeIterator interatorProperty = navigator.Select("NetworkEvaluatorData/PropertyArray/PropertySetProperty"); while (interatorProperty.MoveNext()) { // Get <PropertySetProperty> XPathNavigator navigatorProperty = interatorProperty.Current; // Add PropertySetProperty Property property = new Property(navigatorProperty); this._networkEvaluatorData.Add(property); } }
//=========================================================================================== private string GetCacheFileName(IXPathNavigable xml) { string cacheDirectory = MagickWebSettings.CacheDirectory + CalculateMD5(xml.CreateNavigator().OuterXml) + "\\"; if (!Directory.Exists(cacheDirectory)) Directory.CreateDirectory(cacheDirectory); return cacheDirectory + CalculateMD5(_UrlResolver.FileName) + "." + _UrlResolver.Format; }
public bool CanHandle(IXPathNavigable document) { if (document != null) { var nav = document.CreateNavigator(); return nav.SelectSingleNode("/rss") != null; } return false; }
public static XPathDocument ToXPathDocument(this IXPathNavigable source) { var nav = source?.CreateNavigator(); return (nav != null ? new XPathDocument(nav.ReadSubtree()) : null); }
/// <summary> /// Loads an execution plan from an XML document. /// </summary> /// <param name="navigable">An XPath navigable object to load the execution plan from</param> public static ShowPlan FromXml(IXPathNavigable navigable) { if (navigable == null) throw ExceptionBuilder.ArgumentNull("navigable"); XPathNavigator navigator = navigable.CreateNavigator(); ShowPlanElement root = ReadPlanElement(navigator.SelectSingleNode("executionPlan/element")); return new ShowPlan(root); }
/// <summary> /// Default document as XPathNavigator. /// </summary> public override void Execute(IXPathNavigable contextDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlWriter results) { if (results == null) throw new ArgumentNullException(nameof(results)); if (contextDocument != null) Execute(contextDocument.CreateNavigator(), dataSources, argumentList, results, false); else Execute(null, dataSources, argumentList, results, false); }
// // CONSTRUCTOR // public RasterDataset(IXPathNavigable path) : base(path) { // Get Navigator XPathNavigator navigator = path.CreateNavigator(); // <Extent> XPathNavigator navigatorExtent = navigator.SelectSingleNode("Extent"); if (navigatorExtent != null) { this._extent = new Extent(navigatorExtent); } else { this._extent = new Extent(); } // <SpatialReference> XPathNavigator navigatorSpatialReference = navigator.SelectSingleNode("SpatialReference"); this._spatialReference = new SpatialReference(navigatorSpatialReference); if (navigatorSpatialReference != null) { this._spatialReference = new SpatialReference(navigatorSpatialReference); } else { this._spatialReference = new SpatialReference(); } // <Format> XPathNavigator navigatorFormat = navigator.SelectSingleNode("Format"); if (navigatorFormat != null) { this._format = navigatorFormat.Value; } // <CompressionType> XPathNavigator navigatorCompressionType = navigator.SelectSingleNode("CompressionType"); if (navigatorCompressionType != null) { this._compressionType = navigatorCompressionType.Value; } // <SensorType> XPathNavigator navigatorSensorType = navigator.SelectSingleNode("SensorType"); if (navigatorSensorType != null) { this._sensorType = navigatorSensorType.Value; } // <Permanent> XPathNavigator navigatorPermanent = navigator.SelectSingleNode("Permanent"); if (navigatorPermanent != null) { this._permanent = navigatorPermanent.ValueAsBoolean; } // <StorageDef> XPathNavigator navigatorStorageDef = navigator.SelectSingleNode("StorageDef"); if (navigatorStorageDef != null) { this._storageDef = new StorageDef(navigatorStorageDef); } else { this._storageDef = new StorageDef(); } }
/// <summary> /// Constructor /// </summary> /// <param name="Element">XML element holding info for the enclosure</param> public GUID(IXPathNavigable Element) { Contract.Requires<ArgumentNullException>(Element != null, "Element"); XPathNavigator Navigator = Element.CreateNavigator(); if (Navigator.GetAttribute("isPermaLink", "") != null) { PermaLink = Navigator.GetAttribute("isPermaLink", ""); } GUIDText = Navigator.Value; }
public NetworkControllerMembership(IXPathNavigable path) : base(path) { // Get Navigator XPathNavigator navigator = path.CreateNavigator(); // <NetworkDatasetName>ParisNet</NetworkDatasetName> XPathNavigator navigatorNetworkDatasetName = navigator.SelectSingleNode("NetworkDatasetName"); if (navigatorNetworkDatasetName != null) { this._networkDatasetName = navigatorNetworkDatasetName.Value; } }
/// <summary> /// Returns the value from the node that matches the parent node and /// element name parameters provided. /// </summary> /// <param name="parentNode">The parent node object</param> /// <param name="elementName">The element name</param> /// <returns>Returns the value if found or an empty string if not</returns> public string ReadXmlValue(IXPathNavigable parentNode, string elementName) { if (parentNode == null) { throw new HabaneroArgumentException("parentNode", "The parent node " + "being passed in the method ReadXMLValue() is null."); } IXPathNavigable node = parentNode.CreateNavigator().SelectSingleNode(elementName); return node != null ? node.CreateNavigator().InnerXml : string.Empty; }
// // CONSTRUCTOR // public SystemJunctionSource(IXPathNavigable path) : base(path) { // Get Navigator XPathNavigator navigator = path.CreateNavigator(); // <ElevationFieldName> XPathNavigator navigatorElevationFieldName = navigator.SelectSingleNode("ElevationFieldName"); if (navigatorElevationFieldName != null) { this._elevationFieldName = navigatorElevationFieldName.Value; } }
/// <summary> /// Initializes a new instance of the <see cref="SyndicationExtensionLoadedEventArgs"/> class using the supplied <see cref="IXPathNavigable"/>. /// </summary> /// <param name="data">A <see cref="IXPathNavigable"/> object that represents the XML data that was used to load the syndication extension.</param> /// <exception cref="ArgumentNullException">The <paramref name="data"/> is a null reference (Nothing in Visual Basic).</exception> public SyndicationExtensionLoadedEventArgs(IXPathNavigable data) : this() { //------------------------------------------------------------ // Validate parameter //------------------------------------------------------------ Guard.ArgumentNotNull(data, "data"); eventNavigator = data.CreateNavigator(); }
public static XmlDocument ToXmlDocument(this IXPathNavigable source, XmlResolver xmlResolver) { var nav = source?.CreateNavigator(); if (nav == null) { return(null); } var doc = new XmlDocument(nav.NameTable) { XmlResolver = xmlResolver }; doc.Load(nav.ReadSubtree()); return(doc); }
XmlReader Transform(IXPathNavigable input, XsltArgumentList args, XmlResolver resolver) #endif { return(Transform(input.CreateNavigator(), args, resolver)); }
void Transform(IXPathNavigable input, XsltArgumentList args, XmlWriter output, XmlResolver resolver) #endif { Transform(input.CreateNavigator(), args, output, resolver); }
public void Load(IXPathNavigable stylesheet, XmlResolver resolver) { Load(stylesheet.CreateNavigator(), resolver); }
public IXPathNavigable AddRunSettings(IXPathNavigable runSettingDocument, IRunSettingsConfigurationInfo configurationInfo, ILogger logger) { XPathNavigator runSettingsNavigator = runSettingDocument.CreateNavigator(); Debug.Assert(runSettingsNavigator != null, "userRunSettingsNavigator == null!"); if (!runSettingsNavigator.MoveToChild(Constants.RunSettingsName, "")) { logger.Log(MessageLevel.Warning, Resources.RunSettingsMissingNode); return(runSettingsNavigator); } var settingsContainer = new RunSettingsContainer(); settingsContainer.SolutionSettings = new RunSettings(); try { if (CopyToUnsetValues(runSettingsNavigator, settingsContainer)) { runSettingsNavigator.DeleteSelf(); // this node is to be replaced by the final run settings } } catch (InvalidRunSettingsException) { } string solutionRunSettingsFile = GetSolutionSettingsXmlFile(); try { if (File.Exists(solutionRunSettingsFile)) { var settings = new XmlReaderSettings(); // Don't use an object initializer for FxCop to understand. settings.XmlResolver = null; using (var reader = XmlReader.Create(solutionRunSettingsFile, settings)) { var solutionRunSettingsDocument = new XPathDocument(reader); XPathNavigator solutionRunSettingsNavigator = solutionRunSettingsDocument.CreateNavigator(); if (solutionRunSettingsNavigator.MoveToChild(Constants.RunSettingsName, "")) { CopyToUnsetValues(solutionRunSettingsNavigator, settingsContainer); } else { logger.Log(MessageLevel.Warning, string.Format(Resources.SolutionFoundButMissingNode, solutionRunSettingsFile, Constants.RunSettingsName)); } } } } catch (Exception e) { logger.Log(MessageLevel.Warning, string.Format(Resources.CantParseSettings, solutionRunSettingsFile, e)); } foreach (var projectSettings in settingsContainer.ProjectSettings) { projectSettings.GetUnsetValuesFrom(settingsContainer.SolutionSettings); } GetValuesFromGlobalSettings(settingsContainer); runSettingsNavigator.MoveToChild(Constants.RunSettingsName, ""); runSettingsNavigator.AppendChild(settingsContainer.ToXml().CreateNavigator()); runSettingsNavigator.MoveToRoot(); return(runSettingsNavigator); }
public void BlogItem(IXPathNavigable rssFragment, bool edited) { LoadConfig(); DoExportItem(rssFragment.CreateNavigator()); }
/// <summary> /// Initializes a new instance of the <see cref="MagickScript"/> class. /// </summary> /// <param name="xml">The IXPathNavigable that contains the script.</param> public MagickScript(IXPathNavigable xml) { Throw.IfNull(nameof(xml), xml); Initialize(xml.CreateNavigator()); }
/// <inheritdoc /> public object Convert(object sourceValue, Type targetType, IConverter elementConverter, bool nullable) { IXPathNavigable node = (IXPathNavigable)sourceValue; return(elementConverter.Convert(node.CreateNavigator(), targetType)); }
public void Transform(IXPathNavigable input, XsltArgumentList args, Stream output) { Transform(input.CreateNavigator(), args, output); }
public void Load(IXPathNavigable stylesheet) { Load(stylesheet.CreateNavigator(), XsltSettings.Default, XsltConfigSection.CreateDefaultResolver()); }
public void Transform(IXPathNavigable input, XsltArgumentList arguments, XmlWriter results) { Transform(input.CreateNavigator(), arguments, results, null); }
public void Transform(IXPathNavigable input, XsltArgumentList arguments, Stream results) { using (var sw = new StreamWriter(results)) { Transform(input.CreateNavigator(), arguments, sw); } }
public override void Transform(IXPathNavigable input, XsltArgumentList arguments, XmlWriter results, XmlResolver documentResolver) { CheckCommand(); this.command.Execute((object)input.CreateNavigator(), documentResolver, arguments, results); }
/// <summary> /// Creates <c>XPointerReader</c> instnace with given <see cref="IXPathNavigable"/> /// and xpointer. /// </summary> public XPointerReader(IXPathNavigable doc, string xpointer) : this(doc.CreateNavigator(), xpointer) { }
public void usage_whenIXPathNavigable(IXPathNavigable xml) { Assert.Equal("<example />", xml.CreateNavigator().OuterXml); }
public string WriteXml(string path, IXPathNavigable content) { return(this.Write(path, content.CreateNavigator().OuterXml)); }
public static string retriveText(this IXPathNavigable source, textRetriveSetup settings = null) { return(source.CreateNavigator().retriveText(settings)); }
public StorageDef(IXPathNavigable path) : base(path) { // Get Navigator XPathNavigator navigator = path.CreateNavigator(); // <CompressionQuality></CompressionQuality> XPathNavigator navigatorCompressionQuality = navigator.SelectSingleNode("CompressionQuality"); if (navigatorCompressionQuality != null) { this._compressionQuality = navigatorCompressionQuality.ValueAsInt; } // <CompressionType></CompressionType> XPathNavigator navigatorCompressionType = navigator.SelectSingleNode("CompressionType"); if (navigatorCompressionType != null) { this._compressionType = (esriRasterCompressionType)Enum.Parse(typeof(esriRasterCompressionType), navigatorCompressionType.Value, true); } // <PyramidLevel></PyramidLevel> XPathNavigator navigatorPyramidLevel = navigator.SelectSingleNode("PyramidLevel"); if (navigatorPyramidLevel != null) { this._pyramidLevel = navigatorPyramidLevel.ValueAsInt; } // <PyramidResampleType></PyramidResampleType> XPathNavigator navigatorPyramidResampleType = navigator.SelectSingleNode("PyramidResampleType"); if (navigatorPyramidResampleType != null) { this._pyramidResampleType = (rstResamplingTypes)Enum.Parse(typeof(rstResamplingTypes), navigatorPyramidResampleType.Value, true); } // <Tiled></Tiled> XPathNavigator navigatorTiled = navigator.SelectSingleNode("Tiled"); if (navigatorTiled != null) { this._tiled = navigatorTiled.ValueAsBoolean; } // <TileHeight></TileHeight> XPathNavigator navigatorTileHeight = navigator.SelectSingleNode("TileHeight"); if (navigatorTileHeight != null) { this._tileHeight = navigatorTileHeight.ValueAsInt; } // <TileWidth></TileWidth> XPathNavigator navigatorTileWidth = navigator.SelectSingleNode("TileWidth"); if (navigatorTileWidth != null) { this._tileWidth = navigatorTileWidth.ValueAsInt; } // <Origin></Origin> XPathNavigator navigatorOrigin = navigator.SelectSingleNode("Origin"); if (navigatorOrigin != null) { this._origin = new Point(navigatorOrigin); } else { this._origin = new Point(); this._origin.X = -1d; this._origin.Y = -1d; } // <CellSizeX></CellSizeX> XPathNavigator navigatorCellSizeX = navigator.SelectSingleNode("CellSizeX"); if (navigatorCellSizeX != null) { this._cellSizeX = navigatorCellSizeX.ValueAsDouble; } else { this._cellSizeX = -1d; } // <CellSizeY></CellSizeY> XPathNavigator navigatorCellSizeY = navigator.SelectSingleNode("CellSizeY"); if (navigatorCellSizeY != null) { this._cellSizeY = navigatorCellSizeY.ValueAsDouble; } else { this._cellSizeY = -1d; } }
// // CONSTRUCTOR // public Terrain(IXPathNavigable path) : base(path) { // Get Navigator XPathNavigator navigator = path.CreateNavigator(); // <ConfigurationKeyword></ConfigurationKeyword> XPathNavigator navigatorConfigurationKeyword = navigator.SelectSingleNode("ConfigurationKeyword"); if (navigatorConfigurationKeyword != null) { this._configurationKeyword = navigatorConfigurationKeyword.Value; } // <Extent></Extent> XPathNavigator navigatorExtent = navigator.SelectSingleNode("Extent"); if (navigatorExtent != null && !string.IsNullOrEmpty(navigatorExtent.InnerXml)) { this._extent = new Extent(navigatorExtent); } // <SpatialReference></SpatialReference> XPathNavigator navigatorSpatialReference = navigator.SelectSingleNode("SpatialReference"); if (navigatorSpatialReference != null && !string.IsNullOrEmpty(navigatorSpatialReference.InnerXml)) { this._spatialReference = new SpatialReference(navigatorSpatialReference); } // <FeatureDatasetName></FeatureDatasetName> // Do not load. This can be inferred. // <PyramidType></PyramidType> XPathNavigator navigatorPyramidType = navigator.SelectSingleNode("PyramidType"); if (navigatorPyramidType != null) { this._pyramidType = (esriTerrainPyramidType)Enum.Parse(typeof(esriTerrainPyramidType), navigatorPyramidType.Value, true); } // <WindowSizeMethod></WindowSizeMethod> XPathNavigator navigatorWindowSizeMethod = navigator.SelectSingleNode("WindowSizeMethod"); if (navigatorWindowSizeMethod != null) { this._windowSizeMethod = (esriTerrainWindowSizeMethod)Enum.Parse(typeof(esriTerrainWindowSizeMethod), navigatorWindowSizeMethod.Value, true); } // <WindowSizeZThreshold></WindowSizeZThreshold> XPathNavigator navigatorWindowSizeZThreshold = navigator.SelectSingleNode("WindowSizeZThreshold"); if (navigatorWindowSizeZThreshold != null) { this._windowSizeZThreshold = navigatorWindowSizeZThreshold.ValueAsDouble; } // <WindowSizeZThresholdStrategy></WindowSizeZThresholdStrategy> XPathNavigator navigatorWindowSizeZThresholdStrategy = navigator.SelectSingleNode("WindowSizeZThresholdStrategy"); if (navigatorWindowSizeZThresholdStrategy != null) { this._windowSizeZThresholdStrategy = (esriTerrainZThresholdStrategy)Enum.Parse(typeof(esriTerrainZThresholdStrategy), navigatorWindowSizeZThresholdStrategy.Value, true); } // <TileSize></TileSize> XPathNavigator navigatorTileSize = navigator.SelectSingleNode("TileSize"); if (navigatorTileSize != null) { this._tileSize = navigatorTileSize.ValueAsDouble; } // <MaxShapeSize></MaxShapeSize> XPathNavigator navigatorMaxShapeSize = navigator.SelectSingleNode("MaxShapeSize"); if (navigatorMaxShapeSize != null) { this._maxShapeSize = navigatorMaxShapeSize.ValueAsInt; } // <MaxOverviewSize></MaxOverviewSize> XPathNavigator navigatorMaxOverviewSize = navigator.SelectSingleNode("MaxOverviewSize"); if (navigatorMaxOverviewSize != null) { this._maxOverviewSize = navigatorMaxOverviewSize.ValueAsInt; } // <ExtentDomain></ExtentDomain> XPathNavigator navigatorExtentDomain = navigator.SelectSingleNode("ExtentDomain"); if (navigatorExtentDomain != null && !string.IsNullOrEmpty(navigatorExtentDomain.InnerXml)) { this._extentDomain = new Extent(navigatorExtentDomain); } // <ExtentAOI></ExtentAOI> XPathNavigator navigatorExtentAOI = navigator.SelectSingleNode("ExtentAOI"); if (navigatorExtentAOI != null && !string.IsNullOrEmpty(navigatorExtentAOI.InnerXml)) { this._extentAOI = new Extent(navigatorExtentAOI); } // <TerrainDataSources> // <TerrainDataSource> // </TerrainDataSource> // </TerrainDataSources> this._terrainDataSources = new List <TerrainDataSource>(); XPathNodeIterator interatorTerrainDataSource = navigator.Select("TerrainDataSources/TerrainDataSource"); while (interatorTerrainDataSource.MoveNext()) { // Get <ConnectivityRule> XPathNavigator navigatorTerrainDataSource = interatorTerrainDataSource.Current; TerrainDataSource terrainDataSource = new TerrainDataSource(navigatorTerrainDataSource); this._terrainDataSources.Add(terrainDataSource); } // TerrainPyramids this._terrainPyramids = new List <TerrainPyramid>(); string pyramidPath = null; switch (this._pyramidType) { case esriTerrainPyramidType.esriTerrainPyramidWindowSize: // <TerrainPyramidLevelWindowSizes> // <TerrainPyramidLevelWindowSize> // </TerrainPyramidLevelWindowSize> // </TerrainPyramidLevelWindowSizes> pyramidPath = "TerrainPyramidLevelWindowSizes/TerrainPyramidLevelWindowSize"; break; case esriTerrainPyramidType.esriTerrainPyramidZTolerance: // <TerrainPyramidLevelZTols> // <TerrainPyramidLevelZTol> // </TerrainPyramidLevelZTol> // </TerrainPyramidLevelZTols> pyramidPath = "TerrainPyramidLevelZTols/TerrainPyramidLevelZTol"; break; } XPathNodeIterator interatorTerrainPyramid = navigator.Select(pyramidPath); while (interatorTerrainPyramid.MoveNext()) { // Get <ConnectivityRule> XPathNavigator navigatorTerrainPyramid = interatorTerrainPyramid.Current; TerrainPyramid terrainPyramid = new TerrainPyramid(navigatorTerrainPyramid); this._terrainPyramids.Add(terrainPyramid); } // <TerrainID></TerrainID> XPathNavigator navigatorTerrainID = navigator.SelectSingleNode("TerrainID"); if (navigatorTerrainID != null) { this._terrainID = navigatorTerrainID.ValueAsInt; } // <Version></Version> XPathNavigator navigatorVersion = navigator.SelectSingleNode("Version"); if (navigatorVersion != null) { this._version = navigatorVersion.ValueAsInt; } }
internal void Load(IXPathNavigable stylesheet, XmlResolver resolver, Evidence evidence) #endif { Load(stylesheet.CreateNavigator(), resolver, evidence); }
protected object ProcessResult(object value) { if (value is string) { return(value); } if (value is double) { return(value); } if (value is bool) { return(value); } if (value is XPathNavigator) { return(value); } if (value is Int32) { return((double)(Int32)value); } if (value == null) { _queryIterator = XPathEmptyIterator.Instance; return(this); // We map null to NodeSet to let $null/foo work well. } ResetableIterator resetable = value as ResetableIterator; if (resetable != null) { // We need Clone() value because variable may be used several times // and they shouldn't _queryIterator = (ResetableIterator)resetable.Clone(); return(this); } XPathNodeIterator nodeIterator = value as XPathNodeIterator; if (nodeIterator != null) { _queryIterator = new XPathArrayIterator(nodeIterator); return(this); } IXPathNavigable navigable = value as IXPathNavigable; if (navigable != null) { return(navigable.CreateNavigator()); } if (value is Int16) { return((double)(Int16)value); } if (value is Int64) { return((double)(Int64)value); } if (value is UInt32) { return((double)(UInt32)value); } if (value is UInt16) { return((double)(UInt16)value); } if (value is UInt64) { return((double)(UInt64)value); } if (value is Single) { return((double)(Single)value); } if (value is Decimal) { return((double)(Decimal)value); } return(value.ToString()); }
public void Load(IXPathNavigable stylesheet) { Load(stylesheet.CreateNavigator(), null); }
/// <summary> /// Populates this <see cref="Personal"/> instance from the data in the XML. /// </summary> /// /// <param name="typeSpecificXml"> /// The XML to get the personal data from. /// </param> /// /// <exception cref="InvalidOperationException"> /// The first node in <paramref name="typeSpecificXml"/> is not /// a personal node. /// </exception> /// protected override void ParseXml(IXPathNavigable typeSpecificXml) { XPathNavigator itemNav = typeSpecificXml.CreateNavigator().SelectSingleNode("personal"); Validator.ThrowInvalidIfNull(itemNav, Resources.PersonalUnexpectedNode); _name = XPathHelper.GetOptNavValue <Name>(itemNav, "name"); _birthDate = XPathHelper.GetOptNavValue <HealthServiceDateTime>( itemNav, "birthdate"); _bloodtype = XPathHelper.GetOptNavValue <CodableValue>( itemNav, "blood-type"); _ethnicity = XPathHelper.GetOptNavValue <CodableValue>( itemNav, "ethnicity"); _ssn = XPathHelper.GetOptNavValue(itemNav, "ssn"); _maritalStatus = XPathHelper.GetOptNavValue <CodableValue>( itemNav, "marital-status"); _employmentStatus = XPathHelper.GetOptNavValue(itemNav, "employment-status"); // <is-deceased> _isDeceased = XPathHelper.GetOptNavValueAsBool( itemNav, "is-deceased"); // <date-of-death> _dateOfDeath = XPathHelper.GetOptNavValue <ApproximateDateTime>( itemNav, "date-of-death"); // <religion> _religion = XPathHelper.GetOptNavValue <CodableValue>( itemNav, "religion"); // <is-veteran> _isVeteran = XPathHelper.GetOptNavValueAsBool(itemNav, "is-veteran"); // <highest-education-level> _highestEducationLevel = XPathHelper.GetOptNavValue <CodableValue>( itemNav, "highest-education-level"); // <is-disabled> _isDisabled = XPathHelper.GetOptNavValueAsBool(itemNav, "is-disabled"); // <organ-donor> _organDonor = XPathHelper.GetOptNavValue(itemNav, "organ-donor"); }
public void Transform(IXPathNavigable input, XsltArgumentList args, TextWriter output) { Transform(input.CreateNavigator(), args, output, xmlResolver); }
public TerrainDataSource(IXPathNavigable path) : base(path) { // Get Navigator XPathNavigator navigator = path.CreateNavigator(); //<FeatureClassID>5</FeatureClassID> XPathNavigator navigatorFeatureClassID = navigator.SelectSingleNode("FeatureClassID"); if (navigatorFeatureClassID != null) { this._featureClassID = navigatorFeatureClassID.ValueAsInt; } //<FeatureClassName>topo_clip_poly</FeatureClassName> XPathNavigator navigatorFeatureClassName = navigator.SelectSingleNode("FeatureClassName"); if (navigatorFeatureClassName != null) { this._featureClassName = navigatorFeatureClassName.Value; } //<GroupID>1</GroupID> XPathNavigator navigatorGroupID = navigator.SelectSingleNode("GroupID"); if (navigatorGroupID != null) { this._groupID = navigatorGroupID.ValueAsInt; } //<SourceStatus>1</SourceStatus> XPathNavigator navigatorSourceStatus = navigator.SelectSingleNode("SourceStatus"); if (navigatorSourceStatus != null) { this._sourceStatus = (TerrainElementStatus)Enum.Parse(typeof(TerrainElementStatus), navigatorSourceStatus.Value, true); } //<SourceType>0</SourceType> XPathNavigator navigatorSourceType = navigator.SelectSingleNode("SourceType"); if (navigatorSourceType != null) { this._sourceType = (TerrainDataSourceType)Enum.Parse(typeof(TerrainDataSourceType), navigatorSourceType.Value, true); } //<SurfaceFeatureType>18</SurfaceFeatureType> XPathNavigator navigatorSurfaceFeatureType = navigator.SelectSingleNode("SurfaceFeatureType"); if (navigatorSurfaceFeatureType != null) { this._surfaceFeatureType = (esriTinSurfaceType)Enum.Parse(typeof(esriTinSurfaceType), navigatorSurfaceFeatureType.Value, true); } //<IsBase>false</IsBase> XPathNavigator navigatorIsBase = navigator.SelectSingleNode("IsBase"); if (navigatorIsBase != null) { this._isBase = navigatorIsBase.ValueAsBoolean; } //<Anchored>false</Anchored> XPathNavigator navigatorAnchored = navigator.SelectSingleNode("Anchored"); if (navigatorAnchored != null) { this._anchored = navigatorAnchored.ValueAsBoolean; } //<ApplyToOverview>true</ApplyToOverview> XPathNavigator navigatorApplyToOverview = navigator.SelectSingleNode("ApplyToOverview"); if (navigatorApplyToOverview != null) { this._applyToOverview = navigatorApplyToOverview.ValueAsBoolean; } //<AutoGeneralize>false</AutoGeneralize> XPathNavigator navigatorAutoGeneralize = navigator.SelectSingleNode("AutoGeneralize"); if (navigatorAutoGeneralize != null) { this._autoGeneralize = navigatorAutoGeneralize.ValueAsBoolean; } //<ResolutionLowerBound>0</ResolutionLowerBound> XPathNavigator navigatorResolutionLowerBound = navigator.SelectSingleNode("ResolutionLowerBound"); if (navigatorResolutionLowerBound != null) { this._resolutionLowerBound = navigatorResolutionLowerBound.ValueAsInt; } //<ResolutionUpperBound>32</ResolutionUpperBound> XPathNavigator navigatorResolutionUpperBound = navigator.SelectSingleNode("ResolutionUpperBound"); if (navigatorResolutionUpperBound != null) { this._resolutionUpperBound = navigatorResolutionUpperBound.ValueAsInt; } //<SourceName /> XPathNavigator navigatorSourceName = navigator.SelectSingleNode("SourceName"); if (navigatorSourceName != null) { this._sourceName = navigatorSourceName.Value; } //<HeightField /> XPathNavigator navigatorHeightField = navigator.SelectSingleNode("HeightField"); if (navigatorHeightField != null) { this._heightField = navigatorHeightField.Value; } //<TagValueField /> XPathNavigator navigatorTagValueField = navigator.SelectSingleNode("TagValueField"); if (navigatorTagValueField != null) { this._tagValueField = navigatorTagValueField.Value; } // <ReservedFields xsi:type="esri:ArrayOfString" /> // TODO Verify TerrainDataSource::ReservedFields this._reservedFields = new List <string>(); XPathNodeIterator interatorReservedField = navigator.Select("ReservedFields/String"); while (interatorReservedField.MoveNext()) { // Get <Property> XPathNavigator navigatorReservedField = interatorReservedField.Current; // Add Property this._reservedFields.Add(navigatorReservedField.Value); } }
public XmlReader Transform(IXPathNavigable input, XsltArgumentList args) { return(Transform(input.CreateNavigator(), args, xmlResolver)); }
/// <summary> /// Returns a JSON representation of the specified XML stream and whose value is equivalent to the specified XML stream. /// </summary> /// <param name="value">The XML to convert to a JSON representation.</param> /// <param name="encoding">The text encoding to use.</param> /// <returns>A JSON representation of the specified <paramref name="value"/> and whose value is equivalent to <paramref name="value"/>.</returns> /// <exception cref="ArgumentOutOfRangeException">This exception is thrown when <paramref name="encoding"/> is not within the boundaries of RFC 4627.</exception> /// <exception cref="ArgumentNullException">This exception is thrown should either of <paramref name="value"/> or <paramref name="encoding"/> have the value of null.</exception> /// <remarks>The JSON representation is in compliance with RFC 4627. Take note, that all string values is escaped using <see cref="StringUtility.Escape"/>. This is by design and to help ensure compatibility with a wide range of data.</remarks> public static Stream FromXmlStream(Stream value, Encoding encoding) { if (value == null) { throw new ArgumentNullException(nameof(value)); } if (encoding == null) { throw new ArgumentNullException(nameof(encoding)); } JsonWriter.ValidateEncoding(encoding); long startingPosition = value.Position; if (value.CanSeek) { value.Position = 0; } MemoryStream output = null; MemoryStream tempOutput = null; try { tempOutput = new MemoryStream(); using (JsonWriter writer = JsonWriter.Create(tempOutput, encoding)) { IXPathNavigable navigable = XPathNavigableConverter.FromStream(value); XPathNavigator rootNavigator = navigable.CreateNavigator(); XPathNodeIterator rootIterator = rootNavigator.Select("/node()"); XmlJsonInstance instance = BuildJsonInstance(rootIterator); writer.WriteStartObject(); WriteJsonInstance(writer, instance); writer.WriteEndObject(); writer.Flush(); tempOutput.Position = 0; output = new MemoryStream(tempOutput.ToArray()); tempOutput = null; } } catch (Exception) { if (output != null) { output.Dispose(); } throw; } finally { if (tempOutput != null) { tempOutput.Dispose(); } } if (value.CanSeek) { value.Seek(startingPosition, SeekOrigin.Begin); } // reset to original position return(output); }
/// <summary> /// Constructor /// </summary> /// <param name="Doc">XML representation of the channel</param> public Channel(IXPathNavigable Doc) : this() { Contract.Requires <ArgumentNullException>(Doc != null, "Element"); var Element = Doc.CreateNavigator(); if (!Element.Name.Equals("channel", StringComparison.CurrentCultureIgnoreCase)) { throw new ArgumentException("Element is not a channel"); } var NamespaceManager = new XmlNamespaceManager(Element.NameTable); var Node = Element.SelectSingleNode("./title", NamespaceManager); if (Node != null) { Title = Node.Value; } Node = Element.SelectSingleNode("./link", NamespaceManager); if (Node != null) { Link = Node.Value; } Node = Element.SelectSingleNode("./description", NamespaceManager); if (Node != null) { Description = Node.Value; } Node = Element.SelectSingleNode("./copyright", NamespaceManager); if (Node != null) { Copyright = Node.Value; } Node = Element.SelectSingleNode("./language", NamespaceManager); if (Node != null) { Language = Node.Value; } Node = Element.SelectSingleNode("./webmaster", NamespaceManager); if (Node != null) { WebMaster = Node.Value; } Node = Element.SelectSingleNode("./pubdate", NamespaceManager); if (Node != null) { PubDate = DateTime.Parse(Node.Value, CultureInfo.InvariantCulture); } var Nodes = Element.Select("./category", NamespaceManager); foreach (XmlNode TempNode in Nodes) { Categories.Add(Utils.StripIllegalCharacters(TempNode.Value)); } Node = Element.SelectSingleNode("./docs", NamespaceManager); if (Node != null) { Docs = Node.Value; } Node = Element.SelectSingleNode("./ttl", NamespaceManager); if (Node != null) { TTL = int.Parse(Node.Value, CultureInfo.InvariantCulture); } Node = Element.SelectSingleNode("./image/url", NamespaceManager); if (Node != null) { ImageUrl = Node.Value; } Nodes = Element.Select("./item", NamespaceManager); foreach (XmlNode TempNode in Nodes) { Items.Add(new Item((XmlElement)TempNode)); } }
private static string BuildMessage(string name, IXPathNavigable currentNode) { return($"Missing nodes: {currentNode.CreateNavigator().GetPath()}/{name}"); }