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,44 @@
|
|
1
|
+
<result><para>With the ever-changing and growing global market, companies and
|
2
|
+
large organizations are searching for ways to become more viable and
|
3
|
+
competitive. Downsizing and other cost-cutting measures demand more
|
4
|
+
efficient use of corporate resources. One very important resource is
|
5
|
+
an organization's information.</para><para>As part of the move toward integrated information management,
|
6
|
+
whole industries are developing and implementing standards for
|
7
|
+
exchanging technical information. This report describes how one such
|
8
|
+
standard, the Standard Generalized Markup Language (SGML), works as
|
9
|
+
part of an overall information management strategy.</para><para>While SGML is a fairly recent technology, the use of
|
10
|
+
<emph>markup</emph> in computer-generated documents has existed for a
|
11
|
+
while.</para><para>Markup is everything in a document that is not content. The
|
12
|
+
traditional meaning of markup is the manual <emph>marking</emph> up
|
13
|
+
of typewritten text to give instructions for a typesetter or
|
14
|
+
compositor about how to fit the text on a page and what typefaces to
|
15
|
+
use. This kind of markup is known as <emph>procedural markup</emph>.</para><para>Most electronic publishing systems today use some form of
|
16
|
+
procedural markup. Procedural markup codes are good for one
|
17
|
+
presentation of the information.</para><para>Generic markup (also known as descriptive markup) describes the
|
18
|
+
<emph>purpose</emph> of the text in a document. A basic concept of
|
19
|
+
generic markup is that the content of a document must be separate from
|
20
|
+
the style. Generic markup allows for multiple presentations of the
|
21
|
+
information.</para><para>Industries involved in technical documentation increasingly
|
22
|
+
prefer generic over procedural markup schemes. When a company changes
|
23
|
+
software or hardware systems, enormous data translation tasks arise,
|
24
|
+
often resulting in errors.</para><para>SGML defines a strict markup scheme with a syntax for defining
|
25
|
+
document data elements and an overall framework for marking up
|
26
|
+
documents.</para><para>SGML can describe and create documents that are not dependent on
|
27
|
+
any hardware, software, formatter, or operating system. Since SGML documents
|
28
|
+
conform to an international standard, they are portable.</para><para>You can break a typical document into three layers: structure,
|
29
|
+
content, and style. SGML works by separating these three aspects and
|
30
|
+
deals mainly with the relationship between structure and content.</para><para>At the heart of an SGML application is a file called the DTD, or
|
31
|
+
Document Type Definition. The DTD sets up the structure of a document,
|
32
|
+
much like a database schema describes the types of information it
|
33
|
+
handles.</para><para>A database schema also defines the relationships between the
|
34
|
+
various types of data. Similarly, a DTD specifies <emph>rules</emph>
|
35
|
+
to help ensure documents have a consistent, logical structure.</para><para>Content is the information itself. The method for identifying
|
36
|
+
the information and its meaning within this framework is called
|
37
|
+
<emph>tagging</emph>. Tagging must
|
38
|
+
conform to the rules established in the DTD (see <xref xrefid='top4'/>).</para><para>SGML does not standardize style or other processing methods for
|
39
|
+
information stored in SGML.</para><para>The Graphic Communications Association has been
|
40
|
+
instrumental in the development of SGML. GCA provides conferences,
|
41
|
+
tutorials, newsletters, and publication sales for both members and
|
42
|
+
non-members.</para><para security='c'>Exiled members of the former Soviet Union's secret
|
43
|
+
police, the KGB, have infiltrated the upper ranks of the GCA and are
|
44
|
+
planning the Final Revolution as soon as DSSSL is completed.</para></result>
|
@@ -0,0 +1,23 @@
|
|
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.result!(XML.load('sgml.xml').descendants(:para))
|
@@ -0,0 +1 @@
|
|
1
|
+
<result><title>Content</title></result>
|
@@ -0,0 +1,28 @@
|
|
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
|
+
doc = XML.load('sgml.xml')
|
24
|
+
|
25
|
+
XML.result! {
|
26
|
+
xref = doc.descendants(:xref).find{|xref| xref[:xrefid] == "top4"}
|
27
|
+
add! doc.range(nil,xref).descendants(:title)[-1]
|
28
|
+
}
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<result><para>With the ever-changing and growing global market, companies and
|
2
|
+
large organizations are searching for ways to become more viable and
|
3
|
+
competitive. Downsizing and other cost-cutting measures demand more
|
4
|
+
efficient use of corporate resources. One very important resource is
|
5
|
+
an organization's information.</para><para>As part of the move toward integrated information management,
|
6
|
+
whole industries are developing and implementing standards for
|
7
|
+
exchanging technical information. This report describes how one such
|
8
|
+
standard, the Standard Generalized Markup Language (SGML), works as
|
9
|
+
part of an overall information management strategy.</para><para>While SGML is a fairly recent technology, the use of
|
10
|
+
<emph>markup</emph> in computer-generated documents has existed for a
|
11
|
+
while.</para><para>Markup is everything in a document that is not content. The
|
12
|
+
traditional meaning of markup is the manual <emph>marking</emph> up
|
13
|
+
of typewritten text to give instructions for a typesetter or
|
14
|
+
compositor about how to fit the text on a page and what typefaces to
|
15
|
+
use. This kind of markup is known as <emph>procedural markup</emph>.</para><para>SGML defines a strict markup scheme with a syntax for defining
|
16
|
+
document data elements and an overall framework for marking up
|
17
|
+
documents.</para><para>SGML can describe and create documents that are not dependent on
|
18
|
+
any hardware, software, formatter, or operating system. Since SGML documents
|
19
|
+
conform to an international standard, they are portable.</para><para>You can break a typical document into three layers: structure,
|
20
|
+
content, and style. SGML works by separating these three aspects and
|
21
|
+
deals mainly with the relationship between structure and content.</para><para>The Graphic Communications Association has been
|
22
|
+
instrumental in the development of SGML. GCA provides conferences,
|
23
|
+
tutorials, newsletters, and publication sales for both members and
|
24
|
+
non-members.</para><para security='c'>Exiled members of the former Soviet Union's secret
|
25
|
+
police, the KGB, have infiltrated the upper ranks of the GCA and are
|
26
|
+
planning the Final Revolution as soon as DSSSL is completed.</para></result>
|
@@ -0,0 +1,23 @@
|
|
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
|
+
puts XML.result(XML.load('sgml.xml').descendants(:intro, :para))
|
@@ -0,0 +1,6 @@
|
|
1
|
+
<result><para>The Graphic Communications Association has been
|
2
|
+
instrumental in the development of SGML. GCA provides conferences,
|
3
|
+
tutorials, newsletters, and publication sales for both members and
|
4
|
+
non-members.</para><para security='c'>Exiled members of the former Soviet Union's secret
|
5
|
+
police, the KGB, have infiltrated the upper ranks of the GCA and are
|
6
|
+
planning the Final Revolution as soon as DSSSL is completed.</para></result>
|
@@ -0,0 +1,28 @@
|
|
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.result! {
|
24
|
+
XML.load('sgml.xml').descendants(:chapter) {|c|
|
25
|
+
next unless c.children(:intro).empty?
|
26
|
+
add! c.children(:section, :intro, :para)
|
27
|
+
}
|
28
|
+
}
|
@@ -0,0 +1,25 @@
|
|
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.result!(
|
24
|
+
XML.load('sgml.xml').descendants(:chapter)[1].descendants(:section)[2].descendants(:para)[1]
|
25
|
+
)
|
@@ -0,0 +1,23 @@
|
|
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.result!(XML.load('sgml.xml').descendants(:para).find_all{|p| p[:security] == 'c'})
|
@@ -0,0 +1 @@
|
|
1
|
+
<result><stitle>What is markup?</stitle><stitle>What is SGML?</stitle><stitle>How does SGML work?</stitle><stitle/></result>
|
@@ -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.result! {
|
24
|
+
XML.load('sgml.xml').descendants(:section).each{|s|
|
25
|
+
stitle! s[:shorttitle]
|
26
|
+
}
|
27
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
<result><first_letter>W</first_letter><first_letter>W</first_letter><first_letter>M</first_letter><first_letter>S</first_letter><first_letter>Y</first_letter><first_letter>T</first_letter></result>
|
@@ -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.result! {
|
24
|
+
XML.load('sgml.xml').descendants(:intro) {|i|
|
25
|
+
first_letter! i.children(:para)[0].text[0,1]
|
26
|
+
}
|
27
|
+
}
|
@@ -0,0 +1,34 @@
|
|
1
|
+
<result><section shorttitle='What is SGML?'>
|
2
|
+
<title>What <emph>is</emph> SGML in the grand scheme of the universe, anyway?</title>
|
3
|
+
<intro>
|
4
|
+
<para>SGML defines a strict markup scheme with a syntax for defining
|
5
|
+
document data elements and an overall framework for marking up
|
6
|
+
documents.</para>
|
7
|
+
<para>SGML can describe and create documents that are not dependent on
|
8
|
+
any hardware, software, formatter, or operating system. Since SGML documents
|
9
|
+
conform to an international standard, they are portable.</para></intro></section><section shorttitle='How does SGML work?'>
|
10
|
+
<title>How is SGML and would you recommend it to your grandmother?</title>
|
11
|
+
<intro>
|
12
|
+
<para>You can break a typical document into three layers: structure,
|
13
|
+
content, and style. SGML works by separating these three aspects and
|
14
|
+
deals mainly with the relationship between structure and content.</para></intro>
|
15
|
+
<topic topicid='top4'>
|
16
|
+
<title>Structure</title>
|
17
|
+
<para>At the heart of an SGML application is a file called the DTD, or
|
18
|
+
Document Type Definition. The DTD sets up the structure of a document,
|
19
|
+
much like a database schema describes the types of information it
|
20
|
+
handles.</para>
|
21
|
+
<para>A database schema also defines the relationships between the
|
22
|
+
various types of data. Similarly, a DTD specifies <emph>rules</emph>
|
23
|
+
to help ensure documents have a consistent, logical structure.</para></topic>
|
24
|
+
<topic topicid='top5'>
|
25
|
+
<title>Content</title>
|
26
|
+
<para>Content is the information itself. The method for identifying
|
27
|
+
the information and its meaning within this framework is called
|
28
|
+
<emph>tagging</emph>. Tagging must
|
29
|
+
conform to the rules established in the DTD (see <xref xrefid='top4'/>).</para>
|
30
|
+
<graphic graphname='tagexamp'/></topic>
|
31
|
+
<topic topicid='top6'>
|
32
|
+
<title>Style</title>
|
33
|
+
<para>SGML does not standardize style or other processing methods for
|
34
|
+
information stored in SGML.</para></topic></section></result>
|
@@ -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.result! {
|
24
|
+
XML.load('sgml.xml').descendants(:section) {|s|
|
25
|
+
add! s if s.descendants(:title).any?{|t| t =~ /is SGML/}
|
26
|
+
}
|
27
|
+
}
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<result><section shorttitle='How does SGML work?'>
|
2
|
+
<title>How is SGML and would you recommend it to your grandmother?</title>
|
3
|
+
<intro>
|
4
|
+
<para>You can break a typical document into three layers: structure,
|
5
|
+
content, and style. SGML works by separating these three aspects and
|
6
|
+
deals mainly with the relationship between structure and content.</para></intro>
|
7
|
+
<topic topicid='top4'>
|
8
|
+
<title>Structure</title>
|
9
|
+
<para>At the heart of an SGML application is a file called the DTD, or
|
10
|
+
Document Type Definition. The DTD sets up the structure of a document,
|
11
|
+
much like a database schema describes the types of information it
|
12
|
+
handles.</para>
|
13
|
+
<para>A database schema also defines the relationships between the
|
14
|
+
various types of data. Similarly, a DTD specifies <emph>rules</emph>
|
15
|
+
to help ensure documents have a consistent, logical structure.</para></topic>
|
16
|
+
<topic topicid='top5'>
|
17
|
+
<title>Content</title>
|
18
|
+
<para>Content is the information itself. The method for identifying
|
19
|
+
the information and its meaning within this framework is called
|
20
|
+
<emph>tagging</emph>. Tagging must
|
21
|
+
conform to the rules established in the DTD (see <xref xrefid='top4'/>).</para>
|
22
|
+
<graphic graphname='tagexamp'/></topic>
|
23
|
+
<topic topicid='top6'>
|
24
|
+
<title>Style</title>
|
25
|
+
<para>SGML does not standardize style or other processing methods for
|
26
|
+
information stored in SGML.</para></topic></section></result>
|
@@ -0,0 +1,32 @@
|
|
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.result! {
|
24
|
+
doc = XML.load('sgml.xml')
|
25
|
+
# If we don't normalize "single text node" isn't very meaningful
|
26
|
+
doc.normalize!
|
27
|
+
doc.descendants(:section) {|s|
|
28
|
+
add! s if s.descendants(:title).any?{|t|
|
29
|
+
t.descendants.any?{|d| d.is_a? String and d =~ /is SGML/}
|
30
|
+
}
|
31
|
+
}
|
32
|
+
}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<result><topic topicid='top4'>
|
2
|
+
<title>Structure</title>
|
3
|
+
<para>At the heart of an SGML application is a file called the DTD, or
|
4
|
+
Document Type Definition. The DTD sets up the structure of a document,
|
5
|
+
much like a database schema describes the types of information it
|
6
|
+
handles.</para>
|
7
|
+
<para>A database schema also defines the relationships between the
|
8
|
+
various types of data. Similarly, a DTD specifies <emph>rules</emph>
|
9
|
+
to help ensure documents have a consistent, logical structure.</para></topic></result>
|
@@ -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
|
+
doc = XML.load('sgml.xml')
|
24
|
+
|
25
|
+
XML.result! {
|
26
|
+
doc.descendants(:xref) {|xref|
|
27
|
+
add! doc.descendants(:topic).find_all{|t| t[:topicid] == xref[:xrefid]}
|
28
|
+
}
|
29
|
+
}
|