public override void WritePropertyValue(object value)
        {
            if (this.property == null)
            {
                throw PropertyTreesFailure.WouldCreateMalformedDocument();
            }

            this.property.AppendValue(value);
        }
        public override void WriteEndTree()
        {
            if (currentParent == null)
            {
                throw PropertyTreesFailure.WouldCreateMalformedDocument();
            }

            PopParent();
        }
        private void PushParent(PropertyNode newParent)
        {
            if (this.currentParent == null)
            {
                throw PropertyTreesFailure.WouldCreateMalformedDocument();
            }

            this.currentParent.Append(newParent);
            this.currentParent = newParent;
        }
        public override void WriteEndProperty()
        {
            if (property == null || currentParent == null)
            {
                throw PropertyTreesFailure.WouldCreateMalformedDocument();
            }

            this.property.End();
            this.property = null;
            PopParent();
        }
 PTXWriterState RequirePop(PTXWriterStateType requiredType)
 {
     if (this.states.Peek().State == requiredType)
     {
         return(PopState());
     }
     else
     {
         throw PropertyTreesFailure.WouldCreateMalformedDocument();
     }
 }