
cibien
Novice
Aug 9, 2012, 1:23 AM
Views: 3161
|
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)
|