Socket
Socket
Sign inDemoInstall

github.com/avbru/xml

Package Overview
Dependencies
0
Alerts
File Explorer

Install Socket

Detect and block malicious and high-risk dependencies

Install

    github.com/avbru/xml

Package xml implements a simple XML 1.0 parser that understands XML name spaces.


Version published

Readme

Source

This package is basically golang encoding/xml fork with fixes to support:

  • omitempty tag for struct fields
  • omitempty tag for nested xml tags
package main

import (
	"encoding/xml"	
	 oxml "github.com/avbru/xml"
)

type Test struct {
	Nested struct {
		Something string
	} `xml:"nested,omitempty"`
	NestedWithPath string `xml:"nestedL1>nestedL2>nestedwithpath,omitempty"`
}

func main() {
	d, err := xml.Marshal(&Test{})
	if err != nil {
		panic(err)
	}
	println("standart xml: ", string(d))
	
	
	d, err = oxml.Marshal(&Test{})
	if err != nil {
		panic(err)
	}
	println("oxml: ", string(d))
	
	
}

Example:

https://play.golang.org/p/wGPvdvlObFA

FAQs

Last updated on 03 Mar 2020

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc