Skip to content

Disregard namespace prefix #15

@devangvira

Description

@devangvira

While parsing a XML document having the following structure:
<?xml version="1.0" encoding="UTF-8"?> <pd:ProcessDefinition xmlns:pd="http://xmlns.xyz.com/process/2003" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <pd:activity name="Invoke Request-Response Service"> <pd:type>RequestReplyActivity</pd:type> <pd:resourceType>OpClientReqActivity</pd:resourceType> <pd:x>300</pd:x> <pd:y>80</pd:y> <config> ...

I have to specify the namespace prefix for parsing the tags like:

fmt.Println("Parsing process") for i, n := range xmlquery.Find(doc, "//pd:ProcessDefinition/pd:activity/pd:type") { fmt.Printf("#%d %s\n", i, n.InnerText()) }

Is there a way to disregard the namespace prefix? So that I can just look for xmlquery.Find(doc, "//ProcessDefinition/activity/type")

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions