Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add atom example

  • Loading branch information...
commit e762a3913a0c9486a5f04bf0ce7f84dfdcb72f4a 1 parent 2509d15
@marianoguerra authored
View
15 examples/oliver.erl
@@ -0,0 +1,15 @@
+-module(oliver).
+-export([run/0]).
+
+print_entry(Entry) ->
+
+ [{_, _, [Published]}, {_, _, [Title]}, {_, _, Content}] = qrly:filter(Entry, "published, title, content"),
+
+ io:format("title: ~s~n~npublished: ~s~n~n~s~n~n", [Published, Title,
+ Content]).
+
+run() ->
+{ok, Qrly} = qrly_xml:parse("../extra/test/atom.xml"),
+ Entries = qrly:filter(Qrly, "entry"),
+
+ [print_entry(Entry) || Entry <- Entries].
View
1,043 extra/test/atom.xml
1,043 additions, 0 deletions not shown
View
1  src/qrly.erl
@@ -35,6 +35,7 @@ parse_query(Str) ->
{Status, Result}
end.
+
filter_multiple(Qrly, MultiFilters) ->
filter_multiple(Qrly, MultiFilters, []).
View
1  src/qrly_xml.erl
@@ -46,7 +46,6 @@ filter(Qrly, Expression) -> qrly:filter(Qrly, Expression).
% internal api
to_neutral(#xmlElement{name=Name, attributes=Attrs, content=Content}) ->
- io:format("~s~n", [Name]),
{atom_to_binary(Name, latin1),
[to_neutral(Attr) || Attr <- Attrs],
[to_neutral(Child) || Child <- Content]};
Please sign in to comment.
Something went wrong with that request. Please try again.