merging xml files

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Nathan Coast

    #1

    merging xml files

    Hi,

    I need to merge the contents of an xml file with xml elements that have
    been generated into another file.

    What I'm actually trying to do....

    I'm updating the maven tomcat plugin. This plugin uses the tomcat jspc
    to generate servlet classes for the jsps. the jspc also creates xml
    elements for the servlets and servlet mappings. I need to merge this
    generated xml snippet with the original web.xml for the web-application.

    Problems I have is to merge the files without violating the
    web-application schema

    <xsd:schema xmlns="http://www.w3.org/2001/XMLSchema"
    targetNamespace ="http://java.sun.com/xml/ns/j2ee"
    xmlns:j2ee="htt p://java.sun.com/xml/ns/j2ee"
    xmlns:xsd="http ://www.w3.org/2001/XMLSchema"
    elementFormDefa ult="qualified"
    attributeFormDe fault="unqualif ied"
    version="2.4">

    The difficulty comes as there's no guarantee what other elements will be
    present in the original web.xml

    I've had a look at JDom and dom4j and there doesn't seem to be an easy
    way to do this.

    Anyone have any ideas how to go about this? Additional constraints I
    have are that the solution needs to work from java or ant.

    any help much appreciated,

    cheers
    Nathan
Working...