[Expat-discuss] Howto combine tags with different context via XML::Parser

Peter Teichert peter.teichert at gmail.com
Mon May 29 15:27:57 CEST 2006


Hi XML::Parser Users

I am new to XML parsing with the XML::Parser. Maybe some of you know the
solution to the following problem:

Description

I want to generate one htmlpage (site) with links to other html pages
(site1, site2)

which will also be created while parsing the following XML file:

<site>

<site1><tag1></tag1></site1>

<site2><tag2><tag1></tag1></tag2></site2>

</site>

The issue is how to detect on which htmlpage (site1 or site 2) the </tag1>
will be inserted

I am using the stream style of XML::PARSER and put the following code in
starttag:

if ($starttag eq "tag1" ) { print $site "tag1"; }

How can I detect the variable $site, whether it is site1 or site2 ?

best regards

Peter


More information about the Expat-discuss mailing list