Convert a node to text format. Each rdataset at the node is printed. Any keyword arguments to this method are passed on to the rdataset's to_text() method. *name*, a ``dns.name.Name``, the owner name of the rdatasets. Returns a ``str``.
(self, name: dns.name.Name, **kw: Dict[str, Any])
| 91 | self.rdatasets = [] |
| 92 | |
| 93 | def to_text(self, name: dns.name.Name, **kw: Dict[str, Any]) -> str: |
| 94 | """Convert a node to text format. |
| 95 | |
| 96 | Each rdataset at the node is printed. Any keyword arguments |
| 97 | to this method are passed on to the rdataset's to_text() method. |
| 98 | |
| 99 | *name*, a ``dns.name.Name``, the owner name of the |
| 100 | rdatasets. |
| 101 | |
| 102 | Returns a ``str``. |
| 103 | |
| 104 | """ |
| 105 | |
| 106 | s = io.StringIO() |
| 107 | for rds in self.rdatasets: |
| 108 | if len(rds) > 0: |
| 109 | s.write(rds.to_text(name, **kw)) # type: ignore[arg-type] |
| 110 | s.write("\n") |
| 111 | return s.getvalue()[:-1] |
| 112 | |
| 113 | def __repr__(self): |
| 114 | return "<DNS node " + str(id(self)) + ">" |