| 725 | } |
| 726 | |
| 727 | func TestProcessingInstructionStructure(t *testing.T) { |
| 728 | t.Run("Document1", func(t *testing.T) { |
| 729 | xml := `<?xml version="1.0" encoding="UTF-8"?><item><para>first</para><?xe-change-remove-start?><item><para>second</para></item></item>` |
| 730 | doc, err := Parse(strings.NewReader(xml)) |
| 731 | if err != nil { |
| 732 | t.Fatalf("Failed to parse document1: %v", err) |
| 733 | } |
| 734 | |
| 735 | output := doc.OutputXML(false) |
| 736 | if output != xml { |
| 737 | t.Errorf("Document1 output mismatch:\nExpected: %s\nGot: %s", xml, output) |
| 738 | } |
| 739 | }) |
| 740 | |
| 741 | t.Run("Document2", func(t *testing.T) { |
| 742 | xml := `<?xml version="1.0" encoding="UTF-8"?><list><item><para><?xe-change-remove-start?></para></item></list>` |
| 743 | doc, err := Parse(strings.NewReader(xml)) |
| 744 | if err != nil { |
| 745 | t.Fatalf("Failed to parse document2: %v", err) |
| 746 | } |
| 747 | |
| 748 | output := doc.OutputXML(false) |
| 749 | if output != xml { |
| 750 | t.Errorf("Document2 output mismatch:\nExpected: %s\nGot: %s", xml, output) |
| 751 | } |
| 752 | }) |
| 753 | } |