How to replace a xml tag with DTD entity

こ雲淡風輕ζ 提交于 2019-12-13 03:11:12

问题


I can replace a xml Attribute values using DTD Entity declaration using following methode

//in DTD
<!ENTITY varchar "VARCHAR(200)">
// In xml 
<column name="attachment_url" type="&varchar;"/>

Now I want to replace a xml tag like

<column name="attachment_url" type="VARCHAR(200)"/>

using DTD Entity.

I try like <!ENTITY full_coulumn "&lt;column name=&quot;attachment_url&quot; type=&quot;VARCHAR(200)&quot;/&gt;">

then i get an error

 Unexpected column with text: <column name="attachment_url" type="VARCHAR(200)
"/>

Is it possible to replace entire xml tag with dtd Entity? How can i do that?

I am try to do this with liquibase xml file.


回答1:


Don't escape the markup in the entity declaration; by doing so, you signal to the processor that the entity's replacement text is a string of characters, not markup. What you want is:

<!ENTITY full_column "<column name='attachment_url' 
                      type='VARCHAR(200)' />">


来源:https://stackoverflow.com/questions/14473460/how-to-replace-a-xml-tag-with-dtd-entity

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!