nest xml in an xml doctype entity
<!DOCTYPE cruisecontrol [
<!ENTITY triggers "<triggers><intervalTrigger seconds="30" /></triggers>">
<!ENTITY rootdir "J:\pathyness\" >
]>
I'm trying to setup my first cruisecontrol.net server, so since I want to reduce the amount of repeated configuration I am trying to setup this nested XML entity so I can just use &triggers;
within the body of the xml.
What do I need to do to that XML entity <triggers><intervalTrigger seconds="30" /></triggers>
to make sure 开发者_高级运维it will work as I've illustrated above? I know that the two gotchas so far are
- quotes
- angle brackets
So I'm not sure if I have to go so far as <triggers><intervalTrigger seconds="30" /></triggers>
as that all seems like overkill of the nth degree.
Try going like this:
$ cat doctype-markup.xml
<!DOCTYPE cruisecontrol [
<!ENTITY triggers "<triggers><intervalTrigger seconds='30' /></triggers>">
<!ENTITY rootdir "J:\pathyness\" >
]>
<cruisecontrol>
<dir>&rootdir;</dir>
<eins>&triggers;</eins>
<zwei>&triggers;</zwei>
<drei>&triggers;</drei>
</cruisecontrol>
$ xmllint doctype-markup.xml
<?xml version="1.0"?>
<!DOCTYPE cruisecontrol [
<!ENTITY triggers "<triggers><intervalTrigger seconds='30' /></triggers>">
<!ENTITY rootdir "J:\pathyness\">
]>
<cruisecontrol>
<dir>&rootdir;</dir>
<eins>&triggers;</eins>
<zwei>&triggers;</zwei>
<drei>&triggers;</drei>
</cruisecontrol>
$ xmllint --noent doctype-markup.xml
<?xml version="1.0"?>
<!DOCTYPE cruisecontrol [
<!ENTITY triggers "<triggers><intervalTrigger seconds='30' /></triggers>">
<!ENTITY rootdir "J:\pathyness\">
]>
<cruisecontrol>
<dir>J:\pathyness\</dir>
<eins><triggers><intervalTrigger seconds="30"/></triggers></eins>
<zwei><triggers><intervalTrigger seconds="30"/></triggers></zwei>
<drei><triggers><intervalTrigger seconds="30"/></triggers></drei>
</cruisecontrol>
If your goal is to reduce repetition Configuration Preprocessor is vastly superior to working with entity subtitution.
精彩评论