|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.myjavatools.xml.BasicXmlData
public class BasicXmlData
Nested Class Summary | |
---|---|
static class |
BasicXmlData.Expression
An abstract class that stores an expression used in XmlData search/filtering. |
class |
BasicXmlData.Function<X,Y>
|
static class |
BasicXmlData.Policy
Class Policy defines three different casting policies. |
Nested classes/interfaces inherited from interface com.myjavatools.xml.XmlData |
---|
XmlData.Condition |
Field Summary | |
---|---|
static java.lang.Class |
XmlDataClass
|
Constructor Summary | |
---|---|
BasicXmlData()
Default constructor. |
|
BasicXmlData(java.io.File in)
Creates an instance from the data read from a file. |
|
BasicXmlData(java.io.InputStream in)
Creates an instance from the data read from input stream. |
|
BasicXmlData(java.lang.String type)
Creates an instance of BasicXmlData of specified type. |
|
BasicXmlData(java.lang.String type,
java.lang.String value)
Creates an instance of specified type and with the specified value. |
|
BasicXmlData(java.lang.String type,
java.lang.String value,
org.xml.sax.AttributeList attributes)
Creates an instance of specified type, with the specified value, attributes that are listed in the provided AttributeList. |
|
BasicXmlData(java.lang.String type,
java.lang.String value,
org.xml.sax.AttributeList attributes,
java.util.Collection<XmlData> kids)
Creates an instance of specified type, with the specified value, attributes that are listed in the provided AttributeList, and the kids that are listed in the provided collection. |
|
BasicXmlData(java.lang.String type,
java.lang.String value,
org.xml.sax.AttributeList attributes,
XmlData... kids)
Creates an instance of specified type, with the specified value, attributes that are listed in the provided AttributeList, and the kids that are listed in the provided array of XmlData. |
|
BasicXmlData(java.lang.String type,
java.lang.String value,
java.util.Collection<? extends XmlData> kids)
Creates an instance of specified type, with the specified value and the kids that are listed in the provided collection. |
|
BasicXmlData(java.lang.String type,
java.lang.String value,
java.util.Map<java.lang.String,java.lang.String> attributes,
java.util.Collection<? extends XmlData> kids)
Creates an instance of specified type, with the specified value, attributes that are listed in the provided array as name-value pairs, and the kids that are listed in the provided collection. |
|
BasicXmlData(java.lang.String type,
java.lang.String value,
java.lang.String... attributes)
Creates an instance of specified type, with the specified value and the attributes that are listed in the provided array as name-value pairs. |
|
BasicXmlData(java.lang.String type,
java.lang.String value,
java.lang.String[] attributes,
java.util.Collection<? extends XmlData> kids)
Creates an instance of specified type, with the specified value, attributes that are listed in the provided array as name-value pairs, and the kids that are listed in the provided collection. |
|
BasicXmlData(java.lang.String type,
java.lang.String value,
java.lang.String[] attributes,
XmlData... kids)
Creates an instance of BasicXmlData of specified type, with the specified value, attributes that are listed in the provided array as name-value pairs, and the kids that are listed in the provided array of XmlData. |
|
BasicXmlData(java.lang.String type,
java.lang.String value,
XmlData... kids)
Creates an instance of specified type, with the specified value and the kids that are listed in the provided array. |
|
BasicXmlData(java.lang.String type,
XmlData org)
Creates an instance of specified type from another XmlData object (deep copy). |
|
BasicXmlData(java.net.URL url)
Creates an instance from the data read from URL. |
|
BasicXmlData(XmlData org)
Creates an instance from another XmlData object (deep copy). |
Method Summary | |
---|---|
XmlData |
addKid(XmlData kid)
Adds a kid to the set of kids. |
void |
addKids(java.util.Collection<? extends XmlData> kids)
Adds all XmlData elements from given Collection to the set of kids, skipping elements that are not XmlData. |
void |
addKids(java.util.Iterator<? extends XmlData> kids)
Adds all XmlData elements from given Iterator to the collection of kids, skipping elements that are not BasicXmlData. |
XmlData |
cast(java.util.Map<java.lang.String,java.lang.Class<? extends XmlData>> typemap,
BasicXmlData.Policy policy)
Casts XmlData and its kids, recursively, to specified classes, according to the typemap. |
static XmlData |
cast(XmlData object,
java.util.Map<java.lang.String,java.lang.Class<? extends XmlData>> typemap,
BasicXmlData.Policy policy)
Casts XmlData and its kids, recursively, to specified classes, according to the typemap. |
boolean |
castKids(java.lang.String type,
java.lang.Class<? extends XmlData> clazz)
Casts kids of specified type to a specified class (actually replacing them with the new instances). |
XmlData |
castToPackage(java.lang.String packageName,
BasicXmlData.Policy policy)
Casts XmlData and its kids, recursively, to classes in specified package. |
static XmlData |
castToPackage(XmlData object,
java.lang.String packageName,
BasicXmlData.Policy policy)
Casts XmlData and its kids, recursively, to classes in specified package. |
void |
cleanAttributes()
cleans attributes map Just removes all the attributes except xmlns (because) |
XmlData |
clone()
Clones of XmlData, same thing as deepCopy. |
static void |
debug(boolean doit)
|
XmlData |
deepCopy()
Deep copy of XmlData. |
protected static boolean |
equal(java.lang.Object o1,
java.lang.Object o2)
|
boolean |
equals(java.lang.Object o)
Compares the specified object with this XmlData for equality. |
java.util.Collection<XmlData> |
getAllKids()
Gets a collection of all kids of XmlData. |
java.lang.String |
getAttribute(java.lang.String name)
Gets the value of a specified attribute. |
java.lang.String |
getAttribute(java.lang.String name,
java.lang.String defaultValue)
Gets the value of a specified attribute; if there is none, returns default value. |
java.util.Map<java.lang.String,java.lang.String> |
getAttributes()
Gets a Map of attributes. |
java.lang.String |
getId()
Gets the id of XmlData, which is the value of attribute "id". |
protected static java.io.InputStream |
getInputStream(java.net.URL url)
|
XmlData |
getKid(int position)
Gets a kid at specified position. |
XmlData |
getKid(java.lang.String type)
Gets a kid of specified type, if any. |
XmlData |
getKid(java.lang.String type,
java.lang.String id)
Gets a kid having specified type and specified id. |
XmlData |
getKid(java.lang.String type,
java.lang.String attribute,
java.lang.String value)
Gets a kid of specified type that has an attribute with a specified value. |
java.lang.String |
getKidAttribute(java.lang.String type,
java.lang.String attribute)
Gets the value of specified attribute of a kid of specified type, if any |
int |
getKidCount(java.lang.String type)
Gets the number of kids of specified type. |
java.util.List<XmlData> |
getKids(java.lang.String type)
Gets a Collection of kids of specified type. |
java.util.Collection |
getKidTypes()
Gets a collection of kid types |
java.lang.String |
getKidValue(java.lang.String type)
Gets the value of a kid of specified type, if any. |
java.lang.String |
getName()
Gets the name of XmlData, which is the value of attribute "name". |
java.lang.String |
getType()
Gets XmlData type, which is just a String. |
java.lang.String |
getValue()
Gets a value of XmlData, which is just a String. |
XmlData |
getXmlContent()
Gets the contents of this XmlData (that is, itself). |
int |
hashCode()
|
int |
indexOf(XmlData kid)
returns the position of kid in the list of kids |
XmlData |
insertKid(int position,
XmlData kid)
Insertes a kid into the list of kids. |
XmlData |
insertKid(XmlData before,
XmlData kid)
Insertes a kid before a specified kid. |
void |
removeKid(XmlData kid)
Removes a kid from the set of kids. |
java.util.Collection<XmlData> |
removeKids(java.lang.String type)
Removes all kids of given type. |
void |
replaceKid(XmlData oldKid,
XmlData newKid)
Replaces a kid with another. |
boolean |
satisfies(java.lang.String expression)
Checks whether this XmlData node satisfies given expression (presented as string). |
boolean |
satisfies(XmlData.Condition condition)
Checks whether this XmlData node satisfies given condition. |
void |
save(java.io.File file)
Saves XmlData to a file. |
void |
save(java.io.OutputStream os)
Saves XmlData to an output stream. |
void |
save(java.lang.String filename)
Saves XmlData to a file. |
XmlData |
selectTree(java.lang.String expression)
Selects a subtree from XmlData, that is, the tree of those nodes that satisfy a condition. |
XmlData |
selectTree(XmlData.Condition condition)
Selects a subtree from XmlData, that is, the tree of those nodes that satisfy a condition. |
void |
setAttribute(java.lang.String name,
java.lang.String value)
Sets an attribute value. |
void |
setAttributes(org.xml.sax.AttributeList attributes)
Sets attributes from an AttributeList. |
void |
setAttributes(java.util.Map<java.lang.String,java.lang.String> attributes)
Sets attributes from a Map. |
void |
setAttributes(java.lang.String... attributes)
Sets attributes from an array of name-value pairs. |
void |
setKidAttribute(java.lang.String type,
java.lang.String attribute,
java.lang.String value)
Sets the value of specified attribute of a kid of specified type; if the kid does not exist, it is created. |
protected void |
setKids(java.lang.String type,
java.util.Collection<XmlData> kids)
|
void |
setKidValue(java.lang.String type,
java.lang.String value)
Sets the value of a kid of specified type, creating it if necessary |
void |
setType(java.lang.String type)
|
XmlData |
setValue(java.lang.String v)
Sets the value of XmlData. |
void |
setXmlContent(XmlData org)
Sets the contents from another XmlData. |
void |
trim()
Tries to trim the set of kids, so that there are no spare slots left. |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.Class XmlDataClass
Constructor Detail |
---|
public BasicXmlData()
Creates an empty instance.
public BasicXmlData(java.lang.String type)
type
- the type of data, an arbitrary identifier string.public BasicXmlData(java.lang.String type, java.lang.String value)
type
- the type of data, an arbitrary identifier string.value
- the value of data, any string.
Example:
new BasicXmlData("example", "This is an example").save(filename)
<?xml version="1.0" encoding="UTF-8"?> <example>This is an example</example>
public BasicXmlData(java.lang.String type, java.lang.String value, java.util.Collection<? extends XmlData> kids)
type
- the type of data, an arbitrary identifier string.value
- the value of data, any string.kids
- a Collection of XmlData that attach themselves as kids to the instance being created
Example:
new BasicXmlData("example", "This is an example",
Arrays.asList(
new BasicXmlData... {new BasicXmlData("subexample", "This is a kid of example")}).
save(filename)
<?xml version="1.0" encoding="UTF-8"?> <example> <subexample>This is a kid of example</subexample>This is an example</example>
public BasicXmlData(java.lang.String type, java.lang.String value, XmlData... kids)
type
- the type of data, an arbitrary identifier string.value
- the value of data, any string.kids
- an array of XmlData that attach themselves as kids to the instance being created
Example:
new BasicXmlData("example", "This is an example",
new BasicXmlData... {new BasicXmlData("subexample", "This is a kid of example")}).save(filename)
<?xml version="1.0" encoding="UTF-8"?> <example> <subexample>This is a kid of example</subexample>This is an example</example>
public BasicXmlData(java.lang.String type, java.lang.String value, java.lang.String... attributes)
type
- the type of data, an arbitrary identifier string.value
- the value of data, any string.attributes
- an String array of name-value pairs
Example:
new BasicXmlData("example", "This is an example", new String... {"id", "0123dx", "name", "Whittman"}).save(filename)
<?xml version="1.0" encoding="UTF-8"?> <example id="0123dx" name="Whittman">This is an example</example>
public BasicXmlData(java.lang.String type, java.lang.String value, java.lang.String[] attributes, java.util.Collection<? extends XmlData> kids)
type
- the type of data, an arbitrary identifier string.value
- the value of data, any string.attributes
- an String array of name-value pairskids
- a Collection of XmlData that attach themselves as kids to the instance being created
Example:
new BasicXmlData("example", "This is an example",
new String[] {"id", "007", "name", "Bond"},
Arrays.asList(new BasicXmlData[] {new BasicXmlData("subexample", "This is a kid of example")}).save(filename)
<?xml version="1.0" encoding="UTF-8"?> <example id="007" name="Bond"> <subexample>This is a kid of example</subexample>This is an example</example>
public BasicXmlData(java.lang.String type, java.lang.String value, java.util.Map<java.lang.String,java.lang.String> attributes, java.util.Collection<? extends XmlData> kids)
type
- the type of data, an arbitrary identifier string.value
- the value of data, any string.attributes
- an String array of name-value pairskids
- a Collection of XmlData that attach themselves as kids to the instance being created
Example:
new BasicXmlData("example", "This is an example",
new String[] {"id", "007", "name", "Bond"},
Arrays.asList(new BasicXmlData[] {new BasicXmlData("subexample", "This is a kid of example")}).save(filename)
<?xml version="1.0" encoding="UTF-8"?> <example id="007" name="Bond"> <subexample>This is a kid of example</subexample>This is an example</example>
public BasicXmlData(java.lang.String type, java.lang.String value, java.lang.String[] attributes, XmlData... kids)
type
- the type of data, an arbitrary identifier string.value
- the value of data, any string.attributes
- an String array of name-value pairskids
- an array of XmlData that attach themselves as kids to the instance being created
Example:
new BasicXmlData("example", "This is an example",
new String[] {"id", "007", "name", "Bond"},
new BasicXmlData[] {new BasicXmlData("subexample", "This is a kid of example")}).save(filename)
<?xml version="1.0" encoding="UTF-8"?> <example id="007" name="Bond"> <subexample>This is a kid of example</subexample>This is an example</example>
public BasicXmlData(java.lang.String type, java.lang.String value, org.xml.sax.AttributeList attributes)
type
- the type of data, an arbitrary identifier string.value
- the value of data, any string.attributes
- an AttributeList (@see org.xml.sax.AttributeList)public BasicXmlData(java.lang.String type, java.lang.String value, org.xml.sax.AttributeList attributes, java.util.Collection<XmlData> kids)
type
- the type of data, an arbitrary identifier string.value
- the value of data, any string.attributes
- an AttributeList (@see org.xml.sax.AttributeList)kids
- a Collection of XmlData that attach themselves as kids to the instance being createdpublic BasicXmlData(java.lang.String type, java.lang.String value, org.xml.sax.AttributeList attributes, XmlData... kids)
type
- the type of data, an arbitrary identifier string.value
- the value of data, any string.attributes
- an AttributeList (@see org.xml.sax.AttributeList)kids
- an array of XmlData that attach themselves as kids to the instance being createdpublic BasicXmlData(java.lang.String type, XmlData org)
type
- Stringorg
- original XmlDatapublic BasicXmlData(XmlData org)
org
- original XmlDatapublic BasicXmlData(java.io.InputStream in) throws java.io.IOException, java.lang.InstantiationException
in
- input stream
java.io.IOException
java.lang.InstantiationiException
java.lang.InstantiationException
public BasicXmlData(java.io.File in) throws java.io.IOException, java.lang.InstantiationException
in
- file containing XML data
java.io.IOException
java.lang.InstantiationiException
java.lang.InstantiationException
public BasicXmlData(java.net.URL url) throws java.io.IOException, java.lang.InstantiationException
url
- url pointing to XML data
java.io.IOException
java.lang.InstantiationiException
java.lang.InstantiationException
Method Detail |
---|
public static void debug(boolean doit)
protected static java.io.InputStream getInputStream(java.net.URL url) throws java.io.IOException, java.lang.InstantiationException
java.io.IOException
java.lang.InstantiationException
public void setXmlContent(XmlData org)
setXmlContent
in interface XmlData
org
- original XmlDatapublic XmlData getXmlContent()
getXmlContent
in interface XmlData
public XmlData deepCopy()
public XmlData clone()
clone
in interface XmlData
clone
in class java.lang.Object
protected static boolean equal(java.lang.Object o1, java.lang.Object o2)
public boolean equals(java.lang.Object o)
equals
in interface XmlData
equals
in class java.lang.Object
o
- object to be compared for equality with this XmlData.
Example:
<?xml version="1.0" encoding="UTF-8"?> <example a1="v1" a2="v2"> <sub1 ax="vx" ay="vy"/> <sub2 aa="va" ab="vb"/> </example>and
<?xml version="1.0" encoding="UTF-8"?> <example a2="v2" a1="v1"> <sub2 ab="vb" aa="va"/> <sub1 ay="vy" ax="vx"/> </example>are equal.
public int hashCode()
hashCode
in class java.lang.Object
public void save(java.lang.String filename) throws java.io.IOException
filename
- name of the file to write to
java.io.IOException
public void save(java.io.File file) throws java.io.IOException
file
- file to write to
java.io.IOException
public void save(java.io.OutputStream os) throws java.io.IOException
os
- output stream to write to
java.io.IOException
public void cleanAttributes()
cleanAttributes
in interface XmlData
public void setAttribute(java.lang.String name, java.lang.String value)
setAttribute
in interface XmlData
name
- attribute namevalue
- attribute valuepublic void setAttributes(java.lang.String... attributes)
setAttributes
in interface XmlData
attributes
- a String array consisting of name-value pairs.public void setAttributes(java.util.Map<java.lang.String,java.lang.String> attributes)
setAttributes
in interface XmlData
attributes
- a Map, name -> value.public void setAttributes(org.xml.sax.AttributeList attributes)
setAttributes
in interface XmlData
attributes
- AttributeListpublic java.util.Map<java.lang.String,java.lang.String> getAttributes()
getAttributes
in interface XmlData
public java.lang.String getType()
getType
in interface XmlData
public void setType(java.lang.String type)
public java.lang.String getValue()
getValue
in interface XmlData
public XmlData setValue(java.lang.String v)
setValue
in interface XmlData
v
- new value for XmlData
public java.lang.String getAttribute(java.lang.String name)
getAttribute
in interface XmlData
name
- attribute name
public java.lang.String getAttribute(java.lang.String name, java.lang.String defaultValue)
getAttribute
in interface XmlData
name
- attribute namedefaultValue
-
public java.lang.String getName()
Same thing as getAttribute("name")
.
getName
in interface XmlData
public java.lang.String getId()
Same thing as getAttribute("id")
.
getId
in interface XmlData
public java.util.Collection<XmlData> getAllKids()
getAllKids
in interface XmlData
public java.util.List<XmlData> getKids(java.lang.String type)
getKids
in interface XmlData
type
- type of the kids to choose
protected void setKids(java.lang.String type, java.util.Collection<XmlData> kids)
public int getKidCount(java.lang.String type)
getKidCount
in interface XmlData
type
-
public XmlData getKid(java.lang.String type)
getKid
in interface XmlData
type
- type of the kid to chose
public XmlData getKid(int position)
getKid
in interface XmlData
position
- position of the kid to retrieve, starting with 0;
public java.lang.String getKidValue(java.lang.String type)
getKidValue
in interface XmlData
type
-
public void setKidValue(java.lang.String type, java.lang.String value)
setKidValue
in interface XmlData
type
- value
- public void setKidAttribute(java.lang.String type, java.lang.String attribute, java.lang.String value)
type
- Stringattribute
- Stringvalue
- Stringpublic java.lang.String getKidAttribute(java.lang.String type, java.lang.String attribute)
getKidAttribute
in interface XmlData
type
- Stringattribute
- String
public XmlData getKid(java.lang.String type, java.lang.String attribute, java.lang.String value)
getKid
in interface XmlData
type
- type of the kid to chooseattribute
- attribute namevalue
- attribute value
public XmlData getKid(java.lang.String type, java.lang.String id)
getKid
in interface XmlData
type
- kid typeid
- kid id
public XmlData addKid(XmlData kid)
addKid
in interface XmlData
kid
- kid to add
public int indexOf(XmlData kid)
kid
- XmlData
public XmlData insertKid(int position, XmlData kid)
position
- int the position where to insert the kidkid
- kid to add
public XmlData insertKid(XmlData before, XmlData kid)
before
- the kid before which this one should be insertedkid
- kid to add
public void removeKid(XmlData kid)
removeKid
in interface XmlData
kid
- kid to removepublic void replaceKid(XmlData oldKid, XmlData newKid)
replaceKid
in interface XmlData
oldKid
- kid to removenewKid
- kid to insert in its placepublic void addKids(java.util.Iterator<? extends XmlData> kids)
kids
- kids to add; can be nullpublic void addKids(java.util.Collection<? extends XmlData> kids)
addKids
in interface XmlData
kids
- kids to add; can be nullpublic java.util.Collection<XmlData> removeKids(java.lang.String type)
removeKids
in interface XmlData
type
- type of kids to remove
public boolean castKids(java.lang.String type, java.lang.Class<? extends XmlData> clazz)
castKids
in interface XmlData
type
- type of the kids to castclazz
- class to cast to
public static XmlData cast(XmlData object, java.util.Map<java.lang.String,java.lang.Class<? extends XmlData>> typemap, BasicXmlData.Policy policy) throws java.lang.InstantiationException, java.lang.NoSuchMethodException, java.lang.reflect.InvocationTargetException, java.lang.IllegalArgumentException, java.lang.IllegalAccessException, java.lang.ClassNotFoundException
object
- the objec to casttypemap
- maps types to classes. Type is what XmlData considers a type:
a string value of type property.policy
- one of the following: Policy.THROW_ON_ERROR (causes an exception
in case of any error), Policy.KEEP_ON_ERROR (keeps nodes that cannot be cast),
Policy.SKIP_ON_ERROR (ignores nodes that cannot be cast).
java.lang.InstantiationException
java.lang.NoSuchMethodException
java.lang.reflect.InvocationTargetException
java.lang.IllegalArgumentException
java.lang.IllegalAccessException
- Exception are thrown only if policy is Policy.THROW_ON_ERROR
java.lang.ClassNotFoundException
public static XmlData castToPackage(XmlData object, java.lang.String packageName, BasicXmlData.Policy policy) throws java.lang.InstantiationException, java.lang.NoSuchMethodException, java.lang.reflect.InvocationTargetException, java.lang.IllegalArgumentException, java.lang.IllegalAccessException, java.lang.ClassNotFoundException
object
- the objec to castpackageName
- the name of the package for casting. XmlData types
are mapped to classes with the same name inside specified package.
packageName can be null: then it is ignored.policy
- one of the following: Policy.THROW_ON_ERROR (causes an exception
in case of any error), Policy.KEEP_ON_ERROR (keeps nodes that cannot be cast),
Policy.SKIP_ON_ERROR (ignores nodes that cannot be cast).
java.lang.InstantiationException
java.lang.NoSuchMethodException
java.lang.reflect.InvocationTargetException
java.lang.IllegalArgumentException
java.lang.IllegalAccessException
- Exception are thrown only if policy is Policy.THROW_ON_ERROR
java.lang.ClassNotFoundException
public XmlData cast(java.util.Map<java.lang.String,java.lang.Class<? extends XmlData>> typemap, BasicXmlData.Policy policy) throws java.lang.InstantiationException, java.lang.NoSuchMethodException, java.lang.reflect.InvocationTargetException, java.lang.IllegalArgumentException, java.lang.IllegalAccessException, java.lang.ClassNotFoundException
typemap
- maps types to classes. Type is what XmlData considers a type:
a string value of type property.policy
- one of the following: Policy.THROW_ON_ERROR (causes an exception
in case of any error), Policy.KEEP_ON_ERROR (keeps nodes that cannot be cast),
Policy.SKIP_ON_ERROR (ignores nodes that cannot be cast).
java.lang.InstantiationException
java.lang.NoSuchMethodException
java.lang.reflect.InvocationTargetException
java.lang.IllegalArgumentException
java.lang.IllegalAccessException
- Exception are thrown only if policy is Policy.THROW_ON_ERROR
java.lang.ClassNotFoundException
public XmlData castToPackage(java.lang.String packageName, BasicXmlData.Policy policy) throws java.lang.InstantiationException, java.lang.NoSuchMethodException, java.lang.reflect.InvocationTargetException, java.lang.IllegalArgumentException, java.lang.IllegalAccessException, java.lang.ClassNotFoundException
packageName
- the name of the package for casting. XmlData types
are mapped to classes with the same name inside specified package.
packageName can be null: then it is ignored.policy
- one of the following: Policy.THROW_ON_ERROR (causes an exception
in case of any error), Policy.KEEP_ON_ERROR (keeps nodes that cannot be cast),
Policy.SKIP_ON_ERROR (ignores nodes that cannot be cast).
java.lang.InstantiationException
java.lang.NoSuchMethodException
java.lang.reflect.InvocationTargetException
java.lang.IllegalArgumentException
java.lang.IllegalAccessException
java.lang.ClassNotFoundException
- Exception are thrown only if policy is Policy.THROW_ON_ERRORpublic void trim()
This operation does not go deep, since it is assumed that you apply it in the process of building XmlData, and the kids are already trimmed.
public boolean satisfies(XmlData.Condition condition)
condition
-
public boolean satisfies(java.lang.String expression) throws java.lang.InstantiationException
the string is parsed first, and then the node is checked against the parsed expression.
expression
-
java.lang.InstantiationException
public XmlData selectTree(XmlData.Condition condition)
The node is included into the resulting tree iff it satisfies the condition; this filtering operation is applied recursively to its kids.
selectTree
in interface XmlData
condition
-
public XmlData selectTree(java.lang.String expression) throws java.lang.InstantiationException
The node is included into the resulting tree iff it satisfies the condition; this filtering operation is applied recursively to its kids.
expression
- the string that contains a filtering expression
Example:
<?xml version="1.0" encoding="UTF-8"?> <example a1="v1" a2="v2"> <sub1 ax="vx" ay="vy"/> <sub2 aa="va" ab="vb"/> </example>
selectTree("ax != \"vx\"")
and
selectTree("a1 == \"v1\" || ab == \"vb\"")
<?xml version="1.0" encoding="UTF-8"?> <example a1="v1" a2="v2"> <sub2 aa="va" ab="vb"/> </example>
java.lang.InstantiationException
public java.util.Collection getKidTypes()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |