author | Simon Howkins <simonh@symbian.org> |
Mon, 22 Nov 2010 16:51:00 +0000 | |
branch | HighFidelityModel |
changeset 508 | 5725bcd8254c |
parent 312 | 9527bd30de64 |
permissions | -rw-r--r-- |
206
eccc98839441
Sysdef tools: additional comments and help.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
201
diff
changeset
|
1 |
# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
eccc98839441
Sysdef tools: additional comments and help.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
201
diff
changeset
|
2 |
# All rights reserved. |
eccc98839441
Sysdef tools: additional comments and help.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
201
diff
changeset
|
3 |
# This component and the accompanying materials are made available |
eccc98839441
Sysdef tools: additional comments and help.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
201
diff
changeset
|
4 |
# under the terms of "Eclipse Public License v1.0" |
eccc98839441
Sysdef tools: additional comments and help.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
201
diff
changeset
|
5 |
# which accompanies this distribution, and is available |
eccc98839441
Sysdef tools: additional comments and help.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
201
diff
changeset
|
6 |
# at the URL "http://www.eclipse.org/legal/epl-v10.html". |
eccc98839441
Sysdef tools: additional comments and help.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
201
diff
changeset
|
7 |
# |
eccc98839441
Sysdef tools: additional comments and help.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
201
diff
changeset
|
8 |
# Initial Contributors: |
eccc98839441
Sysdef tools: additional comments and help.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
201
diff
changeset
|
9 |
# Nokia Corporation - initial contribution. |
eccc98839441
Sysdef tools: additional comments and help.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
201
diff
changeset
|
10 |
# |
eccc98839441
Sysdef tools: additional comments and help.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
201
diff
changeset
|
11 |
# Contributors: |
eccc98839441
Sysdef tools: additional comments and help.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
201
diff
changeset
|
12 |
# |
eccc98839441
Sysdef tools: additional comments and help.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
201
diff
changeset
|
13 |
# Description: |
eccc98839441
Sysdef tools: additional comments and help.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
201
diff
changeset
|
14 |
# This will create a new root system definition file based on the provided template |
eccc98839441
Sysdef tools: additional comments and help.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
201
diff
changeset
|
15 |
#!/usr/bin/perl |
eccc98839441
Sysdef tools: additional comments and help.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
201
diff
changeset
|
16 |
|
151
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
17 |
use strict; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
18 |
|
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
19 |
|
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
20 |
use FindBin; # for FindBin::Bin |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
21 |
use lib $FindBin::Bin; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
22 |
use lib "$FindBin::Bin/lib"; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
23 |
|
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
24 |
use Cwd; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
25 |
use Cwd 'abs_path'; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
26 |
use Getopt::Long; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
27 |
use File::Basename; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
28 |
use File::Spec; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
29 |
use XML::DOM; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
30 |
|
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
31 |
my $output; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
32 |
my $path; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
33 |
my $defaultns = 'http://www.symbian.org/system-definition'; # needed if no DTD |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
34 |
my @searchpaths; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
35 |
my @searchroots; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
36 |
my %additional; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
37 |
my %add; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
38 |
my %newNs; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
39 |
my $warning = "Error"; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
40 |
my $placeholders=0; |
312
9527bd30de64
updates to validation scripts and bugfixes for rootsysdef
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
206
diff
changeset
|
41 |
my $sysmodelname; |
151
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
42 |
|
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
43 |
my @tdOrder =("hb","se", "lo","dc", "vc" , "pr", "dm", "de", "mm", "ma" , "ui", "rt", "to" ); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
44 |
|
206
eccc98839441
Sysdef tools: additional comments and help.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
201
diff
changeset
|
45 |
sub help |
eccc98839441
Sysdef tools: additional comments and help.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
201
diff
changeset
|
46 |
{ |
eccc98839441
Sysdef tools: additional comments and help.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
201
diff
changeset
|
47 |
my $name= $0; $name=~s,^.*[\\/],,; |
eccc98839441
Sysdef tools: additional comments and help.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
201
diff
changeset
|
48 |
print STDERR "usage: $name [options...] template\n\nThis will create a new root system definition file based on the provided template by globbing for pkgdefs in the filesystem. Any found pkgdef files are added to the end of their layer or at the end of their tech domain section, if one is defined", |
eccc98839441
Sysdef tools: additional comments and help.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
201
diff
changeset
|
49 |
"\nvalid options are:\n", |
eccc98839441
Sysdef tools: additional comments and help.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
201
diff
changeset
|
50 |
" -path [dir]\tspecifies the full system-model path to the file which is being processed. By default this is \"/os/deviceplatformrelease/foundation_system/system_model/system_definition.xml\"\n", |
eccc98839441
Sysdef tools: additional comments and help.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
201
diff
changeset
|
51 |
"\t\tThis is only needed when creating a stand-alone sysdef as the output", |
eccc98839441
Sysdef tools: additional comments and help.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
201
diff
changeset
|
52 |
|
eccc98839441
Sysdef tools: additional comments and help.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
201
diff
changeset
|
53 |
" -output [file]\tspecifies the file to save the output to. If set, all hrefs will set to be relative to this location. If not specified all href will be absolute file URIs and this will write to stdout\n\n", |
eccc98839441
Sysdef tools: additional comments and help.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
201
diff
changeset
|
54 |
|
eccc98839441
Sysdef tools: additional comments and help.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
201
diff
changeset
|
55 |
" -w [Note|Warning|Error]\tspecifies prefix text for any notifications. Defautls to Error\n\n", |
eccc98839441
Sysdef tools: additional comments and help.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
201
diff
changeset
|
56 |
" -root [dir]\tspecifies the root directory of the filesystem. All globbing will be done relative to this path\n\n", |
eccc98839441
Sysdef tools: additional comments and help.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
201
diff
changeset
|
57 |
|
312
9527bd30de64
updates to validation scripts and bugfixes for rootsysdef
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
206
diff
changeset
|
58 |
" -glob [wildcard path]\tThe wildcard search to look for pkgdef files. eg \"\\*\\*\package_definition.xml\". Can specify any number of these.\n", |
206
eccc98839441
Sysdef tools: additional comments and help.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
201
diff
changeset
|
59 |
" -placeholders [bool]\tif set, all packages not found in the template will be left in as empty placeholders\n"; |
312
9527bd30de64
updates to validation scripts and bugfixes for rootsysdef
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
206
diff
changeset
|
60 |
" -name [text]\tthe name in <systemModel> to use for the generated root sysdef. If not present, this will use the name from the templat\n"; |
206
eccc98839441
Sysdef tools: additional comments and help.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
201
diff
changeset
|
61 |
exit(1); |
eccc98839441
Sysdef tools: additional comments and help.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
201
diff
changeset
|
62 |
} |
eccc98839441
Sysdef tools: additional comments and help.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
201
diff
changeset
|
63 |
|
151
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
64 |
GetOptions |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
65 |
( |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
66 |
'path=s' => \$path, |
312
9527bd30de64
updates to validation scripts and bugfixes for rootsysdef
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
206
diff
changeset
|
67 |
'name=s' => \$sysmodelname, |
151
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
68 |
'output=s' => \$output, |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
69 |
'w=s' => \$warning, |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
70 |
'root=s' => \@searchroots, |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
71 |
'glob=s' => \@searchpaths, |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
72 |
'placeholders=s' => \$placeholders |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
73 |
); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
74 |
|
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
75 |
|
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
76 |
if($path eq '') {$path = '/os/deviceplatformrelease/foundation_system/system_model/system_definition.xml'} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
77 |
|
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
78 |
if(!($warning =~/^(Note|Warning|Error)$/)) {$warning="Error"} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
79 |
|
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
80 |
# path is the system model path of the processed sysdef file. This is only used when creating a stand-alone sysdef as the output |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
81 |
# output specifies the file this is saved in. If specified, all (relative) paths will be modified to be relative to it. If not, all paths will be absolute |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
82 |
# w is the warning level: Note, Warning or Error. |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
83 |
# root = -root g:\sf |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
84 |
# glob = -glob "\*\*\package_definition.xml" |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
85 |
|
206
eccc98839441
Sysdef tools: additional comments and help.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
201
diff
changeset
|
86 |
#Example command lines: |
eccc98839441
Sysdef tools: additional comments and help.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
201
diff
changeset
|
87 |
#rootsysdef.pl -root F:\sftest\mcl\sf -glob "\*\*\package_definition.xml" -output F:\sftest\mcl\build\system_definition.sf.xml F:\sftest\mcl\sf\os\deviceplatformrelease\foundation_system\system_model\system_definition.xml |
eccc98839441
Sysdef tools: additional comments and help.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
201
diff
changeset
|
88 |
#rootsysdef.pl -root F:\sftest\mcl\sf -glob "\*\*\*\*\package_definition.xml" -output F:\sftest\mcl\build\system_definition.mine.xml F:\sftest\mcl\sf\os\deviceplatformrelease\foundation_system\system_model\system_definition.xml |
312
9527bd30de64
updates to validation scripts and bugfixes for rootsysdef
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
206
diff
changeset
|
89 |
if(!scalar @ARGV && !scalar @searchpaths) {&help()}; |
206
eccc98839441
Sysdef tools: additional comments and help.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
201
diff
changeset
|
90 |
|
151
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
91 |
|
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
92 |
my %replacefile; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
93 |
my $dir; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
94 |
foreach(@searchpaths) |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
95 |
{ |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
96 |
my $ndir = shift(@searchroots); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
97 |
if($ndir ne '') {$dir=$ndir} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
98 |
foreach my $file (glob "$dir$_") |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
99 |
{ |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
100 |
my $map =substr($file,length($dir)); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
101 |
$map=~tr/\\/\//; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
102 |
$additional{$map}=$file; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
103 |
$replacefile{&abspath($file)}=$map; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
104 |
$add{&abspath($file)}=1; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
105 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
106 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
107 |
|
312
9527bd30de64
updates to validation scripts and bugfixes for rootsysdef
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
206
diff
changeset
|
108 |
my $parser = new XML::DOM::Parser; |
9527bd30de64
updates to validation scripts and bugfixes for rootsysdef
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
206
diff
changeset
|
109 |
my $sysdef; |
9527bd30de64
updates to validation scripts and bugfixes for rootsysdef
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
206
diff
changeset
|
110 |
my %rootmap; |
9527bd30de64
updates to validation scripts and bugfixes for rootsysdef
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
206
diff
changeset
|
111 |
my $sysdefdoc; |
9527bd30de64
updates to validation scripts and bugfixes for rootsysdef
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
206
diff
changeset
|
112 |
if(scalar @ARGV) |
9527bd30de64
updates to validation scripts and bugfixes for rootsysdef
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
206
diff
changeset
|
113 |
{ |
9527bd30de64
updates to validation scripts and bugfixes for rootsysdef
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
206
diff
changeset
|
114 |
$sysdef = &abspath(shift); # resolve the location of the root sysdef |
206
eccc98839441
Sysdef tools: additional comments and help.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
201
diff
changeset
|
115 |
|
312
9527bd30de64
updates to validation scripts and bugfixes for rootsysdef
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
206
diff
changeset
|
116 |
# rootmap is a mapping from the filesystem to the paths in the doc |
9527bd30de64
updates to validation scripts and bugfixes for rootsysdef
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
206
diff
changeset
|
117 |
%rootmap = &rootMap($path,$sysdef); |
9527bd30de64
updates to validation scripts and bugfixes for rootsysdef
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
206
diff
changeset
|
118 |
|
9527bd30de64
updates to validation scripts and bugfixes for rootsysdef
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
206
diff
changeset
|
119 |
$sysdefdoc = $parser->parsefile ($sysdef); |
9527bd30de64
updates to validation scripts and bugfixes for rootsysdef
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
206
diff
changeset
|
120 |
} |
9527bd30de64
updates to validation scripts and bugfixes for rootsysdef
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
206
diff
changeset
|
121 |
else |
9527bd30de64
updates to validation scripts and bugfixes for rootsysdef
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
206
diff
changeset
|
122 |
{ |
9527bd30de64
updates to validation scripts and bugfixes for rootsysdef
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
206
diff
changeset
|
123 |
$sysdefdoc = $parser->parse('<SystemDefinition schema="3.0.1"><systemModel name="System Model"/></SystemDefinition>'); |
9527bd30de64
updates to validation scripts and bugfixes for rootsysdef
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
206
diff
changeset
|
124 |
} |
9527bd30de64
updates to validation scripts and bugfixes for rootsysdef
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
206
diff
changeset
|
125 |
|
151
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
126 |
my %nsmap; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
127 |
my %urimap; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
128 |
|
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
129 |
my $mapmeta; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
130 |
my $modpath; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
131 |
if($output eq '') |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
132 |
{ #figure out mapping path |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
133 |
my @fspath = split(/[\\\/]/,$sysdef); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
134 |
my @smpath = split(/[\\\/]/,$path); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
135 |
while(lc($smpath[$#smpath]) eq lc($fspath[$#fspath] )) { |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
136 |
pop(@smpath); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
137 |
pop(@fspath); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
138 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
139 |
my $mappath = join('/',@fspath); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
140 |
my $topath = join('/',@smpath); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
141 |
$mappath=~s,^/?,file:///,; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
142 |
$mapmeta = $sysdefdoc->createElement('meta'); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
143 |
$mapmeta->setAttribute('rel','link-mapping'); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
144 |
my $node = $sysdefdoc->createElement('map-prefix'); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
145 |
$node->setAttribute('link',$mappath); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
146 |
$topath ne '' && $node->setAttribute('to',$topath); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
147 |
$mapmeta->appendChild($node); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
148 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
149 |
else |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
150 |
{ |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
151 |
$modpath = &relativeTo(&abspath($output), $sysdef); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
152 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
153 |
|
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
154 |
|
206
eccc98839441
Sysdef tools: additional comments and help.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
201
diff
changeset
|
155 |
# find all the namespaces used in all the fragments and use that |
eccc98839441
Sysdef tools: additional comments and help.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
201
diff
changeset
|
156 |
# to set the namespaces in the root element of the created doc |
151
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
157 |
# should be able to optimise by only parsing each doc once and |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
158 |
# maybe skipping the contends of <meta> |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
159 |
my @nslist = &namespaces($sysdef,$sysdefdoc->getDocumentElement()); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
160 |
|
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
161 |
my %replacing; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
162 |
my %newContainer; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
163 |
my %foundDescendants; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
164 |
|
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
165 |
foreach(keys %add) |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
166 |
{ |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
167 |
my $fragment = $parser->parsefile ($_); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
168 |
my $fdoc = $fragment->getDocumentElement(); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
169 |
my $topmost =&firstElement($fdoc); |
201
280dc2a9385b
Extra warnings, help and bug fixes in sysdeftools perl scripts. Support for 3.0.1 sysdef syntax (replacing when merging)
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
151
diff
changeset
|
170 |
if(!$topmost) { |
280dc2a9385b
Extra warnings, help and bug fixes in sysdeftools perl scripts. Support for 3.0.1 sysdef syntax (replacing when merging)
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
151
diff
changeset
|
171 |
print STDERR "$warning: $_ has no content. Skipping\n"; |
280dc2a9385b
Extra warnings, help and bug fixes in sysdeftools perl scripts. Support for 3.0.1 sysdef syntax (replacing when merging)
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
151
diff
changeset
|
172 |
next; |
280dc2a9385b
Extra warnings, help and bug fixes in sysdeftools perl scripts. Support for 3.0.1 sysdef syntax (replacing when merging)
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
151
diff
changeset
|
173 |
} |
151
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
174 |
my $type = $topmost->getTagName; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
175 |
my $id = $topmost->getAttribute('id'); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
176 |
my ($localid,$ns) = &idns($topmost,$id); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
177 |
my @path = &guessIdInPath($localid,$_); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
178 |
if($type eq 'layer') {@path=@path[0]} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
179 |
elsif($type eq 'package') {@path=@path[0..1]} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
180 |
elsif($type eq 'collection') {@path=@path[0..2]} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
181 |
elsif($type eq 'component') {@path=@path[0..3]} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
182 |
@path = reverse(@path); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
183 |
$add{$_}=join('/',@path)." $localid $ns"; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
184 |
$replacing{$type}->{"$localid $ns"} = $_; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
185 |
# keys with a space are namespaced and fully identified, and contain the filename as the content. |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
186 |
# keys with no space have unknown namespace and contain a hash of the content |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
187 |
$newContainer{join('/',@path[0..$#path-1])}->{"$localid $ns"} = $_; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
188 |
for(my $i=-1;$i<$#path-1;$i++) |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
189 |
{ |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
190 |
$foundDescendants{$path[$i+1]}=1; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
191 |
$newContainer{join('/',@path[0..$i])}->{$path[$i+1]}=1; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
192 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
193 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
194 |
|
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
195 |
|
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
196 |
while(@nslist) |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
197 |
{ |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
198 |
my $uri = shift(@nslist); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
199 |
my $prefix =shift(@nslist); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
200 |
if($prefix eq 'id namespace'){$prefix=''} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
201 |
if(defined $urimap{$uri}) {next} # already done this uri |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
202 |
$urimap{$uri} = $prefix; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
203 |
if($nsmap{$prefix}) |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
204 |
{ # need a new prefix for this, guess from the URI (for readability) |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
205 |
if($uri=~/http:\/\/(www\.)?([^.\/]+)\./) {$prefix = $2} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
206 |
my $i=0; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
207 |
while($nsmap{$prefix}) |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
208 |
{ # still no prefix, just make up |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
209 |
$prefix="ns$i"; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
210 |
$i++; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
211 |
# next line not really necessary, but it's a good safety to stop infinite loops |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
212 |
$i eq 1000 && die "ERROR: cannot create namespace prefix for $uri"; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
213 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
214 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
215 |
$nsmap{$prefix}=$uri; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
216 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
217 |
|
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
218 |
my $docroot = $sysdefdoc->getDocumentElement; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
219 |
|
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
220 |
my $ns = $docroot->getAttribute('id-namespace'); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
221 |
if(!$ns && $nsmap{''}) |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
222 |
{ |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
223 |
$docroot->setAttribute('id-namespace',$nsmap{''}); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
224 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
225 |
while(my($pre,$uri) = each(%nsmap)) |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
226 |
{ |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
227 |
$pre ne '' || next ; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
228 |
$docroot->setAttribute("xmlns:$pre",$uri); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
229 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
230 |
|
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
231 |
&walk($sysdef,$docroot); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
232 |
|
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
233 |
if($output eq '') |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
234 |
{ |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
235 |
print $sysdefdoc->toString; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
236 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
237 |
else |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
238 |
{ |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
239 |
$sysdefdoc->printToFile($output); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
240 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
241 |
|
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
242 |
|
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
243 |
sub abspath |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
244 |
{ |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
245 |
# normalize the path into an absolute one |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
246 |
my ($name,$path) = fileparse($_[0]); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
247 |
if($path eq '' && $name eq '') {return}; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
248 |
$path=~tr,\\,/,; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
249 |
if( -e $path) |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
250 |
{ |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
251 |
return abs_path($path)."/$name"; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
252 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
253 |
my @dir = split('/',$_[0]); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
254 |
my @new; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
255 |
foreach my $d (@dir) |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
256 |
{ |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
257 |
if($d eq '.') {next} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
258 |
if($d eq '..') |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
259 |
{ |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
260 |
pop(@new); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
261 |
next; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
262 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
263 |
push(@new,$d) |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
264 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
265 |
return join('/',@new); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
266 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
267 |
|
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
268 |
|
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
269 |
|
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
270 |
sub normpath |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
271 |
{ |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
272 |
# normalize the path |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
273 |
my @norm; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
274 |
foreach my $dir(split(/[\\\/]/,shift)) { |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
275 |
if($dir eq '.') {next} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
276 |
if($dir eq '..') |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
277 |
{ |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
278 |
if($#norm == -1 || $norm[$#norm] eq '..') |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
279 |
{ # keep as is |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
280 |
push(@norm,$dir); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
281 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
282 |
elsif($#norm == 0 && $norm[0] eq '') |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
283 |
{ # path begins with /, interpret /.. as just / -- ie toss out |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
284 |
next |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
285 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
286 |
else |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
287 |
{ |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
288 |
pop(@norm); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
289 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
290 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
291 |
else |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
292 |
{ |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
293 |
push(@norm,$dir); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
294 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
295 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
296 |
|
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
297 |
return join('/',@norm) |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
298 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
299 |
|
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
300 |
|
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
301 |
sub rootMap { |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
302 |
my @pathdirs = split(/\//,$_[0]); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
303 |
my @rootdirs = split(/\//,$_[1]); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
304 |
|
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
305 |
while(lc($rootdirs[$#rootdirs]) eq lc($pathdirs[$#pathdirs]) ) |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
306 |
{ |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
307 |
pop(@rootdirs); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
308 |
pop(@pathdirs); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
309 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
310 |
return (join('/',@rootdirs) => join('/',@pathdirs) ); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
311 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
312 |
|
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
313 |
sub replacedBy |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
314 |
{ # can only check once. Destroys data |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
315 |
my $node = shift; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
316 |
my $fullid= join(' ',&idns($node)); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
317 |
my $type = $node->getTagName; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
318 |
my $repl = $replacing{$type}->{$fullid}; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
319 |
delete $replacing{$type}->{$fullid}; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
320 |
return $repl; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
321 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
322 |
|
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
323 |
sub walk |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
324 |
{ |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
325 |
#' walk through the doc, resolving all links |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
326 |
my $file = shift; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
327 |
my $node = shift; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
328 |
my $type = $node->getNodeType; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
329 |
if($type!=1) {return} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
330 |
my $tag = $node->getTagName; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
331 |
if($tag=~/^(layer|package|collection|component)$/ ) |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
332 |
{ |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
333 |
if($file eq $sysdef) |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
334 |
{ |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
335 |
&fixIDs($node); # normalise all IDs in the root doc. |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
336 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
337 |
my $override = &replacedBy($node); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
338 |
my $link= $node->getAttribute('href'); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
339 |
if($override eq '' ) |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
340 |
{ |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
341 |
my ($id,$ns)=&idns($node); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
342 |
if($foundDescendants{$id}) |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
343 |
{ # keep this node, it'll be populated by what we found |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
344 |
if($link) |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
345 |
{ |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
346 |
$node->removeAttribute('href'); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
347 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
348 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
349 |
elsif($link || !$placeholders) |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
350 |
{ # not going to be used, remove |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
351 |
$node->getParentNode->removeChild($node) ; # not present, remove |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
352 |
return; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
353 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
354 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
355 |
else |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
356 |
{ |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
357 |
my $href = $node->getAttribute('href'); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
358 |
my $ppath = join('/',&parentPath($node->getParentNode)); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
359 |
delete $newContainer{$ppath}->{join(' ',&idns($node))}; # remove this from list of things which need to be added |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
360 |
if(&resolvePath($file,$href) ne $override) |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
361 |
{ # file has changed, update |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
362 |
print STDERR "$warning: Replacing $tag ",$node->getAttribute('id')," with $override\n"; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
363 |
&setHref($node,$override); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
364 |
return; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
365 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
366 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
367 |
my @curpath = &parentPath($node); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
368 |
my $curitem = $curpath[$#curpath]; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
369 |
my $curp = join('/',@curpath[0..$#curpath-1]); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
370 |
delete $newContainer{$curp}->{$curitem}; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
371 |
|
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
372 |
if($link) |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
373 |
{ |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
374 |
foreach my $child (@{$node->getChildNodes}) {$node->removeChild($child)} # can't have children |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
375 |
&fixHref($node,$file); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
376 |
return; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
377 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
378 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
379 |
elsif($tag eq 'systemModel' && $mapmeta) |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
380 |
{ # need absolute paths for all links |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
381 |
$node->insertBefore ($mapmeta,$node->getFirstChild); |
312
9527bd30de64
updates to validation scripts and bugfixes for rootsysdef
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
206
diff
changeset
|
382 |
$sysmodelname eq '' || $node->setAttribute('name',$sysmodelname); |
151
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
383 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
384 |
elsif($tag=~/^(SystemDefinition|systemModel)$/ ) |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
385 |
{ |
312
9527bd30de64
updates to validation scripts and bugfixes for rootsysdef
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
206
diff
changeset
|
386 |
($sysmodelname ne '' && $tag eq 'systemModel') && $node->setAttribute('name',$sysmodelname); |
151
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
387 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
388 |
elsif($tag eq 'unit') |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
389 |
{ |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
390 |
foreach my $atr ('bldFile','mrp','base','proFile') |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
391 |
{ |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
392 |
my $link= $node->getAttribute($atr); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
393 |
if($link && !($link=~/^\//)) |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
394 |
{ |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
395 |
if($mapmeta) |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
396 |
{ # use absolute paths |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
397 |
$link= &abspath(File::Basename::dirname($file)."/$link"); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
398 |
foreach my $a (keys %rootmap) |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
399 |
{ |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
400 |
$link=~s,^$a,$rootmap{$a},ie; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
401 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
402 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
403 |
else |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
404 |
{ # modified relative path |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
405 |
$link = &normpath($modpath.$link); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
406 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
407 |
$node->setAttribute($atr,$link); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
408 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
409 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
410 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
411 |
elsif($tag eq 'meta') |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
412 |
{ |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
413 |
&fixHref($node,$file); |
201
280dc2a9385b
Extra warnings, help and bug fixes in sysdeftools perl scripts. Support for 3.0.1 sysdef syntax (replacing when merging)
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
151
diff
changeset
|
414 |
foreach my $child (@{$node->getChildNodes}) {$node->removeChild($child)} # can't have children |
151
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
415 |
&processMeta($node); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
416 |
next; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
417 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
418 |
else {return} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
419 |
foreach my $item (@{$node->getChildNodes}) |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
420 |
{ |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
421 |
#print $item->getNodeType,"\n"; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
422 |
&walk($file,$item); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
423 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
424 |
if($tag=~/^(systemModel|layer|package|collection|component)$/ ) |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
425 |
{ # check for appending |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
426 |
my $ppath = join('/',&parentPath($node)); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
427 |
if($newContainer{$ppath}) { |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
428 |
foreach my $item (sort keys %{$newContainer{$ppath}}) |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
429 |
{ |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
430 |
&appendNewItem($node,$item,$newContainer{$ppath}->{$item}); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
431 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
432 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
433 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
434 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
435 |
|
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
436 |
|
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
437 |
sub getNs |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
438 |
{ |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
439 |
# find the ns URI that applies to the specified prefix. |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
440 |
my $node = shift; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
441 |
my $pre = shift; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
442 |
my $uri = $node->getAttribute("xmlns:$pre"); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
443 |
if($uri) {return $uri} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
444 |
my $parent = $node->getParentNode; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
445 |
if($parent && $parent->getNodeType==1) |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
446 |
{ |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
447 |
return getNs($parent,$pre); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
448 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
449 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
450 |
|
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
451 |
|
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
452 |
sub fixIDs |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
453 |
{ |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
454 |
# translate the ID to use the root doc's namespaces |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
455 |
my $node = shift; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
456 |
foreach my $id ('id','before') |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
457 |
{ |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
458 |
&fixID($node,$id); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
459 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
460 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
461 |
|
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
462 |
sub idns |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
463 |
{ # return the namespace of an ID |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
464 |
my $node = shift; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
465 |
my $id = shift; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
466 |
if($id eq '' ) {$id = $node->getAttribute('id'); } |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
467 |
if($id=~s/^(.*)://) |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
468 |
{ # it's got a ns, find out what it is |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
469 |
my $pre = $1; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
470 |
return ($id,&getNs($node,$pre)); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
471 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
472 |
return ($id,$node->getOwnerDocument->getDocumentElement->getAttribute("id-namespace") || $defaultns); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
473 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
474 |
|
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
475 |
sub fixID |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
476 |
{ |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
477 |
# translate the ID to use the root doc's namespaces |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
478 |
my $node = shift; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
479 |
my $attr = shift || 'id'; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
480 |
my $id = $node->getAttribute($attr); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
481 |
if($id eq '') {return} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
482 |
my $ns; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
483 |
if($id=~s/^(.*)://) |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
484 |
{ # it's got a ns, find out what it is |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
485 |
my $pre = $1; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
486 |
$ns=&getNs($node,$pre); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
487 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
488 |
else |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
489 |
{ |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
490 |
$ns = $node->getOwnerDocument->getDocumentElement->getAttribute("id-namespace") || |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
491 |
$defaultns; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
492 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
493 |
$ns = $urimap{$ns}; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
494 |
$id = ($ns eq '') ? $id : "$ns:$id"; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
495 |
return $node->setAttribute($attr,$id); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
496 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
497 |
|
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
498 |
sub firstElement { |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
499 |
# return the first element in this node |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
500 |
my $node = shift; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
501 |
foreach my $item (@{$node->getChildNodes}) { |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
502 |
if($item->getNodeType==1) {return $item} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
503 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
504 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
505 |
|
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
506 |
|
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
507 |
sub atts { |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
508 |
# return a hash of all attribtues defined for this element |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
509 |
my $node = shift; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
510 |
my %at = $node->getAttributes; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
511 |
my %list; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
512 |
foreach my $a (keys %{$node->getAttributes}) |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
513 |
{ |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
514 |
if($a ne '') |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
515 |
{ |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
516 |
$list{$a} = $node->getAttribute ($a); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
517 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
518 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
519 |
return %list; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
520 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
521 |
|
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
522 |
|
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
523 |
sub ns |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
524 |
{ |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
525 |
# return a hash of ns prefix and uri -- the xmlns: part is stripped off |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
526 |
my $node = shift; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
527 |
my %list; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
528 |
foreach my $a (keys %{$node->getAttributes}) |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
529 |
{ |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
530 |
my $pre = $a; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
531 |
if($pre=~s/^xmlns://) |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
532 |
{ |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
533 |
$list{$pre} = $node->getAttribute ($a); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
534 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
535 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
536 |
return %list; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
537 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
538 |
|
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
539 |
|
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
540 |
|
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
541 |
sub namespaces |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
542 |
{ |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
543 |
# return a list of namespace URI / prefix pairs, in the order they're defined |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
544 |
# these need to be used to define namespaces in the root element |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
545 |
my $file = shift; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
546 |
my $node = shift; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
547 |
my $type = $node->getNodeType; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
548 |
if($type!=1) {return} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
549 |
my $tag = $node->getTagName; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
550 |
my @res; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
551 |
my %nslist = &ns($node); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
552 |
while(my($pre,$uri)=each(%nslist)) |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
553 |
{ # push all namespaces defined here onto the list |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
554 |
push(@res,$uri,$pre); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
555 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
556 |
if($tag=~/^(layer|package|collection|component)$/ ) |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
557 |
{ # these have the potential of linking, so check for that |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
558 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
559 |
elsif($tag eq 'SystemDefinition' ) |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
560 |
{ |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
561 |
my $default = $node->getAttribute('id-namespace'); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
562 |
if($default) |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
563 |
{# mangle with a space so it's clear it's not a qname |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
564 |
push(@res,$default,'id namespace'); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
565 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
566 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
567 |
foreach my $item (@{$node->getChildNodes}) |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
568 |
{ |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
569 |
push(@res,&namespaces($file,$item)); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
570 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
571 |
return @res; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
572 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
573 |
|
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
574 |
sub processMeta |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
575 |
{ |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
576 |
my $metanode = shift; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
577 |
# do nothing. Not supported yet |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
578 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
579 |
|
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
580 |
sub guessIdInPath |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
581 |
{ |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
582 |
my $id = shift; |
201
280dc2a9385b
Extra warnings, help and bug fixes in sysdeftools perl scripts. Support for 3.0.1 sysdef syntax (replacing when merging)
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
151
diff
changeset
|
583 |
my @path = reverse(split(/\//,$_[0])); |
151
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
584 |
while(@path) |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
585 |
{ |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
586 |
my $dir = shift(@path); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
587 |
if($dir eq $id) |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
588 |
{ |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
589 |
return ($id,@path); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
590 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
591 |
} |
201
280dc2a9385b
Extra warnings, help and bug fixes in sysdeftools perl scripts. Support for 3.0.1 sysdef syntax (replacing when merging)
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
151
diff
changeset
|
592 |
print STDERR "$warning: Non-standard ID $id in $_[0]\n"; |
280dc2a9385b
Extra warnings, help and bug fixes in sysdeftools perl scripts. Support for 3.0.1 sysdef syntax (replacing when merging)
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
151
diff
changeset
|
593 |
@path = reverse(split(/\//,$_[0])); |
280dc2a9385b
Extra warnings, help and bug fixes in sysdeftools perl scripts. Support for 3.0.1 sysdef syntax (replacing when merging)
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
151
diff
changeset
|
594 |
if($path[0] eq 'package_definition.xml') |
280dc2a9385b
Extra warnings, help and bug fixes in sysdeftools perl scripts. Support for 3.0.1 sysdef syntax (replacing when merging)
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
151
diff
changeset
|
595 |
{ |
280dc2a9385b
Extra warnings, help and bug fixes in sysdeftools perl scripts. Support for 3.0.1 sysdef syntax (replacing when merging)
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
151
diff
changeset
|
596 |
return @path[1..$#path]; |
280dc2a9385b
Extra warnings, help and bug fixes in sysdeftools perl scripts. Support for 3.0.1 sysdef syntax (replacing when merging)
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
151
diff
changeset
|
597 |
} |
151
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
598 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
599 |
|
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
600 |
|
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
601 |
sub parentPath |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
602 |
{ |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
603 |
my $node=shift; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
604 |
my @path; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
605 |
while($node) |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
606 |
{ |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
607 |
if(!$node) {return @path} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
608 |
my $id=$node->getAttribute('id'); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
609 |
if($id eq '') {return @path} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
610 |
$id=~s/^.*://; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
611 |
@path = ($id,@path); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
612 |
$node = $node->getParentNode(); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
613 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
614 |
return @path; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
615 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
616 |
|
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
617 |
sub childTag |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
618 |
{ |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
619 |
my $tag = shift; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
620 |
if($tag eq 'systemModel') {return 'layer'} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
621 |
if($tag eq 'layer') {return 'package'} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
622 |
if($tag eq 'package') {return 'collection'} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
623 |
if($tag eq 'collection') {return 'component'} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
624 |
die "ERROR: no child for $tag"; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
625 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
626 |
|
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
627 |
sub appendNewItem |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
628 |
{ |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
629 |
my $node = shift; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
630 |
my $doc = $node->getOwnerDocument; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
631 |
my $id = shift; |
201
280dc2a9385b
Extra warnings, help and bug fixes in sysdeftools perl scripts. Support for 3.0.1 sysdef syntax (replacing when merging)
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
151
diff
changeset
|
632 |
if($id eq '') {return} |
151
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
633 |
my $fullid=$id; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
634 |
my $contents = shift; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
635 |
my $tag = &childTag($node->getTagName()); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
636 |
my $new = $doc->createElement($tag); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
637 |
if($id=~/^(.*) (.*)/) |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
638 |
{ |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
639 |
$id=$1; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
640 |
$ns = getNamespacePrefix($node,$2); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
641 |
if($ns ne '') {$id="$ns:$id"} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
642 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
643 |
else |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
644 |
{ |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
645 |
$contents = ''; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
646 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
647 |
$new->setAttribute('id',$id); # default namespace |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
648 |
$node->appendChild($new); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
649 |
my $ppath = join('/',&parentPath($new)); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
650 |
if($contents eq '') |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
651 |
{ # look for additions |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
652 |
print STDERR "$warning: Adding new $tag: $id\n"; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
653 |
if($newContainer{$ppath}) { |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
654 |
foreach my $item (sort keys %{$newContainer{$ppath}}) |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
655 |
{ |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
656 |
&appendNewItem($new,$item,$newContainer{$ppath}->{$item}); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
657 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
658 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
659 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
660 |
else |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
661 |
{ # this one item is defined in the specified file |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
662 |
if($tag eq 'package') |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
663 |
{ #include some package data in root |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
664 |
my $fragment = $parser->parsefile ($contents); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
665 |
my $fdoc = $fragment->getDocumentElement(); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
666 |
my $topmost =&firstElement($fdoc); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
667 |
my %at = &atts($topmost); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
668 |
foreach my $arg ('tech-domain','level','span') |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
669 |
{ |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
670 |
if($at{$arg}) { $new->setAttribute($arg,$at{$arg})} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
671 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
672 |
if($at{'tech-domain'}) {&positionByTechDomain($new)} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
673 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
674 |
&setHref($new,$contents); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
675 |
print STDERR "$warning: Adding found $tag $id from $contents\n"; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
676 |
delete $replacing{$tag}->{$fullid}; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
677 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
678 |
# newline after each new tag so output's not ugly |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
679 |
if($new->getNextSibling) |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
680 |
{ |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
681 |
$node->insertBefore($doc->createTextNode ("\n"),$new->getNextSibling); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
682 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
683 |
else |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
684 |
{ |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
685 |
$node->appendChild($doc->createTextNode ("\n")); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
686 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
687 |
delete $newContainer{$ppath}; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
688 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
689 |
|
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
690 |
|
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
691 |
sub getNamespacePrefix |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
692 |
{ |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
693 |
my $node = shift; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
694 |
my $ns = shift; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
695 |
my $root = $node->getOwnerDocument->getDocumentElement; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
696 |
my $idns = $root->getAttribute("id-namespace"); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
697 |
if($idns && $idns eq $ns) {return} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
698 |
if(!$idns && $defaultns eq $ns) {return} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
699 |
foreach my $a (keys %{$root->getAttributes}) |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
700 |
{ |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
701 |
my $pre = $a; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
702 |
if($pre=~s/^xmlns://) |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
703 |
{ |
201
280dc2a9385b
Extra warnings, help and bug fixes in sysdeftools perl scripts. Support for 3.0.1 sysdef syntax (replacing when merging)
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
151
diff
changeset
|
704 |
if($root->getAttribute ($a) eq $ns) {return $pre} |
151
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
705 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
706 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
707 |
die "ERROR: no namespace prefix defined for $ns"; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
708 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
709 |
|
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
710 |
|
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
711 |
sub resolvePath |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
712 |
{ |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
713 |
# return full path to 2nd arg relative to first (path or absolute URI) |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
714 |
my $base = shift; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
715 |
my $path = shift; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
716 |
if($path=~m,^/,) {return $path } # path is absolute, but has no drive. Let OS deal with it. |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
717 |
if($path=~s,^file:///([a-zA-Z]:/),$1,) {return $path } # file URI with drive letter |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
718 |
if($path=~m,^file://,) {return $path } # file URI with no drive letter (unit-style). Just pass on as is with leading / and let OS deal with it |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
719 |
if($path=~m,^[a-z0-9][a-z0-9]+:,i) {return $path } # absolute URI -- no idea how to handle, so just return |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
720 |
return &abspath(File::Basename::dirname($base)."/$path"); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
721 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
722 |
|
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
723 |
|
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
724 |
sub fixHref { |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
725 |
my $node = shift; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
726 |
my $base = shift; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
727 |
my $link= $node->getAttribute('href'); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
728 |
if($link=~/^(ftp|http)s:\/\//) {return} # remote link, do nothing |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
729 |
my $path = &resolvePath($base,$link); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
730 |
if(!-e $path) |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
731 |
{ # no such file, delete |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
732 |
my $tag =$node->getTagName; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
733 |
my $id = $node->getAttribute('id'); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
734 |
print STDERR "$warning: $tag $id not found at $link\n"; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
735 |
$node->getParentNode->removeChild($node); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
736 |
return; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
737 |
} |
201
280dc2a9385b
Extra warnings, help and bug fixes in sysdeftools perl scripts. Support for 3.0.1 sysdef syntax (replacing when merging)
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
151
diff
changeset
|
738 |
foreach my $child (@{$node->getChildNodes}) {$node->removeChild($child)} # can't have children |
151
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
739 |
if($output eq '') |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
740 |
{ |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
741 |
$path=~s,^/?,file:///,; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
742 |
$node->setAttribute('href',$path); # replace with absolute URI |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
743 |
return; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
744 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
745 |
$node->setAttribute('href',&normpath($modpath.$link)); # make relative path to output file |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
746 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
747 |
|
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
748 |
|
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
749 |
sub setHref { |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
750 |
my $node = shift; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
751 |
my $file = shift; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
752 |
if($output eq '') |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
753 |
{ |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
754 |
$path = &abspath($file); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
755 |
$path=~s,^/?,file:///,; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
756 |
$node->setAttribute('href',$path); # replace with absolute URI |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
757 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
758 |
else |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
759 |
{ |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
760 |
$node->setAttribute('href',&relativeTo(&abspath($output),$file,'file')); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
761 |
} |
201
280dc2a9385b
Extra warnings, help and bug fixes in sysdeftools perl scripts. Support for 3.0.1 sysdef syntax (replacing when merging)
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
151
diff
changeset
|
762 |
while(my $child = $node->getFirstChild ) {$node->removeChild($child)} |
151
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
763 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
764 |
|
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
765 |
|
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
766 |
sub relativeTo { |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
767 |
if($_[0] eq '') {return &abspath($_[1])} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
768 |
my @outfile = split(/[\\\/]/,lc(shift)); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
769 |
my @infile = split(/[\\\/]/,lc(shift)); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
770 |
my $asdir = shift ne 'file'; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
771 |
while($outfile[0] eq $infile[0]) |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
772 |
{ |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
773 |
shift(@outfile); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
774 |
shift(@infile); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
775 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
776 |
$modpath = '../' x (scalar(@outfile) - 1); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
777 |
if($asdir) { |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
778 |
if(scalar @infile > 1) {$modpath .= join('/',@infile[0..$#infile - 1]).'/'} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
779 |
} else {$modpath .= join('/',@infile)} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
780 |
return $modpath; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
781 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
782 |
|
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
783 |
sub positionByTechDomain |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
784 |
{ |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
785 |
my $node=shift; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
786 |
my $td = $node->getAttribute('tech-domain'); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
787 |
my %before; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
788 |
foreach my $t (@tdOrder) |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
789 |
{ |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
790 |
$before{$t}=1; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
791 |
if($t eq $td) {last} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
792 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
793 |
my $prev = $node->getPreviousSibling; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
794 |
foreach my $child (reverse @{$node->getParentNode->getChildNodes}) |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
795 |
{ |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
796 |
if($child->getNodeType==1 && $child->getTagName eq 'package' && $child!=$node) |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
797 |
{ |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
798 |
if($before{$child->getAttribute('tech-domain')}) |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
799 |
{ |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
800 |
my $next = $child->getNextSibling; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
801 |
while($next && $next->getNodeType!=1) {$next = $next->getNextSibling} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
802 |
if($next) { |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
803 |
$node->getParentNode->insertBefore ($node,$next); |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
804 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
805 |
last; |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
806 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
807 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
808 |
} |
84b123918d3f
Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
809 |
} |