Skip to content
This repository was archived by the owner on Jan 27, 2025. It is now read-only.
This repository was archived by the owner on Jan 27, 2025. It is now read-only.

can IronJS handle Xml via parameters? #100

@jchonc

Description

@jchonc

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"..

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions