使用XSD过滤anyURI类型的XML元素

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?

I think you should consider alternative choices of technology for this. The problem becomes very easy with a schema-aware XSLT transformation:

<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="3.0"
               xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xsl:mode on-no-match="shallow-copy">
  <xsl:template match="element(*, xs:anyURI)/text()">
    <xsl:value-of select=". || '?param=value'"/>
  </xsl:template>
</xsl:transform>