8000 Value() on text node is useless · Issue #20 · antchfx/jsonquery · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Value() on text node is useless #20
Open
@bterrier

Description

@bterrier

Sorry for the offensive title, but I do not know how to describe it otherwise.

My issue is with this line:
Node{Data: fmt.Sprintf("%v", v), Type: TextNode, level: level, value: fmt.Sprintf("%v", v)}

the result is that on text nodes Data and Value() both contains the exact same string representation of the underlying value. Meaning that in practice when I encounter a text node, to get its value if have to do node.Parent.Value().

So why not do: Node{Data: fmt.Sprintf("%v", v), Type: TextNode, level: level, value: v} ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0