How to replace a xml tag with DTD entity

2019-09-06 02:41发布

问题:

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)' />">