Skip to content
Commit 55edfb40 authored by Richard Schwarting's avatar Richard Schwarting
Browse files

* change content_to_string () to a content property, for user convenience.

parent 82d35186
No related branches found
No related tags found
No related merge requests found
...@@ -281,5 +281,51 @@ namespace GXml.Dom { ...@@ -281,5 +281,51 @@ namespace GXml.Dom {
} }
} }
// /**
// * This is a convenience method for Elements, mostly
// * useful when you know a given element's children are
// * only Text. With the example {{{<shops><shop
// * id="1">Eeylops Owl Emporium</shop><shop
// * id="2">Obscurus Books</shop></shops>}}} taking the
// * node for the shop element with id 1 and using this
// * method, you would get back "Eeylops Owl Emporiums".
// * If you used it on the shops element, you'd get
// * '<shop id="1">Eeylops Owl Emporium</shop><shop
// * id="2">Obscurus Books</shop>'
// *
// * @return XML string of child contents
// */
// public string content_to_string () {
// return this.child_nodes.to_string (true);
// }
/**
* This is a convenience property for Elements, mostly
* useful when you know a given element's children are
* only Text. With the example {{{<shops><shop
* id="1">Eeylops Owl Emporium</shop><shop
* id="2">Obscurus Books</shop></shops>}}} taking the
* node for the shop element with id 1 and using this
* method, you would get back "Eeylops Owl Emporiums".
* If you used it on the shops element, you'd get
* '<shop id="1">Eeylops Owl Emporium</shop><shop
* id="2">Obscurus Books</shop>'
*/
// TODO: add test
public string content {
owned get {
//return this.child_nodes.to_string (true);
return base.node->get_content ();
// TODO: what's the difference between this and stringifying
// the child nodes?
}
set {
// TODO: check impact on existing child nodes; they will be
// detached, right?
// TODO: is XML in value interpreted or escaped?
base.node->set_content (value);
}
}
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment