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:
createHeader
my $Header = $BMEcat->creatHeader();
setTransaction
$Header->setTransaction($TRANSACTION, [ 'PREV_VERSION' => $prev_version ]);
setGeneralInfo
$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 );
setBuyerInfo
$Header->setBuyerInfo( 'BUYER_ID' => $BUYER_ID, 'BUYER_NAME' => $BUYER_NAME, 'NAME' => $NAME, 'STREET' => $STREET, 'ZIP' => $ZIP, 'CITY' => $CITY, 'COUNTRY' => $COUNTRY, 'EMAIL' => $EMAIL, 'URL' => $URL );
setAgreementInfo
$Header->setAgreementInfo( 'AGREEMENT_ID' => $AGREEMENT_ID, 'AGREEMENT_start_date' => $AGREEMENT_start_date, 'AGREEMENT_end_date' => $AGREEMENT_end_date );
setSupplierInfo
$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 );
setConfigInfo
$Header->setConfigInfo( 'VERSION' => $BMEcat_VERSION, 'CHAR_SET' => $CHAR_SET, 'DTD' => $DTD, 'VERBOSE' => 1 );
writeHeader
$BMEcat->writeHeader();
Writes the BMEcat - Feature-System:
$Header->setConfigInfo('FEATURE_SYSTEM_NAME' => $FEATURE_SYSTEM_NAME);
creatFeatureSystem
my $FeatureSystem = $BMEcat->creatFeatureSystem();
addFeatureGroup
$FeatureSystem->addFeatureGroup( 'ftg1', 'ft1' => $unit_a, 'ft2' => $unit_b, 'ft3' => $unit_c, ); $FeatureSystem->addFeatureGroup( 'ftg2', 'ft4' => $unit_d, 'ft5' => $unit_e, 'ft6' => $unit_f, );
writeFeatureSystem
$BMEcat->writeFeatureSystem();
Writes the BMEcat - Catalog-Structure:
$Header->setConfigInfo('GROUP_SYSTEM_ID' => $GROUP_SYSTEM_ID);
creatGroupSystem
my $GroupSystem = $BMEcat->creatGroupSystem();
creatCatalogGroup
my $CatalogGroup = $GroupSystem->creatCatalogGroup($group_id);
getCatalogGroup
my $CatalogGroup = $GroupSystem->getCatalogGroup($group_id);
setData
$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 );
getData
$CatalogGroup->getData('PARENT');
addDescription
$CatalogGroup->addDescription($Description08);
addMime
$CatalogGroup->addMime($type, $source, $description, $purpose); $CatalogGroup = $GroupSystem->creatCatalogGroup('10'); $CatalogGroup->setData( 'PARENT' => 4, 'NAME' => $name10, 'SORT' => 10, 'LEAF' => 1 );
addMember
$CatalogGroup->addMember('foo');
getMembers
my @members = $CatalogGroup->getMembers;
writeGroupSystem
$BMEcat->writeGroupSystem() and print "not ";
Writes the BMEcat - Article-Entrys:
creatArticleSystem
my $ArticleSystem = $BMEcat->creatArticleSystem();
writeArticleSystem
$BMEcat->writeArticleSystem();
getGroupSystem
my $GroupSystem = ArticleSystem->getGroupSystem();
creatArticle
my $Article = $ArticleSystem->creatArticle($index);
getArticel
my $Article = $ArticleSystem->getArticle($index);
getKey
my $ArticleKey = $Article->getKey;
setMainInfo
$Article->setMainInfo('mode' => $mode, 'SUPPLIER_AID' => $SUPPLIER_AID );
setFeatureGroup
$Article->setFeatureGroup($group_id);
setFeatureValues
$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 );
setDetails
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();
writeTail
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.
http://www.BMEcat.org
http://www.perlxml.com/faq/perl-xml-faq.html
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.
3 POD Errors
The following errors were encountered while parsing the POD:
You can't have =items (as at line 1282) unless the first thing after the =over is an =item
You can't have =items (as at line 1306) unless the first thing after the =over is an =item
Non-ASCII character seen before =encoding in 'Krüger.'. Assuming CP1252
To install XML::BMEcat, copy and paste the appropriate command in to your terminal.
cpanm
cpanm XML::BMEcat
CPAN shell
perl -MCPAN -e shell install XML::BMEcat
For more information on module installation, please visit the detailed CPAN module installation guide.