magic_xml 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README +22 -0
- data/Rakefile +52 -0
- data/VERSION +1 -0
- data/doc/classes/Array.html +148 -0
- data/doc/classes/File.html +113 -0
- data/doc/classes/Hash.html +117 -0
- data/doc/classes/Patterns_all.html +145 -0
- data/doc/classes/Patterns_any.html +145 -0
- data/doc/classes/String.html +470 -0
- data/doc/classes/Symbol.html +145 -0
- data/doc/classes/XML.html +1881 -0
- data/doc/classes/XML_Comment.html +148 -0
- data/doc/classes/XML_PI.html +145 -0
- data/doc/classes/XML_Tests.html +1727 -0
- data/doc/files/magic_xml_rb.html +186 -0
- data/doc/files/simple_examples/xml_hello_f_rb.html +88 -0
- data/doc/files/simple_examples/xml_hello_m_rb.html +88 -0
- data/doc/files/simple_examples/xml_list_f_rb.html +88 -0
- data/doc/files/simple_examples/xml_list_m_rb.html +88 -0
- data/doc/files/tests_rb.html +94 -0
- data/doc/files/xquery_use_cases/parts/q1_rb.html +117 -0
- data/doc/files/xquery_use_cases/rdb/q10_rb.html +88 -0
- data/doc/files/xquery_use_cases/rdb/q11_rb.html +88 -0
- data/doc/files/xquery_use_cases/rdb/q12_rb.html +88 -0
- data/doc/files/xquery_use_cases/rdb/q13_rb.html +88 -0
- data/doc/files/xquery_use_cases/rdb/q14_rb.html +88 -0
- data/doc/files/xquery_use_cases/rdb/q15_rb.html +88 -0
- data/doc/files/xquery_use_cases/rdb/q16_rb.html +88 -0
- data/doc/files/xquery_use_cases/rdb/q17_rb.html +88 -0
- data/doc/files/xquery_use_cases/rdb/q18_rb.html +88 -0
- data/doc/files/xquery_use_cases/rdb/q1_rb.html +88 -0
- data/doc/files/xquery_use_cases/rdb/q2_rb.html +88 -0
- data/doc/files/xquery_use_cases/rdb/q3_rb.html +88 -0
- data/doc/files/xquery_use_cases/rdb/q4_rb.html +88 -0
- data/doc/files/xquery_use_cases/rdb/q5_rb.html +88 -0
- data/doc/files/xquery_use_cases/rdb/q6_rb.html +88 -0
- data/doc/files/xquery_use_cases/rdb/q7_rb.html +88 -0
- data/doc/files/xquery_use_cases/rdb/q8_rb.html +88 -0
- data/doc/files/xquery_use_cases/rdb/q9_rb.html +88 -0
- data/doc/files/xquery_use_cases/seq/q1_rb.html +88 -0
- data/doc/files/xquery_use_cases/seq/q2_rb.html +88 -0
- data/doc/files/xquery_use_cases/seq/q3_rb.html +88 -0
- data/doc/files/xquery_use_cases/seq/q4_rb.html +88 -0
- data/doc/files/xquery_use_cases/seq/q5_rb.html +88 -0
- data/doc/files/xquery_use_cases/sgml/q10_rb.html +88 -0
- data/doc/files/xquery_use_cases/sgml/q1_rb.html +88 -0
- data/doc/files/xquery_use_cases/sgml/q2_rb.html +88 -0
- data/doc/files/xquery_use_cases/sgml/q3_rb.html +88 -0
- data/doc/files/xquery_use_cases/sgml/q4_rb.html +88 -0
- data/doc/files/xquery_use_cases/sgml/q5_rb.html +88 -0
- data/doc/files/xquery_use_cases/sgml/q6_rb.html +88 -0
- data/doc/files/xquery_use_cases/sgml/q7_rb.html +88 -0
- data/doc/files/xquery_use_cases/sgml/q8a_rb.html +88 -0
- data/doc/files/xquery_use_cases/sgml/q8b_rb.html +88 -0
- data/doc/files/xquery_use_cases/sgml/q9_rb.html +88 -0
- data/doc/files/xquery_use_cases/solution_sizes_rb.html +88 -0
- data/doc/files/xquery_use_cases/string/q1_rb.html +88 -0
- data/doc/files/xquery_use_cases/string/q2_rb.html +93 -0
- data/doc/files/xquery_use_cases/string/q4_rb.html +88 -0
- data/doc/files/xquery_use_cases/string/q5_rb.html +88 -0
- data/doc/files/xquery_use_cases/test_driver_rb.html +92 -0
- data/doc/files/xquery_use_cases/tree/q1_rb.html +111 -0
- data/doc/files/xquery_use_cases/tree/q2_rb.html +88 -0
- data/doc/files/xquery_use_cases/tree/q3_rb.html +88 -0
- data/doc/files/xquery_use_cases/tree/q4_rb.html +88 -0
- data/doc/files/xquery_use_cases/tree/q5_rb.html +88 -0
- data/doc/files/xquery_use_cases/tree/q6_rb.html +113 -0
- data/doc/files/xquery_use_cases/xmp/q10_rb.html +88 -0
- data/doc/files/xquery_use_cases/xmp/q11_rb.html +88 -0
- data/doc/files/xquery_use_cases/xmp/q12_rb.html +88 -0
- data/doc/files/xquery_use_cases/xmp/q1_rb.html +88 -0
- data/doc/files/xquery_use_cases/xmp/q2_rb.html +88 -0
- data/doc/files/xquery_use_cases/xmp/q3_rb.html +88 -0
- data/doc/files/xquery_use_cases/xmp/q4_rb.html +88 -0
- data/doc/files/xquery_use_cases/xmp/q5_rb.html +92 -0
- data/doc/files/xquery_use_cases/xmp/q6_rb.html +88 -0
- data/doc/files/xquery_use_cases/xmp/q7_rb.html +88 -0
- data/doc/files/xquery_use_cases/xmp/q8_rb.html +88 -0
- data/doc/files/xquery_use_cases/xmp/q9_rb.html +88 -0
- data/doc/fr_class_index.html +56 -0
- data/doc/fr_file_index.html +110 -0
- data/doc/fr_method_index.html +159 -0
- data/doc/index.html +26 -0
- data/doc/rdoc-style.css +175 -0
- data/lib/magic_xml.rb +1400 -0
- data/simple_examples/README +14 -0
- data/simple_examples/xml_hello_f.rb +32 -0
- data/simple_examples/xml_hello_m.rb +32 -0
- data/simple_examples/xml_list_f.rb +36 -0
- data/simple_examples/xml_list_m.rb +36 -0
- data/test/helper.rb +9 -0
- data/test/test_magic_xml.rb +855 -0
- data/xquery_use_cases/README +17 -0
- data/xquery_use_cases/parts/README +12 -0
- data/xquery_use_cases/parts/partlist.xml +13 -0
- data/xquery_use_cases/parts/q1.out +16 -0
- data/xquery_use_cases/parts/q1.rb +38 -0
- data/xquery_use_cases/parts/q1.xquery +18 -0
- data/xquery_use_cases/rdb/README +50 -0
- data/xquery_use_cases/rdb/bids.xml +81 -0
- data/xquery_use_cases/rdb/items.xml +57 -0
- data/xquery_use_cases/rdb/q1.out +10 -0
- data/xquery_use_cases/rdb/q1.rb +31 -0
- data/xquery_use_cases/rdb/q1.xquery +14 -0
- data/xquery_use_cases/rdb/q10.out +27 -0
- data/xquery_use_cases/rdb/q10.rb +37 -0
- data/xquery_use_cases/rdb/q10.xquery +15 -0
- data/xquery_use_cases/rdb/q11.out +7 -0
- data/xquery_use_cases/rdb/q11.rb +38 -0
- data/xquery_use_cases/rdb/q11.xquery +15 -0
- data/xquery_use_cases/rdb/q12.out +12 -0
- data/xquery_use_cases/rdb/q12.rb +42 -0
- data/xquery_use_cases/rdb/q12.xquery +28 -0
- data/xquery_use_cases/rdb/q13.out +32 -0
- data/xquery_use_cases/rdb/q13.rb +45 -0
- data/xquery_use_cases/rdb/q13.xquery +15 -0
- data/xquery_use_cases/rdb/q14.out +14 -0
- data/xquery_use_cases/rdb/q14.rb +42 -0
- data/xquery_use_cases/rdb/q14.xquery +14 -0
- data/xquery_use_cases/rdb/q15.out +5 -0
- data/xquery_use_cases/rdb/q15.rb +31 -0
- data/xquery_use_cases/rdb/q15.xquery +9 -0
- data/xquery_use_cases/rdb/q16.out +35 -0
- data/xquery_use_cases/rdb/q16.rb +35 -0
- data/xquery_use_cases/rdb/q16.xquery +17 -0
- data/xquery_use_cases/rdb/q17.out +1 -0
- data/xquery_use_cases/rdb/q17.rb +35 -0
- data/xquery_use_cases/rdb/q17.xquery +11 -0
- data/xquery_use_cases/rdb/q18.out +32 -0
- data/xquery_use_cases/rdb/q18.rb +40 -0
- data/xquery_use_cases/rdb/q18.xquery +19 -0
- data/xquery_use_cases/rdb/q2.out +22 -0
- data/xquery_use_cases/rdb/q2.rb +36 -0
- data/xquery_use_cases/rdb/q2.xquery +14 -0
- data/xquery_use_cases/rdb/q3.out +8 -0
- data/xquery_use_cases/rdb/q3.rb +34 -0
- data/xquery_use_cases/rdb/q3.xquery +16 -0
- data/xquery_use_cases/rdb/q4.out +14 -0
- data/xquery_use_cases/rdb/q4.rb +31 -0
- data/xquery_use_cases/rdb/q4.xquery +11 -0
- data/xquery_use_cases/rdb/q5.out +12 -0
- data/xquery_use_cases/rdb/q5.rb +46 -0
- data/xquery_use_cases/rdb/q5.xquery +25 -0
- data/xquery_use_cases/rdb/q6.out +14 -0
- data/xquery_use_cases/rdb/q6.rb +38 -0
- data/xquery_use_cases/rdb/q6.xquery +15 -0
- data/xquery_use_cases/rdb/q7.out +1 -0
- data/xquery_use_cases/rdb/q7.rb +30 -0
- data/xquery_use_cases/rdb/q7.xquery +10 -0
- data/xquery_use_cases/rdb/q8.out +1 -0
- data/xquery_use_cases/rdb/q8.rb +23 -0
- data/xquery_use_cases/rdb/q8.xquery +8 -0
- data/xquery_use_cases/rdb/q9.out +22 -0
- data/xquery_use_cases/rdb/q9.rb +32 -0
- data/xquery_use_cases/rdb/q9.xquery +16 -0
- data/xquery_use_cases/rdb/users.xml +25 -0
- data/xquery_use_cases/seq/README +12 -0
- data/xquery_use_cases/seq/q1.out +1 -0
- data/xquery_use_cases/seq/q1.rb +25 -0
- data/xquery_use_cases/seq/q1.xquery +2 -0
- data/xquery_use_cases/seq/q2.out +2 -0
- data/xquery_use_cases/seq/q2.rb +25 -0
- data/xquery_use_cases/seq/q2.xquery +2 -0
- data/xquery_use_cases/seq/q3.out +2 -0
- data/xquery_use_cases/seq/q3.rb +26 -0
- data/xquery_use_cases/seq/q3.xquery +3 -0
- data/xquery_use_cases/seq/q4.out +0 -0
- data/xquery_use_cases/seq/q4.rb +27 -0
- data/xquery_use_cases/seq/q4.xquery +4 -0
- data/xquery_use_cases/seq/q5.out +5 -0
- data/xquery_use_cases/seq/q5.rb +29 -0
- data/xquery_use_cases/seq/q5.xquery +10 -0
- data/xquery_use_cases/seq/report1.xml +40 -0
- data/xquery_use_cases/sgml/README +53 -0
- data/xquery_use_cases/sgml/q1.out +44 -0
- data/xquery_use_cases/sgml/q1.rb +23 -0
- data/xquery_use_cases/sgml/q1.xquery +5 -0
- data/xquery_use_cases/sgml/q10.out +1 -0
- data/xquery_use_cases/sgml/q10.rb +28 -0
- data/xquery_use_cases/sgml/q10.xquery +7 -0
- data/xquery_use_cases/sgml/q2.out +26 -0
- data/xquery_use_cases/sgml/q2.rb +23 -0
- data/xquery_use_cases/sgml/q2.xquery +5 -0
- data/xquery_use_cases/sgml/q3.out +6 -0
- data/xquery_use_cases/sgml/q3.rb +28 -0
- data/xquery_use_cases/sgml/q3.xquery +7 -0
- data/xquery_use_cases/sgml/q4.out +4 -0
- data/xquery_use_cases/sgml/q4.rb +25 -0
- data/xquery_use_cases/sgml/q4.xquery +5 -0
- data/xquery_use_cases/sgml/q5.out +3 -0
- data/xquery_use_cases/sgml/q5.rb +23 -0
- data/xquery_use_cases/sgml/q5.xquery +5 -0
- data/xquery_use_cases/sgml/q6.out +1 -0
- data/xquery_use_cases/sgml/q6.rb +27 -0
- data/xquery_use_cases/sgml/q6.xquery +6 -0
- data/xquery_use_cases/sgml/q7.out +1 -0
- data/xquery_use_cases/sgml/q7.rb +27 -0
- data/xquery_use_cases/sgml/q7.xquery +7 -0
- data/xquery_use_cases/sgml/q8a.out +34 -0
- data/xquery_use_cases/sgml/q8a.rb +27 -0
- data/xquery_use_cases/sgml/q8a.xquery +5 -0
- data/xquery_use_cases/sgml/q8b.out +26 -0
- data/xquery_use_cases/sgml/q8b.rb +32 -0
- data/xquery_use_cases/sgml/q8b.xquery +5 -0
- data/xquery_use_cases/sgml/q9.out +9 -0
- data/xquery_use_cases/sgml/q9.rb +29 -0
- data/xquery_use_cases/sgml/q9.xquery +6 -0
- data/xquery_use_cases/sgml/sgml.xml +101 -0
- data/xquery_use_cases/solution_sizes.rb +48 -0
- data/xquery_use_cases/string/README +29 -0
- data/xquery_use_cases/string/company-data.xml +20 -0
- data/xquery_use_cases/string/q1.out +4 -0
- data/xquery_use_cases/string/q1.rb +25 -0
- data/xquery_use_cases/string/q1.xquery +1 -0
- data/xquery_use_cases/string/q2.out +13 -0
- data/xquery_use_cases/string/q2.rb +32 -0
- data/xquery_use_cases/string/q2.xquery +23 -0
- data/xquery_use_cases/string/q4.out +50 -0
- data/xquery_use_cases/string/q4.rb +34 -0
- data/xquery_use_cases/string/q4.xquery +14 -0
- data/xquery_use_cases/string/q5.out +12 -0
- data/xquery_use_cases/string/q5.rb +33 -0
- data/xquery_use_cases/string/q5.xquery +8 -0
- data/xquery_use_cases/string/string.xml +82 -0
- data/xquery_use_cases/test_driver.rb +60 -0
- data/xquery_use_cases/tree/README +23 -0
- data/xquery_use_cases/tree/book.xml +50 -0
- data/xquery_use_cases/tree/q1.out +23 -0
- data/xquery_use_cases/tree/q1.rb +31 -0
- data/xquery_use_cases/tree/q1.xquery +14 -0
- data/xquery_use_cases/tree/q2.out +11 -0
- data/xquery_use_cases/tree/q2.rb +27 -0
- data/xquery_use_cases/tree/q2.xquery +10 -0
- data/xquery_use_cases/tree/q3.out +2 -0
- data/xquery_use_cases/tree/q3.rb +26 -0
- data/xquery_use_cases/tree/q3.xquery +2 -0
- data/xquery_use_cases/tree/q4.out +1 -0
- data/xquery_use_cases/tree/q4.rb +23 -0
- data/xquery_use_cases/tree/q4.xquery +5 -0
- data/xquery_use_cases/tree/q5.out +9 -0
- data/xquery_use_cases/tree/q5.rb +30 -0
- data/xquery_use_cases/tree/q5.xquery +8 -0
- data/xquery_use_cases/tree/q6.out +30 -0
- data/xquery_use_cases/tree/q6.rb +35 -0
- data/xquery_use_cases/tree/q6.xquery +21 -0
- data/xquery_use_cases/xmp/README +41 -0
- data/xquery_use_cases/xmp/bib.xml +35 -0
- data/xquery_use_cases/xmp/books.xml +15 -0
- data/xquery_use_cases/xmp/prices.xml +32 -0
- data/xquery_use_cases/xmp/q1.out +8 -0
- data/xquery_use_cases/xmp/q1.rb +29 -0
- data/xquery_use_cases/xmp/q1.xquery +10 -0
- data/xquery_use_cases/xmp/q10.out +11 -0
- data/xquery_use_cases/xmp/q10.rb +36 -0
- data/xquery_use_cases/xmp/q10.xquery +11 -0
- data/xquery_use_cases/xmp/q11.out +35 -0
- data/xquery_use_cases/xmp/q11.rb +37 -0
- data/xquery_use_cases/xmp/q11.xquery +18 -0
- data/xquery_use_cases/xmp/q12.out +6 -0
- data/xquery_use_cases/xmp/q12.rb +35 -0
- data/xquery_use_cases/xmp/q12.xquery +20 -0
- data/xquery_use_cases/xmp/q2.out +37 -0
- data/xquery_use_cases/xmp/q2.rb +30 -0
- data/xquery_use_cases/xmp/q2.xquery +12 -0
- data/xquery_use_cases/xmp/q3.out +34 -0
- data/xquery_use_cases/xmp/q3.rb +27 -0
- data/xquery_use_cases/xmp/q3.xquery +10 -0
- data/xquery_use_cases/xmp/q4.out +31 -0
- data/xquery_use_cases/xmp/q4.rb +44 -0
- data/xquery_use_cases/xmp/q4.xquery +21 -0
- data/xquery_use_cases/xmp/q5.out +17 -0
- data/xquery_use_cases/xmp/q5.rb +38 -0
- data/xquery_use_cases/xmp/q5.xquery +13 -0
- data/xquery_use_cases/xmp/q6.out +28 -0
- data/xquery_use_cases/xmp/q6.rb +33 -0
- data/xquery_use_cases/xmp/q6.xquery +19 -0
- data/xquery_use_cases/xmp/q7.out +8 -0
- data/xquery_use_cases/xmp/q7.rb +30 -0
- data/xquery_use_cases/xmp/q7.xquery +12 -0
- data/xquery_use_cases/xmp/q8.out +7 -0
- data/xquery_use_cases/xmp/q8.rb +29 -0
- data/xquery_use_cases/xmp/q8.xquery +9 -0
- data/xquery_use_cases/xmp/q9.out +4 -0
- data/xquery_use_cases/xmp/q9.rb +29 -0
- data/xquery_use_cases/xmp/q9.xquery +7 -0
- data/xquery_use_cases/xmp/reviews.xml +24 -0
- metadata +342 -0
@@ -0,0 +1,35 @@
|
|
1
|
+
<bib>
|
2
|
+
<book>
|
3
|
+
<title>TCP/IP Illustrated</title>
|
4
|
+
<author>
|
5
|
+
<last>Stevens</last>
|
6
|
+
<first>W.</first>
|
7
|
+
</author>
|
8
|
+
</book>
|
9
|
+
<book>
|
10
|
+
<title>Advanced Programming in the Unix environment</title>
|
11
|
+
<author>
|
12
|
+
<last>Stevens</last>
|
13
|
+
<first>W.</first>
|
14
|
+
</author>
|
15
|
+
</book>
|
16
|
+
<book>
|
17
|
+
<title>Data on the Web</title>
|
18
|
+
<author>
|
19
|
+
<last>Abiteboul</last>
|
20
|
+
<first>Serge</first>
|
21
|
+
</author>
|
22
|
+
<author>
|
23
|
+
<last>Buneman</last>
|
24
|
+
<first>Peter</first>
|
25
|
+
</author>
|
26
|
+
<author>
|
27
|
+
<last>Suciu</last>
|
28
|
+
<first>Dan</first>
|
29
|
+
</author>
|
30
|
+
</book>
|
31
|
+
<reference>
|
32
|
+
<title>The Economics of Technology and Content for Digital TV</title>
|
33
|
+
<affiliation>CITI</affiliation>
|
34
|
+
</reference>
|
35
|
+
</bib>
|
@@ -0,0 +1,37 @@
|
|
1
|
+
#!/usr/bin/ruby -I../.. -rmagic_xml
|
2
|
+
#Copyright (c) 2006-2007 Tomasz Wegrzanowski <Tomasz.Wegrzanowski@gmail.com>
|
3
|
+
#
|
4
|
+
#Permission is hereby granted, free of charge, to any person obtaining a
|
5
|
+
#copy of this software and associated documentation files (the "Software"),
|
6
|
+
#to deal in the Software without restriction, including without limitation
|
7
|
+
#the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
8
|
+
#and/or sell copies of the Software, and to permit persons to whom the
|
9
|
+
#Software is furnished to do so, subject to the following conditions:
|
10
|
+
#
|
11
|
+
#The above copyright notice and this permission notice shall be included in
|
12
|
+
#all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15
|
+
#IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
16
|
+
#FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
17
|
+
#THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
18
|
+
#OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
19
|
+
#ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
20
|
+
#DEALINGS IN THE SOFTWARE.
|
21
|
+
|
22
|
+
|
23
|
+
XML.bib! {
|
24
|
+
doc = XML.load('bib.xml')
|
25
|
+
|
26
|
+
doc.children(:book) {|b|
|
27
|
+
if b.children(:author).size != 0
|
28
|
+
book!(b.children(:title), b.children(:author))
|
29
|
+
end
|
30
|
+
}
|
31
|
+
|
32
|
+
doc.children(:book) {|b|
|
33
|
+
if b.children(:editor).size != 0
|
34
|
+
reference!(b.children(:title), b.children(:editor).children(:affiliation))
|
35
|
+
end
|
36
|
+
}
|
37
|
+
}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<bib>
|
2
|
+
{
|
3
|
+
for $b in doc("http://bstore1.example.com/bib.xml")//book[author]
|
4
|
+
return
|
5
|
+
<book>
|
6
|
+
{ $b/title }
|
7
|
+
{ $b/author }
|
8
|
+
</book>
|
9
|
+
}
|
10
|
+
{
|
11
|
+
for $b in doc("http://bstore1.example.com/bib.xml")//book[editor]
|
12
|
+
return
|
13
|
+
<reference>
|
14
|
+
{ $b/title }
|
15
|
+
{$b/editor/affiliation}
|
16
|
+
</reference>
|
17
|
+
}
|
18
|
+
</bib>
|
@@ -0,0 +1,35 @@
|
|
1
|
+
#!/usr/bin/ruby -I../.. -rmagic_xml
|
2
|
+
#Copyright (c) 2006-2007 Tomasz Wegrzanowski <Tomasz.Wegrzanowski@gmail.com>
|
3
|
+
#
|
4
|
+
#Permission is hereby granted, free of charge, to any person obtaining a
|
5
|
+
#copy of this software and associated documentation files (the "Software"),
|
6
|
+
#to deal in the Software without restriction, including without limitation
|
7
|
+
#the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
8
|
+
#and/or sell copies of the Software, and to permit persons to whom the
|
9
|
+
#Software is furnished to do so, subject to the following conditions:
|
10
|
+
#
|
11
|
+
#The above copyright notice and this permission notice shall be included in
|
12
|
+
#all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15
|
+
#IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
16
|
+
#FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
17
|
+
#THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
18
|
+
#OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
19
|
+
#ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
20
|
+
#DEALINGS IN THE SOFTWARE.
|
21
|
+
|
22
|
+
|
23
|
+
XML.bib! {
|
24
|
+
books = XML.load('bib.xml').children(:book)
|
25
|
+
books.each_with_index{|book1, i|
|
26
|
+
aut1 = book1.children(:author).map{|a| [a[:@last], a[:@first]]}.sort
|
27
|
+
|
28
|
+
books.each_with_index{|book2, j|
|
29
|
+
next unless i < j and book1[:@title] != book2[:@title]
|
30
|
+
aut2 = book2.children(:author).map{|a| [a[:@last], a[:@first]]}.sort
|
31
|
+
|
32
|
+
xml!(:"book-pair", book1.child(:title), book2.child(:title)) if aut1 == aut2
|
33
|
+
}
|
34
|
+
}
|
35
|
+
}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<bib>
|
2
|
+
{
|
3
|
+
for $book1 in doc("http://bstore1.example.com/bib.xml")//book,
|
4
|
+
$book2 in doc("http://bstore1.example.com/bib.xml")//book
|
5
|
+
let $aut1 := for $a in $book1/author
|
6
|
+
order by $a/last, $a/first
|
7
|
+
return $a
|
8
|
+
let $aut2 := for $a in $book2/author
|
9
|
+
order by $a/last, $a/first
|
10
|
+
return $a
|
11
|
+
where $book1 << $book2
|
12
|
+
and not($book1/title = $book2/title)
|
13
|
+
and deep-equal($aut1, $aut2)
|
14
|
+
return
|
15
|
+
<book-pair>
|
16
|
+
{ $book1/title }
|
17
|
+
{ $book2/title }
|
18
|
+
</book-pair>
|
19
|
+
}
|
20
|
+
</bib>
|
@@ -0,0 +1,37 @@
|
|
1
|
+
<results>
|
2
|
+
<result>
|
3
|
+
<title>TCP/IP Illustrated</title>
|
4
|
+
<author>
|
5
|
+
<last>Stevens</last>
|
6
|
+
<first>W.</first>
|
7
|
+
</author>
|
8
|
+
</result>
|
9
|
+
<result>
|
10
|
+
<title>Advanced Programming in the Unix environment</title>
|
11
|
+
<author>
|
12
|
+
<last>Stevens</last>
|
13
|
+
<first>W.</first>
|
14
|
+
</author>
|
15
|
+
</result>
|
16
|
+
<result>
|
17
|
+
<title>Data on the Web</title>
|
18
|
+
<author>
|
19
|
+
<last>Abiteboul</last>
|
20
|
+
<first>Serge</first>
|
21
|
+
</author>
|
22
|
+
</result>
|
23
|
+
<result>
|
24
|
+
<title>Data on the Web</title>
|
25
|
+
<author>
|
26
|
+
<last>Buneman</last>
|
27
|
+
<first>Peter</first>
|
28
|
+
</author>
|
29
|
+
</result>
|
30
|
+
<result>
|
31
|
+
<title>Data on the Web</title>
|
32
|
+
<author>
|
33
|
+
<last>Suciu</last>
|
34
|
+
<first>Dan</first>
|
35
|
+
</author>
|
36
|
+
</result>
|
37
|
+
</results>
|
@@ -0,0 +1,30 @@
|
|
1
|
+
#!/usr/bin/ruby -I../.. -rmagic_xml
|
2
|
+
#Copyright (c) 2006-2007 Tomasz Wegrzanowski <Tomasz.Wegrzanowski@gmail.com>
|
3
|
+
#
|
4
|
+
#Permission is hereby granted, free of charge, to any person obtaining a
|
5
|
+
#copy of this software and associated documentation files (the "Software"),
|
6
|
+
#to deal in the Software without restriction, including without limitation
|
7
|
+
#the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
8
|
+
#and/or sell copies of the Software, and to permit persons to whom the
|
9
|
+
#Software is furnished to do so, subject to the following conditions:
|
10
|
+
#
|
11
|
+
#The above copyright notice and this permission notice shall be included in
|
12
|
+
#all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15
|
+
#IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
16
|
+
#FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
17
|
+
#THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
18
|
+
#OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
19
|
+
#ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
20
|
+
#DEALINGS IN THE SOFTWARE.
|
21
|
+
|
22
|
+
|
23
|
+
XML.results! {
|
24
|
+
XML.load('bib.xml').children(:book) {|b|
|
25
|
+
t = b.child(:title)
|
26
|
+
b.children(:author) {|a|
|
27
|
+
result!(t,a)
|
28
|
+
}
|
29
|
+
}
|
30
|
+
}
|
@@ -0,0 +1,34 @@
|
|
1
|
+
<results>
|
2
|
+
<result>
|
3
|
+
<title>TCP/IP Illustrated</title>
|
4
|
+
<author>
|
5
|
+
<last>Stevens</last>
|
6
|
+
<first>W.</first>
|
7
|
+
</author>
|
8
|
+
</result>
|
9
|
+
<result>
|
10
|
+
<title>Advanced Programming in the Unix environment</title>
|
11
|
+
<author>
|
12
|
+
<last>Stevens</last>
|
13
|
+
<first>W.</first>
|
14
|
+
</author>
|
15
|
+
</result>
|
16
|
+
<result>
|
17
|
+
<title>Data on the Web</title>
|
18
|
+
<author>
|
19
|
+
<last>Abiteboul</last>
|
20
|
+
<first>Serge</first>
|
21
|
+
</author>
|
22
|
+
<author>
|
23
|
+
<last>Buneman</last>
|
24
|
+
<first>Peter</first>
|
25
|
+
</author>
|
26
|
+
<author>
|
27
|
+
<last>Suciu</last>
|
28
|
+
<first>Dan</first>
|
29
|
+
</author>
|
30
|
+
</result>
|
31
|
+
<result>
|
32
|
+
<title>The Economics of Technology and Content for Digital TV</title>
|
33
|
+
</result>
|
34
|
+
</results>
|
@@ -0,0 +1,27 @@
|
|
1
|
+
#!/usr/bin/ruby -I../.. -rmagic_xml
|
2
|
+
#Copyright (c) 2006-2007 Tomasz Wegrzanowski <Tomasz.Wegrzanowski@gmail.com>
|
3
|
+
#
|
4
|
+
#Permission is hereby granted, free of charge, to any person obtaining a
|
5
|
+
#copy of this software and associated documentation files (the "Software"),
|
6
|
+
#to deal in the Software without restriction, including without limitation
|
7
|
+
#the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
8
|
+
#and/or sell copies of the Software, and to permit persons to whom the
|
9
|
+
#Software is furnished to do so, subject to the following conditions:
|
10
|
+
#
|
11
|
+
#The above copyright notice and this permission notice shall be included in
|
12
|
+
#all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15
|
+
#IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
16
|
+
#FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
17
|
+
#THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
18
|
+
#OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
19
|
+
#ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
20
|
+
#DEALINGS IN THE SOFTWARE.
|
21
|
+
|
22
|
+
|
23
|
+
XML.results! {
|
24
|
+
XML.load('bib.xml').children(:book) {|b|
|
25
|
+
result!(b.children(:title), b.children(:author))
|
26
|
+
}
|
27
|
+
}
|
@@ -0,0 +1,31 @@
|
|
1
|
+
<results>
|
2
|
+
<result>
|
3
|
+
<author>
|
4
|
+
<last>Abiteboul</last>
|
5
|
+
<first>Serge</first>
|
6
|
+
</author>
|
7
|
+
<title>Data on the Web</title>
|
8
|
+
</result>
|
9
|
+
<result>
|
10
|
+
<author>
|
11
|
+
<last>Buneman</last>
|
12
|
+
<first>Peter</first>
|
13
|
+
</author>
|
14
|
+
<title>Data on the Web</title>
|
15
|
+
</result>
|
16
|
+
<result>
|
17
|
+
<author>
|
18
|
+
<last>Stevens</last>
|
19
|
+
<first>W.</first>
|
20
|
+
</author>
|
21
|
+
<title>TCP/IP Illustrated</title>
|
22
|
+
<title>Advanced Programming in the Unix environment</title>
|
23
|
+
</result>
|
24
|
+
<result>
|
25
|
+
<author>
|
26
|
+
<last>Suciu</last>
|
27
|
+
<first>Dan</first>
|
28
|
+
</author>
|
29
|
+
<title>Data on the Web</title>
|
30
|
+
</result>
|
31
|
+
</results>
|
@@ -0,0 +1,44 @@
|
|
1
|
+
#!/usr/bin/ruby -I../.. -rmagic_xml
|
2
|
+
#Copyright (c) 2006-2007 Tomasz Wegrzanowski <Tomasz.Wegrzanowski@gmail.com>
|
3
|
+
#
|
4
|
+
#Permission is hereby granted, free of charge, to any person obtaining a
|
5
|
+
#copy of this software and associated documentation files (the "Software"),
|
6
|
+
#to deal in the Software without restriction, including without limitation
|
7
|
+
#the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
8
|
+
#and/or sell copies of the Software, and to permit persons to whom the
|
9
|
+
#Software is furnished to do so, subject to the following conditions:
|
10
|
+
#
|
11
|
+
#The above copyright notice and this permission notice shall be included in
|
12
|
+
#all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15
|
+
#IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
16
|
+
#FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
17
|
+
#THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
18
|
+
#OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
19
|
+
#ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
20
|
+
#DEALINGS IN THE SOFTWARE.
|
21
|
+
|
22
|
+
|
23
|
+
XML.results! {
|
24
|
+
doc = XML.load('bib.xml')
|
25
|
+
a = doc.descendants(:author)
|
26
|
+
books = doc.children(:book)
|
27
|
+
|
28
|
+
a.map{|node|
|
29
|
+
[node[:@last], node[:@first]]
|
30
|
+
}.uniq.sort.each {|last, first|
|
31
|
+
result! {
|
32
|
+
author! {
|
33
|
+
last! last
|
34
|
+
first! first
|
35
|
+
}
|
36
|
+
books.each{|b|
|
37
|
+
next unless b.children(:author).any?{|ba|
|
38
|
+
ba[:@last] == last and ba[:@first] == first
|
39
|
+
}
|
40
|
+
add! b.children(:title)
|
41
|
+
}
|
42
|
+
}
|
43
|
+
}
|
44
|
+
}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<results>
|
2
|
+
{
|
3
|
+
let $a := doc("http://bstore1.example.com/bib/bib.xml")//author
|
4
|
+
for $last in distinct-values($a/last),
|
5
|
+
$first in distinct-values($a[last=$last]/first)
|
6
|
+
order by $last, $first
|
7
|
+
return
|
8
|
+
<result>
|
9
|
+
<author>
|
10
|
+
<last>{ $last }</last>
|
11
|
+
<first>{ $first }</first>
|
12
|
+
</author>
|
13
|
+
{
|
14
|
+
for $b in doc("http://bstore1.example.com/bib.xml")/bib/book
|
15
|
+
where some $ba in $b/author
|
16
|
+
satisfies ($ba/last = $last and $ba/first=$first)
|
17
|
+
return $b/title
|
18
|
+
}
|
19
|
+
</result>
|
20
|
+
}
|
21
|
+
</results>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<books-with-prices>
|
2
|
+
<book-with-prices>
|
3
|
+
<title>TCP/IP Illustrated</title>
|
4
|
+
<price-bstore2>65.95</price-bstore2>
|
5
|
+
<price-bstore1>65.95</price-bstore1>
|
6
|
+
</book-with-prices>
|
7
|
+
<book-with-prices>
|
8
|
+
<title>Advanced Programming in the Unix environment</title>
|
9
|
+
<price-bstore2>65.95</price-bstore2>
|
10
|
+
<price-bstore1>65.95</price-bstore1>
|
11
|
+
</book-with-prices>
|
12
|
+
<book-with-prices>
|
13
|
+
<title>Data on the Web</title>
|
14
|
+
<price-bstore2>34.95</price-bstore2>
|
15
|
+
<price-bstore1>39.95</price-bstore1>
|
16
|
+
</book-with-prices>
|
17
|
+
</books-with-prices>
|
@@ -0,0 +1,38 @@
|
|
1
|
+
#!/usr/bin/ruby -I../.. -rmagic_xml
|
2
|
+
#Copyright (c) 2006-2007 Tomasz Wegrzanowski <Tomasz.Wegrzanowski@gmail.com>
|
3
|
+
#
|
4
|
+
#Permission is hereby granted, free of charge, to any person obtaining a
|
5
|
+
#copy of this software and associated documentation files (the "Software"),
|
6
|
+
#to deal in the Software without restriction, including without limitation
|
7
|
+
#the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
8
|
+
#and/or sell copies of the Software, and to permit persons to whom the
|
9
|
+
#Software is furnished to do so, subject to the following conditions:
|
10
|
+
#
|
11
|
+
#The above copyright notice and this permission notice shall be included in
|
12
|
+
#all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15
|
+
#IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
16
|
+
#FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
17
|
+
#THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
18
|
+
#OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
19
|
+
#ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
20
|
+
#DEALINGS IN THE SOFTWARE.
|
21
|
+
|
22
|
+
|
23
|
+
# dash in tag names forces us to use
|
24
|
+
# a bit less convenient methods.
|
25
|
+
xml!(:"books-with-prices") {
|
26
|
+
books = XML.load("bib.xml").descendants(:book)
|
27
|
+
entries = XML.load("reviews.xml").descendants(:entry)
|
28
|
+
books.each{|b|
|
29
|
+
entries.each{|a|
|
30
|
+
next unless a[:@title] == b[:@title]
|
31
|
+
xml!(:"book-with-prices") {
|
32
|
+
add! b.child(:title)
|
33
|
+
xml!(:"price-bstore2", a[:@price])
|
34
|
+
xml!(:"price-bstore1", b[:@price])
|
35
|
+
}
|
36
|
+
}
|
37
|
+
}
|
38
|
+
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<books-with-prices>
|
2
|
+
{
|
3
|
+
for $b in doc("http://bstore1.example.com/bib.xml")//book,
|
4
|
+
$a in doc("http://bstore2.example.com/reviews.xml")//entry
|
5
|
+
where $b/title = $a/title
|
6
|
+
return
|
7
|
+
<book-with-prices>
|
8
|
+
{ $b/title }
|
9
|
+
<price-bstore2>{ $a/price/text() }</price-bstore2>
|
10
|
+
<price-bstore1>{ $b/price/text() }</price-bstore1>
|
11
|
+
</book-with-prices>
|
12
|
+
}
|
13
|
+
</books-with-prices>
|
@@ -0,0 +1,28 @@
|
|
1
|
+
<bib>
|
2
|
+
<book>
|
3
|
+
<title>TCP/IP Illustrated</title>
|
4
|
+
<author>
|
5
|
+
<last>Stevens</last>
|
6
|
+
<first>W.</first>
|
7
|
+
</author>
|
8
|
+
</book>
|
9
|
+
<book>
|
10
|
+
<title>Advanced Programming in the Unix environment</title>
|
11
|
+
<author>
|
12
|
+
<last>Stevens</last>
|
13
|
+
<first>W.</first>
|
14
|
+
</author>
|
15
|
+
</book>
|
16
|
+
<book>
|
17
|
+
<title>Data on the Web</title>
|
18
|
+
<author>
|
19
|
+
<last>Abiteboul</last>
|
20
|
+
<first>Serge</first>
|
21
|
+
</author>
|
22
|
+
<author>
|
23
|
+
<last>Buneman</last>
|
24
|
+
<first>Peter</first>
|
25
|
+
</author>
|
26
|
+
<et-al/>
|
27
|
+
</book>
|
28
|
+
</bib>
|
@@ -0,0 +1,33 @@
|
|
1
|
+
#!/usr/bin/ruby -I../.. -rmagic_xml
|
2
|
+
#Copyright (c) 2006-2007 Tomasz Wegrzanowski <Tomasz.Wegrzanowski@gmail.com>
|
3
|
+
#
|
4
|
+
#Permission is hereby granted, free of charge, to any person obtaining a
|
5
|
+
#copy of this software and associated documentation files (the "Software"),
|
6
|
+
#to deal in the Software without restriction, including without limitation
|
7
|
+
#the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
8
|
+
#and/or sell copies of the Software, and to permit persons to whom the
|
9
|
+
#Software is furnished to do so, subject to the following conditions:
|
10
|
+
#
|
11
|
+
#The above copyright notice and this permission notice shall be included in
|
12
|
+
#all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15
|
+
#IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
16
|
+
#FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
17
|
+
#THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
18
|
+
#OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
19
|
+
#ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
20
|
+
#DEALINGS IN THE SOFTWARE.
|
21
|
+
|
22
|
+
|
23
|
+
XML.bib! {
|
24
|
+
XML.load('bib.xml').children(:book) {|b|
|
25
|
+
next unless b.children(:author).size > 0
|
26
|
+
book! {
|
27
|
+
add! b.children(:title)
|
28
|
+
authors = b.children(:author)
|
29
|
+
add! authors[0,2]
|
30
|
+
xml!(:"et-al") if authors.size > 2
|
31
|
+
}
|
32
|
+
}
|
33
|
+
}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<bib>
|
2
|
+
{
|
3
|
+
for $b in doc("http://bstore1.example.com/bib.xml")//book
|
4
|
+
where count($b/author) > 0
|
5
|
+
return
|
6
|
+
<book>
|
7
|
+
{ $b/title }
|
8
|
+
{
|
9
|
+
for $a in $b/author[position()<=2]
|
10
|
+
return $a
|
11
|
+
}
|
12
|
+
{
|
13
|
+
if (count($b/author) > 2)
|
14
|
+
then <et-al/>
|
15
|
+
else ()
|
16
|
+
}
|
17
|
+
</book>
|
18
|
+
}
|
19
|
+
</bib>
|
@@ -0,0 +1,30 @@
|
|
1
|
+
#!/usr/bin/ruby -I../.. -rmagic_xml
|
2
|
+
#Copyright (c) 2006-2007 Tomasz Wegrzanowski <Tomasz.Wegrzanowski@gmail.com>
|
3
|
+
#
|
4
|
+
#Permission is hereby granted, free of charge, to any person obtaining a
|
5
|
+
#copy of this software and associated documentation files (the "Software"),
|
6
|
+
#to deal in the Software without restriction, including without limitation
|
7
|
+
#the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
8
|
+
#and/or sell copies of the Software, and to permit persons to whom the
|
9
|
+
#Software is furnished to do so, subject to the following conditions:
|
10
|
+
#
|
11
|
+
#The above copyright notice and this permission notice shall be included in
|
12
|
+
#all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15
|
+
#IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
16
|
+
#FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
17
|
+
#THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
18
|
+
#OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
19
|
+
#ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
20
|
+
#DEALINGS IN THE SOFTWARE.
|
21
|
+
|
22
|
+
|
23
|
+
XML.bib! {
|
24
|
+
XML.load('bib.xml').children(:book).find_all{|b|
|
25
|
+
b[:@publisher] == "Addison-Wesley" and
|
26
|
+
b[:year].to_i > 1991
|
27
|
+
}.sort_by{|b| b[:@title] }.each {|b|
|
28
|
+
book!({:year => b[:year]}, b.child(:title))
|
29
|
+
}
|
30
|
+
}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/ruby -I../.. -rmagic_xml
|
2
|
+
#Copyright (c) 2006-2007 Tomasz Wegrzanowski <Tomasz.Wegrzanowski@gmail.com>
|
3
|
+
#
|
4
|
+
#Permission is hereby granted, free of charge, to any person obtaining a
|
5
|
+
#copy of this software and associated documentation files (the "Software"),
|
6
|
+
#to deal in the Software without restriction, including without limitation
|
7
|
+
#the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
8
|
+
#and/or sell copies of the Software, and to permit persons to whom the
|
9
|
+
#Software is furnished to do so, subject to the following conditions:
|
10
|
+
#
|
11
|
+
#The above copyright notice and this permission notice shall be included in
|
12
|
+
#all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15
|
+
#IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
16
|
+
#FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
17
|
+
#THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
18
|
+
#OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
19
|
+
#ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
20
|
+
#DEALINGS IN THE SOFTWARE.
|
21
|
+
|
22
|
+
|
23
|
+
XML.load('bib.xml').children(:book) {|b|
|
24
|
+
b.descendants {|e|
|
25
|
+
if e.is_a? XML and e =~ /Suciu/ and e.name.to_s =~ /or$/
|
26
|
+
XML.book!(b.child(:title), e)
|
27
|
+
end
|
28
|
+
}
|
29
|
+
}
|