Not logged in. · Lost password · Register
Forum: agsXMPP SDK Support RSS
Avatar
jason #1
Member since Oct 2007 · 9 posts
Group memberships: Members
Show profile · Link to this post
Subject: CData Node WriteTree
It appears CData was left out of Node WriteTree method. Is there a reason this was left out, and if so is there another approach to include cdata tags?

It seems to me the following snippet could be included in the WriteTree method.

else if (e.NodeType == NodeType.Cdata)
            {
                tw.WriteCData(e.Value);
            }
Avatar
Alex #2
Member since Feb 2003 · 4245 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
xmpp is only a subset of xml. For this reason only the stuff needed is included.
If you need CDATA we can check and include it, if it breaks no other code and compatibility.

Alex
Alexander Gnauck
AG-Software
Avatar
jason #3
Member since Oct 2007 · 9 posts
Group memberships: Members
Show profile · Link to this post
Yes, please add it in if you can. I am sending custom objects in RPC request/response to a java xmpp api and it is expecting cdata tags around these objects.
Avatar
Alex #4
Member since Feb 2003 · 4245 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
you have to read CDATA only, or also write CDATA?
There is currently nothing in agsXMPP.Xm which would allow you to write CDATA nodes.

Alex
Alexander Gnauck
AG-Software
Avatar
jason #5
Member since Oct 2007 · 9 posts
Group memberships: Members
Show profile · Link to this post
I had to modify your write value method.. By doing this along with adding the tw.WriteCData(e.Value); previously metioned I am able create CData Nodes and write CData. I am sure this could be more robust, but the idea is there. By the way, you removed the Element Constructor that I was using, it allowed NodeType to be passed. I dont really need it, but I saw a post where you mentioned removing it. I believe the reading of cdata is automatically being handled. I am referring to the writing of cdata. Thanks again for the help.


 public static void WriteValue(object param, Element parent, bool isCdata)
        {
            Element value = new Element("value");

            if (param is String)
            {
                Element str = new Element("string");

                if (isCdata)
                {
                    Element cdata = new Element();
                    cdata.Value = param; // some serialized object
                    cdata.NodeType = NodeType.Cdata;
                    str.AddChild(cdata);
                    value.AddChild(str);
                }
                else
                {
                    value.AddChild(new Element("string", param as string));
                }
            }
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Forum: agsXMPP SDK Support RSS