Exemple #1
0
        private void WriteElement(StageElement element)
        {
            bool separate = false;

            _json.WriteElementStart();

            foreach (var a in element.Attributes())
            {
                if (separate)
                {
                    _json.WriteSeparator();
                }
                else
                {
                    separate = true;
                }

                _json.WriteAttributeLabel(a);
                _json.WriteValue(a);
            }

            foreach (var item in element.Items())
            {
                if (separate)
                {
                    _json.WriteSeparator();
                }
                else
                {
                    separate = true;
                }

                _json.WriteLabel(item);

                if (item is StageValue)
                {
                    _json.WriteValue((StageValue)item);
                }
                else if (item is StageElement)
                {
                    WriteElement((StageElement)item);
                }
                else if (item is StageList)
                {
                    WriteList((StageList)item);
                }
                else if (item is StageNull)
                {
                    _json.WriteNull((StageNull)item);
                }
            }

            _json.WriteElementEnd();
        }