Top Description Inners Fields Constructors Methods
org.apache.tools.ant.util

public Class XMLFragment

extends ProjectComponent
implements DynamicElementNS
Class Inheritance
All Implemented Interfaces
org.apache.tools.ant.DynamicElementNS
Known Direct Subclasses
org.apache.tools.ant.taskdefs.EchoXML
Imports
org.apache.tools.ant.DynamicConfiguratorNS, .DynamicElementNS, .ProjectComponent, org.w3c.dom.Document, .DocumentFragment, .Element, .Node, .Text

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 and Inner Type Summary

Modifier and TypeClass and Description
public class
XMLFragment.Child

An object to handle (recursively) nested elements.

Field Summary

Modifier and TypeField and Description
private Document
private DocumentFragment
Inherited from org.apache.tools.ant.ProjectComponent:
descriptionlocationproject

Constructor Summary

AccessConstructor and Description
public
XMLFragment()

Constructor for XMLFragment object.

Method Summary

Modifier and TypeMethod and Description
public void
addText(String
the text to add
s
)

Add nested text, expanding properties as we go

private void
addText(Node
node
n
,
String
value
s
)

Add text to a node.

public Object

Returns:

an object that the element is applied to
createDynamicElement
(String
the uri of the nested element
uri
,
String
the localname of the nested element
name
,
String
the qualified name of the nested element
qName
)

Implements org.apache.tools.ant.DynamicElementNS.createDynamicElement.

Creates a nested element.
public DocumentFragment

Returns:

the DocumentFragment that corresponds to the nested structure.
getFragment
()

Inherited from org.apache.tools.ant.ProjectComponent:
clonegetDescriptiongetLocationgetProjectloglogsetDescriptionsetLocationsetProject

Field Detail

docback to summary
private Document doc
fragmentback to summary
private DocumentFragment fragment

Constructor Detail

XMLFragmentback to summary
public XMLFragment()

Constructor for XMLFragment object.

Method Detail

addTextback to summary
public void addText(String s)

Add nested text, expanding properties as we go

Parameters
s:String

the text to add

addTextback to summary
private void addText(Node n, String s)

Add text to a node.

Parameters
n:Node

node

s:String

value

createDynamicElementback to summary
public Object createDynamicElement(String uri, String name, String qName)

Implements org.apache.tools.ant.DynamicElementNS.createDynamicElement.

Creates a nested element.

Parameters
uri:String

the uri of the nested element

name:String

the localname of the nested element

qName:String

the qualified name of the nested element

Returns:Object

an object that the element is applied to

Annotations
@Override
getFragmentback to summary
public DocumentFragment getFragment()
Returns:DocumentFragment

the DocumentFragment that corresponds to the nested structure.

org.apache.tools.ant.util back to summary

public Class XMLFragment.Child

extends Object
implements DynamicConfiguratorNS
Class Inheritance
All Implemented Interfaces
org.apache.tools.ant.DynamicConfiguratorNS, org.apache.tools.ant.DynamicElementNS, org.apache.tools.ant.DynamicAttributeNS

An object to handle (recursively) nested elements.

Field Summary

Modifier and TypeField and Description
private Element
e

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
addText(String
the text to add
s
)

Add nested text.

public Object

Returns:

an object that the element is applied to
createDynamicElement
(String
the uri of the nested element
uri
,
String
the localname of the nested element
name
,
String
the qualified name of the nested element
qName
)

Implements org.apache.tools.ant.DynamicElementNS.createDynamicElement.

Creates a nested element.
public void
setDynamicAttribute(String
the uri of the attribute
uri
,
String
the localname of the attribute
name
,
String
the qualified name of the attribute
qName
,
String
the value of the attribute
value
)

Implements org.apache.tools.ant.DynamicAttributeNS.setDynamicAttribute.

Sets the attribute
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

eback to summary
private Element e

Constructor Detail

Childback to summary
pack-priv Child(Element e)

Method Detail

addTextback to summary
public void addText(String s)

Add nested text.

Parameters
s:String

the text to add

createDynamicElementback to summary
public Object createDynamicElement(String uri, String name, String qName)

Implements org.apache.tools.ant.DynamicElementNS.createDynamicElement.

Creates a nested element.

Parameters
uri:String

the uri of the nested element

name:String

the localname of the nested element

qName:String

the qualified name of the nested element

Returns:Object

an object that the element is applied to

Annotations
@Override
setDynamicAttributeback to summary
public void setDynamicAttribute(String uri, String name, String qName, String value)

Implements org.apache.tools.ant.DynamicAttributeNS.setDynamicAttribute.

Sets the attribute

Parameters
uri:String

the uri of the attribute

name:String

the localname of the attribute

qName:String

the qualified name of the attribute

value:String

the value of the attribute

Annotations
@Override