Exemplo n.º 1
0
 def asElement(self):
     doc = XmlUtils.createDocument("docInfo")
     root = doc.documentElement
     root.setAttribute("path", self.path)
     for attr in self.attrs:
         val = getattr(self, attr) or ""
         # print "%s: %s" % (attr, val)
         XmlUtils.addChild(doc, attr, val)
     element = doc.removeChild(root)
     doc.unlink()
     return element
Exemplo n.º 2
0
    def asXml(self, prefix=None):
        doc = XmlUtils.createDocument("record")
        root = doc.documentElement
        addChild = XmlUtils.addChild

        addChild(doc, "id", self.getRecordId(prefix))
        addChild(doc, "title", self.title)
        addChild(doc, "box", self.box)
        addChild(doc, "folder", self.box)
        addChild(doc, "extent", self.extent)
        if self.hasDigitalObject():
            digi = XmlUtils.addElement(doc, root, "digitalObject")
            addChild(doc, "href", self.dao.href, digi)
            addChild(doc, "title", self.dao.title, digi)
        return doc