-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- ROXML >= 2.0 uses libxml instead of REXML for parsing. Much faster
- Loading branch information
Showing
11 changed files
with
112 additions
and
134 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
module ONIX | ||
class Contributor | ||
include XML::Mapping | ||
include ROXML | ||
|
||
numeric_node :sequence_number, "SequenceNumber", :optional => true | ||
text_node :contributor_role, "ContributorRole", :optional => true | ||
text_node :language_code, "LanguageCode", :optional => true | ||
numeric_node :sequence_number_within_role, "SequenceNumberWithinRole", :optional => true | ||
text_node :person_name, "PersonName", :optional => true | ||
text_node :person_name_inverted, "PersonNameInverted", :optional => true | ||
text_node :titles_before_name, "TitlesBeforeName", :optional => true | ||
text_node :names_before_key, "NamesBeforeKey", :optional => true | ||
text_node :prefix_to_key, "PrefixToKey", :optional => true | ||
text_node :key_names, "KeyNames", :optional => true | ||
text_node :names_after_key, "NamesArterKey", :optional => true | ||
text_node :suffix_to_key, "SuffixToKey", :optional => true | ||
text_node :letters_after_names, "LettersAfterNames", :optional => true | ||
text_node :titles_after_names, "TitlesAfterNames", :optional => true | ||
xml_accessor :sequence_number, :from => "SequenceNumber" | ||
xml_accessor :contributor_role, :from => "ContributorRole" | ||
xml_accessor :language_code, :from => "LanguageCode" | ||
xml_accessor :sequence_number_within_role, :from => "SequenceNumberWithinRole" | ||
xml_accessor :person_name, :from => "PersonName" | ||
xml_accessor :person_name_inverted, :from => "PersonNameInverted" | ||
xml_accessor :titles_before_name, :from => "TitlesBeforeName" | ||
xml_accessor :names_before_key, :from => "NamesBeforeKey" | ||
xml_accessor :prefix_to_key, :from => "PrefixToKey" | ||
xml_accessor :key_names, :from => "KeyNames" | ||
xml_accessor :names_after_key, :from => "NamesArterKey" | ||
xml_accessor :suffix_to_key, :from => "SuffixToKey" | ||
xml_accessor :letters_after_names, :from => "LettersAfterNames" | ||
xml_accessor :titles_after_names, :from => "TitlesAfterNames" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,29 @@ | ||
module ONIX | ||
class Header | ||
include XML::Mapping | ||
include ROXML | ||
|
||
root_element_name "Header" | ||
|
||
text_node :sender_ean_number, "SenderEANNumber", :optional => true | ||
text_node :from_san, "FromSAN", :optional => true | ||
array_node :sender_identifiers, "SenderIdentifier", :optional => true, :class => ONIX::SenderIdentifier | ||
text_node :from_company, "FromCompany", :optional => true | ||
text_node :from_person, "FromPerson", :optional => true | ||
text_node :from_email, "FromEmail", :optional => true | ||
text_node :to_ean_number, "ToEANNumber", :optional => true | ||
text_node :to_san, "ToSAN", :optional => true | ||
array_node :addressee_identifier, "AddresseeIdentifier", :optional => true, :class => ONIX::AddresseeIdentifier | ||
text_node :to_company, "ToCompany", :optional => true | ||
text_node :to_person, "ToPerson", :optional => true | ||
text_node :message_number, "MessageNumber", :optional => true | ||
text_node :message_repeat, "MessageRepeat", :optional => true | ||
date_node :sent_date, "SentDate", :optional => true | ||
text_node :message_note, "MessageNote", :optional => true | ||
xml_accessor :from_person, :from => "FromPerson" | ||
xml_accessor :sender_ean_number, :from => "SenderEANNumber" | ||
xml_accessor :from_san, :from => "FromSAN" | ||
#array_node :sender_identifiers, :from => "SenderIdentifier", :class => ONIX::SenderIdentifier | ||
xml_accessor :from_company, :from => "FromCompany" | ||
xml_accessor :from_email, :from => "FromEmail" | ||
xml_accessor :to_ean_number, :from => "ToEANNumber" | ||
xml_accessor :to_san, :from => "ToSAN" | ||
#array_node :addressee_identifier, "AddresseeIdentifier", :class => ONIX::AddresseeIdentifier | ||
xml_accessor :to_company, :from => "ToCompany" | ||
xml_accessor :to_person, :from => "ToPerson" | ||
xml_accessor :message_number, :from => "MessageNumber" | ||
xml_accessor :message_repeat, :from => "MessageRepeat" | ||
#date_node :sent_date, "SentDate" | ||
xml_accessor :message_note, :from => "MessageNote" | ||
|
||
# defaults | ||
text_node :default_language_of_text, "DefaultLanguageOfText", :optional => true | ||
text_node :default_price_type_code, "DefaultPriceTypeCode", :optional => true | ||
text_node :default_currency_code, "DefaultCurrencyCode", :optional => true | ||
text_node :default_linear_unit, "DefaultLinearUnit", :optional => true # TODO deprecated. make read only | ||
text_node :default_weight_unit, "DefaultWeightUnit", :optional => true # TODO deprecated. make read only | ||
text_node :default_class_of_trade, "DefaultClassOfTrade", :optional => true | ||
xml_accessor :default_language_of_text, :from => "DefaultLanguageOfText" | ||
xml_accessor :default_price_type_code, :from => "DefaultPriceTypeCode" | ||
xml_accessor :default_currency_code, :from => "DefaultCurrencyCode" | ||
xml_reader :default_linear_unit, :from => "DefaultLinearUnit" # deprecated | ||
xml_reader :default_weight_unit, :from => "DefaultWeightUnit" # deprecated | ||
xml_accessor :default_class_of_trade, :from => "DefaultClassOfTrade" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,27 @@ | ||
module ONIX | ||
class Product | ||
include XML::Mapping | ||
include ROXML | ||
|
||
root_element_name "Product" | ||
xml_accessor :record_reference, :from => "RecordReference" | ||
xml_accessor :notification_type, :from => "NotificationType" | ||
xml_accessor :product_identifiers, [ONIX::ProductIdentifier], :from => "ProductIdentifier" | ||
xml_accessor :product_form, :from => "ProductForm" | ||
xml_accessor :series, :from => "Series" | ||
xml_accessor :edition, :from => "Edition" | ||
xml_accessor :titles, [ONIX::Title], :from => "Title" | ||
xml_accessor :websites, [ONIX::Website], :from => "Website" | ||
xml_accessor :contributors, [ONIX::Contributor], :from => "Contributor" | ||
xml_accessor :number_of_pages, :from => "NumberOfPages" | ||
xml_accessor :bic_main_subject, :from => "BICMainSubject" | ||
#array_node :subjects, "Subject", , :class => ONIX::Subject | ||
#array_node :text, "OtherText", , :class => ONIX::OtherText | ||
#array_node :media_files, "MediaFile", , :class => ONIX::MediaFile | ||
#array_node :imprints, "Imprint", , :class => ONIX::Imprint | ||
#array_node :publishers, "Publisher", , :class => ONIX::Publisher | ||
xml_accessor :publishing_status, :from => "PublishingStatus" | ||
xml_accessor :publication_date, :from => "PublicationDate" | ||
#array_node :sales_restrictions, "SalesRestriction", , :class => ONIX::SalesRestriction | ||
#array_node :supply_details, "SupplyDetail", , :class => ONIX::SupplyDetail | ||
|
||
text_node :record_reference, "RecordReference" | ||
two_digit_node :notification_type, "NotificationType" | ||
array_node :product_identifiers, "ProductIdentifier", :class => ONIX::ProductIdentifier | ||
text_node :product_form, "ProductForm", :optional => true | ||
text_node :series, "Series", :optional => true | ||
text_node :edition, "Edition", :optional => true | ||
array_node :titles, "Title", :optional => true, :class => ONIX::Title | ||
array_node :websites, "Website", :optional => true, :class => ONIX::Website | ||
array_node :contributors, "Contributor", :optional => true, :class => ONIX::Contributor | ||
numeric_node :number_of_pages, "NumberOfPages", :optional => true | ||
text_node :bic_main_subject, "BICMainSubject", :optional => true | ||
array_node :subjects, "Subject", :optional => true, :class => ONIX::Subject | ||
array_node :text, "OtherText", :optional => true, :class => ONIX::OtherText | ||
array_node :media_files, "MediaFile", :optional => true, :class => ONIX::MediaFile | ||
array_node :imprints, "Imprint", :optional => true, :class => ONIX::Imprint | ||
array_node :publishers, "Publisher", :optional => true, :class => ONIX::Publisher | ||
two_digit_node :publishing_status, "PublishingStatus", :optional => true | ||
text_node :publication_date, "PublicationDate", :optional => true | ||
array_node :sales_restrictions, "SalesRestriction", :optional => true, :class => ONIX::SalesRestriction | ||
array_node :supply_details, "SupplyDetail", :optional => true, :class => ONIX::SupplyDetail | ||
|
||
def initialize | ||
# setup some default values for when the object is created from scratch | ||
self.product_identifiers = [] | ||
self.titles = [] | ||
self.websites = [] | ||
self.contributors = [] | ||
self.subjects = [] | ||
self.text = [] | ||
self.media_files = [] | ||
self.imprints = [] | ||
self.publishers = [] | ||
self.sales_restrictions = [] | ||
self.supply_details = [] | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
module ONIX | ||
class ProductIdentifier | ||
include XML::Mapping | ||
include ROXML | ||
|
||
two_digit_node :product_id_type, "ProductIDType" | ||
text_node :id_value, "IDValue" | ||
xml_accessor :product_id_type, :from => "ProductIDType" | ||
xml_accessor :id_value, :from => "IDValue" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
module ONIX | ||
class Title | ||
include XML::Mapping | ||
include ROXML | ||
|
||
two_digit_node :title_type, "TitleType" | ||
text_node :title_text, "TitleText" | ||
text_node :subtitle, "Subtitle", :optional => true | ||
xml_accessor :title_type, :from => "TitleType" | ||
xml_accessor :title_text, :from => "TitleText" | ||
xml_accessor :subtitle, :from => "Subtitle" | ||
|
||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
module ONIX | ||
class Website | ||
include XML::Mapping | ||
include ROXML | ||
|
||
numeric_node :website_role, "WebsiteRole", :optional => true | ||
text_node :website_description, "WebsiteDescription", :optional => true | ||
text_node :website_link, "WebsiteLink" | ||
xml_accessor :website_role, :from => "WebsiteRole" | ||
xml_accessor :website_description, :from => "WebsiteDescription" | ||
xml_accessor :website_link, :from => "WebsiteLink" | ||
end | ||
end |