텍스트 열에 XML/HTML 파일을 문제없이 텍스트로 저장할 수 있습니다.
분명한 단점은 XML에서 값을 쿼리 할 수 없다는 것입니다.
편집 : 다음은 예입니다. XML 파일을 변수로 읽어 들인 다음 저장하려는 다른 값과 함께 문자열을 저장하는 것처럼 DB에 저장하십시오. XML을 사용하려면 XML에서 파싱하고 XML 파서로 파싱합니다.
# connect to database and create table
import sqlite3
conn = sqlite3.connect(":memory:")
conn.execute('''create table my_table (value1 integer, value2 integer, xml text)''')
# read text from file
f = file('/tmp/my_file.xml')
xml_string_from_file = f.read()
# insert text into database
cur = conn.cursor()
cur.execute('''insert into my_table (value1, value2, xml) values (?, ?, ?)''', (23, 42, xml_string_from_file))
cur.commit()
# read from database into variable
cur.execute('''select * from my_table''')
xml_string_from_db = cur.fetchone()[2]
# parse with the XML parser of your choice
from xml.dom.minidom import parseString
dom = parseString(xml_string_from_db)
실제로 SQLite에 저장할 수 있습니다. 파싱 및 사용 방법은 귀하에게 달려 있습니다. SQLite는 타입에 관해서도 꽤 관대합니다 ... –