1GraphViz2::Parse::XML(3U)ser Contributed Perl DocumentatiGornaphViz2::Parse::XML(3)
2
3
4
6 GraphViz2::Parse::XML - Visualize XML as a graph
7
9 #!/usr/bin/env perl
10
11 use strict;
12 use warnings;
13
14 use File::Spec;
15
16 use GraphViz2;
17 use GraphViz2::Parse::XML;
18
19 use Log::Handler;
20
21 # ------------------------------------------------
22
23 my($logger) = Log::Handler -> new;
24
25 $logger -> add
26 (
27 screen =>
28 {
29 maxlevel => 'debug',
30 message_layout => '%m',
31 minlevel => 'error',
32 }
33 );
34
35 my($graph) = GraphViz2 -> new
36 (
37 edge => {color => 'grey'},
38 global => {directed => 1},
39 graph => {rankdir => 'TB'},
40 logger => $logger,
41 node => {color => 'blue', shape => 'oval'},
42 );
43 my($g) = GraphViz2::Parse::XML -> new(graph => $graph);
44
45 $g -> create(file_name => File::Spec -> catfile('t', 'sample.xml') );
46
47 my($format) = shift || 'svg';
48 my($output_file) = shift || File::Spec -> catfile('html', "parse.xml.pp.$format");
49
50 $graph -> run(format => $format, output_file => $output_file);
51
52 See scripts/parse.xml.pp.pl ("Scripts Shipped with this Module" in
53 GraphViz2).
54
56 Takes an XML file and converts it into a graph, using the pure-Perl
57 XML::Tiny.
58
59 You can write the result in any format supported by Graphviz
60 <http://www.graphviz.org/>.
61
62 Here is the list of output formats
63 <http://www.graphviz.org/content/output-formats>.
64
66 This module is available as a Unix-style distro (*.tgz).
67
68 See <http://savage.net.au/Perl-modules/html/installing-a-module.html>
69 for help on unpacking and installing distros.
70
72 Install GraphViz2 as you would for any "Perl" module:
73
74 Run:
75
76 cpanm GraphViz2
77
78 or run:
79
80 sudo cpan GraphViz2
81
82 or unpack the distro, and then either:
83
84 perl Build.PL
85 ./Build
86 ./Build test
87 sudo ./Build install
88
89 or:
90
91 perl Makefile.PL
92 make (or dmake or nmake)
93 make test
94 make install
95
97 Calling new()
98 "new()" is called as "my($obj) = GraphViz2::Parse::XML -> new(k1 => v1,
99 k2 => v2, ...)".
100
101 It returns a new object of type "GraphViz2::Parse::XML".
102
103 Key-value pairs accepted in the parameter list:
104
105 o graph => $graphviz_object
106 This option specifies the GraphViz2 object to use. This allows you
107 to configure it as desired.
108
109 The default is GraphViz2 -> new. The default attributes are the
110 same as in the synopsis, above, except for the logger of course,
111 which defaults to ''.
112
113 This key is optional.
114
116 create(file_name => $file_name)
117 Creates the graph, which is accessible via the graph() method, or via
118 the graph object you passed to new().
119
120 Returns $self for method chaining.
121
122 $file_name is the name of an XML file.
123
124 graph()
125 Returns the graph object, either the one supplied to new() or the one
126 created during the call to new().
127
129 See "FAQ" in GraphViz2 and "Scripts Shipped with this Module" in
130 GraphViz2.
131
133 Many thanks are due to the people who chose to make Graphviz
134 <http://www.graphviz.org/> Open Source.
135
136 And thanks to Leon Brocard <http://search.cpan.org/~lbrocard/>, who
137 wrote GraphViz, and kindly gave me co-maint of the module.
138
140 Version numbers < 1.00 represent development versions. From 1.00 up,
141 they are production versions.
142
144 The file Changes was converted into Changelog.ini by
145 Module::Metadata::Changes.
146
148 Email the author, or log a bug on RT:
149
150 <https://rt.cpan.org/Public/Dist/Display.html?Name=GraphViz2>.
151
153 GraphViz2 was written by Ron Savage <ron@savage.net.au> in 2011.
154
155 Home page: <http://savage.net.au/index.html>.
156
158 Australian copyright (c) 2011, Ron Savage.
159
160 All Programs of mine are 'OSI Certified Open Source Software';
161 you can redistribute them and/or modify them under the terms of
162 The Perl License, a copy of which is available at:
163 http://dev.perl.org/licenses/
164
165
166
167perl v5.32.0 2020-07-28 GraphViz2::Parse::XML(3)