0
我有一个XML文档文件。该文件的部分看起来像这样:如何从XML文件创建PostgreSQL表...
-<attr>
<attrlabl>COUNTY</attrlabl>
<attrdef>County abbreviation</attrdef>
<attrtype>Text</attrtype>
<attwidth>1</attwidth>
<atnumdec>0</atnumdec>
-<attrdomv>
-<edom>
<edomv>C</edomv>
<edomvd>Clackamas County</edomvd>
<edomvds/>
</edom>
-<edom>
<edomv>M</edomv>
<edomvd>Multnomah County</edomvd>
<edomvds/>
</edom>
-<edom>
<edomv>W</edomv>
<edomvd>Washington County</edomvd>
<edomvds/>
</edom>
</attrdomv>
</attr>
从这个XML文件,我想创建一个PostgreSQL表attrlabl,attrdef,attrtype和attrdomv列。我感谢你的建议!
attrlabl有一个项目,attrdomv有子女和子女。这不会转换成任何表格格式。如果你想强制它,你将不得不利用一个XML解析器和滚动你自己的翻译程序来从它生成SQL。 –
@EricLeschinski:实际上,它可以用PostgreSQL工具完成,但它很复杂,我现在没有时间了。我前一段时间发布了一个相关的答案[here](http://stackoverflow.com/a/7628453/939860)。 –