Hi,
I am dealing with J2EE web app XML web.xml based on
the the DTD which defines the top level element as
<!ELEMENT web-app (icon?, display-name?,
description?, distributable?,
context-param*, filter*, filter-mapping*, listener*, servlet*, servlet-mapping*, session-config?, mime-mapping*, welcome-file-list?, error-page*, taglib*, resource-env-ref*, resource-ref*, security-constraint*, login-config?, security-role*, env-entry*, ejb-ref*, ejb-local-ref*)> I have the web.xml in memory as a dom4j tree. When
user asks me to insert a node, I can not simply append it but insert it at a
point dictated by DTD. If I simply append it, the document is invalid as per
DTD.
Is there any API that will let me insert an element
at the right spot based on the order dictated by DTD?
Without such APIs, if some user asks me to insert
servlet-mapping, then I will have to search for any existing servlet-mapping and
insert after them. If there are no servlet-mapping, then search if there are any
servlet then insert after them, If no servlets ..., you get the idea.
Even if there is no API in dom4j, this seem like
such a common problem, I am sure somebody has already written generic code that
I could use. Please pass me any info you may have on that.
|
- Re: [dom4j-user] Ordered insert based on DTD Vishy Kasar
- Re: [dom4j-user] Ordered insert based on DTD Thierry Hanser