如何通过python从dtd创建xml示例文件

时间:2012-07-02 10:16:57

标签: python xml dtd-parsing

我想使用python从dtd创建示例xml。不知道beautifulsoup会有所帮助

<?xml version="1.0" encoding="UTF-8"?>
   <!ELEMENT DatabaseInventory (DatabaseName+)>
   <!ELEMENT DatabaseName (   GlobalDatabaseName
                            , OracleSID
                            , DatabaseDomain
                            , Administrator+
                            , DatabaseAttributes
                            , Comments)
   >
   <!ELEMENT GlobalDatabaseName (#PCDATA)>
   <!ELEMENT OracleSID          (#PCDATA)>
   <!ELEMENT DatabaseDomain     (#PCDATA)>
   <!ELEMENT Administrator      (#PCDATA)>
   <!ELEMENT DatabaseAttributes EMPTY>
   <!ELEMENT Comments           (#PCDATA)>

   <!ATTLIST Administrator       EmailAlias CDATA #REQUIRED>
   <!ATTLIST Administrator       Extension  CDATA #IMPLIED>
   <!ATTLIST DatabaseAttributes  Type       (Production|Development|Testing) #REQUIRED>
   <!ATTLIST DatabaseAttributes  Version    (7|8|8i|9i) "9i">

   <!ENTITY AUTHOR "exampler">
   <!ENTITY WEB    "www.example.com">
   <!ENTITY EMAIL  "exampler@example.com">

我从其他来源复制了这个dtd。

0 个答案:

没有答案