예제 #1
0
        /// <summary>
        ///     Serializes an attribute set to a string builder in form " [a = b]"
        /// </summary>
        private void AppendAttributeSet(IAttrSet attrSet, StringBuilder sb)
        {
            if (!AttrSet.NotNullOrEmpty(attrSet))
            {
                return;
            }

            sb.Append(" [");
            bool wroteFirst = false;

            foreach (IAttribute attribute in attrSet)
            {
                if (wroteFirst)
                {
                    sb.Append(", ");
                }

                string record = _dotHelper.GetRecordFromAttribute(attribute);
                sb.Append(record);

                wroteFirst = true;
            }

            sb.Append("]");
        }
예제 #2
0
        public void SetNodeAttributes(IAttrSet attributesSet)
        {
            if (!AttrSet.NotNullOrEmpty(attributesSet))
            {
                return;
            }

            StringBuilder sb = new StringBuilder();

            sb.Append("node");
            AppendAttributeSet(attributesSet, sb);
            sb.Append(";");
            Line(sb.ToString());
        }