Commit Graph

86 Commits

Author SHA1 Message Date
Jim Teeuwen 76f54ee732 Merge pull request #24 from lmas/master
Allow setting custom user agent
2015-12-01 02:29:46 +01:00
A. Svensson b5ae4aeda6 Ops, some leftover crap. 2015-11-30 20:31:22 +01:00
A. Svensson 6abeb2c101 Do not atempt to set nil user agents. 2015-11-30 19:32:32 +01:00
A. Svensson fb6cebc8dc Allow setting custom user agent string. 2015-11-30 19:30:01 +01:00
Jim Teeuwen cf505b97c7 Merge pull request #22 from kdar/select-nodes-direct
added SelectNodesDirect function
2015-02-03 22:44:45 +01:00
Kevin Darlington 1145e04eb0 added SelectNodesDirect function 2015-02-03 13:35:02 -08:00
Jim Teeuwen 89d27a9dee Merge pull request #21 from gwitmond/master
Added Node.SetValue(string) method.
2015-01-05 23:05:01 +01:00
Guido Witmond 305e0dc0da Fixed a needless conversion to byte and string.
Added comment to show the purpose.
Added testcase.
2015-01-05 20:54:53 +01:00
Guido Witmond 17e1b69620 Added Node.SetValue(string) method.
SetValue replaces all children of the current node with a single NT_TEXT node and sets its Value to the given parameter.
This lets us replace node values before writing out the document.
2015-01-05 17:13:46 +01:00
jimt 745ca85455 Merge pull request #20 from WesTower/master
Rolled back mistaken bugfix
2014-01-29 14:35:56 -08:00
Bob Uhl 4a541f77a5 Rolled back mistaken bugfix 2014-01-29 14:27:00 -07:00
jimt 3623786eeb Merge pull request #15 from MJDSys/FixValueFetchers
Fix the value fetcher to deal with NT_TEXT nodes.
2013-10-25 18:14:50 -07:00
jimt 6bc115078b Merge pull request #17 from shaunduncan/develop
Fix inadvertent recursive calls when doing a SelectNodes()
2013-10-25 18:11:59 -07:00
Shaun Duncan 72c0afcf93 Reworked the tests just a bit 2013-10-25 17:31:10 -04:00
Shaun Duncan ecf8264ac7 Fixed inadvertent recursion in SelectNodes. Updated/add tests for this behavior 2013-10-25 16:44:32 -04:00
Matthew Dawson 38e440df97 Fix the value fetcher to deal with NT_TEXT nodes.
Due to the introduction of the NT_TEXT nodes, all of the simple value fetchers
broke.  To fix, make a GetValue function fetch all NT_TEXT nodes for
NT_ELEMENT nodes, and put them together, using string.TrimSpace to remove
extra, maintaining compatibility.  Then change the .S function to use GetValue
to fetch a node's content. Also, make all the other value fetchers use .S to
get a string representation to convert, centralizing the implementation.  Use
.S to centralize the handling of a not found node.

Also, implement a series of tests to verify all the fetcher's functionality.
The test is based on the test produced by Tim Jurcka.
2013-09-30 01:09:47 -04:00
jimt d5a758279d Merge pull request #14 from ThomsonReutersEikon/master
Implement text nodes / content escaping
2013-09-11 05:28:50 -07:00
Felix Geisendörfer b3124cf4a7 Implement text nodes / content escaping
This removes the support for re-indenting XML, but allows to faithfully
parse / stringify a document. Beautification could be added again later
on if desired.
2013-09-11 12:17:56 +02:00
jimt 662d1a3eaa Merge pull request #13 from ThomsonReutersEikon/master
fix: String() handled ns prefixes incorrectly
2013-09-03 17:21:14 -07:00
Felix Geisendörfer 08c0943149 fix: String() handled ns prefixes incorrectly
Previously parsing a document like this:

  <root xmlns:foo='http:/example.org/foo' foo:bar='1'/>

Would produce an incorrect document when turning it back into a string:

  <root xmlns:foo='http:/example.org/foo' http:/example.org/foo:bar='1'/>

This patch fixes this by implementing a proper lookup for namespace
prefixes.
2013-09-04 00:35:22 +02:00
jimt 089e94f17d Merge pull request #12 from mattkanwisher/master
Adding new helper methods to make things more useful
2013-08-29 15:49:32 -07:00
Matthew Kanwisher 199b36f234 cleaning up remove function 2013-08-29 18:19:26 -04:00
Matthew Kanwisher 3236d1c7cb more helper methods 2013-08-29 17:38:55 -04:00
Matthew Kanwisher d59371c359 add some new helper methods 2013-08-29 17:29:22 -04:00
jimt 6de2878785 Merge pull request #10 from cgrinds/patch-1
CDATA is overwritten, append instead
2013-03-28 13:12:26 -07:00
Chris Grindstaff f41a2d1569 CDATA is overwritten, append instead
See testcase in https://github.com/jteeuwen/go-pkg-rss/blob/master/feed_test.go of an example of where CDATA is overwritten.
2013-03-28 17:05:49 -03:00
jimt f2fb9084dd Merge pull request #9 from anschelsc/master
http.Client flexibility
2013-03-19 10:49:48 -07:00
Anschel Schaffer-Cohen ab85624fd0 Allow fetching with arbitrary *http.Client. 2013-03-19 09:49:00 -04:00
jimt 79b9108a49 Adds a more complete set of numeric type conversion methods to Node.
These now cover all the bit sizes for signed and unsigned numbers.
Methods have been implemented for Node values and attributes.

This addresses issue #8
2012-12-11 12:36:39 +01:00
jimt c085b35fb9 Adds optional indented output for the Node.String() and Node.Bytes()
methods. Set the global `IndentPrefix` var to a tab or spaces to
enable indented output. The existing API has not been changed.

This addresses issue #7.
2012-11-25 23:46:56 +01:00
jimt 88d4341915 Merge pull request #6 from rdamazio/master
Fixed recursive node selection
2012-07-29 14:57:44 -07:00
Rodrigo Damazio 0459b7b32e Making the recursive SelectNodes a separate function and adding tests 2012-07-29 16:28:03 -03:00
Rodrigo Damazio 05fda09c14 Allowing recursive node selection - e.g. when getting all nodes from a given namespace, or simply all nodes 2012-07-29 10:06:21 -03:00
jim teeuwen 672384faa8 Small fixes in README 2012-04-05 11:35:46 +02:00
jim teeuwen 91731c5264 Another minor README fix. 2012-03-20 02:29:13 +01:00
jim teeuwen 45769307c0 Rename README to README.md and fix contents. 2012-03-20 02:27:54 +01:00
jim teeuwen 032fe9d27c Run gofmt and fix the Unmarshal test. 2012-02-29 11:42:39 +01:00
jim teeuwen 6da9091d5a Add a descriptive comment to the CharsetFunc type. 2012-02-29 11:27:52 +01:00
jim teeuwen 817a15ca8b Remove CharsetFunc as field for Document type and instead supply it as a parameter for all Document.LoadXXX methods. There should be no need to store the function pointer in the Document struct. 2012-02-29 11:21:35 +01:00
jim teeuwen ebbd6b3656 Remove deprecated Verbose field from Document type. 2012-02-29 11:10:05 +01:00
jim teeuwen fcfc98fd64 Add CharsetReader function pointer to Document struct as a public field. This allows the caller to specify their own charset conversion handler when loading xml content. 2012-02-29 11:08:37 +01:00
jim teeuwen b14dd79d8d No more Makefiles. Use go command to build and install. Temporarily removed dependency of external go-charset package. It is incompatible with new Go versions and is not updated by the author. We should find a replacement for it. This may cause problems with xml files supplied in non-utf8 encodings. 2012-02-09 17:30:21 +01:00
jim teeuwen 6e76dc96aa gofix for weekly.2012-01-27 2012-01-27 11:51:02 +01:00
jim teeuwen b5c33469fa fix for weekly 2011.12.06 2011-12-07 13:57:00 +01:00
jim teeuwen fb24618017 fix for weekly 2011.12.06 2011-12-07 13:53:17 +01:00
jim teeuwen 8a9dae755c gofix go1rename 2011-11-09 14:56:55 +01:00
jim teeuwen 4b31ea924d gofix error 2011-11-02 16:50:45 +01:00
jim teeuwen 0ecfd7fd99 Changed code to use new rune type unicode code points. 2011-10-26 12:24:45 +02:00
jim teeuwen 4f7417ecbc Minor improvements in Node.Bytes() implementation. Some test case tweaking. 2011-09-30 12:06:20 +02:00
jim teeuwen 2a2a591c08 Add wildcard support for node names. Allows selecting of all child nodes with a specific namespace (See issue #4). 2011-07-13 05:17:00 +02:00