Code view:

A painting is a person's account of this edit as text, recorded independently of the node mapping - a rendering often has several equally defensible answers where the mapping has one. Deletions and insertions carry no position on the opposite side in a painting, so that panel draws no caret for them.

Before

…lines 1–84 unchanged (84 lines)
85 Node insert = comment;
86 if (commentToken.bogus) { // xml declarations are emitted as bogus comments (which is right for html, but not xml)
87 // so we do a bit of a hack and parse the data as an element to pull the attributes out
88 String data = comment.getData();
89 if (data.length() > 1 && (data.startsWith("!") || data.startsWith("?"))) {
90 Document doc = Jsoup.parse("<" + data.substring(1, data.length() -1) + ">", baseUri, Parser.xmlParser());
91 Element el = doc.child(0);
92 insert = new XmlDeclaration(settings.normalizeTag(el.tagName()), data.startsWith("!"));
93 insert.attributes().addAll(el.attributes());
94 }
95 }
96 insertNode(insert);
97 }
98
99 void insert(Token.Character token) {
100 final String data = token.getData();
…lines 101–144 unchanged (44 lines)

After

…lines 1–84 unchanged (84 lines)
85 Node insert = comment;
86 if (commentToken.bogus) { // xml declarations are emitted as bogus comments (which is right for html, but not xml)
87 // so we do a bit of a hack and parse the data as an element to pull the attributes out
88 String data = comment.getData();
89 if (data.length() > 1 && (data.startsWith("!") || data.startsWith("?"))) {
90 Document doc = Jsoup.parse("<" + data.substring(1, data.length() -1) + ">", baseUri, Parser.xmlParser());
91 if (doc.childNodeSize() > 0) {
92 Element el = doc.child(0);
93 insert = new XmlDeclaration(settings.normalizeTag(el.tagName()), data.startsWith("!"));
94 insert.attributes().addAll(el.attributes());
95 } // else, we couldn't parse it as a decl, so leave as a comment
96 }
97 }
98 insertNode(insert);
99 }
100
101 void insert(Token.Character token) {
…lines 102–146 unchanged (45 lines)

Before

program
package_declaration
package "package"
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "jsoup"
. "."
identifier "parser"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "jsoup"
. "."
identifier "Jsoup"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "jsoup"
. "."
identifier "helper"
. "."
identifier "Validate"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "jsoup"
. "."
identifier "nodes"
. "."
asterisk
* "*"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "io"
. "."
identifier "Reader"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "io"
. "."
identifier "StringReader"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "List"
; ";"
block_comment "/**\n * Use the {@code XmlTreeBuilder} when you want to parse"...
class_declaration
modifiers
public "public"
class "class"
identifier "XmlTreeBuilder"
superclass
extends "extends"
type_identifier "TreeBuilder"
class_body
{ "{"
method_declaration
type_identifier "ParseSettings"
identifier "defaultSettings"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
field_access
identifier "ParseSettings"
. "."
identifier "preserveCase"
; ";"
} "}"
method_declaration (+40 nodes collapsed)
method_declaration (+46 nodes collapsed)
method_declaration (+81 nodes collapsed)
method_declaration (+176 nodes collapsed)
method_declaration (+28 nodes collapsed)
method_declaration (+130 nodes collapsed)
method_declaration
void_type "void"
identifier "insert"
formal_parameters
( "("
formal_parameter
scoped_type_identifier
type_identifier "Token"
. "."
type_identifier "Comment"
identifier "commentToken"
) ")"
block
{ "{"
local_variable_declaration
type_identifier "Comment"
variable_declarator
identifier "comment"
= "="
object_creation_expression
new "new"
type_identifier "Comment"
argument_list
( "("
method_invocation
identifier "commentToken"
. "."
identifier "getData"
argument_list
( "("
) ")"
) ")"
; ";"
local_variable_declaration
type_identifier "Node"
variable_declarator
identifier "insert"
= "="
identifier "comment"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
field_access
identifier "commentToken"
. "."
identifier "bogus"
) ")"
block
{ "{"
line_comment "// xml declarations are emitted as bogus comments (which is "...
line_comment "// so we do a bit of a hack and parse the data as an element"...
local_variable_declaration
type_identifier "String"
variable_declarator
identifier "data"
= "="
method_invocation
identifier "comment"
. "."
identifier "getData"
argument_list
( "("
) ")"
; ";"
if_statement
if "if"
parenthesized_expression (+42 nodes collapsed)
block
{ "{"
local_variable_declaration (+54 nodes collapsed)
local_variable_declaration
type_identifier "Element"
variable_declarator
identifier "el"
= "="
method_invocation
identifier "doc"
. "."
identifier "child"
argument_list
( "("
decimal_integer_literal "0"
) ")"
; ";"
expression_statement (+37 nodes collapsed)
expression_statement (+22 nodes collapsed)
} "}"
} "}"
expression_statement
method_invocation
identifier "insertNode"
argument_list
( "("
identifier "insert"
) ")"
; ";"
} "}"
method_declaration (+61 nodes collapsed)
method_declaration (+81 nodes collapsed)
block_comment "/**\n * If the stack contains an element with this tag's "...
method_declaration (+199 nodes collapsed)
method_declaration (+66 nodes collapsed)
} "}"

After

program
package_declaration
package "package"
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "jsoup"
. "."
identifier "parser"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "jsoup"
. "."
identifier "Jsoup"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "jsoup"
. "."
identifier "helper"
. "."
identifier "Validate"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "jsoup"
. "."
identifier "nodes"
. "."
asterisk
* "*"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "io"
. "."
identifier "Reader"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "io"
. "."
identifier "StringReader"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "List"
; ";"
block_comment "/**\n * Use the {@code XmlTreeBuilder} when you want to parse"...
class_declaration
modifiers
public "public"
class "class"
identifier "XmlTreeBuilder"
superclass
extends "extends"
type_identifier "TreeBuilder"
class_body
{ "{"
method_declaration
type_identifier "ParseSettings"
identifier "defaultSettings"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
field_access
identifier "ParseSettings"
. "."
identifier "preserveCase"
; ";"
} "}"
method_declaration (+40 nodes collapsed)
method_declaration (+46 nodes collapsed)
method_declaration (+81 nodes collapsed)
method_declaration (+176 nodes collapsed)
method_declaration (+28 nodes collapsed)
method_declaration (+130 nodes collapsed)
method_declaration
void_type "void"
identifier "insert"
formal_parameters
( "("
formal_parameter
scoped_type_identifier
type_identifier "Token"
. "."
type_identifier "Comment"
identifier "commentToken"
) ")"
block
{ "{"
local_variable_declaration
type_identifier "Comment"
variable_declarator
identifier "comment"
= "="
object_creation_expression
new "new"
type_identifier "Comment"
argument_list
( "("
method_invocation
identifier "commentToken"
. "."
identifier "getData"
argument_list
( "("
) ")"
) ")"
; ";"
local_variable_declaration
type_identifier "Node"
variable_declarator
identifier "insert"
= "="
identifier "comment"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
field_access
identifier "commentToken"
. "."
identifier "bogus"
) ")"
block
{ "{"
line_comment "// xml declarations are emitted as bogus comments (which is "...
line_comment "// so we do a bit of a hack and parse the data as an element"...
local_variable_declaration
type_identifier "String"
variable_declarator
identifier "data"
= "="
method_invocation
identifier "comment"
. "."
identifier "getData"
argument_list
( "("
) ")"
; ";"
if_statement
if "if"
parenthesized_expression (+42 nodes collapsed)
block
{ "{"
local_variable_declaration (+54 nodes collapsed)
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
method_invocation
identifier "doc"
. "."
identifier "childNodeSize"
argument_list
( "("
) ")"
> ">"
decimal_integer_literal "0"
) ")"
block
{ "{"
local_variable_declaration
type_identifier "Element"
variable_declarator
identifier "el"
= "="
method_invocation
identifier "doc"
. "."
identifier "child"
argument_list
( "("
decimal_integer_literal "0"
) ")"
; ";"
expression_statement (+37 nodes collapsed)
expression_statement (+22 nodes collapsed)
} "}"
line_comment "// else, we couldn't parse it as a decl, so leave as a comme"...
} "}"
} "}"
expression_statement
method_invocation
identifier "insertNode"
argument_list
( "("
identifier "insert"
) ")"
; ";"
} "}"
method_declaration (+61 nodes collapsed)
method_declaration (+81 nodes collapsed)
block_comment "/**\n * If the stack contains an element with this tag's "...
method_declaration (+199 nodes collapsed)
method_declaration (+66 nodes collapsed)
} "}"