diff options
author | hansp <hansp> | 2001-07-13 23:24:34 +0000 |
---|---|---|
committer | hansp <hansp> | 2001-07-13 23:24:34 +0000 |
commit | 59c48ffbc0c177bfad69aa17107a7e198e9f1a28 (patch) | |
tree | a01f01f9f8d54e380a7063aeff00811825129583 | |
parent | 00709516117b9531f4cccb14e9597e8a88f01334 (diff) |
2001-07-13 Hans Petter Jansson <hpj@ximian.com>
* xml.pl.in (xst_xml_model_get_pcdata): Implement.
(xst_xml_model_set_pcdata): Implement.
(xst_xml_model_get_attribute): Implement.
(xst_xml_model_set_attribute): Implement.
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | parse.pl.in | 4 | ||||
-rwxr-xr-x | test.pl | 5 | ||||
-rw-r--r-- | xml.pl.in | 43 |
4 files changed, 55 insertions, 6 deletions
@@ -1,8 +1,15 @@ 2001-07-13 Hans Petter Jansson <hpj@ximian.com> + * xml.pl.in (xst_xml_model_get_pcdata): Implement. + (xst_xml_model_set_pcdata): Implement. + (xst_xml_model_get_attribute): Implement. + (xst_xml_model_set_attribute): Implement. + +2001-07-13 Hans Petter Jansson <hpj@ximian.com> + * xml.pl.in (xst_xml_model_add): Implement. (xst_xml_model_ensure): Implement. - (xst_xml_model_remove): Implement. + (xst_xml_model_remove): Implement. 2001-07-13 Tambet Ingo <tambet@ximian.com> diff --git a/parse.pl.in b/parse.pl.in index 6766631..4a49d9c 100644 --- a/parse.pl.in +++ b/parse.pl.in @@ -1307,8 +1307,8 @@ sub xst_parse_xml if ($branch) { - return &xst_xml_get_attribute ($branch, $property) if $property ne ""; - return &xst_xml_get_pcdata ($branch); + return &xst_xml_model_get_attribute ($branch, $property) if $property ne ""; + return &xst_xml_model_get_pcdata ($branch); } return undef; @@ -100,8 +100,9 @@ sub test_interfaces # &xst_debug_print_struct ($tree); $model = &xst_xml_model_scan ("/etc/alchemist/namespace/printconf/local.adl"); -&xst_xml_model_ensure ($model, "/adm_context/datatree/printconf/print_queues/lpnew/faan/pekk/fette/"); -&xst_xml_model_remove ($model, "/adm_context/datatree/printconf/print_queues/", "lpekk"); +$branch = &xst_xml_model_find ($model, "/adm_context/datatree/"); +&xst_xml_model_set_pcdata ($branch, "FAAN"); +&xst_xml_model_set_attribute ($branch, "Jern", "Jepp"); print &xst_xml_model_print ($model); # print &xst_parse_xml ("/etc/alchemist/namespace/printconf/local.adl", @@ -784,7 +784,7 @@ sub xst_xml_model_ensure sub xst_xml_model_remove { my ($model, $varpath, $tag) = @_; - my ($branch); + my ($branch, $i); @path = split /\//, $addpath; $branch = &xst_xml_model_find ($model, $varpath); @@ -805,4 +805,45 @@ sub xst_xml_model_remove return -1; } +sub xst_xml_model_get_pcdata +{ + my ($branch) = @_; + my ($i); + + for ($i = 1; $i < @$branch; $i += 2) + { + if ($$branch [$i] == 0) + { + my $retval = &xst_xml_unquote ($$branch [$i + 1]); + return ($retval); + } + } + + return ""; +} + +sub xst_xml_model_set_pcdata +{ + my ($branch, $pcdata) = @_; + + @$branch = (@$branch [0]); + + $$branch [1] = 0; + $$branch [2] = &xst_xml_quote ($pcdata); +} + +sub xst_xml_model_get_attribute +{ + my ($branch, $attr) = @_; + + return $$branch[0]->{$attr}; +} + +sub xst_xml_model_set_attribute +{ + my ($branch, $attr, $value) = @_; + + return $$branch[0]->{$attr} = $value; +} + 1; |