protected override void ParseConfiguration(XPathNavigator configurationElement, IXmlNamespaceResolver xmlNamespaceResolver, ContentType contentType)
		{
            //<MinValue>-6</MinValue>
			//<MaxValue>42</MaxValue>
			foreach (XPathNavigator node in configurationElement.SelectChildren(XPathNodeType.Element))
			{
				switch (node.LocalName)
				{
					case MinValueName:
                        int minValue;
                        if (Int32.TryParse(node.InnerXml, out minValue))
                            _minValue = minValue;
						break;
					case MaxValueName:
						int maxValue;
						if (Int32.TryParse(node.InnerXml, out maxValue))
							_maxValue = maxValue;
						break;
                    case ShowAsPercentageName:
                        bool perc;
                        if (Boolean.TryParse(node.InnerXml, out perc))
                            _showAsPercentage = perc;
                        break;
				}
			}
		}
 public static IEnumerable Select(object container, string xPath, IXmlNamespaceResolver resolver)
 {
     if (container == null)
     {
         throw new ArgumentNullException("container");
     }
     if (string.IsNullOrEmpty(xPath))
     {
         throw new ArgumentNullException("xPath");
     }
     ArrayList list = new ArrayList();
     IXPathNavigable navigable = container as IXPathNavigable;
     if (navigable == null)
     {
         throw new ArgumentException(System.Web.SR.GetString("XPathBinder_MustBeIXPathNavigable", new object[] { container.GetType().FullName }));
     }
     XPathNodeIterator iterator = navigable.CreateNavigator().Select(xPath, resolver);
     while (iterator.MoveNext())
     {
         IHasXmlNode current = iterator.Current as IHasXmlNode;
         if (current == null)
         {
             throw new InvalidOperationException(System.Web.SR.GetString("XPathBinder_MustHaveXmlNodes"));
         }
         list.Add(current.GetNode());
     }
     return list;
 }
 public override object ChangeType(string value, Type destinationType, IXmlNamespaceResolver nsResolver)
 {
     if (value == null)
     {
         throw new ArgumentNullException("value");
     }
     if (destinationType == null)
     {
         throw new ArgumentNullException("destinationType");
     }
     if (destinationType == XmlBaseConverter.ObjectType)
     {
         destinationType = base.DefaultClrType;
     }
     if (destinationType == XmlBaseConverter.StringType)
     {
         return value;
     }
     if (destinationType == XmlBaseConverter.XmlAtomicValueType)
     {
         return new XmlAtomicValue(base.SchemaType, value);
     }
     if (destinationType == XmlBaseConverter.XPathItemType)
     {
         return new XmlAtomicValue(base.SchemaType, value);
     }
     return this.ChangeListType(value, destinationType, nsResolver);
 }
 public static object Eval(object container, string xPath, IXmlNamespaceResolver resolver)
 {
     if (container == null)
     {
         throw new ArgumentNullException("container");
     }
     if (string.IsNullOrEmpty(xPath))
     {
         throw new ArgumentNullException("xPath");
     }
     IXPathNavigable navigable = container as IXPathNavigable;
     if (navigable == null)
     {
         throw new ArgumentException(System.Web.SR.GetString("XPathBinder_MustBeIXPathNavigable", new object[] { container.GetType().FullName }));
     }
     object obj2 = navigable.CreateNavigator().Evaluate(xPath, resolver);
     XPathNodeIterator iterator = obj2 as XPathNodeIterator;
     if (iterator == null)
     {
         return obj2;
     }
     if (iterator.MoveNext())
     {
         return iterator.Current.Value;
     }
     return null;
 }
 internal override Exception TryParseValue(string s, XmlNameTable nameTable, IXmlNamespaceResolver nsmgr, out object typedValue)
 {
     typedValue = null;
     if ((s == null) || (s.Length == 0))
     {
         return new XmlSchemaException("Sch_EmptyAttributeValue", string.Empty);
     }
     Exception exception = DatatypeImplementation.durationFacetsChecker.CheckLexicalFacets(ref s, this);
     if (exception == null)
     {
         XsdDuration duration;
         exception = XsdDuration.TryParse(s, XsdDuration.DurationType.YearMonthDuration, out duration);
         if (exception == null)
         {
             TimeSpan span;
             exception = duration.TryToTimeSpan(XsdDuration.DurationType.YearMonthDuration, out span);
             if (exception == null)
             {
                 exception = DatatypeImplementation.durationFacetsChecker.CheckValueFacets(span, this);
                 if (exception == null)
                 {
                     typedValue = span;
                     return null;
                 }
             }
         }
     }
     return exception;
 }
        public void Apply (XmlDocument targetDocument, IXmlNamespaceResolver context) {

            XPathExpression local_file_expression = file_expression.Clone();
            local_file_expression.SetContext(context);

            XPathExpression local_source_expression = source_expression.Clone();
            local_source_expression.SetContext(context);

            XPathExpression local_target_expression = target_expression.Clone();
            local_target_expression.SetContext(context);

            string file_name = (string) targetDocument.CreateNavigator().Evaluate(local_file_expression);
            string file_path = Path.Combine(root_directory, file_name);

            if (!File.Exists(file_path)) return;
            XPathDocument sourceDocument = new XPathDocument(file_path);

            XPathNavigator target_node = targetDocument.CreateNavigator().SelectSingleNode(local_target_expression);
            if (target_node == null) return;

            XPathNodeIterator source_nodes = sourceDocument.CreateNavigator().Select(local_source_expression);
            foreach (XPathNavigator source_node in source_nodes) {
                target_node.AppendChild(source_node);
            }
       
        }
        public override async Task< object > ReadContentAsAsync(Type returnType, IXmlNamespaceResolver namespaceResolver) {
            if (!CanReadContentAs(this.NodeType)) {
                throw CreateReadContentAsException("ReadContentAs");
            }
            string originalStringValue;

            var tuple_0 = await InternalReadContentAsObjectTupleAsync(false).ConfigureAwait(false);
            originalStringValue = tuple_0.Item1;

            object typedValue = tuple_0.Item2;

            XmlSchemaType xmlType = NodeType == XmlNodeType.Attribute ? AttributeXmlType : ElementXmlType; //
            try {
                if (xmlType != null) {
                    // special-case convertions to DateTimeOffset; typedValue is by default a DateTime 
                    // which cannot preserve time zone, so we need to convert from the original string
                    if (returnType == typeof(DateTimeOffset) && xmlType.Datatype is Datatype_dateTimeBase) {
                        typedValue = originalStringValue;
                    }
                    return xmlType.ValueConverter.ChangeType(typedValue, returnType);
                }
                else {
                    return XmlUntypedConverter.Untyped.ChangeType(typedValue, returnType, namespaceResolver);
                }
            }
            catch (FormatException e) {
                throw new XmlException(Res.Xml_ReadContentAsFormatException, returnType.ToString(), e, this as IXmlLineInfo);
            }
            catch (InvalidCastException e) {
                throw new XmlException(Res.Xml_ReadContentAsFormatException, returnType.ToString(), e, this as IXmlLineInfo);
            }
            catch (OverflowException e) {
                throw new XmlException(Res.Xml_ReadContentAsFormatException, returnType.ToString(), e, this as IXmlLineInfo);
            }
        }
 public XmlSchemaValidator(XmlNameTable nameTable, XmlSchemaSet schemas, IXmlNamespaceResolver namespaceResolver, XmlSchemaValidationFlags validationFlags)
 {
     if (nameTable == null)
     {
         throw new ArgumentNullException("nameTable");
     }
     if (schemas == null)
     {
         throw new ArgumentNullException("schemas");
     }
     if (namespaceResolver == null)
     {
         throw new ArgumentNullException("namespaceResolver");
     }
     this.nameTable = nameTable;
     this.nsResolver = namespaceResolver;
     this.validationFlags = validationFlags;
     if (((validationFlags & XmlSchemaValidationFlags.ProcessInlineSchema) != XmlSchemaValidationFlags.None) || ((validationFlags & XmlSchemaValidationFlags.ProcessSchemaLocation) != XmlSchemaValidationFlags.None))
     {
         this.schemaSet = new XmlSchemaSet(nameTable);
         this.schemaSet.ValidationEventHandler += schemas.GetEventHandler();
         this.schemaSet.CompilationSettings = schemas.CompilationSettings;
         this.schemaSet.XmlResolver = schemas.GetResolver();
         this.schemaSet.Add(schemas);
         this.validatedNamespaces = new Hashtable();
     }
     else
     {
         this.schemaSet = schemas;
     }
     this.Init();
 }
        //=====================================================================

        /// <summary>
        /// Apply the copy command to the specified target document using the specified context
        /// </summary>
        /// <param name="targetDocument">The target document</param>
        /// <param name="context">The context to use</param>
        public override void Apply(XmlDocument targetDocument, IXmlNamespaceResolver context)
        {
            // Extract the target node
            XPathExpression targetXPath = this.Target.Clone();
            targetXPath.SetContext(context);

            XPathNavigator target = targetDocument.CreateNavigator().SelectSingleNode(targetXPath);

            if(target != null)
            {
                // Extract the source nodes
                XPathExpression sourceXPath = this.Source.Clone();
                sourceXPath.SetContext(context);

                XPathNodeIterator sources = this.SourceDocument.CreateNavigator().Select(sourceXPath);

                // Append the source nodes to the target node
                foreach(XPathNavigator source in sources)
                    target.AppendChild(source);

                // Don't warn or generate an error if no source nodes are found, that may be the case
            }
            else
                base.ParentComponent.WriteMessage(MessageLevel.Error, "CopyFromFileCommand target node not found");
        }
 public override object ChangeType(object value, Type destinationType, IXmlNamespaceResolver nsResolver)
 {
     if (value == null)
     {
         throw new ArgumentNullException("value");
     }
     if (destinationType == null)
     {
         throw new ArgumentNullException("destinationType");
     }
     Type sourceType = value.GetType();
     if ((sourceType == XmlBaseConverter.XmlAtomicValueType) && this.hasAtomicMember)
     {
         return ((XmlAtomicValue) value).ValueAs(destinationType, nsResolver);
     }
     if ((sourceType == XmlBaseConverter.XmlAtomicValueArrayType) && this.hasListMember)
     {
         return XmlAnyListConverter.ItemList.ChangeType(value, destinationType, nsResolver);
     }
     if (!(sourceType == XmlBaseConverter.StringType))
     {
         throw base.CreateInvalidClrMappingException(sourceType, destinationType);
     }
     if (destinationType == XmlBaseConverter.StringType)
     {
         return value;
     }
     XsdSimpleValue value2 = (XsdSimpleValue) base.SchemaType.Datatype.ParseValue((string) value, new NameTable(), nsResolver, true);
     return value2.XmlType.ValueConverter.ChangeType((string) value, destinationType, nsResolver);
 }
Exemple #11
0
		public static XElement XPathSelectElement (this XNode node, string expression, IXmlNamespaceResolver resolver)
		{
			XPathNavigator nav = CreateNavigator (node).SelectSingleNode (expression, resolver);
			if (nav == null)
				return null;
			return nav.UnderlyingObject as XElement;
		}
Exemple #12
0
        public OdtTemplate( DocumentInformation documentInformation, IXmlNamespaceResolver xmlNamespaceResolver,
		                    IXDocumentParserService xDocumentParserService )
            : base(documentInformation, xmlNamespaceResolver, xDocumentParserService)
        {
            ScriptSectionFormatting();
            ReplaceFields();
        }
Exemple #13
0
		public static object XPathEvaluate (this XNode node, string expression, IXmlNamespaceResolver resolver)
		{
			object navigationResult = CreateNavigator (node).Evaluate (expression, resolver);
			if (!(navigationResult is XPathNodeIterator))
				return navigationResult;
			return GetUnderlyingXObjects((XPathNodeIterator) navigationResult);
		}
 public override object ChangeType(object value, Type destinationType, IXmlNamespaceResolver nsResolver)
 {
     if (value == null)
     {
         throw new ArgumentNullException("value");
     }
     if (destinationType == null)
     {
         throw new ArgumentNullException("destinationType");
     }
     Type derivedType = value.GetType();
     if (destinationType == XmlBaseConverter.ObjectType)
     {
         destinationType = base.DefaultClrType;
     }
     if ((destinationType == XmlBaseConverter.XPathNavigatorType) && XmlBaseConverter.IsDerivedFrom(derivedType, XmlBaseConverter.XPathNavigatorType))
     {
         return (XPathNavigator) value;
     }
     if ((destinationType == XmlBaseConverter.XPathItemType) && XmlBaseConverter.IsDerivedFrom(derivedType, XmlBaseConverter.XPathNavigatorType))
     {
         return (XPathItem) value;
     }
     return this.ChangeListType(value, destinationType, nsResolver);
 }
        public static object Eval(object container, string xPath, IXmlNamespaceResolver resolver) {
            if (container == null) {
                throw new ArgumentNullException("container");
            }
            if (String.IsNullOrEmpty(xPath)) {
                throw new ArgumentNullException("xPath");
            }

            IXPathNavigable node = container as IXPathNavigable;
            if (node == null) {
                throw new ArgumentException(SR.GetString(SR.XPathBinder_MustBeIXPathNavigable, container.GetType().FullName));
            }
            XPathNavigator navigator = node.CreateNavigator();

            object retValue = navigator.Evaluate(xPath, resolver);

            // If we get back an XPathNodeIterator instead of a simple object, advance
            // the iterator to the first node and return the value.
            XPathNodeIterator iterator = retValue as XPathNodeIterator;
            if (iterator != null) {
                if (iterator.MoveNext()) {
                    retValue = iterator.Current.Value;
                }
                else {
                    retValue = null;
                }
            }

            return retValue;
        }
 internal override Exception TryParseValue(string s, XmlNameTable nameTable, IXmlNamespaceResolver nsmgr, out object typedValue)
 {
     typedValue = null;
     Exception exception = DatatypeImplementation.binaryFacetsChecker.CheckLexicalFacets(ref s, this);
     if (exception == null)
     {
         byte[] buffer = null;
         try
         {
             buffer = XmlConvert.FromBinHexString(s, false);
         }
         catch (ArgumentException exception2)
         {
             return exception2;
         }
         catch (XmlException exception3)
         {
             return exception3;
         }
         exception = DatatypeImplementation.binaryFacetsChecker.CheckValueFacets(buffer, this);
         if (exception == null)
         {
             typedValue = buffer;
             return null;
         }
     }
     return exception;
 }
 public override object ParseValue(string s, XmlNameTable nameTable, IXmlNamespaceResolver nsmgr)
 {
     object obj2;
     if ((s == null) || (s.Length == 0))
     {
         throw new XmlSchemaException("Sch_EmptyAttributeValue", string.Empty);
     }
     if (nsmgr == null)
     {
         throw new ArgumentNullException("nsmgr");
     }
     try
     {
         string str;
         obj2 = XmlQualifiedName.Parse(s.Trim(), nsmgr, out str);
     }
     catch (XmlSchemaException exception)
     {
         throw exception;
     }
     catch (Exception exception2)
     {
         throw new XmlSchemaException(Res.GetString("Sch_InvalidValue", new object[] { s }), exception2);
     }
     return obj2;
 }
        // Concatenates values of textual nodes of the current content, ignoring comments and PIs, expanding entity references, 
        // and converts the content to the requested type. Stops at start tags and end tags.
        public virtual async Task<object> ReadContentAsAsync(Type returnType, IXmlNamespaceResolver namespaceResolver)
        {
            if (!CanReadContentAs())
            {
                throw CreateReadContentAsException("ReadContentAs");
            }

            string strContentValue = await InternalReadContentAsStringAsync().ConfigureAwait(false);
            if (returnType == typeof(string))
            {
                return strContentValue;
            }
            else
            {
                try
                {
                    return XmlUntypedStringConverter.Instance.FromString(strContentValue, returnType, (namespaceResolver == null ? this as IXmlNamespaceResolver : namespaceResolver));
                }
                catch (FormatException e)
                {
                    throw new XmlException(SR.Xml_ReadContentAsFormatException, returnType.ToString(), e, this as IXmlLineInfo);
                }
                catch (InvalidCastException e)
                {
                    throw new XmlException(SR.Xml_ReadContentAsFormatException, returnType.ToString(), e, this as IXmlLineInfo);
                }
            }
        }
 internal override Exception TryParseValue(string s, XmlNameTable nameTable, IXmlNamespaceResolver nsmgr, out object typedValue)
 {
     typedValue = null;
     if ((s == null) || (s.Length == 0))
     {
         return new XmlSchemaException("Sch_EmptyAttributeValue", string.Empty);
     }
     Exception exception = DatatypeImplementation.qnameFacetsChecker.CheckLexicalFacets(ref s, this);
     if (exception == null)
     {
         XmlQualifiedName name = null;
         try
         {
             string str;
             name = XmlQualifiedName.Parse(s, nsmgr, out str);
         }
         catch (ArgumentException exception2)
         {
             return exception2;
         }
         catch (XmlException exception3)
         {
             return exception3;
         }
         exception = DatatypeImplementation.qnameFacetsChecker.CheckValueFacets(name, this);
         if (exception == null)
         {
             typedValue = name;
             return null;
         }
     }
     return exception;
 }
Exemple #20
0
        public OdsTemplate( DocumentInformation documentInformation, IXmlNamespaceResolver xmlNamespaceResolver,
		                    IXDocumentParserService xDocumentParserService )
            : base(documentInformation, xmlNamespaceResolver, xDocumentParserService)
        {
            HandleConditionals();
            ReplaceComments();
        }
        public ExpressionBuilderParameters(ParameterExpression[] parameters, IQueryProvider queryProvider, Type elementType, IXmlNamespaceResolver namespaceResolver, bool mayRootPathBeImplied, IOperatorImplementationProvider operatorImplementationProvider, Func<Type, IXmlNamespaceResolver, XPathTypeNavigator> navigatorCreator=null)
        {
            Debug.Assert(parameters!=null);
            if (parameters==null)
                throw new ArgumentNullException("parameters");
            Debug.Assert(parameters.Length>0);
            if (parameters.Length==0)
                throw new ArgumentException(
                    string.Format(
                        CultureInfo.CurrentCulture,
                        SR.ArrayShouldHaveElementsException,
                        1,
                        parameters.Length
                    ),
                    "parameters"
                );
            Debug.Assert(queryProvider!=null);
            if (queryProvider==null)
                throw new ArgumentNullException("queryProvider");
            Debug.Assert(elementType!=null);
            if (elementType==null)
                throw new ArgumentNullException("elementType");

            Parameters=new ReadOnlyCollection<ParameterExpression>(parameters);
            ElementType=elementType;
            QueryProvider=queryProvider;
            NamespaceResolver=namespaceResolver;
            MayRootPathBeImplied=mayRootPathBeImplied;
            OperatorImplementationProvider=operatorImplementationProvider;
            NavigatorCreator=navigatorCreator;
        }
Exemple #22
0
		public static IEnumerable<XElement> XPathSelectElements (this XNode node, string xpath, IXmlNamespaceResolver nsResolver)
		{
			XPathNodeIterator iter = CreateNavigator (node).Select (xpath, nsResolver);
			foreach (XPathNavigator nav in iter){
				if (nav.UnderlyingObject is XElement)
					yield return (XElement) nav.UnderlyingObject;
			}
		}
 /// <summary>
 /// Start construction of a new Xml tree (document or fragment).
 /// </summary>
 public override XmlRawWriter StartTree(XPathNodeType rootType, IXmlNamespaceResolver nsResolver, XmlNameTable nameTable) {
     // Build XPathDocument
     // If rootType != XPathNodeType.Root, then build an XQuery fragment
     this.doc = new XPathDocument(nameTable);
     this.writer = doc.LoadFromWriter(XPathDocument.LoadFlags.AtomizeNames | (rootType == XPathNodeType.Root ? XPathDocument.LoadFlags.None : XPathDocument.LoadFlags.Fragment), string.Empty);
     this.writer.NamespaceResolver = nsResolver;
     return this.writer;
 }
        //=====================================================================

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="path">The path expression</param>
        /// <param name="item">The item name expression</param>
        /// <param name="parameters">The parameters expression</param>
        /// <param name="attribute">The attribute name expression</param>
        /// <param name="context">The context to use for the XPath expressions</param>
        public SharedContentElement(string path, string item, string parameters, string attribute,
          IXmlNamespaceResolver context)
        {
            this.Path = XPathExpression.Compile(path, context);
            this.Item = XPathExpression.Compile(item, context);
            this.Parameters = XPathExpression.Compile(parameters, context);
            this.Attribute = XPathExpression.Compile(attribute, context);
        }
 static AcceptanceTests()
 {
     var manager = new XmlNamespaceManager(new NameTable());
     manager.AddNamespace("", mshNs.NamespaceName);
     manager.AddNamespace("maml", mamlNs.NamespaceName);
     manager.AddNamespace("command", commandNs.NamespaceName);
     manager.AddNamespace("dev", devNs.NamespaceName);
     resolver = manager;
 }
 public static object XPathEvaluate(this XNode node, string expression, IXmlNamespaceResolver resolver)
 {
     if (node == null)
     {
         throw new ArgumentNullException("node");
     }
     XPathEvaluator evaluator2 = new XPathEvaluator();
     return evaluator2.Evaluate<object>(node, expression, resolver);
 }
Exemple #27
0
        protected Template( DocumentInformation documentInformation, IXmlNamespaceResolver xmlNamespaceResolver,
		                    IXDocumentParserService xDocumentParserService )
        {
            OriginalDocument = documentInformation.Document;
            Meta = documentInformation.Metadata;
            Manager = xmlNamespaceResolver;
            _xDocumentParserService = xDocumentParserService;
            ConvertDocument( documentInformation.Content );
        }
        public static void XPathAppendElement(this XNode node, string expression, IXmlNamespaceResolver resolver)
        {
            if (resolver == null)
            {
                throw new ArgumentNullException("resolver", "Es wurde keine NamespaceResolver angegeben.");
            }

            node.XPathAppendElement(expression, string.Empty, resolver);
        }
 static CommentReaderExtensions()
 {
     var manager = new XmlNamespaceManager(new NameTable());
     manager.AddNamespace("", MshNs.NamespaceName);
     manager.AddNamespace("maml", MamlNs.NamespaceName);
     manager.AddNamespace("command", CommandNs.NamespaceName);
     manager.AddNamespace("dev", DevNs.NamespaceName);
     Resolver = manager;
 }
 public static XPathExpression Compile(string xpath, IXmlNamespaceResolver nsResolver) {
     bool hasPrefix;
     Query query = new QueryBuilder().Build(xpath, out hasPrefix);
     CompiledXpathExpr expr = new CompiledXpathExpr(query, xpath, hasPrefix);
     if (null != nsResolver) {
         expr.SetContext(nsResolver);
     }
     return expr;
 }
Exemple #31
0
 public PlainUblParser(XDocument document, IXmlNamespaceResolver nsResolver)
 {
     this.document   = document;
     this.nsResolver = nsResolver;
 }
Exemple #32
0
        //
        // Summary:
        //     Compiles the specified XPath expression, with the System.Xml.IXmlNamespaceResolver
        //     object specified for namespace resolution, and returns an System.Xml.XPath.XPathExpression
        //     object that represents the XPath expression.
        //
        // Parameters:
        //   xpath:
        //     An XPath expression.
        //
        //   nsResolver:
        //     An object that implements the System.Xml.IXmlNamespaceResolver interface
        //     for namespace resolution.
        //
        // Returns:
        //     An System.Xml.XPath.XPathExpression object.
        //
        // Exceptions:
        //   System.ArgumentException:
        //     The XPath expression parameter is not a valid XPath expression.
        //
        //   System.Xml.XPath.XPathException:
        //     The XPath expression is not valid.
        public static XPathExpression Compile(string xpath, IXmlNamespaceResolver nsResolver)
        {
            Contract.Ensures(Contract.Result <XPathExpression>() != null);

            return(default(XPathExpression));
        }
Exemple #33
0
        private Dictionary <string, FieldDescriptor> ParseFieldElements(XPathNavigator fieldsElement, IXmlNamespaceResolver nsres)
        {
            Dictionary <string, FieldDescriptor> fieldDescriptorList = new Dictionary <string, FieldDescriptor>();
            ContentType listType = ContentType.GetByName("Aspect");

            foreach (XPathNavigator fieldElement in fieldsElement.SelectChildren(XPathNodeType.Element))
            {
                FieldDescriptor fieldDescriptor = FieldDescriptor.Parse(fieldElement, nsres, listType);
                fieldDescriptorList.Add(fieldDescriptor.FieldName, fieldDescriptor);
            }
            return(fieldDescriptorList);
        }
        internal XmlReader AddConformanceWrapper(XmlReader baseReader)
        {
            XmlReaderSettings baseReaderSettings = baseReader.Settings;
            bool          checkChars             = false;
            bool          noWhitespace           = false;
            bool          noComments             = false;
            bool          noPIs    = false;
            DtdProcessing dtdProc  = (DtdProcessing)(-1);
            bool          needWrap = false;

            if (baseReaderSettings == null)
            {
#pragma warning disable 618

#if SILVERLIGHT
                if (this.conformanceLevel != ConformanceLevel.Auto)
                {
                    throw new InvalidOperationException(Res.GetString(Res.Xml_IncompatibleConformanceLevel, this.conformanceLevel.ToString()));
                }
#else
                if (this.conformanceLevel != ConformanceLevel.Auto && this.conformanceLevel != XmlReader.GetV1ConformanceLevel(baseReader))
                {
                    throw new InvalidOperationException(Res.GetString(Res.Xml_IncompatibleConformanceLevel, this.conformanceLevel.ToString()));
                }
#endif

#if !SILVERLIGHT
                // get the V1 XmlTextReader ref
                XmlTextReader v1XmlTextReader = baseReader as XmlTextReader;
                if (v1XmlTextReader == null)
                {
                    XmlValidatingReader vr = baseReader as XmlValidatingReader;
                    if (vr != null)
                    {
                        v1XmlTextReader = (XmlTextReader)vr.Reader;
                    }
                }
#endif

                // assume the V1 readers already do all conformance checking;
                // wrap only if IgnoreWhitespace, IgnoreComments, IgnoreProcessingInstructions or ProhibitDtd is true;
                if (this.ignoreWhitespace)
                {
                    WhitespaceHandling wh = WhitespaceHandling.All;
#if !SILVERLIGHT
                    // special-case our V1 readers to see if whey already filter whitespaces
                    if (v1XmlTextReader != null)
                    {
                        wh = v1XmlTextReader.WhitespaceHandling;
                    }
#endif
                    if (wh == WhitespaceHandling.All)
                    {
                        noWhitespace = true;
                        needWrap     = true;
                    }
                }
                if (this.ignoreComments)
                {
                    noComments = true;
                    needWrap   = true;
                }
                if (this.ignorePIs)
                {
                    noPIs    = true;
                    needWrap = true;
                }
                // DTD processing
                DtdProcessing baseDtdProcessing = DtdProcessing.Parse;
#if !SILVERLIGHT
                if (v1XmlTextReader != null)
                {
                    baseDtdProcessing = v1XmlTextReader.DtdProcessing;
                }
#endif
                if ((this.dtdProcessing == DtdProcessing.Prohibit && baseDtdProcessing != DtdProcessing.Prohibit) ||
                    (this.dtdProcessing == DtdProcessing.Ignore && baseDtdProcessing == DtdProcessing.Parse))
                {
                    dtdProc  = this.dtdProcessing;
                    needWrap = true;
                }
#pragma warning restore 618
            }
            else
            {
                if (this.conformanceLevel != baseReaderSettings.ConformanceLevel && this.conformanceLevel != ConformanceLevel.Auto)
                {
                    throw new InvalidOperationException(Res.GetString(Res.Xml_IncompatibleConformanceLevel, this.conformanceLevel.ToString()));
                }
                if (this.checkCharacters && !baseReaderSettings.CheckCharacters)
                {
                    checkChars = true;
                    needWrap   = true;
                }
                if (this.ignoreWhitespace && !baseReaderSettings.IgnoreWhitespace)
                {
                    noWhitespace = true;
                    needWrap     = true;
                }
                if (this.ignoreComments && !baseReaderSettings.IgnoreComments)
                {
                    noComments = true;
                    needWrap   = true;
                }
                if (this.ignorePIs && !baseReaderSettings.IgnoreProcessingInstructions)
                {
                    noPIs    = true;
                    needWrap = true;
                }

                if ((this.dtdProcessing == DtdProcessing.Prohibit && baseReaderSettings.DtdProcessing != DtdProcessing.Prohibit) ||
                    (this.dtdProcessing == DtdProcessing.Ignore && baseReaderSettings.DtdProcessing == DtdProcessing.Parse))
                {
                    dtdProc  = this.dtdProcessing;
                    needWrap = true;
                }
            }

            if (needWrap)
            {
                IXmlNamespaceResolver readerAsNSResolver = baseReader as IXmlNamespaceResolver;
                if (readerAsNSResolver != null)
                {
                    return(new XmlCharCheckingReaderWithNS(baseReader, readerAsNSResolver, checkChars, noWhitespace, noComments, noPIs, dtdProc));
                }
                else
                {
                    return(new XmlCharCheckingReader(baseReader, checkChars, noWhitespace, noComments, noPIs, dtdProc));
                }
            }
            else
            {
                return(baseReader);
            }
        }
        protected void WriteXPath(XmlWriter writer, IXmlNamespaceResolver resolver)
        {
            // Lex the xpath to find all prefixes used
            int        startChar = 0;
            int        tmp       = 0;
            string     newXPath  = "";
            XPathLexer lexer     = new XPathLexer(xpath, false);
            Dictionary <string, string> prefixMap = new Dictionary <string, string>();
            List <string> prefixes = new List <string>();

            while (lexer.MoveNext())
            {
                string nsPrefix = lexer.Token.Prefix;
                string nsNS     = resolver.LookupNamespace(nsPrefix);

                // Check if we need to write the namespace
                if (nsPrefix.Length > 0 && (nsNS == null || (nsNS != null && nsNS != this.namespaces.LookupNamespace(nsPrefix))))
                {
                    // Write the previous xpath segment
                    if (this.xpath[tmp] == '$')
                    {
                        newXPath += this.xpath.Substring(startChar, tmp - startChar + 1);
                        startChar = tmp + 1;
                    }
                    else
                    {
                        newXPath += this.xpath.Substring(startChar, tmp - startChar);
                        startChar = tmp;
                    }

                    // Check if we need a new prefix
                    if (!prefixMap.ContainsKey(nsPrefix))
                    {
                        prefixes.Add(nsPrefix);
                        if (nsNS != null)
                        {
                            string newPrefix = nsPrefix;
                            int    i         = 0;
                            while (resolver.LookupNamespace(newPrefix) != null || this.namespaces.LookupNamespace(newPrefix) != null)
                            {
                                newPrefix = newPrefix + i.ToString(NumberFormatInfo.InvariantInfo);
                                ++i;
                            }
                            prefixMap.Add(nsPrefix, newPrefix);
                        }
                        else
                        {
                            prefixMap.Add(nsPrefix, nsPrefix);
                        }
                    }

                    // Write the new prefix
                    newXPath += prefixMap[nsPrefix];

                    // Update the xpath marker
                    startChar += nsPrefix.Length;
                }
                tmp = lexer.FirstTokenChar;
            }
            newXPath += this.xpath.Substring(startChar);    // Consume the remainder of the xpath

            // Write the namespaces
            for (int i = 0; i < prefixes.Count; ++i)
            {
                string prefix = prefixes[i];
                writer.WriteAttributeString("xmlns", prefixMap[prefix], null, this.namespaces.LookupNamespace(prefix));
            }

            // Write the XPath
            writer.WriteString(newXPath);
        }
Exemple #36
0
 public override object ReadElementContentAs(Type returnType, IXmlNamespaceResolver namespaceResolver)
 {
     CheckAsync();
     return(_coreReader.ReadElementContentAs(returnType, namespaceResolver));
 }
Exemple #37
0
 public ReadOnlyWrapper(IXmlNamespaceResolver other)
 {
     _other = other;
 }
Exemple #38
0
 protected BaseNode(IXmlNamespaceResolver namespaceResolver, int linenumber = -1, int lineposition = -1)
 {
     NamespaceResolver = namespaceResolver;
     LineNumber        = linenumber;
     LinePosition      = lineposition;
 }
        protected override void ParseConfiguration(XPathNavigator configurationElement, IXmlNamespaceResolver xmlNamespaceResolver, ContentType contentType)
        {
            base.ParseConfiguration(configurationElement, xmlNamespaceResolver, contentType);

            //<Regex>^[a-zA-Z0-9]*$</Regex>
            foreach (XPathNavigator element in configurationElement.SelectChildren(XPathNodeType.Element))
            {
                switch (element.LocalName)
                {
                case RegexName:
                    _regex = element.Value;
                    break;
                }
            }
        }
Exemple #40
0
 public RuntimeRootNode(XmlType xmlType, object root, IXmlNamespaceResolver resolver) : base(xmlType, resolver)
 {
     Root = root;
 }
Exemple #41
0
        internal static FieldDescriptor Parse(XPathNavigator fieldElement, IXmlNamespaceResolver nsres, ContentType contentType)
        {
            FieldDescriptor fdesc = new FieldDescriptor();

            fdesc.Owner = contentType;
            var fieldName = fieldElement.GetAttribute("name", String.Empty);

            fdesc.FieldName          = fieldName;
            fdesc.FieldTypeShortName = fieldElement.GetAttribute("type", String.Empty);
            fdesc.FieldTypeName      = fieldElement.GetAttribute("handler", String.Empty);
            fdesc.IsContentListField = fdesc.FieldName[0] == '#';
            if (String.IsNullOrEmpty(fdesc.FieldTypeShortName))
            {
                fdesc.FieldTypeShortName = FieldManager.GetShortName(fdesc.FieldTypeName);
            }

            if (fdesc.FieldTypeName.Length == 0)
            {
                if (fdesc.FieldTypeShortName.Length == 0)
                {
                    throw new ContentRegistrationException("Field element's 'handler' attribute is required if 'type' attribute is not given.", contentType.Name, fdesc.FieldName);
                }
                fdesc.FieldTypeName = FieldManager.GetFieldHandlerName(fdesc.FieldTypeShortName);
            }

            fdesc.Bindings = new List <string>();

            foreach (XPathNavigator subElement in fieldElement.SelectChildren(XPathNodeType.Element))
            {
                switch (subElement.LocalName)
                {
                case "DisplayName":
                    fdesc.DisplayName = subElement.Value;
                    break;

                case "Description":
                    fdesc.Description = subElement.Value;
                    break;

                case "Icon":
                    fdesc.Icon = subElement.Value;
                    break;

                case "Bind":
                    fdesc.Bindings.Add(subElement.GetAttribute("property", String.Empty));
                    break;

                case "Indexing":
                    foreach (XPathNavigator indexingSubElement in subElement.SelectChildren(XPathNodeType.Element))
                    {
                        switch (indexingSubElement.LocalName)
                        {
                        case "Mode": fdesc.IndexingMode = indexingSubElement.Value; break;

                        case "Store": fdesc.IndexStoringMode = indexingSubElement.Value; break;

                        case "TermVector": fdesc.IndexingTermVector = indexingSubElement.Value; break;

                        case "Analyzer": fdesc.Analyzer = indexingSubElement.Value; break;

                        case "IndexHandler": fdesc.IndexHandlerTypeName = indexingSubElement.Value; break;
                        }
                    }
                    break;

                case "Configuration":
                    fdesc.ConfigurationElement = subElement;
                    fdesc.FieldSettingTypeName = subElement.GetAttribute("handler", String.Empty);
                    break;

                case "AppInfo":
                    fdesc.AppInfo = subElement;
                    break;

                default:
                    throw new NotSupportedException(String.Concat("Unknown element in Field: ", subElement.LocalName));
                }
            }

            //-- Default binding;
            RepositoryDataType[] dataTypes = FieldManager.GetDataTypes(fdesc.FieldTypeShortName);
            fdesc.DataTypes = dataTypes;
            if (fdesc.IsContentListField)
            {
                foreach (var d in dataTypes)
                {
                    fdesc.Bindings.Add(null);
                }
            }
            else
            {
                if (dataTypes.Length > 1 && fdesc.Bindings.Count != dataTypes.Length)
                {
                    throw new ContentRegistrationException("Missing excplicit 'Binding' elements", contentType.Name, fdesc.FieldName);
                }
                if (dataTypes.Length == 1 && fdesc.Bindings.Count == 0)
                {
                    fdesc.Bindings.Add(fdesc.FieldName);
                }
            }

            fdesc.XmlNamespaceResolver = nsres;

            return(fdesc);
        }
Exemple #42
0
 public ValueNode(object value, IXmlNamespaceResolver namespaceResolver, int linenumber = -1, int lineposition = -1)
     : base(namespaceResolver, linenumber, lineposition)
 {
     Value = value;
 }
Exemple #43
0
        private void Initialize(XmlReader givenXmlReader, XamlSchemaContext schemaContext, XamlXmlReaderSettings settings)
        {
            XmlReader myXmlReader;

            _mergedSettings = (settings == null) ? new XamlXmlReaderSettings() : new XamlXmlReaderSettings(settings);
            //Wrap the xmlreader with a XmlCompatReader instance to apply MarkupCompat rules.
            if (!_mergedSettings.SkipXmlCompatibilityProcessing)
            {
                XmlCompatibilityReader mcReader =
                    new XmlCompatibilityReader(givenXmlReader,
                                               new IsXmlNamespaceSupportedCallback(IsXmlNamespaceSupported)
                                               );
                mcReader.Normalization = true;
                myXmlReader            = mcReader;
            }
            else
            {   //Don't wrap the xmlreader with XmlCompatReader.
                // Useful for uses where users want to keep mc: content in the XamlNode stream.
                // Or have already processed the markup compat and want that extra perf.
                myXmlReader = givenXmlReader;
            }
            // Pick up the XmlReader settings to override the "settings" defaults.
            if (!String.IsNullOrEmpty(myXmlReader.BaseURI))
            {
                _mergedSettings.BaseUri = new Uri(myXmlReader.BaseURI);
            }
            if (myXmlReader.XmlSpace == XmlSpace.Preserve)
            {
                _mergedSettings.XmlSpacePreserve = true;
            }
            if (!String.IsNullOrEmpty(myXmlReader.XmlLang))
            {
                _mergedSettings.XmlLang = myXmlReader.XmlLang;
            }
            IXmlNamespaceResolver       myXmlReaderNS   = myXmlReader as IXmlNamespaceResolver;
            Dictionary <string, string> xmlnsDictionary = null;

            if (myXmlReaderNS != null)
            {
                IDictionary <string, string> rootNamespaces = myXmlReaderNS.GetNamespacesInScope(XmlNamespaceScope.Local);
                if (rootNamespaces != null)
                {
                    foreach (KeyValuePair <string, string> ns in rootNamespaces)
                    {
                        if (xmlnsDictionary == null)
                        {
                            xmlnsDictionary = new Dictionary <string, string>();
                        }
                        xmlnsDictionary[ns.Key] = ns.Value;
                    }
                }
            }

            if (schemaContext == null)
            {
                schemaContext = new XamlSchemaContext();
            }

            _endOfStreamNode = new XamlNode(XamlNode.InternalNodeType.EndOfStream);

            _context = new XamlParserContext(schemaContext, _mergedSettings.LocalAssembly);
            _context.AllowProtectedMembersOnRoot = _mergedSettings.AllowProtectedMembersOnRoot;
            _context.AddNamespacePrefix(KnownStrings.XmlPrefix, XamlLanguage.Xml1998Namespace);

            Func <string, string> namespaceResolver = myXmlReader.LookupNamespace;

            _context.XmlNamespaceResolver = namespaceResolver;

            XamlScanner    xamlScanner = new XamlScanner(_context, myXmlReader, _mergedSettings);
            XamlPullParser parser      = new XamlPullParser(_context, xamlScanner, _mergedSettings);

            _nodeStream      = new NodeStreamSorter(_context, parser, _mergedSettings, xmlnsDictionary);
            _current         = new XamlNode(XamlNode.InternalNodeType.StartOfStream); // user must call Read() before using properties.
            _currentLineInfo = new LineInfo(0, 0);
        }
Exemple #44
0
 public override object ReadElementContentAs(Type returnType, IXmlNamespaceResolver namespaceResolver, string localName, string namespaceURI)
 {
     CheckAsync();
     return(_coreReader.ReadElementContentAs(returnType, namespaceResolver, localName, namespaceURI));
 }
 internal XmlCharCheckingReaderWithNS(XmlReader reader, IXmlNamespaceResolver readerAsNSResolver, bool checkCharacters, bool ignoreWhitespace, bool ignoreComments, bool ignorePis, DtdProcessing dtdProcessing)
     : base(reader, checkCharacters, ignoreWhitespace, ignoreComments, ignorePis, dtdProcessing)
 {
     Debug.Assert(readerAsNSResolver != null);
     this.readerAsNSResolver = readerAsNSResolver;
 }
Exemple #46
0
 public XmlAsyncCheckReaderWithNS(XmlReader reader)
     : base(reader)
 {
     _readerAsIXmlNamespaceResolver = (IXmlNamespaceResolver)reader;
 }
Exemple #47
0
 public ListNode(IList <INode> nodes, IXmlNamespaceResolver namespaceResolver, int linenumber = -1,
                 int lineposition = -1) : base(namespaceResolver, linenumber, lineposition)
 {
     CollectionItems = nodes.ToList();
 }
Exemple #48
0
 public static XmlQualifiedName Parse(string name, IXmlNamespaceResolver resolver, XmlNameTable nameTable)
 {
     return(Parse(name, resolver, String.Empty, nameTable));
 }
Exemple #49
0
        protected override void ParseConfiguration(XPathNavigator configurationElement, IXmlNamespaceResolver xmlNamespaceResolver, ContentType contentType)
        {
            //<MinValue>-6</MinValue>
            //<MaxValue>42</MaxValue>
            foreach (XPathNavigator node in configurationElement.SelectChildren(XPathNodeType.Element))
            {
                switch (node.LocalName)
                {
                case MinValueName:
                    decimal minValue;
                    if (Decimal.TryParse(node.InnerXml, NumberStyles.Number, CultureInfo.InvariantCulture, out minValue))
                    {
                        _minValue = minValue;
                    }
                    break;

                case MaxValueName:
                    decimal maxValue;
                    if (Decimal.TryParse(node.InnerXml, NumberStyles.Number, CultureInfo.InvariantCulture, out maxValue))
                    {
                        _maxValue = maxValue;
                    }
                    break;

                case DigitsName:
                    int digits;
                    if (Int32.TryParse(node.InnerXml, NumberStyles.Number, CultureInfo.InvariantCulture, out digits))
                    {
                        _digits = digits;
                    }
                    break;

                case ShowAsPercentageName:
                    bool perc;
                    if (Boolean.TryParse(node.InnerXml, out perc))
                    {
                        _showAsPercentage = perc;
                    }
                    break;
                }
            }
        }
Exemple #50
0
 protected RootNode(XmlType xmlType, IXmlNamespaceResolver nsResolver) : base(xmlType, xmlType.NamespaceUri, nsResolver)
 {
 }
Exemple #51
0
 public abstract void SetContext(IXmlNamespaceResolver nsResolver);
Exemple #52
0
        public static string TryXPathValueWithDefault(this XElement element, string xPath, IXmlNamespaceResolver nsm, string defaultValue)
        {
            var xPathResult = element.XPathSelectElement(xPath, nsm);

            return(xPathResult == null ? defaultValue : xPathResult.Value);
        }
Exemple #53
0
        private Dictionary <string, FieldDescriptor> ParseRootElement(XPathNavigator rootElement, IXmlNamespaceResolver nsres)
        {
            Dictionary <string, FieldDescriptor> result = null;

            foreach (XPathNavigator subElement in rootElement.SelectChildren(XPathNodeType.Element))
            {
                switch (subElement.LocalName)
                {
                case "DisplayName":
                    _displayName = subElement.Value;
                    break;

                case "Description":
                    _description = subElement.Value;
                    break;

                case "Icon":
                    _icon = subElement.Value;
                    break;

                case "Fields":
                    result = ParseFieldElements(subElement, nsres);
                    break;

                case "Actions":
                    SnLog.WriteWarning("Ignoring obsolete Actions element in List definition: " + this.Name);
                    break;

                default:
                    throw new NotSupportedException("Unknown element in AspectDefinition: " + subElement.LocalName);
                }
            }
            return(result);
        }
Exemple #54
0
        public static string ToString(object value, IXmlNamespaceResolver nsResolver)
        {
            if (value == null)
            {
                throw new ArgumentNullException(nameof(value));
            }

            Type sourceType = value.GetType();

            if (sourceType == BooleanType)
            {
                return(XmlConvert.ToString((bool)value));
            }
            if (sourceType == ByteType)
            {
                return(XmlConvert.ToString((byte)value));
            }
            if (sourceType == ByteArrayType)
            {
                return(Base64BinaryToString((byte[])value));
            }
            if (sourceType == DateTimeType)
            {
                return(DateTimeToString((DateTime)value));
            }
            if (sourceType == DateTimeOffsetType)
            {
                return(DateTimeOffsetToString((DateTimeOffset)value));
            }
            if (sourceType == DecimalType)
            {
                return(XmlConvert.ToString((decimal)value));
            }
            if (sourceType == DoubleType)
            {
                return(XmlConvert.ToString((double)value));
            }
            if (sourceType == Int16Type)
            {
                return(XmlConvert.ToString((short)value));
            }
            if (sourceType == Int32Type)
            {
                return(XmlConvert.ToString((int)value));
            }
            if (sourceType == Int64Type)
            {
                return(XmlConvert.ToString((long)value));
            }
            if (sourceType == SByteType)
            {
                return(XmlConvert.ToString((sbyte)value));
            }
            if (sourceType == SingleType)
            {
                return(XmlConvert.ToString((float)value));
            }
            if (sourceType == StringType)
            {
                return((string)value);
            }
            if (sourceType == TimeSpanType)
            {
                return(XmlConvert.ToString((TimeSpan)value));
            }
            if (sourceType == UInt16Type)
            {
                return(XmlConvert.ToString((ushort)value));
            }
            if (sourceType == UInt32Type)
            {
                return(XmlConvert.ToString((uint)value));
            }
            if (sourceType == UInt64Type)
            {
                return(XmlConvert.ToString((ulong)value));
            }
            Uri valueAsUri = value as Uri;

            if (valueAsUri != null)
            {
                return(AnyUriToString(valueAsUri));
            }
            XmlQualifiedName valueAsXmlQualifiedName = value as XmlQualifiedName;

            if (valueAsXmlQualifiedName != null)
            {
                return(QNameToString(valueAsXmlQualifiedName, nsResolver));
            }

            throw new InvalidCastException(SR.Format(SR.XmlConvert_TypeToString, sourceType.Name));
        }
Exemple #55
0
 public MarkupNode(string markupString, IXmlNamespaceResolver namespaceResolver, int linenumber = -1,
                   int lineposition = -1)
     : base(namespaceResolver, linenumber, lineposition)
 {
     MarkupString = markupString;
 }
Exemple #56
0
        public static object ChangeType(string value, Type destinationType, IXmlNamespaceResolver nsResolver)
        {
            if (value == null)
            {
                throw new ArgumentNullException(nameof(value));
            }
            if (destinationType == null)
            {
                throw new ArgumentNullException(nameof(destinationType));
            }

            if (destinationType == BooleanType)
            {
                return(XmlConvert.ToBoolean((string)value));
            }
            if (destinationType == ByteType)
            {
                return(Int32ToByte(XmlConvert.ToInt32((string)value)));
            }
            if (destinationType == ByteArrayType)
            {
                return(StringToBase64Binary((string)value));
            }
            if (destinationType == DateTimeType)
            {
                return(UntypedAtomicToDateTime((string)value));
            }
            if (destinationType == DateTimeOffsetType)
            {
                return(XmlConvert.ToDateTimeOffset((string)value));
            }
            if (destinationType == DecimalType)
            {
                return(XmlConvert.ToDecimal((string)value));
            }
            if (destinationType == DoubleType)
            {
                return(XmlConvert.ToDouble((string)value));
            }
            if (destinationType == Int16Type)
            {
                return(Int32ToInt16(XmlConvert.ToInt32((string)value)));
            }
            if (destinationType == Int32Type)
            {
                return(XmlConvert.ToInt32((string)value));
            }
            if (destinationType == Int64Type)
            {
                return(XmlConvert.ToInt64((string)value));
            }
            if (destinationType == SByteType)
            {
                return(Int32ToSByte(XmlConvert.ToInt32((string)value)));
            }
            if (destinationType == SingleType)
            {
                return(XmlConvert.ToSingle((string)value));
            }
            if (destinationType == TimeSpanType)
            {
                return(XmlConvert.ToTimeSpan((string)value));
            }
            if (destinationType == UInt16Type)
            {
                return(Int32ToUInt16(XmlConvert.ToInt32((string)value)));
            }
            if (destinationType == UInt32Type)
            {
                return(Int64ToUInt32(XmlConvert.ToInt64((string)value)));
            }
            if (destinationType == UInt64Type)
            {
                return(DecimalToUInt64(XmlConvert.ToDecimal((string)value)));
            }
            if (destinationType == UriType)
            {
                return(XmlConvertEx.ToUri((string)value));
            }
            if (destinationType == XmlQualifiedNameType)
            {
                return(StringToQName((string)value, nsResolver));
            }
            if (destinationType == StringType)
            {
                return((string)value);
            }

            throw new InvalidCastException(SR.Format(SR.XmlConvert_TypeFromString, destinationType.Name));
        }
Exemple #57
0
 public XamlTypeResolver(IXmlNamespaceResolver namespaceResolver, Assembly currentAssembly)
     : this(namespaceResolver, XamlParser.GetElementType, currentAssembly)
 {
 }
Exemple #58
0
 public DataField(XPathNavigator field, IXmlNamespaceResolver nm, bool hidden) :
     this(field, nm)
 {
     this._hidden = hidden;
 }
Exemple #59
0
 public PlainUblHeaderParser(XDocument document, IXmlNamespaceResolver nsResolver) : base(document, nsResolver)
 {
 }
        // Returns the content of the current element as the requested type. Moves to the node following the element's end tag.
        public virtual async Task <object> ReadElementContentAsAsync(Type returnType, IXmlNamespaceResolver namespaceResolver)
        {
            if (await SetupReadElementContentAsXxxAsync("ReadElementContentAs").ConfigureAwait(false))
            {
                object value = await ReadContentAsAsync(returnType, namespaceResolver).ConfigureAwait(false);
                await FinishReadElementContentAsXxxAsync().ConfigureAwait(false);

                return(value);
            }
            return((returnType == typeof(string)) ? string.Empty : XmlUntypedStringConverter.Instance.FromString(string.Empty, returnType, namespaceResolver));
        }