Example #1
0
        //private XNode CreateElement(string name)
        //{
        //    return new XElement(name);
        //}

        //private static void AddElement(XNode parent, XNode child)
        //{
        //    if (parent is XElement)
        //        ((XElement)parent).Add(child);
        //    else if (parent is XDocument)
        //        ((XDocument)parent).Add(child);
        //    else
        //        throw new PBException("error generating XDocument node is neither a XElement nor a XDocument");
        //}

        //private static void AddAttribute(XNode parent, string name, string value)
        //{
        //    XElement xeParent = (XElement)parent;
        //    if (xeParent.Attribute(name) == null)
        //    {
        //        if (value == null)
        //            value = "";
        //        XAttribute attrib = new XAttribute(name, value);
        //        xeParent.Add(attrib);
        //    }
        //}

        //private static void AddText(XNode parent, string text)
        //{
        //    if (IsSeparator(text))
        //        return;
        //    ((XElement)parent).Add(new XText(text));
        //}

        private void AddText(XElement parent, string text)
        {
            if (IsSeparator(text))
            {
                return;
            }
            _xdCreator.AddText(parent, text);
        }
Example #2
0
 private void AddText(XXXNode_v2 parent, string text)
 {
     if (IsSeparator(text))
     {
         return;
     }
     if (_xmlDocument != null)
     {
         XmlText node = _xmlDocument.CreateTextNode(text);
         parent.XmlNode.AppendChild(node);
     }
     if (_xDocument != null)
     {
         if (_xdCreator != null)
         {
             _xdCreator.AddText((XElement)parent.XNode, text);
         }
         else
         {
             XText node = new XText(text);
             ((XElement)parent.XNode).Add(node);
         }
     }
 }