MCPcopy Create free account
hub / github.com/antchfx/xmlquery / TestUnnecessaryEscapeOutputValue

Function TestUnnecessaryEscapeOutputValue

node_test.go:448–472  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

446}
447
448func TestUnnecessaryEscapeOutputValue(t *testing.T) {
449 data := `<?xml version="1.0" encoding="utf-8"?>
450 <class_list xml:space="preserve">
451 <student>
452 <name> Robert </name>
453 <grade>A+</grade>
454
455 </student>
456 </class_list>`
457
458 root, err := Parse(strings.NewReader(data))
459 if err != nil {
460 t.Error(err)
461 }
462
463 escapedInnerText := root.OutputXML(true)
464 if strings.Contains(escapedInnerText, "&#x9") {
465 t.Fatal("\\n has been escaped unnecessarily")
466 }
467
468 if strings.Contains(escapedInnerText, "&#xA") {
469 t.Fatal("\\t has been escaped unnecessarily")
470 }
471
472}
473
474func TestUnnecessaryEscapeValueWrite(t *testing.T) {
475 data := `<?xml version="1.0" encoding="utf-8"?>

Callers

nothing calls this directly

Calls 2

ParseFunction · 0.85
OutputXMLMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…