Skip to content
GitLab
Explore
Sign in
Commit
55edfb40
authored
13 years ago
by
Richard Schwarting
Browse files
Options
Downloads
Patches
Plain Diff
* 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
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
gxml/Element.vala
+46
-0
46 additions, 0 deletions
gxml/Element.vala
with
46 additions
and
0 deletions
gxml/Element.vala
+
46
−
0
View file @
55edfb40
...
@@ -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
);
}
}
}
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment