The example document from https://way2tutorial.com/xml/xpath-node-test.php
()
| 740 | |
| 741 | // The example document from https://way2tutorial.com/xml/xpath-node-test.php |
| 742 | func createEmployeeExample() *TNode { |
| 743 | /* |
| 744 | <?xml version="1.0" standalone="yes"?> |
| 745 | <empinfo> |
| 746 | <employee id="1"> |
| 747 | <name>Opal Kole</name> |
| 748 | <designation discipline="web" experience="3 year">Senior Engineer</designation> |
| 749 | <email>OpalKole@myemail.com</email> |
| 750 | </employee> |
| 751 | <employee id="2"> |
| 752 | <name from="CA">Max Miller</name> |
| 753 | <designation discipline="DBA" experience="2 year">DBA Engineer</designation> |
| 754 | <email>maxmiller@email.com</email> |
| 755 | </employee> |
| 756 | <employee id="3"> |
| 757 | <name>Beccaa Moss</name> |
| 758 | <designation discipline="appdev">Application Developer</designation> |
| 759 | <email>beccaamoss@email.com</email> |
| 760 | </employee> |
| 761 | </empinfo> |
| 762 | */ |
| 763 | |
| 764 | type Element struct { |
| 765 | Data string |
| 766 | Attributes map[string]string |
| 767 | } |
| 768 | var lines = 0 |
| 769 | doc := createNode("", RootNode) |
| 770 | lines++ // 1 |
| 771 | empinfo := doc.createChildNode("empinfo", ElementNode) |
| 772 | lines++ |
| 773 | empinfo.lines = lines |
| 774 | var employees = []struct { |
| 775 | name Element |
| 776 | designation Element |
| 777 | email Element |
| 778 | }{ |
| 779 | { |
| 780 | name: Element{Data: "Opal Kole"}, |
| 781 | designation: Element{Data: "Senior Engineer", Attributes: map[string]string{ |
| 782 | "discipline": "web", |
| 783 | "experience": "3 year", |
| 784 | }}, |
| 785 | email: Element{Data: "OpalKole@myemail.com"}, |
| 786 | }, |
| 787 | { |
| 788 | name: Element{Data: "Max Miller", Attributes: map[string]string{"from": "CA"}}, |
| 789 | designation: Element{Data: "DBA Engineer", Attributes: map[string]string{ |
| 790 | "discipline": "DBA", |
| 791 | "experience": "2 year", |
| 792 | }}, |
| 793 | email: Element{Data: "maxmiller@email.com"}, |
| 794 | }, |
| 795 | { |
| 796 | name: Element{Data: "Beccaa Moss"}, |
| 797 | designation: Element{Data: "Application Developer", Attributes: map[string]string{ |
| 798 | "discipline": "appdev", |
| 799 | }}, |
no test coverage detected
searching dependent graphs…