Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can IronJS handle Xml via parameters? #100

Open
jchonc opened this issue Mar 14, 2013 · 0 comments
Open

can IronJS handle Xml via parameters? #100

jchonc opened this issue Mar 14, 2013 · 0 comments

Comments

@jchonc
Copy link

jchonc commented Mar 14, 2013

If I pass an XmlDocument or XmlNode from C#, how can I get the results back?
Here is the code:

        var ctx = new IronJS.Hosting.CSharp.Context();
        string js = @"
            var cn = x.InnerText;
            cn = ( cn == 'bbb' ) ? 'ccc' : ( cn + 'x' );
            x.InnerText = cn;
            cn
        ";
        XmlDocument doc = new XmlDocument();
        doc.LoadXml("<a>bbb</a>");
        ctx.SetGlobal("x", doc.DocumentElement);
        object o = ctx.Execute(js);
        XmlNode n = ctx.GetGlobalAs<XmlNode>("x");

here o = "ccc"
but n.InnerText is still "bbb"..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant