public interface MinXML extends java.util.List<MinXML>
| Modifier and Type | Method and Description |
|---|---|
java.util.Map<java.lang.String,java.lang.String> |
asMap()
Returns a
Map that represents the attributes of an element
that shares updates with the original element. |
java.lang.Iterable<java.util.Map.Entry<java.lang.String,java.lang.String>> |
asMapEntries()
Returns an iterator over the attributes of an element that shares
updates with the original element.
|
java.lang.Iterable<java.lang.String> |
asMapKeys()
Returns an iterator over the keys of an element that shares
updates with the original element.
|
void |
clearAttributes()
Removes all the attributes of the element.
|
@NonNull MinXML |
deepCopy()
deepCopy makes a copy of the topmost node and all the children.
|
java.lang.Iterable<java.util.Map.Entry<java.lang.String,java.lang.String>> |
entries()
Returns a iterator over the attributes of an element, as if the
attributes were implemented as a
Map, which shares updates
with the original element (when updates are allowed). |
boolean |
equals(java.lang.Object obj) |
java.lang.String |
getAttribute(java.lang.String key)
Gets the attribute value associated with a given key.
|
java.lang.String |
getAttribute(java.lang.String key,
java.lang.String value_otherwise)
Gets the attribute value associated with a given key.
|
java.util.Map<java.lang.String,java.lang.String> |
getAttributes()
Returns a
Map representing the attributes of an element that
does not share updates with the original element. |
@NonNull java.lang.String |
getName()
Returns the name of a MinXML element.
|
boolean |
hasAttribute()
Returns true if the element has any attributes, otherwise false.
|
boolean |
hasAttribute(java.lang.String key)
Returns true if the element has an attribute with the given key.
|
boolean |
hasAttribute(java.lang.String key,
java.lang.String value)
Returns true if the element has an attribute with the given key
whose value is equal to the given value.
|
boolean |
hasName(java.lang.String name)
Returns true if the name of the element is the same as
given string.
|
boolean |
hasntAttribute()
Returns true if the element has no attributes, otherwise false.
|
boolean |
isntEmpty()
Returns true if the element has no children.
|
java.lang.Iterable<java.lang.String> |
keys()
Returns a iterator for the set of keys of the attributes of an element, as if the
attributes were implemented as a
Map, which shares updates
with the original element (when updates are allowed). |
void |
prettyPrint(java.io.PrintWriter pw)
Renders the element using the supplied
PrintWriter such that each start and
end tag are on their own line and the children indented. |
void |
prettyPrint(java.io.Writer w)
Renders the element using the supplied
Writer such that each start and
end tag are on their own line and the children indented. |
void |
print(java.io.PrintWriter pw)
Renders the element using the supplied
PrintWriter. |
void |
print(java.io.Writer w)
Renders the element to the supplied
Writer. |
void |
putAllAttributes(java.util.Map<java.lang.String,java.lang.String> map) |
void |
putAttribute(java.lang.String key,
java.lang.String value)
Puts an attribute key=value into the element.
|
void |
setName(@NonNull java.lang.String name)
Changes the name of the element to the given string.
|
@NonNull MinXML |
shallowCopy()
shallowCopy makes a copy of the topmost node but shares the children.
|
int |
sizeAttributes()
Returns the number of attributes of the element.
|
void |
trimToSize()
This method signals that there will be no further updates to an element, at least for a while,
and the implementation should consider this a good opportunity to compact the space used
by this element and all child elements, including any shared elements.
|
@NonNull java.lang.String getName()
boolean hasName(java.lang.String name)
name - the name we are checkingvoid setName(@NonNull java.lang.String name)
throws java.lang.UnsupportedOperationException
name - the name we are settingjava.lang.UnsupportedOperationException - if the implementing class cannot support this methodjava.lang.String getAttribute(java.lang.String key)
key - the attribute key being looked upjava.lang.String getAttribute(java.lang.String key,
java.lang.String value_otherwise)
key - the attribute key being looked upvalue_otherwise - the value to be returned if there is no matching attributeboolean hasAttribute()
boolean hasAttribute(java.lang.String key)
key - the attribute keyboolean hasAttribute(java.lang.String key,
java.lang.String value)
key - attribute being checkedvalue - value being checkedboolean hasntAttribute()
int sizeAttributes()
RuntimeException must
be raised.java.lang.Iterable<java.lang.String> keys()
Map, which shares updates
with the original element (when updates are allowed). If you want
updates to be shared use asMapKeys.java.lang.Iterable<java.lang.String> asMapKeys()
java.lang.Iterable<java.util.Map.Entry<java.lang.String,java.lang.String>> entries()
Map, which shares updates
with the original element (when updates are allowed). If you want
updates to be shared use asMapEntries.java.util.Map<java.lang.String,java.lang.String> getAttributes()
Map representing the attributes of an element that
does not share updates with the original element. If you want updates
to be shared use asMap.java.util.Map<java.lang.String,java.lang.String> asMap()
Map that represents the attributes of an element
that shares updates with the original element.java.lang.Iterable<java.util.Map.Entry<java.lang.String,java.lang.String>> asMapEntries()
void putAttribute(java.lang.String key,
java.lang.String value)
throws java.lang.UnsupportedOperationException
UnsupportedOperationException.key - the attribute keyvalue - the attribute valuejava.lang.UnsupportedOperationException - if the implementing class cannot support this methodvoid putAllAttributes(java.util.Map<java.lang.String,java.lang.String> map)
throws java.lang.UnsupportedOperationException
java.lang.UnsupportedOperationExceptionvoid clearAttributes()
throws java.lang.UnsupportedOperationException
UnsupportedOperationException.java.lang.UnsupportedOperationException - if the implementing class cannot support this methodvoid trimToSize()
IllegalStateException.boolean isntEmpty()
boolean equals(java.lang.Object obj)
void print(java.io.PrintWriter pw)
PrintWriter. The rendering will
not contain any newlines. This is the same as the string generated by toString().pw - the PrintWriter to use.void print(java.io.Writer w)
Writer.w - the Writer to use.void prettyPrint(java.io.PrintWriter pw)
PrintWriter such that each start and
end tag are on their own line and the children indented. The output always finishes
with a newline.pw - the PrintWriter to use.void prettyPrint(java.io.Writer w)
Writer such that each start and
end tag are on their own line and the children indented. The output always finishes
with a newline.w - the Writer to use.@NonNull MinXML shallowCopy()
UnsupportedOperationException@NonNull MinXML deepCopy()
UnsupportedOperationException