var x = <xml><test-ing>Hello</test-ing>, <ot-her>World!</ot-her></xml>; alert(x["test-ing"]); x["test-ing"] = "Good bye"; alert(x.toXMLString());
Dirk's answer is obviously one the smartest. Let me help you understanding where you were wrong.
fails because of the dash obviously
Fails because you, by using parens, indicates a condition which is here kind of undefined : 'book-en' so what…
Fails because you are misusing the child function as it expects a string and not an index.
So you could have used
myxml.bookstore.Author.children() = "titi";
The less precise because you can't presume the first child is kind of book-en.
Similar to /root/bookstore/Author/* in xpath
myxml.bookstore.Author.child ( "book-en" ) = "tata"
You are here targeting the first child of type "book-en"
Similar to /root/bookstore/Author/book-en in xpath
You are here using a condition to retrieve only nodes of the children list whose name matches 'book-en'
Similar to /root/bookstore/Author[name(.)='book-en'] in xpath
myxml.bookstore.Author.descendants("book-en") = "tutu";
This is the most global approach as it would look at any descendants from the starting node.
Similar to /root/bookstore/Author//book-en in xpath
But once again, Dirk's answer is the smartest one you want to use.