AppendEdgeXmlNode() public static method

public static AppendEdgeXmlNode ( GraphMLXmlDocument graphMLXmlDocument, String vertex1ID, String vertex2ID, String relationship ) : XmlNode
graphMLXmlDocument Smrf.XmlLib.GraphMLXmlDocument
vertex1ID String
vertex2ID String
relationship String
return System.Xml.XmlNode
Example #1
0
        AppendRepliesToAndMentionsEdgeXmlNode
        (
            GraphMLXmlDocument graphMLXmlDocument,
            String screenName1,
            String screenName2,
            String relationship,
            TwitterStatus twitterStatus
        )
        {
            Debug.Assert(graphMLXmlDocument != null);
            Debug.Assert(!String.IsNullOrEmpty(screenName1));
            Debug.Assert(!String.IsNullOrEmpty(screenName2));
            Debug.Assert(!String.IsNullOrEmpty(relationship));
            Debug.Assert(twitterStatus != null);

            XmlNode edgeXmlNode = NodeXLGraphMLUtil.AppendEdgeXmlNode(
                graphMLXmlDocument, screenName1, screenName2, relationship);

            String  statusDateUtc    = twitterStatus.ParsedDateUtc;
            Boolean hasStatusDateUtc = !String.IsNullOrEmpty(statusDateUtc);

            if (hasStatusDateUtc)
            {
                // The status's date is the relationship date.

                graphMLXmlDocument.AppendGraphMLAttributeValue(edgeXmlNode,
                                                               EdgeRelationshipDateUtcID, statusDateUtc);
            }

            String statusText = twitterStatus.Text;

            graphMLXmlDocument.AppendGraphMLAttributeValue(edgeXmlNode,
                                                           EdgeStatusID, statusText);

            String urls = twitterStatus.Urls;

            if (!String.IsNullOrEmpty(urls))
            {
                graphMLXmlDocument.AppendGraphMLAttributeValue(edgeXmlNode,
                                                               EdgeStatusUrlsID, urls);

                graphMLXmlDocument.AppendGraphMLAttributeValue(edgeXmlNode,
                                                               EdgeStatusDomainsID, UrlsToDomains(urls));
            }

            if (!String.IsNullOrEmpty(twitterStatus.Hashtags))
            {
                graphMLXmlDocument.AppendGraphMLAttributeValue(edgeXmlNode,
                                                               EdgeStatusHashtagsID, twitterStatus.Hashtags);
            }

            if (hasStatusDateUtc)
            {
                graphMLXmlDocument.AppendGraphMLAttributeValue(edgeXmlNode,
                                                               EdgeStatusDateUtcID, statusDateUtc);
            }

            graphMLXmlDocument.AppendGraphMLAttributeValue(edgeXmlNode,
                                                           EdgeStatusWebPageUrlID,

                                                           FormatStatusWebPageUrl(screenName1, twitterStatus)
                                                           );

            AppendLatitudeAndLongitudeGraphMLAttributeValues(
                graphMLXmlDocument, edgeXmlNode, twitterStatus.Latitude,
                twitterStatus.Longitude);

            // Precede the ID with a single quote to force Excel to treat the
            // ID as text.  Otherwise, it formats the ID, which is a large
            // number, in scientific notation.

            graphMLXmlDocument.AppendGraphMLAttributeValue(edgeXmlNode,
                                                           NodeXLGraphMLUtil.ImportedIDID, "'" + twitterStatus.ID);

            AppendInReplyToStatusIDGraphMLAttributeValue(graphMLXmlDocument,
                                                         edgeXmlNode, twitterStatus.InReplyToStatusID);
        }