peterreilly 2004/12/01 07:07:27 Modified: src/main/org/apache/tools/ant/util XMLFragment.java Log: sylecheck and implement DynamicElementNS instead of DynamicConfiguratorNS Revision Changes Path 1.10 +24 -13 ant/src/main/org/apache/tools/ant/util/XMLFragment.java Index: XMLFragment.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/util/XMLFragment.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- XMLFragment.java 2 Jul 2004 07:23:54 -0000 1.9 +++ XMLFragment.java 1 Dec 2004 15:07:27 -0000 1.10 @@ -23,9 +23,8 @@ import org.w3c.dom.Node; import org.w3c.dom.Text; -import org.apache.tools.ant.BuildException; import org.apache.tools.ant.DynamicConfiguratorNS; -import org.apache.tools.ant.ProjectHelper; +import org.apache.tools.ant.DynamicElementNS; /** * Use this class as a nested element if you want to get a literal DOM @@ -38,19 +37,22 @@ * * @since Ant 1.7 */ -public class XMLFragment implements DynamicConfiguratorNS { +public class XMLFragment implements DynamicElementNS { private Document doc; private DocumentFragment fragment; + /** + * Constructor for XMLFragment object. + */ public XMLFragment() { doc = JAXPUtils.getDocumentBuilder().newDocument(); fragment = doc.createDocumentFragment(); } /** - * Return the DocumentFragment that corresponds to the nested - * structure. + * @return the DocumentFragment that corresponds to the nested + * structure. */ public DocumentFragment getFragment() { return fragment; @@ -58,21 +60,18 @@ /** * Add nested text. + * @param s the text to add */ public void addText(String s) { addText(fragment, s); } /** - * No attributes for the wrapping element. - */ - public void setDynamicAttribute(String uri, String name, String qName, String value) - throws BuildException { - throw new BuildException("Attribute " + name + " is not supported."); - } - - /** * Creates a nested element. + * @param uri the uri of the nested element + * @param name the localname of the nested element + * @param qName the qualified name of the nested element + * @return an object that the element is applied to */ public Object createDynamicElement(String uri, String name, String qName) { Element e = doc.createElementNS(uri, qName); @@ -87,6 +86,9 @@ } } + /** + * An object to handle (recursively) nested elements. + */ public class Child implements DynamicConfiguratorNS { private Element e; @@ -96,6 +98,7 @@ /** * Add nested text. + * @param s the text to add */ public void addText(String s) { XMLFragment.this.addText(e, s); @@ -103,6 +106,10 @@ /** * Sets the attribute + * @param uri the uri of the attribute + * @param name the localname of the attribute + * @param qName the qualified name of the attribute + * @param value the value of the attribute */ public void setDynamicAttribute( String uri, String name, String qName, String value) { @@ -115,6 +122,10 @@ /** * Creates a nested element. + * @param uri the uri of the nested element + * @param name the localname of the nested element + * @param qName the qualified name of the nested element + * @return an object that the element is applied to */ public Object createDynamicElement(String uri, String name, String qName) { Element e2 = null;
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]