CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate: Re: [Laurent_R] Merge duplicated xml lines: Edit Log



cibien
Novice

Aug 9, 2012, 1:23 AM


Views: 2078
Re: [Laurent_R] Merge duplicated xml lines

Thankyou very much for your answer, but sorry I'am novice in perl and is very difficult for me.

this is a little part of my code:


my $materialmapping_table_xml = XML::LibXML->createDocument( "1.0", "UTF-8");
my $materialmapping_table_xml_root = $materialmapping_table_xml->createElement("masterdata");
$materialmapping_table_xml->setDocumentElement($materialmapping_table_xml_root);


my $materialmapping_item3 = $materialmapping_table_xml->createElement("item3");

$materialmapping_item3->setAttribute(decode('cp1252',$pr_cell_name3->{Val}),$pr3);

$materialmapping_item3->setAttribute("pr_family",$family);

$materialmapping_table_xml_root->addChild($materialmapping_item3);


and the same for item2...


for example, generate this output:


<item2 duble="1" pr="c" pr_width="1250" pr_family="2" />
<item2 duble="2" pr="c" pr_width="1250" pr_family="2" />
<item2 pr="a" duble="2" pr_width="1250" pr_family="2" />
<item2 pr="b" duble="2" pr_width="1250" pr_family="2" />
<item2 pr="c" duble="2" pr_width="1250" pr_family="2" />
<item3 pr="a" duble="1" pr_width="1250" pr_family="2" />
<item3 pr="b" duble="1" pr_width="1250" pr_family="2" />
<item3 pr="c" duble="1" pr_width="1250" pr_family="2" />
<item3 pr_width="1250" duble="1" pr="c" pr_family="2" />
<item3 pr="a" duble="2" pr_width="1250" pr_family="2" />
<item3 pr="b" duble="2" pr_width="1250" pr_family="2" />
<item3 pr="c" duble="2" pr_width="1250" pr_family="2" />
<item3 pr_width="1250" duble="2" pr="c" pr_family="2" />
<item3 pr_width="1250" pr="c" duble="2" pr_family="2" />
<item3 pr_width="1250" pr="c" duble="2" pr_family="2" />
<item3 pr_width="1250" pr="c" duble="2" pr_family="2" />
<item2 pr="a" duble="3" pr_width="1250" pr_family="2" />

but the OUTPUT must be:

<item3 pr="a" duble="1" pr_width="1250" pr_family="2" />
<item3 pr="b" duble="1" pr_width="1250" pr_family="2" />
<item3 pr="c" duble="1" pr_width="1250" pr_family="2" />
<item3 pr="a" duble="2" pr_width="1250" pr_family="2" />
<item3 pr="b" duble="2" pr_width="1250" pr_family="2" />
<item3 pr="c" duble="2" pr_width="1250" pr_family="2" />
<item2 pr="a" duble="3" pr_width="1250" pr_family="2" />


where I have to put the code?


thankyou very much for your precious help


(This post was edited by cibien on Aug 9, 2012, 1:30 AM)


Edit Log:
Post edited by cibien (Novice) on Aug 9, 2012, 1:30 AM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives