Permalink
Browse files

- updated docs, example: use WJECloseDocument() to delete

  • Loading branch information...
1 parent ffb5928 commit a31917789a1521acff24541f2e5411b1631e51a2 @penduin penduin committed Nov 16, 2012
Showing with 17 additions and 3 deletions.
  1. +1 −1 documentation/index.html
  2. +4 −0 documentation/wjelement.html
  3. +7 −2 example/example.c
  4. +5 −0 include/wjelement.h
View
@@ -122,7 +122,7 @@ <h1>Contact</h1>
<li>
<a href="mailto:owens@netmail.com">
Owen Swerkstrom &lt;owens@netmail.com&gt;
-</a> - community/repository front-man, primary WJElementSchema author
+</a> - community/repository front-man, WJElementSchema author
</li>
<li>
<a href="mailto:migahg@netmail.com">
@@ -171,6 +171,10 @@ <h2>Document/Element Management</h2>
XplBool WJECloseDocument(WJElement document);
</pre></blockquote>
</p>
+<p>
+ WJECloseDocument is also used to delete/remove an item from a parent document:
+ WJECloseDocument(WJEGet(...));
+</p>
<p>
<strong>WJECopyDocument</strong>
- Duplicate an existing WJElement
View
@@ -26,16 +26,18 @@ var doc = {
"job": "public relations"
"born": 2485
}
- ]
+ ],
+ "shiny": true
};
var person = null;
-for(i in doc.crew) {
+for(i in doc.crew) { // note: tedious...
person = doc.crew[i];
if(person.born == 2468) {
person.born = 2486;
}
}
+delete(doc.shiny);
for(i in doc.crew) {
person = doc.crew[i];
@@ -73,7 +75,10 @@ int main(int argc, char **argv) {
WJEString(doc, "crew[-1].job", WJE_SET, "public relations");
WJEInt64(doc, "crew[-1].born", WJE_SET, 2485);
+ WJEBool(doc, "shiny", WJE_SET, TRUE);
+
WJEInt64(doc, "crew[].born == 2468", WJE_SET, 2486); /* note: awesome! */
+ WJECloseDocument(WJEGet(doc, "shiny", NULL));
while((person = _WJEObject(doc, "crew[]", WJE_GET, &person))) {
printf("%s (%s) is %d\n",
View
@@ -155,6 +155,11 @@ EXPORT XplBool WJEWriteDocument(WJElement document, WJWriter writer, char *name
/* Destroy a WJElement object */
EXPORT XplBool WJECloseDocument(WJElement document);
+/*
+ WJECloseDocument is also used to delete/remove an item from a parent
+ document:
+ WJECloseDocument(WJEGet(...));
+*/
/* Duplicate an existing WJElement */
EXPORT WJElement _WJECopyDocument(WJElement to, WJElement from, WJELoadCB loadcb, void *data, const char *file, const int line);

0 comments on commit a319177

Please sign in to comment.