
XML::BMEcat - Perl extension for generating BMEcat-XML

use XML::BMEcat;
my $BMEcat = XML::BMEcat->new();
$BMEcat->setOutfile("catalog.xml");

XML::BMEcat is a simple module to help in the generation of BMEcat-XML. Basically, you create an XML::BMEcat object and then call the related methods with the necessary parameters.

The following methods are provided:
Writes the BMEcat-Header:
my $Header = $BMEcat->creatHeader();
$Header->setTransaction($TRANSACTION, [ 'PREV_VERSION' => $prev_version ]);
$Header->setGeneralInfo(
'GENERATOR_INFO' => $GENERATOR_INFO,
'LANGUAGE' => $LANGUAGE,
'CATALOG_ID' => $CATALOG_ID,
'CATALOG_VERSION' => $CATALOG_VERSION,
'CATALOG_NAME' => $CATALOG_NAME,
'DATE' => $DATE,
'TIME' => $TIME,
'CURRENCY' => $CURRENCY,
'MIME_ROOT' => $MIME_ROOT
);
$Header->setBuyerInfo(
'BUYER_ID' => $BUYER_ID,
'BUYER_NAME' => $BUYER_NAME,
'NAME' => $NAME,
'STREET' => $STREET,
'ZIP' => $ZIP,
'CITY' => $CITY,
'COUNTRY' => $COUNTRY,
'EMAIL' => $EMAIL,
'URL' => $URL
);
$Header->setAgreementInfo(
'AGREEMENT_ID' => $AGREEMENT_ID,
'AGREEMENT_start_date' => $AGREEMENT_start_date,
'AGREEMENT_end_date' => $AGREEMENT_end_date
);
$Header->setSupplierInfo(
'SUPPLIER_ID' => $SUPPLIER_ID,
'SUPPLIER_NAME' => $SUPPLIER_NAME,
'NAME' => $NAME,
'NAME2' => $NAME2,
'CONTACT' => $CONTACT,
'STREET' => $STREET,
'ZIP' => $ZIP,
'CITY' => $CITY,
'COUNTRY' => $COUNTRY,
'PHONE' => $PHONE,
'FAX' => $FAX,
'EMAIL' => $EMAIL,
'URL' => $URL
);
$Header->setConfigInfo(
'VERSION' => $BMEcat_VERSION,
'CHAR_SET' => $CHAR_SET,
'DTD' => $DTD,
'VERBOSE' => 1
);
$BMEcat->writeHeader();
Writes the BMEcat - Feature-System:
$Header->setConfigInfo('FEATURE_SYSTEM_NAME' => $FEATURE_SYSTEM_NAME);
my $FeatureSystem = $BMEcat->creatFeatureSystem();
$FeatureSystem->addFeatureGroup( 'ftg1',
'ft1' => $unit_a,
'ft2' => $unit_b,
'ft3' => $unit_c,
);
$FeatureSystem->addFeatureGroup( 'ftg2',
'ft4' => $unit_d,
'ft5' => $unit_e,
'ft6' => $unit_f,
);
$BMEcat->writeFeatureSystem();
Writes the BMEcat - Catalog-Structure:
$Header->setConfigInfo('GROUP_SYSTEM_ID' => $GROUP_SYSTEM_ID);
my $GroupSystem = $BMEcat->creatGroupSystem();
my $CatalogGroup = $GroupSystem->creatCatalogGroup($group_id);
my $CatalogGroup = $GroupSystem->getCatalogGroup($group_id);
$CatalogGroup->setData( 'PARENT' => 0,
'NAME' => $name02,
'SORT' => 5 );
$CatalogGroup = $GroupSystem->creatCatalogGroup('04');
$CatalogGroup->setData( 'PARENT' => 2,
'NAME' => $name04,
'SORT' => 5 );
$CatalogGroup = $GroupSystem->creatCatalogGroup('06');
$CatalogGroup->setData( 'PARENT' => 2,
'NAME' => $name06,
'SORT' => 10 );
$CatalogGroup = $GroupSystem->creatCatalogGroup('08');
$CatalogGroup->setData( 'PARENT' => 4,
'NAME' => $name08,
'SORT' => 5,
'LEAF' => 1 );
$CatalogGroup->getData('PARENT');
$CatalogGroup->addDescription($Description08);
$CatalogGroup->addMime($type, $source, $description, $purpose);
$CatalogGroup = $GroupSystem->creatCatalogGroup('10');
$CatalogGroup->setData( 'PARENT' => 4,
'NAME' => $name10,
'SORT' => 10,
'LEAF' => 1 );
$CatalogGroup->addMember('foo');
my @members = $CatalogGroup->getMembers;
$BMEcat->writeGroupSystem() and print "not ";
Writes the BMEcat - Article-Entrys:
my $ArticleSystem = $BMEcat->creatArticleSystem();
$BMEcat->writeArticleSystem();
my $GroupSystem = ArticleSystem->getGroupSystem();
my $Article = $ArticleSystem->creatArticle($index);
my $Article = $ArticleSystem->getArticle($index);
my $ArticleKey = $Article->getKey;
$Article->setMainInfo('mode' => $mode,
'SUPPLIER_AID' => $SUPPLIER_AID );
$Article->setFeatureGroup($group_id);
$Article->setFeatureValues(
$ft_val1,
$ft_val2,
$ft_val3,
$ft_val4
);
Several mimes are possible. See the BMEcat-spezification for more details.
$Article->addMime(
$mime_type,
$mime_source,
$description,
$mime_purpose
);
All in the BMEcat-spezification described elements are allowed to set in free order
and at several times.
$Article->setDetails(
'DESCRIPTION_SHORT' => $DESCRIPTION_SHORT,
'DESCRIPTION_LONG' => $DESCRIPTION_LONG,
'EAN' => $EAN,
. . . ,
'SPECIAL_TREATMENT_CLASS' => [ $type => $val ],
. . .
);
All in the BMEcat-spezification described elements are allowed to set in free order
and at several times.
$Article->setOrderDetails(
'ORDER_UNIT' => $ORDER_UNIT,
'CONTENT_UNIT' => $CONTENT_UNIT,
'NO_CU_PER_OU' => $NO_CU_PER_OU
. . .
);
Several prices and types are possible. See the BMEcat-Spezification for more details.* setPriceDetails
$Article->setPriceDetails( 'valid_start_date' => $start_date, 'valid_end_date' => $end_date );* addPrice
$Article->addPrice( 'price_type' => $price_type, 'PRICE_AMOUNT' => $price_amount, 'PRICE_CURRENCY' => $currency, 'TAX' => $tax );
Maps Articles to the BMEcat - Catalog-Structure:* map2Group
$Article->map2Group($group_id);* writeArticleGroupMap
$BMEcat->writeArticleGroupMap();
Writes the Tail and closes the BMEcat - Document $BMEcat->writeTail();

At this time not usable: - FEATURE_GROUP_NAME - DAILY_PRICE

Not all BMEcat-features (eg. CLASSIFICATION_SYSTEM) have been implemented yet. See method-descriptions for detailed informations.


I'd like to thank Larry Wall, Randolph Schwarz, Tom Christiansen, Gurusamy Sarathy and many others for making Perl what it is today. I had the privilege of working with a really excellent teacher, Robert Krüger. He have guided me through the entire process and his criticisms where always right on.

Copyright 2000-2003 by Frank-Peter Reich (fp$), fpreich@cpan.org This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. BMEcat is a trademark of BME - Bundesverband Materialwirtschaft, Einkauf und Logistik e.V.