Include AtomID header into main Atom header
[cascardo/atompub.git] / atom / person.c
index 62f9ed4..b60e46e 100644 (file)
@@ -106,3 +106,24 @@ atom_person_to_xmlnode (AtomPerson *person, char *elname)
     xmlNewTextChild (node, NULL, "email", person->email);
   return node;
 }
+
+AtomPerson *
+atom_person_new_from_xmlnode (xmlNodePtr node)
+{
+  xmlNodePtr child;
+  AtomPerson *person;
+  person = g_slice_new0 (AtomPerson);
+  for (child = node->xmlChildrenNode; child != NULL; child = child->next)
+    {
+      char *content = xmlNodeGetContent (child->xmlChildrenNode);
+      if (!xmlStrcmp (child->name, "name"))
+       person->name = content;
+      else if (!xmlStrcmp (child->name, "uri"))
+       person->uri = content;
+      else if (!xmlStrcmp (child->name, "email"))
+       person->email = content;
+      else
+       xmlFree (content);
+    }
+  return person;
+}