Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/hellodword/xml

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/hellodword/xml

  • v0.0.0-20221113140703-bceee1329480
  • Source
  • Go
  • Socket score

Version published
Created
Source

encoding/xml with namespace prefixes

This is a fork of the Go encoding/xml package that improves support for XML namespaces, kept in sync with golang/go#48641.

It allows round-trip unmarshaling/marshaling with explicit namespace prefixes. For example, this can be unmarshalled and re-marshalled into this precise XML:

<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
        <command>
                <check>
                        <domain:check xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
                                <domain:name>golang.org</domain:name>
                                <domain:name>go.dev</domain:name>
                        </domain:check>
                </check>
        </command>
</epp>

For marshaling, a preferred namespace prefix can now be specified in a struct tag or XMLName value by prefixing the local name:

xml:"urn:ietf:params:xml:ns:domain-1.0 domain:check"

Name-spaced tag and attribute names are now strictly parsed and will fail with an error if any are malformed, such as having a leading or trailing colon, or more than 1 colon.

An example playground that would be fixed with this package:

https://play.golang.org/p/-6Ee8tcLl2L

Usage


// Instead of "encoding/xml"
import "github.com/nbio/xml"

Development

To ease keeping this code in sync with a fork of Go, this repository contains a go.mod file in vendor/go/src that declares itself as the std package. This package must be tested from that directory:

cd vendor/go/src && go test -v ./encoding/xml

FAQs

Package last updated on 13 Nov 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc