Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
 
 
 

57 řádky
1.6 KiB

  1. // Copyright 2011 The Go Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. package xml
  5. import "time"
  6. var atomValue = &Feed{
  7. XMLName: Name{"http://www.w3.org/2005/Atom", "feed"},
  8. Title: "Example Feed",
  9. Link: []Link{{Href: "http://example.org/"}},
  10. Updated: ParseTime("2003-12-13T18:30:02Z"),
  11. Author: Person{Name: "John Doe"},
  12. Id: "urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6",
  13. Entry: []Entry{
  14. {
  15. Title: "Atom-Powered Robots Run Amok",
  16. Link: []Link{{Href: "http://example.org/2003/12/13/atom03"}},
  17. Id: "urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a",
  18. Updated: ParseTime("2003-12-13T18:30:02Z"),
  19. Summary: NewText("Some text."),
  20. },
  21. },
  22. }
  23. var atomXml = `` +
  24. `<feed xmlns="http://www.w3.org/2005/Atom" updated="2003-12-13T18:30:02Z">` +
  25. `<title>Example Feed</title>` +
  26. `<id>urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6</id>` +
  27. `<link href="http://example.org/"></link>` +
  28. `<author><name>John Doe</name><uri></uri><email></email></author>` +
  29. `<entry>` +
  30. `<title>Atom-Powered Robots Run Amok</title>` +
  31. `<id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id>` +
  32. `<link href="http://example.org/2003/12/13/atom03"></link>` +
  33. `<updated>2003-12-13T18:30:02Z</updated>` +
  34. `<author><name></name><uri></uri><email></email></author>` +
  35. `<summary>Some text.</summary>` +
  36. `</entry>` +
  37. `</feed>`
  38. func ParseTime(str string) time.Time {
  39. t, err := time.Parse(time.RFC3339, str)
  40. if err != nil {
  41. panic(err)
  42. }
  43. return t
  44. }
  45. func NewText(text string) Text {
  46. return Text{
  47. Body: text,
  48. }
  49. }