I am using go-libxml2. I have an XSD and also a XML. I want to filter all anyURI elements in the XML based on XSD including nested elements. Because I am trying to update all anyURI elements in a XML by adding a queryparam. For example
XSD:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="grandParent">
<xs:complexType>
<xs:sequence>
<xs:element name="AnyURI1" type="xs:anyURI"
maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:element name="parent">
<xs:complexType>
<xs:sequence>
<xs:element name="AnyURI2" type="xs:anyURI"
maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:element name="children">
<xs:complexType>
<xs:sequence>
<xs:element name="AnyURI3" type="xs:anyURI"
maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:element>
</xs:element>
</xs:schema>
XML
<grandParent>
<AnyURI1> http://uri_gp1.com </AnyURI1>
<AnyURI1> http://uri_gp2.com </AnyURI1>
<parent>
<AnyURI2> http://uri_p1.com </AnyURI2>
<AnyURI2> http://uri_p2.com </AnyURI2>
<children>
<AnyURI3> http://uri_child1.com </AnyURI3>
<AnyURI3> http://uri_child2.com </AnyURI3>
</children>
</parent>
</grandParent>
In the above XML, I want to filter and update all element of type "anyURI" like <AnyURI1>, <AnyURI2> and <anyURI3>
How can I achieve this using golang?