Laboratory_2

This commit is contained in:
nikbel2004@outlook.com 2024-09-15 23:46:31 +04:00
parent a0a3fd0be4
commit 7849dd4531
4 changed files with 23 additions and 30 deletions

View File

@ -1,14 +0,0 @@
import http.server
import socketserver
PORT = 8000
DIRECTORY = "."
class Handler(http.server.SimpleHTTPRequestHandler):
def __init__(self, *args, **kwargs):
super().__init__(*args, directory=DIRECTORY, **kwargs)
# Запуск сервера на порту 8000
with socketserver.TCPServer(("", PORT), Handler) as httpd:
print(f"Serving at http://localhost:{PORT}")
httpd.serve_forever()

15
Lab 2/library.dtd Normal file
View File

@ -0,0 +1,15 @@
<!DOCTYPE library [
<!ELEMENT library (book+)>
<!ELEMENT book (title, author, genre, year)>
<!ELEMENT title (#PCDATA)>
<!ELEMENT author (#PCDATA)>
<!ELEMENT genre (#PCDATA)>
<!ELEMENT year (#PCDATA)>
<!ATTLIST book ISBN CDATA #REQUIRED>
<!ATTLIST book available CDATA #REQUIRED>
<!ATTLIST book publisher CDATA #IMPLIED>
<!ATTLIST book language CDATA #IMPLIED>
]>

View File

@ -1,34 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="library.xslt"?>
<?xml-model href="library.dtd" type="applecation/xml-dtd"?>
<library>
<book>
<book ISBN="978-3-16-148410-0" available="yes" publisher="Penguin" language="English">
<title>War and Peace</title>
<author>Leo Tolstoy</author>
<genre>Historical</genre>
<year>1869</year>
</book>
<book>
<book ISBN="978-5-17-085410-0" available="no" language="Russian">
<title>The Captain's Daughter</title>
<author>Alexander Pushkin</author>
<genre>Novel</genre>
<year>1836</year>
</book>
<book>
<title>Crime and Punishment</title>
<author>Fyodor Dostoevsky</author>
<genre>Philosophical</genre>
<year>1866</year>
</book>
<book>
<book ISBN="978-5-11-022410-0" available="yes" language="French">
<title>The Three Musketeers</title>
<author>Alexandre Dumas</author>
<genre>Historical novel</genre>
<year>1844</year>
</book>
<book>
<title>Fifteen-year-old captain</title>
<author>Jules Verne</author>
<genre>Novel</genre>
<year>1878</year>
</book>
</library>
<!-- Остальные книги... -->
</library>

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- Шаблон для корневого элемента -->
<xsl:template match="/">
<html>
<head>