Esempio n. 1
0
 private static XmlFormatter GetFormatter(MemberInfo member)
 {
     if (member.DataType.Formatter != null)
         return (XmlFormatter) member.DataType.Formatter;
     else
         return (XmlFormatter) Xs.AnySimpleTypeFormatter;
 }
Esempio n. 2
0
 public XmlNode CreateElement(MemberInfo member)
 {
     XmlDocument doc = node.OwnerDocument;
     if (doc == null)
         doc = (XmlDocument) node;
     XmlNode child = doc.CreateElement(member.LocalName, member.NamespaceURI);
     node.AppendChild(child);
     return child;
 }
Esempio n. 3
0
 public int CountElement(MemberInfo member)
 {
     int count = 0;
     for (XmlNode child=node.FirstChild; child != null; child = child.NextSibling)
     {
         if (MemberEqualsNode(member, child))
             ++count;
     }
     return count;
 }
Esempio n. 4
0
 public static int GetEnumerationIndex(MemberInfo member, string sValue, int enumOffset, int enumCount)
 {
     for( int i = enumOffset; i < (enumOffset + enumCount); i++)
     {
         if( member.DataType.facets[i].facetName == "enumeration" &&
                 member.DataType.facets[i].stringValue == sValue)
             return i - enumOffset;
     }
     return -1;
 }
Esempio n. 5
0
		public XmlNode GetElementAt(MemberInfo member, int index)
		{
			for (XmlNode child = node.FirstChild; child != null; child = child.NextSibling)
			{
				if (MemberEqualsNode(member, child))
				{
					if (index-- == 0)
						return child;
				}
			}
			return null;
		}
Esempio n. 6
0
		public XmlNode GetAttribute(MemberInfo member)
		{
			XmlElement element = (XmlElement) node;
			if (member.LocalName == "")
			{
				for (XmlNode child = element.FirstChild; child != null; child = child.NextSibling)
				{
					if (child.NodeType == XmlNodeType.Text || child.NodeType == XmlNodeType.CDATA)
						return child;
				}
				return null;
			}
			else
				return element.GetAttributeNode(member.LocalName, member.NamespaceURI);
		}
Esempio n. 7
0
        public static XmlNode AddElement( XmlNode node, MemberInfo member)
        {
            string prefix = "";
            if( member.NamespaceURI != null )
            {
                prefix = FindPrefixForNamespace(node, member.NamespaceURI );
                if( prefix.Length > 0 )
                    prefix += ":";
            }

            XmlDocument doc = node.OwnerDocument;
            if (doc == null)
                doc = (XmlDocument)node;
            XmlNode newNode = doc.CreateElement(prefix + member.LocalName, member.NamespaceURI);
            node.AppendChild(newNode);
            return newNode;
        }
Esempio n. 8
0
		public void RemoveAttribute(MemberInfo member)
		{
			XmlElement element = (XmlElement) node;
			if (member.LocalName == "")
			{
				for (XmlNode child = element.FirstChild; child != null;)
				{
					XmlNode keep = child;
					child = child.NextSibling;
					if (keep.NodeType == XmlNodeType.Text || keep.NodeType == XmlNodeType.CDATA)
						element.RemoveChild(keep);
				}
			}
			else
			{
				element.RemoveAttribute(member.LocalName, member.NamespaceURI);
			}
		}
Esempio n. 9
0
 public XmlNode CreateAttribute(MemberInfo member)
 {
     XmlElement element = (XmlElement) node;
     if (member.LocalName == "")
     {
         XmlNode existing = GetAttribute(member);
         if (existing == null)
         {
             XmlText text = element.OwnerDocument.CreateTextNode("");
             element.AppendChild(text);
             return text;
         }
         return existing;
     }
     else
     {
         XmlAttribute att = element.OwnerDocument.CreateAttribute(member.LocalName, member.NamespaceURI);
         element.SetAttributeNode(att);
         return att;
     }
 }
Esempio n. 10
0
 public static string CastToString( XmlNode node, MemberInfo member)
 {
     return Altova.CoreTypes.CastToString(node.InnerText);
 }
Esempio n. 11
0
        public static Altova.Types.QName CastToQName(XmlNode node, MemberInfo member)
        {
            int i = node.InnerText.IndexOf(":");
            if (i == -1)
                return new Altova.Types.QName(node.GetNamespaceOfPrefix(""), node.InnerText);

            string prefix = node.InnerText.Substring(0, i);
            string local = node.InnerText.Substring(i + 1);

            string uri = node.GetNamespaceOfPrefix(prefix);

            return new Altova.Types.QName(uri, prefix, local);
        }
Esempio n. 12
0
 public static int CastToInt( XmlNode node, MemberInfo member)
 {
     return Altova.CoreTypes.CastToInt(node.InnerText);
 }
Esempio n. 13
0
		public Attribute(Altova.TypeInfo.MemberInfo info)
		{
			this.memberInfo = info;
		}
Esempio n. 14
0
 public Enumerator(AllIterator list, MemberInfo info)
 {
     this.iterator = list.GetEnumerator();
     this.info = info;
 }
Esempio n. 15
0
        public static void SetValue(XmlNode node, MemberInfo member, Altova.Types.QName qn)
        {
            if (qn.Uri == null)
            {
                SetValue(node, member, qn.LocalName);
                return;
            }

            string prefix = node.GetPrefixOfNamespace(qn.Uri);
            if (prefix == null || prefix.Length == 0)
            {
                prefix = FindUnusedPrefix(node, qn.Prefix);
                ((XmlElement)node).SetAttribute("xmlns:" + prefix, qn.Uri);
            }

            SetValue(node, member, prefix + ":" + qn.LocalName);
        }
Esempio n. 16
0
 public static void SetValue(XmlNode node, MemberInfo member, byte[] b)
 {
     SetValue(node, member, GetFormatter(member).Format(b));
 }
Esempio n. 17
0
        public static void SetValue( XmlNode node,  MemberInfo member,  string value)
        {
            if (member.LocalName != "")
            {
                string prefix = "";
                if( member.NamespaceURI != "" )
                {
                    prefix = FindPrefixForNamespace(node, member.NamespaceURI );
                    if( prefix.Length > 0 )
                        prefix += ":";
                    else
                        prefix = FindUnusedPrefix(node) + ":";
                }

                XmlElement el = (XmlElement) node;
                XmlAttribute attr = node.OwnerDocument.CreateAttribute(prefix + member.LocalName, member.NamespaceURI);
                attr.Value = value;
                el.SetAttributeNode(attr);
            }
            else
                SetTextValue(node, value);
        }
Esempio n. 18
0
 public static MemberIterator GetElements( XmlNode node,  MemberInfo member)
 {
     return new MemberIterator(node.ChildNodes, member);
 }
Esempio n. 19
0
 public static ulong CastToUInt64( XmlNode node, MemberInfo member)
 {
     return Altova.CoreTypes.CastToUInt64(node.InnerText);
 }
Esempio n. 20
0
        internal static bool MemberEqualsNode(MemberInfo member, XmlNode node)
        {
            string nodeURI = node.NamespaceURI == null ? "" : node.NamespaceURI;
            string nodeLocalName = node.LocalName == null ? "" : node.LocalName;
            string memberURI = member.NamespaceURI == null ? "" : member.NamespaceURI;
            string memberLocalName = member.LocalName == null ? "" : member.LocalName;

            if (nodeURI == memberURI && nodeLocalName == memberLocalName)
                return true;
            return false;
        }
Esempio n. 21
0
 public static XmlNode FindAttribute( XmlNode node,  MemberInfo member)
 {
     XmlElement el = (XmlElement) node;
     XmlAttributeCollection attrs = el.Attributes;
     return attrs.GetNamedItem(member.LocalName, member.NamespaceURI);
 }
Esempio n. 22
0
 public static byte[] CastToBinary(XmlNode node, MemberInfo member)
 {
     return GetFormatter(member).ParseBinary(node.InnerText);
 }
Esempio n. 23
0
        public static bool IsMember( XmlNode node,  MemberInfo member)
        {
            if (member.LocalName == "")
                return node.NodeType == XmlNodeType.Text || node.NodeType == XmlNodeType.CDATA;

            if (node.NodeType != XmlNodeType.Element)
                return false;

            string nodeURI = node.NamespaceURI == null ? "" : node.NamespaceURI;
            string nodeLocalName = node.LocalName == null ? "" : node.LocalName;
            string memberURI = member.NamespaceURI == null ? "" : member.NamespaceURI;
            string memberLocalName = member.LocalName == null ? "" : member.LocalName;

            // soap-array specialty: no-namespace elements are array members.
            if ((member.Flags & MemberFlags.SpecialName) != 0)
                return nodeURI == "";

            if (nodeURI == memberURI && nodeLocalName == memberLocalName)
                return true;
            return false;
        }
Esempio n. 24
0
 public static bool CastToBool( XmlNode node, MemberInfo member)
 {
     return Altova.CoreTypes.CastToBool(node.InnerText);
 }
Esempio n. 25
0
 public static void SetValue(XmlNode node, MemberInfo member, Altova.Types.Duration b)
 {
     SetValue(node, member, GetFormatter(member).Format(b));
 }
Esempio n. 26
0
 public static Altova.Types.DateTime CastToDateTime(XmlNode node, MemberInfo member)
 {
     return Altova.CoreTypes.CastToDateTime(node.InnerText);
 }
Esempio n. 27
0
 public static void SetValue(XmlNode node,  MemberInfo member, decimal d)
 {
     SetValue(node, member, GetFormatter(member).Format(d));
 }
Esempio n. 28
0
 public static decimal CastToDecimal(XmlNode node, MemberInfo member)
 {
     return Altova.CoreTypes.CastToDecimal(node.InnerText);
 }
Esempio n. 29
0
 public MemberIterator(XmlNodeList list, MemberInfo info)
 {
     iterator = new AllIterator(list);
     memberInfo = info;
 }
Esempio n. 30
0
 public static double CastToDouble( XmlNode node, MemberInfo member)
 {
     return Altova.CoreTypes.CastToDouble(node.InnerText);
 }
Esempio n. 31
0
 public static Altova.Types.Duration CastToDuration(XmlNode node, MemberInfo member)
 {
     return Altova.CoreTypes.CastToDuration(node.InnerText);
 }
Esempio n. 32
0
		/// <summary>
		/// Constructs an instance of this class from the given member information.
		/// </summary>
		/// <param name="info">The member information object.</param>
		public Element(Altova.TypeInfo.MemberInfo info)
		{
			this.memberInfo = info;
		}