XMLFragment (Apache Ant API)

Overview | Package | Class | Tree | Deprecated | Index | Help

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.tools.ant.util
Class XMLFragment

    java.lang.Object
      org.apache.tools.ant.ProjectComponent
          org.apache.tools.ant.util.XMLFragment

All Implemented Interfaces:
  java.lang.Cloneable, DynamicElementNS

Direct Known Subclasses:
  EchoXML

    public class XMLFragment

extends ProjectComponent
implements DynamicElementNS

Use this class as a nested element if you want to get a literal DOM fragment of something nested into your task/type.

This is useful for tasks that want to deal with the "real" XML from the build file instead of objects.

Code heavily influenced by code written by Dominique Devienne.

Since:
  Ant 1.7

Nested Class Summary
`class` | `XMLFragment.Child` An object to handle (recursively) nested elements.

Field Summary

Fields inherited from class org.apache.tools.ant.ProjectComponent
`description, location, project`

Constructor Summary
`XMLFragment()` Constructor for XMLFragment object.

Method Summary
`void` | `addText(java.lang.String s)` Add nested text, expanding properties as we go
`java.lang.Object` | `createDynamicElement(java.lang.String uri, java.lang.String name, java.lang.String qName)` Creates a nested element.
`org.w3c.dom.DocumentFragment` | `getFragment()`

Methods inherited from class org.apache.tools.ant.ProjectComponent
`clone, getDescription, getLocation, getProject, log, log, setDescription, setLocation, setProject`

Methods inherited from class java.lang.Object
`equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### XMLFragment

    public XMLFragment()

  Constructor for XMLFragment object.

Method Detail

### getFragment

    public org.w3c.dom.DocumentFragment getFragment()

  Returns:
    the DocumentFragment that corresponds to the nested structure.

### addText

    public void addText(java.lang.String s)

  Add nested text, expanding properties as we go

  Parameters:
    `s` - the text to add

### createDynamicElement

    public java.lang.Object createDynamicElement(java.lang.String uri,
                                                 java.lang.String name,
                                                 java.lang.String qName)

  Creates a nested element.

  Specified by:
    `createDynamicElement` in interface `DynamicElementNS`
  Parameters:
    `uri` - the uri of the nested element
    `name` - the localname of the nested element
    `qName` - the qualified name of the nested element
  Returns:
    an object that the element is applied to

Overview | Package | Class | Tree | Deprecated | Index | Help

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD