Well i know generally a code example is helpfull, but i thought in this case its a pretty General question.
Anyhow, I will give you some examples of what i am doing at the Moment.
given is a Schema like :
-data
-properties
(List of properties in here)
-suites
-tests
Up to now i got my code writing the properties.
$schema->template('PERL', $type);
#warn $schema->template('PERL', $type);
my $doc = XML::LibXML::Document->new('1.0', 'UTF-8');
my $write = $schema->compile(WRITER => $type, use_default_namespace
+=> 1);
my %hash;
#some filling of the hash with values
my $xml = $write->($doc, $hash);
$doc->setDocumentElement($xml);
So the first part of my XML File is generated.
Later on, in a completely different part of the program,
tests have to be written into the second section.
Those tests have to comply the Schema in the xsd file.
So i have to reopen the saved XML file from the code above and insert some new tags in it, at specific Points (every test has to go into a specific Suite, so there is more than one Suite)
Writing a new hash and doing
my $xml = $write->($doc, $hash);
$doc->setDocumentElement($xml);
again, does not work out. I need to reopen, search a node and insert children. This was easy possible with XML Twig, but as said i can only use above mentioned packages.
Was this enough code or do you Need more explaning? |