Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emulab
emulab-devel
Commits
c7dfd6e4
Commit
c7dfd6e4
authored
Apr 05, 2010
by
Srikanth Chikkulapelly
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
AddExtension is modified to accept both key/value pairs and xml elements.
parent
e558b481
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
4 deletions
+21
-4
protogeni/lib/GeniCredential.pm.in
protogeni/lib/GeniCredential.pm.in
+21
-4
No files found.
protogeni/lib/GeniCredential.pm.in
View file @
c7dfd6e4
...
...
@@ -180,13 +180,30 @@ sub AddCapability($$$)
#
Add
an
extension
.
Each
extension
is
an
xml
element
.
#
If
the
element
is
in
a
different
namespace
it
has
to
be
specified
#
during
element
construction
.
sub
AddExtension
($$)
#
It
also
accepts
key
/
value
pairs
.
When
key
/
value
pair
is
specified
#
It
converts
them
to
<
key
>
value
</
key
>
xml
element
and
#
adds
under
extensions
.
sub
AddExtension
{
my
(
$
self
,
$
elem
)
=
@
_
;
my
$
self
=
shift
;
my
$
elem
=
undef
;
return
-
1
if
(
!ref($self));
if
(
!ref($self));
my
$
root
=
GeniXML
::
Parse
($
self
->{
'extensions'
});
return
-
1
if
(
!defined($root));
if
(
1
==
@
_
)
{
#
it
means
xml
element
is
specified
.
$
elem
=
shift
;
}
elsif
(
2
==
@
_
){
#
it
means
key
/
value
pair
is
specified
.
$
elem
=
XML
::
LibXML
::
Element
->
new
(@
_
[
0
]);
$
elem
->
appendText
(@
_
[
1
]);
}
else
{
return
-
1
;
}
$
root
->
appendChild
($
elem
);
$
self
->{
'extensions'
}
=
GeniXML
::
Serialize
($
root
);
return
0
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment