From 7d18972112a7d940333f9ef17a5ae1383da0a57c Mon Sep 17 00:00:00 2001 From: kballou Date: Tue, 14 Apr 2015 16:55:12 -0600 Subject: Add example usage to readme --- README.markdown | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/README.markdown b/README.markdown index 23563f9..f2e0be6 100644 --- a/README.markdown +++ b/README.markdown @@ -3,6 +3,30 @@ This simple library allows users to read and extract Hadoop configuration properties. +## Example Usage ## + +The following is an example of how to use this library: + + package main + + import ( + "fmt" + "github.com/kennyballou/gohadoopxml" + "log" + "os" + ) + + func main() { + configuration, err := gohadoopxml.ParseXML(os.Args[1]) + if err != nil { + log.Panic("Error occurred while parsing xml") + } + + for _, p := range configuration.Properties { + fmt.Printf("%s -> %s\n", p.Name, p.Value) + } + } + ## License ## This code is licensed and distributed, as-is without warranty and in the hopes -- cgit v1.2.1