// name
    $isbnGroup = eZISBNGroup::create($groupNumber, $description);
    $isbnGroup->store();
    $isbnGroupID = $isbnGroup->attribute('id');
    // look for the rules
    $rules = $group->Rules[0]->Rule;
    foreach ($rules as $rule) {
        $length = (int) $rule->Length;
        // if length is 0 there is no need to add to the database
        if ($length > 0) {
            $rangeArray = explode('-', $rule->Range);
            $fromValue = substr($rangeArray[0], 0, 5);
            $toValue = substr($rangeArray[1], 0, 5);
            $registrantFrom = substr($rangeArray[0], 0, $length);
            $registrantTo = substr($rangeArray[1], 0, $length);
            $registrationGroup = eZISBNRegistrantRange::create($isbnGroupID, $fromValue, $toValue, $registrantFrom, $registrantTo, $length);
            $registrationGroup->store();
        }
    }
}
// get group ranges
$groupRanges = $xml->xpath('///EAN.UCC/Rules/Rule');
foreach ($groupRanges as $groupRange) {
    $registrationGroupItemLength = (int) $groupRange->Length;
    // if length is 0 there is no need to add to the database
    if ($registrationGroupItemLength > 0) {
        $rangeArray = explode('-', $groupRange->Range);
        $fromValue = substr($rangeArray[0], 0, 5);
        $toValue = substr($rangeArray[1], 0, 5);
        $groupFrom = substr($rangeArray[0], 0, $registrationGroupItemLength);
        $groupTo = substr($rangeArray[1], 0, $registrationGroupItemLength);
        }
    } else {
        $registrationGroupArray[$length][] = array('from' => $isbnRegGroupElementFrom, 'to' => $isbnRegGroupElementTo);
    }
    $isbnGroup = eZISBNGroup::create($isbnRegGroupElement, $isbnItem['text']);
    $isbnGroup->store();
    $isbnGroupID = $isbnGroup->attribute('id');
    $pubRangeArray = $isbnItem['pubrange'];
    if (is_array($pubRangeArray)) {
        foreach ($pubRangeArray as $isbnRegistrantRange) {
            // The test number should have a base with 5 digits where from should be padded with 0 and
            // to should be padded with 9.
            $fromValue = (int) substr(str_pad($isbnRegistrantRange['from'], 5, 0, STR_PAD_RIGHT), 0, 5);
            $toValue = (int) substr(str_pad($isbnRegistrantRange['to'], 5, 9, STR_PAD_RIGHT), 0, 5);
            $length = $isbnRegistrantRange['length'];
            $registrationGroup = eZISBNRegistrantRange::create($isbnGroupID, $fromValue, $toValue, $isbnRegistrantRange['from'], $isbnRegistrantRange['to'], $length);
            $registrationGroup->store();
        }
    }
}
// Add the registration group ranges to the database.
if (count($registrationGroupArray) > 0) {
    foreach ($registrationGroupArray as $registrationGroupItemLength => $registrationGroupItemArray) {
        foreach ($registrationGroupItemArray as $registrationGroupItemRange) {
            // Will cut the last part of the numbers, since it's up to each registrant to use the other
            // numbers.
            $fromValue = $registrationGroupItemRange['from'];
            $toValue = $registrationGroupItemRange['to'];
            // Create the group: from and to string with the correct length.
            $groupFrom = str_pad(substr($fromValue, 0, $registrationGroupItemLength), 0, $registrationGroupItemLength);
            $groupTo = str_pad(substr($toValue, 0, $registrationGroupItemLength), 0, $registrationGroupItemLength);