From 5ae77714d57586a185279e475c5cade669758edf Mon Sep 17 00:00:00 2001 From: Pavan Mandava Date: Tue, 21 Jan 2020 00:00:51 +0100 Subject: [PATCH] Book XSD Added --- xml_files/book.xsd | 67 ++++++++++++++++++++++++++++++++++++++++ xml_parser/create_xml.py | 7 ++--- 2 files changed, 70 insertions(+), 4 deletions(-) create mode 100644 xml_files/book.xsd diff --git a/xml_files/book.xsd b/xml_files/book.xsd new file mode 100644 index 0000000..f64d1ac --- /dev/null +++ b/xml_files/book.xsd @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/xml_parser/create_xml.py b/xml_parser/create_xml.py index c7ae5fc..0d18efb 100644 --- a/xml_parser/create_xml.py +++ b/xml_parser/create_xml.py @@ -24,14 +24,13 @@ def create_xml_file(book_dict, book_metadata): total_chapters = ET.SubElement(book_info, 'totalChapters') total_chapters.text = book_metadata['totalChapters'] + source = ET.SubElement(book_info, 'source') + source.text = book_metadata['source'] + if 'description' in book_metadata: description = ET.SubElement(book_info, 'description') description.text = book_metadata['description'] - if 'source' in book_metadata: - source = ET.SubElement(book_info, 'source') - source.text = book_metadata['source'] - if 'isbn' in book_metadata: isbn = ET.SubElement(book_info, 'isbn') isbn.text = book_metadata['isbn']