Class XMLPrinter
- java.lang.Object
-
- ch.usi.si.seart.treesitter.printer.XMLPrinter
-
- All Implemented Interfaces:
TreePrinter
public class XMLPrinter extends Object
Printer used for generating Extensible Markup Language (XML) representations of trees using an iterative approach. Note that unlike the CLI counterpart, the resulting XML document does not contain the actual source code contents.- Since:
- 1.2.0
- Author:
- Ozren Dabić
- See Also:
- Rust implementation
-
-
Constructor Summary
Constructors Constructor Description XMLPrinter(TreeCursor cursor)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Fileexport()Generates an XML representation of the tree, writing it directly to a file.Stringprint()Generates an XML representation of the tree, starting from the node currently pointed to by the cursor.
-
-
-
Constructor Detail
-
XMLPrinter
public XMLPrinter(TreeCursor cursor)
-
-
Method Detail
-
print
public String print()
Generates an XML representation of the tree, starting from the node currently pointed to by the cursor.- Returns:
- An XML string of the tree
-
export
public File export() throws IOException
Generates an XML representation of the tree, writing it directly to a file.- Returns:
- A file containing the XML string of the tree
- Throws:
IOException- if an I/O error occurs
-
-