Example #1
0
        public static NodeMapData GetNode(ScriptableNodeMapData scriptableNode)
        {
            NodeMapData node;

            if (scriptableNode is ScriptableIconNodeMapData)
            {
                ScriptableIconNodeMapData scriptableIconNode = (ScriptableIconNodeMapData)scriptableNode;

                IconNodeMapData iconNode = new IconNodeMapData(scriptableIconNode.Id);
                if (!String.IsNullOrEmpty(scriptableIconNode.ImageSource))
                {
                    Uri imageSourceUri = new Uri(scriptableIconNode.ImageSource);
                    iconNode.ImageSource = imageSourceUri;
                }

                node = iconNode;
            }
            else
            {
                node = new TextNodeMapData(scriptableNode.Id);
            }

            // Properties
            node.Description     = scriptableNode.Description;
            node.Label           = scriptableNode.Label;
            node.Dimension       = GetDimension(scriptableNode.Dimension);
            node.Position        = GetPosition(scriptableNode.Position);
            node.IsHidden        = scriptableNode.IsHidden;
            node.BackgroundColor = GetColor(scriptableNode.BackgroundColor);
            node.SelectionColor  = GetColor(scriptableNode.SelectionColor);

            // Attributes
            foreach (KeyValuePair <string, ScriptableAttributeMapData> kvp in scriptableNode.Attributes)
            {
                ScriptableAttributeMapData scriptableAttribute = kvp.Value;

                AttributeMapData attribute = new AttributeMapData(scriptableAttribute.Name, scriptableAttribute.Value);
                attribute.SemanticType      = (SemanticType)scriptableAttribute.SemanticType;
                attribute.SimilarityMeasure = scriptableAttribute.SimilarityMeasure;
                attribute.IsHidden          = scriptableAttribute.IsHidden;

                node.Attributes.Add(kvp.Key, attribute);
            }

            return(node);
        }
Example #2
0
        public static GraphMapData AnbToGraph(Chart chart)
        {
            if (chart == null)
            {
                throw new ArgumentNullException();
            }

            GraphMapData graph = new GraphMapData();

            foreach (ChartItem chartItem in chart.chartItemCollection.chartItems)
            {
                if (chartItem.end != null)
                {
                    IconNodeMapData node = new IconNodeMapData(chartItem.end.entity.attrEntityId);
                    graph.Add(node);

                    node.Label = chartItem.attrLabel;

                    SolidColorBrush backgroundColor = Conversion.HexColorToBrush(chartItem.ciStyle.font.attrBackColour);
                    node.BackgroundColor = backgroundColor.Color;

                    foreach (Anb.Attribute attribute in chartItem.attributeCollection.attributes)
                    {
                        AttributeMapData objAttribute = new AttributeMapData(attribute.attrAttributeClass, attribute.attrValue);
                        node.Attributes.Add(objAttribute.Name, objAttribute);
                    }
                }
                else
                {
                    EdgeMapData edge = new EdgeMapData(chartItem.link.attrEnd1Id, chartItem.link.attrEnd2Id);
                    graph.Add(edge);

                    edge.Label = chartItem.link.linkStyle.attrType;
                }
            }

            return graph;
        }
Example #3
0
        public static EdgeMapData GetEdge(ScriptableEdgeMapData scriptableEdge)
        {
            EdgeMapData edge = new EdgeMapData(scriptableEdge.Source, scriptableEdge.Target);

            // Properties
            edge.Type = (EdgeType)Enum.Parse(typeof(EdgeType), scriptableEdge.Type, false);
            edge.Thickness = scriptableEdge.Thickness;
            edge.Color = GetColor(scriptableEdge.Color);
            edge.Label = scriptableEdge.Label;
            edge.IsLabelTextUnderlined = scriptableEdge.IsLabelTextUnderlined;
            edge.LabelBackgroundColor = GetColor(scriptableEdge.LabelBackgroundColor);
            edge.LabelForegroundColor = GetColor(scriptableEdge.LabelForegroundColor);
            edge.LabelFontStyle = GetFontStyle(scriptableEdge.LabelFontStyle);
            edge.LabelFontWeight = GetFontWeight(scriptableEdge.LabelFontWeight);
            if (!String.IsNullOrEmpty(scriptableEdge.LabelFont))
            {
                FontFamily fontFamily = new FontFamily(scriptableEdge.LabelFont);
                edge.LabelFont = fontFamily;
            }
            edge.Weight = scriptableEdge.Weight;

            // Attributes
            foreach (KeyValuePair<string, ScriptableAttributeMapData> kvp in scriptableEdge.Attributes)
            {
                ScriptableAttributeMapData scriptableAttribute = kvp.Value;

                AttributeMapData attribute = new AttributeMapData(scriptableAttribute.Name, scriptableAttribute.Value);
                attribute.SemanticType = (SemanticType)scriptableAttribute.SemanticType;
                attribute.SimilarityMeasure = scriptableAttribute.SimilarityMeasure;
                attribute.IsHidden = scriptableAttribute.IsHidden;

                edge.Attributes.Add(kvp.Key, attribute);
            }

            return edge;
        }
Example #4
0
        /// <summary>
        /// Maps a <see cref="ScriptableNodeMapData"/> object from a <see cref="NodeMapData"/> object
        /// </summary>
        /// <param name="node">The <see cref="NodeMapData"/> object to map from</param>
        /// <returns>A <see cref="ScriptableNodeMapData"/> object mapped from from a <see cref="NodeMapData"/> object</returns>
        /// <exception cref="ArgumentNullException">Thrown if <paramref name="node"/> is null</exception>
        public static ScriptableNodeMapData GetNode(NodeMapData node)
        {
            if (node == null)
            {
                throw new ArgumentNullException("node");
            }

            ScriptableNodeMapData scriptableNode = new ScriptableNodeMapData
            {
                BackgroundColor = node.BackgroundColor.ToString(),
                Description     = node.Description,
                Dimension       = new ScriptableSize(node.Dimension.Height, node.Dimension.Width),
                Id             = node.Id,
                IsHidden       = node.IsHidden,
                Label          = node.Label,
                Position       = new ScriptablePoint(node.Position.X, node.Position.Y),
                SelectionColor = node.SelectionColor.ToString()
            };

            foreach (KeyValuePair <string, AttributeMapData> kvp in node.Attributes)
            {
                AttributeMapData           attributeMapData        = kvp.Value;
                ScriptableAttributeMapData scriptableAttributeData = new ScriptableAttributeMapData
                {
                    IsHidden          = attributeMapData.IsHidden,
                    Name              = attributeMapData.Name,
                    SemanticType      = (int)attributeMapData.SemanticType,
                    SimilarityMeasure = attributeMapData.SimilarityMeasure,
                    Value             = attributeMapData.Value
                };

                scriptableNode.Attributes.Add(kvp.Key, scriptableAttributeData);
            }

            return(scriptableNode);
        }
Example #5
0
        public static EdgeMapData GetEdge(ScriptableEdgeMapData scriptableEdge)
        {
            EdgeMapData edge = new EdgeMapData(scriptableEdge.Source, scriptableEdge.Target);

            // Properties
            edge.Type                  = (EdgeType)Enum.Parse(typeof(EdgeType), scriptableEdge.Type, false);
            edge.Thickness             = scriptableEdge.Thickness;
            edge.Color                 = GetColor(scriptableEdge.Color);
            edge.Label                 = scriptableEdge.Label;
            edge.IsLabelTextUnderlined = scriptableEdge.IsLabelTextUnderlined;
            edge.LabelBackgroundColor  = GetColor(scriptableEdge.LabelBackgroundColor);
            edge.LabelForegroundColor  = GetColor(scriptableEdge.LabelForegroundColor);
            edge.LabelFontStyle        = GetFontStyle(scriptableEdge.LabelFontStyle);
            edge.LabelFontWeight       = GetFontWeight(scriptableEdge.LabelFontWeight);
            if (!String.IsNullOrEmpty(scriptableEdge.LabelFont))
            {
                FontFamily fontFamily = new FontFamily(scriptableEdge.LabelFont);
                edge.LabelFont = fontFamily;
            }
            edge.Weight = scriptableEdge.Weight;

            // Attributes
            foreach (KeyValuePair <string, ScriptableAttributeMapData> kvp in scriptableEdge.Attributes)
            {
                ScriptableAttributeMapData scriptableAttribute = kvp.Value;

                AttributeMapData attribute = new AttributeMapData(scriptableAttribute.Name, scriptableAttribute.Value);
                attribute.SemanticType      = (SemanticType)scriptableAttribute.SemanticType;
                attribute.SimilarityMeasure = scriptableAttribute.SimilarityMeasure;
                attribute.IsHidden          = scriptableAttribute.IsHidden;

                edge.Attributes.Add(kvp.Key, attribute);
            }

            return(edge);
        }
Example #6
0
        /*/// <summary>
        /// Gets the default edge type (direction) to be used in the
        /// event that the 'directed' attribute of an edge is not included
        /// </summary>
        /// <param name="defaultEdgeType">The value of the edgedefault attribute</param>
        private static GraphType GetDefaultEdgeType(string defaultEdgeType)
        {
            GraphType determinedEdgeType = GraphType.Undirected;

            if (defaultEdgeType != null && defaultEdgeType.ToLower().Equals("directed"))
            {
                determinedEdgeType = GraphType.Directed;
            }

            return determinedEdgeType;
        }*/
        /// <summary>
        /// Reads an XML node from the specified XmlReader
        /// </summary>
        /// <param name="reader">Reader from which to read the node from</param>
        private NodeMapData ReadNode(XmlReader reader, NodeTypes defaultNodeType)
        {
            NodeMapData objNode;

            string nodeId = reader.GetAttribute("id");
            if (defaultNodeType == NodeTypes.Icon)
            {
                objNode = new IconNodeMapData(nodeId);
            }
            else
            {
                objNode = new TextNodeMapData(nodeId);
            }

            if (reader.ReadToDescendant("data"))
            {
                Attributes.Attribute newAttribute = null;
                AttributeValue newAttributeValue = null;

                // Loop over all data elements.  These are the attributes
                do
                {
                    // Record the attributes
                    string dataKey = reader.GetAttribute("key");
                    string dataValue = reader.ReadElementContentAsString();

                    // Determine if we are dealing with a node property
                    if (dataKey.StartsWith(NODE_PROPERTY_PREFIX))
                    {
                        string propName = dataKey.Substring(NODE_PROPERTY_PREFIX.Length);
                        switch (propName)
                        {
                            case "Description":
                                objNode.Description = dataValue;
                                break;

                            case "DisplayValue":
                                objNode.Label = dataValue;
                                break;

                            case "SelectionColor":
                                SolidColorBrush selectionColor = Conversion.HexColorToBrush(dataValue);
                                objNode.SelectionColor = selectionColor.Color;
                                break;

                            case "ImageSource":
                                ((IconNodeMapData)objNode).ImageSource = new Uri(dataValue, UriKind.RelativeOrAbsolute);
                                break;

                            case "Height":
                                double height = double.Parse(dataValue);
                                objNode.Dimension = new Size(objNode.Dimension.Width, height);
                                break;

                            case "Width":
                                double width = double.Parse(dataValue);
                                objNode.Dimension = new Size(width, objNode.Dimension.Height);
                                break;

                            case "Position":
                                string[] splitPosition = dataValue.Split(',');
                                objNode.Position = new Point(double.Parse(splitPosition[0]), double.Parse(splitPosition[1]));
                                break;

                            case "IsHidden":
                                objNode.IsHidden = bool.Parse(dataValue);
                                break;

                            case "BackgroundColor":
                                SolidColorBrush backgroundColor = Conversion.HexColorToBrush(dataValue);
                                objNode.BackgroundColor = backgroundColor.Color;
                                break;

                            default:
                                // TODO prop is for a different version of SnagL
                                break;
                        }

                        // TODO do we only want to do whats above when what is commented out below fails?
                        /*// Attempt to set the node propety
                        if ((SetExportablePropertyValue(dataKey, objNode, dataValue)))
                            _logger.WriteLogEntry(LogLevel.INFO, string.Format("The Node property [{0}] was set to '{1}'", dataKey, dataValue), null, null);
                        else
                        {
                            // The property might be for the view model so try
                            // and set the view model
                            if ((SetExportablePropertyValue(dataKey, objNode, dataValue)))
                                _logger.WriteLogEntry(LogLevel.INFO, string.Format("The NodeVM property [{0}] was set to '{1}'", dataKey, dataValue), null, null);
                            else
                                _logger.WriteLogEntry(LogLevel.ERROR, string.Format("Unable to set the property [{0}] to the specified value [{1}]", dataKey, dataValue), null, null);
                        }*/
                    }
                    else // Determine if we are dealing with an attribute
                    {
                        if (dataKey.StartsWith(NODE_ATTRIBUTE_PREFIX))
                        {
                            // Determine if we are dealing with a descriptor or a value
                            if (dataKey.EndsWith(ATTRIBUTE_DESCRIPTOR_SUFFIX))
                                newAttribute = CreateAttribute(dataValue);
                            else if (dataKey.EndsWith(ATTRIBUTE_VALUE_SUFFIX))
                            {
                                newAttributeValue = new AttributeValue(dataValue);
                            }
                        }
                        else // If we are here, we are not dealing with SnagL formatted GraphML
                        {
                            // We are dealing with an unknown data element so we
                            // are going to treat it like a new attribute
                            // Determine if we are dealing with a descriptor or a value
                            newAttribute = new Attributes.Attribute(dataKey);
                            newAttributeValue = new AttributeValue(dataValue);
                        }

                        // Check if we have a valid Attribute and AttributeValue class
                        if (newAttribute != null && newAttributeValue != null)
                        {
                            AttributeMapData objAttribute = new AttributeMapData(newAttribute.Name, newAttributeValue.Value);
                            objNode.Attributes.Add(objAttribute.Name, objAttribute);

                            objAttribute.SemanticType = newAttribute.SemanticType;
                            objAttribute.SimilarityMeasure = newAttribute.PreferredSimilarityMeasure;
                            objAttribute.IsHidden = !newAttribute.Visible;

                            newAttribute = null;
                            newAttributeValue = null;
                        }
                    }
                } while (reader.LocalName == "data" || (string.IsNullOrEmpty(reader.LocalName) && reader.ReadToNextSibling("data")));
            }

            return objNode;
        }
Example #7
0
        /// <summary>
        /// Reads the edge data from the specified XmlReader
        /// </summary>
        /// <param name="reader">Reader from which to read edge data from</param>
        private static EdgeMapData ReadEdge(XmlReader reader)
        {
            string sourceId = reader.GetAttribute("source");
            string targetId = reader.GetAttribute("target");

            EdgeMapData objEdge = new EdgeMapData(sourceId, targetId);

            string directed = reader.GetAttribute("directed");
            if (directed != null)
            {
                bool isDirected = bool.Parse(directed);
                if (isDirected)
                {
                    objEdge.Type = EdgeType.Directed;
                }
            }

            // this is not used for anything
            //string edgeTypeName = reader.GetAttribute("type", BERICO_NAMESPACE_URI);

            if (reader.ReadToDescendant("data"))
            {
                do
                {
                    string dataKey = reader.GetAttribute("key");
                    string dataValue = reader.ReadElementContentAsString();

                    if (dataKey.StartsWith(EDGE_PROPERTY_PREFIX))
                    {
                        string propertyName = dataKey.Substring(EDGE_PROPERTY_PREFIX.Length);
                        switch (propertyName)
                        {
                            case "DisplayValue":
                                objEdge.Label = dataValue;
                                break;

                            case "Thickness":
                                objEdge.Thickness = double.Parse(dataValue);
                                break;

                            case "Color":
                                Color color = Conversion.HexColorToBrush(dataValue).Color;
                                objEdge.Color = color;
                                break;

                            case "LabelBackgroundColor":
                                Color labelBackgroundColor = Conversion.HexColorToBrush(dataValue).Color;
                                objEdge.LabelBackgroundColor = labelBackgroundColor;
                                break;

                            case "LabelForegroundColor":
                                Color labelForegroundColor = Conversion.HexColorToBrush(dataValue).Color;
                                objEdge.LabelForegroundColor = labelForegroundColor;
                                break;

                            case "LabelFontStyle":
                                objEdge.LabelFontStyle = (FontStyle)typeof(FontStyles).GetProperty(dataValue).GetValue(null, null);
                                break;

                            case "LabelFontWeight":
                                objEdge.LabelFontWeight = (FontWeight)typeof(FontWeights).GetProperty(dataValue).GetValue(null, null);
                                break;

                            case "LabelTextUnderline":
                                objEdge.IsLabelTextUnderlined = bool.Parse(dataValue);
                                break;
                        }
                    }
                    else if (!dataKey.EndsWith(ATTRIBUTE_DESCRIPTOR_SUFFIX))
                    {
                        string attributeName = dataKey.Substring(EDGE_ATTRIBUTE_PREFIX.Length, dataKey.Length - (EDGE_ATTRIBUTE_PREFIX.Length + ATTRIBUTE_VALUE_SUFFIX.Length));
                        AttributeMapData objAttribute = new AttributeMapData(attributeName, dataValue);
                        objEdge.Attributes.Add(objAttribute.Name, objAttribute);
                    }
                } while (reader.LocalName == "data" || (string.IsNullOrEmpty(reader.LocalName) && reader.ReadToNextSibling("data")));
            }

            return objEdge;
        }
Example #8
0
        public static NodeMapData GetNode(ScriptableNodeMapData scriptableNode)
        {
            NodeMapData node;

            if (scriptableNode is ScriptableIconNodeMapData)
            {
                ScriptableIconNodeMapData scriptableIconNode = (ScriptableIconNodeMapData)scriptableNode;

                IconNodeMapData iconNode = new IconNodeMapData(scriptableIconNode.Id);
                if (!String.IsNullOrEmpty(scriptableIconNode.ImageSource))
                {
                    Uri imageSourceUri = new Uri(scriptableIconNode.ImageSource);
                    iconNode.ImageSource = imageSourceUri;
                }

                node = iconNode;
            }
            else
            {
                node = new TextNodeMapData(scriptableNode.Id);
            }

            // Properties
            node.Description = scriptableNode.Description;
            node.Label = scriptableNode.Label;
            node.Dimension = GetDimension(scriptableNode.Dimension);
            node.Position = GetPosition(scriptableNode.Position);
            node.IsHidden = scriptableNode.IsHidden;
            node.BackgroundColor = GetColor(scriptableNode.BackgroundColor);
            node.SelectionColor = GetColor(scriptableNode.SelectionColor);

            // Attributes
            foreach (KeyValuePair<string, ScriptableAttributeMapData> kvp in scriptableNode.Attributes)
            {
                ScriptableAttributeMapData scriptableAttribute = kvp.Value;

                AttributeMapData attribute = new AttributeMapData(scriptableAttribute.Name, scriptableAttribute.Value);
                attribute.SemanticType = (SemanticType)scriptableAttribute.SemanticType;
                attribute.SimilarityMeasure = scriptableAttribute.SimilarityMeasure;
                attribute.IsHidden = scriptableAttribute.IsHidden;

                node.Attributes.Add(kvp.Key, attribute);
            }

            return node;
        }
Example #9
0
        private static EdgeMapData GetEdge(EdgeViewModelBase uiEdge)
        {
            EdgeMapData objEdge = new EdgeMapData(uiEdge.ParentEdge.Source.ID, uiEdge.ParentEdge.Target.ID);

            // Properties
            objEdge.Type = uiEdge.ParentEdge.Type;
            objEdge.IsLabelTextUnderlined = uiEdge.EdgeLine.LabelTextUnderline;
            objEdge.Thickness = uiEdge.Thickness;
            objEdge.Color = ((SolidColorBrush)uiEdge.Color).Color;
            objEdge.LabelBackgroundColor = ((SolidColorBrush)uiEdge.LabelBackgroundColor).Color;
            objEdge.LabelForegroundColor = ((SolidColorBrush)uiEdge.LabelForegroundColor).Color;
            objEdge.LabelFontStyle = uiEdge.LabelFontStyle;
            objEdge.LabelFontWeight = uiEdge.LabelFontWeight;
            objEdge.LabelFont = uiEdge.LabelFont;

            if (uiEdge.ParentEdge.GetType().Equals(typeof(DataEdge)))
            {
                DataEdge dataEdge = (DataEdge)uiEdge.ParentEdge;
                objEdge.Label = dataEdge.DisplayValue;

                // Attributes
                foreach (KeyValuePair<string, AttributeValue> uiDataEdgeAttrKVP in dataEdge.Attributes)
                {
                    //Attributes.Attribute uiEdgeAttribute = GlobalAttributeCollection.GetInstance(scope).GetAttribute(uiDataEdgeAttrKVP.Key);

                    AttributeMapData objEdgeAttribute = new AttributeMapData(uiDataEdgeAttrKVP.Key, uiDataEdgeAttrKVP.Value.Value);
                    objEdge.Attributes.Add(objEdgeAttribute.Name, objEdgeAttribute);

                    //objEdgeAttribute.SemanticType = uiEdgeAttribute.SemanticType;
                    //objEdgeAttribute.SimilarityMeasure = uiEdgeAttribute.PreferredSimilarityMeasure;
                    //objEdgeAttribute.IsHidden = !uiEdgeAttribute.Visible;
                }
            }

            return objEdge;
        }
Example #10
0
        public static NodeMapData GetNode(NodeViewModelBase uiNodeVM)
        {
            NodeMapData objNode;
            if (uiNodeVM.GetType().Equals(typeof(IconNodeViewModel)))
            {
                objNode = new IconNodeMapData(uiNodeVM.ParentNode.ID);

                // Property
                IconNodeViewModel iconNodeVM = (IconNodeViewModel)uiNodeVM;
                if (iconNodeVM.ImageSource != null)
                {
                    ((IconNodeMapData)objNode).ImageSource = new System.Uri(iconNodeVM.ImageSource, UriKind.Relative);
                }
            }
            else
            {
                objNode = new TextNodeMapData(uiNodeVM.ParentNode.ID);
            }

            // Properties
            objNode.Description = uiNodeVM.Description;
            objNode.Label = uiNodeVM.DisplayValue;
            Size dimension = new Size(uiNodeVM.Width, uiNodeVM.Height);
            objNode.Dimension = dimension;
            objNode.Position = uiNodeVM.Position;
            objNode.IsHidden = uiNodeVM.IsHidden;
            objNode.BackgroundColor = uiNodeVM.BackgroundColor.Color;
            objNode.SelectionColor = uiNodeVM.SelectionColor.Color;

            // Attributes
            foreach (KeyValuePair<string, AttributeValue> uiNodeVMAttrKVP in uiNodeVM.ParentNode.Attributes)
            {
                Attributes.Attribute uiNodeVMAttribute = GlobalAttributeCollection.GetInstance(uiNodeVM.Scope).GetAttribute(uiNodeVMAttrKVP.Key);

                AttributeMapData objNodeAttribute = new AttributeMapData(uiNodeVMAttrKVP.Key, uiNodeVMAttrKVP.Value.Value);
                objNode.Attributes.Add(objNodeAttribute.Name, objNodeAttribute);

                objNodeAttribute.SemanticType = uiNodeVMAttribute.SemanticType;
                objNodeAttribute.SimilarityMeasure = uiNodeVMAttribute.PreferredSimilarityMeasure;
                objNodeAttribute.IsHidden = !uiNodeVMAttribute.Visible;
            }

            return objNode;
        }
Example #11
0
        private static IconNodeMapData DataToNode(Data data)
        {
            IconNodeMapData node = new IconNodeMapData(data.address);

            if (data.attr0 != null)
            {
                AttributeMapData objAttribute = new AttributeMapData("attr0", data.attr0);
                node.Attributes.Add("attr0", objAttribute);
            }

            if (data.attr1 != null)
            {
                AttributeMapData objAttribute = new AttributeMapData("attr1", data.attr1);
                node.Attributes.Add("attr1", objAttribute);
            }

            if (data.attr2 != null)
            {
                AttributeMapData objAttribute = new AttributeMapData("attr2", data.attr2);
                node.Attributes.Add("attr2", objAttribute);
            }

            if (data.attr3 != null)
            {
                AttributeMapData objAttribute = new AttributeMapData("attr3", data.attr3);
                node.Attributes.Add("attr3", objAttribute);
            }

            if (data.attr4 != null)
            {
                AttributeMapData objAttribute = new AttributeMapData("attr4", data.attr4);
                node.Attributes.Add("attr4", objAttribute);
            }

            if (data.attr5 != null)
            {
                AttributeMapData objAttribute = new AttributeMapData("attr5", data.attr5);
                node.Attributes.Add("attr5", objAttribute);
            }

            if (data.attr6 != null)
            {
                AttributeMapData objAttribute = new AttributeMapData("attr6", data.attr6);
                node.Attributes.Add("attr6", objAttribute);
            }

            if (data.attr7 != null)
            {
                AttributeMapData objAttribute = new AttributeMapData("attr7", data.attr7);
                node.Attributes.Add("attr7", objAttribute);
            }

            if (data.attr8 != null)
            {
                AttributeMapData objAttribute = new AttributeMapData("attr8", data.attr8);
                node.Attributes.Add("attr8", objAttribute);
            }

            return node;
        }