|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectpl.mbdev.openstage.Xml
public abstract class Xml
General definition of an XML object that represents the common part of all XML entities used by OpenStage 60/80 VoIP phones, according to the "OpenStage 60/80 - XML Applications, Developer's Guide" available in September 2011.
Copyright 2011 Mateusz Bysiek, mb@mbdev.pl, http://mbdev.pl/ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Field Summary | |
---|---|
private java.lang.String |
contents
Contents of this node. |
private Xml |
logicalRoot
The node that is considered as a node with respect to which all operations are made. |
private java.lang.String |
nodeName
Name of this object in its XML-text form. |
private Xml |
parent
Parent of this node. |
private java.util.ArrayList<Xml> |
subObjects
References to all sub-objects of this XML object. |
Constructor Summary | |
---|---|
private |
Xml()
Parameterless constructor. |
|
Xml(java.lang.String nodeName)
Default constructor. |
|
Xml(java.lang.String nodeName,
java.lang.Object contents)
Creates new node, without sub-nodes but with text contents. |
Method Summary | |
---|---|
protected void |
add(java.lang.String nodeName,
java.lang.Object contents)
Adds a simple sub-node to this XML entity. |
protected Xml |
add(Xml o)
Adds the provided XML object to sub-objects of this object, and returns it. |
protected Xml |
addAndReturn(java.lang.String nodeName,
java.lang.Object contents)
Adds a simple sub-node to this XML entity, and returns a reference to it. |
protected java.lang.StringBuffer |
attributesToXmlString()
Should be overridden by classes that have some attributes. |
protected java.lang.String |
attributeToXml(java.lang.String attributeName,
java.lang.Object attributeValue)
Converts an attribute for an object to its XML-text representation. |
protected java.lang.StringBuffer |
firstAttributesToXmlString()
Special method used by intermediate subclasses, which may desire to attach attributes to the object without need to override attirbutesToXmlString() method. |
java.lang.String |
getContents()
Gets the contents of this node. |
protected Xml |
getLogicalRoot()
Gets the logical root of this object. |
protected Xml |
getParent()
Returns the parent node of this node, provided that this node is some other object's sub-node. |
protected Xml |
getSubNode(int index)
|
protected int |
getSubNodeIndex(Xml o)
Returns the index of the first occurrence of the specified element in sub-nodes list, or -1 if that list does not contain the element. |
protected java.util.ArrayList<Xml> |
getSubNodes()
Returns reference to the list of sub-nodes of this object. |
protected java.lang.StringBuffer |
getXmlHeader()
Returns default XML file header, needed for proper interpretation of the file contents by the OpenStage device. |
private void |
insert(Xml o)
Inserts the provided object between this node and its parent. |
boolean |
isEmpty()
Checks if this node has any contents or sub-nodes. |
protected void |
logicalAdd(Xml o)
Adds the provided XML object to the logical root of this object. |
private void |
remove(Xml o)
Removes selected item from the list of sub-nodes of this XML object. |
void |
sendTo(java.io.PrintWriter out)
This method sends the XML to the receiving OpenStage device. |
protected void |
setContents(java.lang.String contents)
Sets the contents of this node. |
protected void |
setParent(Xml o)
Sets parent of this object to a desired one. |
protected int |
subObjectsCount()
Returns number of sub-nodes of this XML node. |
protected java.lang.StringBuffer |
subObjectsToXmlString(int indent)
Goes through every sub-object of this object, creates its XML-text representation, and returns all of them in a single StringBuffer. |
protected java.lang.StringBuffer |
toXmlString(int indent)
Returns full XML-text representation of this object, with all objects it contains inside, attributes, and a XML header. |
protected IppItem |
wrapWithIppItem()
Wraps this XML object with a new IppItem and returns this IppItem. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private java.lang.String nodeName
private java.lang.String contents
private java.util.ArrayList<Xml> subObjects
private Xml parent
private Xml logicalRoot
Constructor Detail |
---|
private Xml()
public Xml(java.lang.String nodeName)
nodeName
- name of the XML nodepublic Xml(java.lang.String nodeName, java.lang.Object contents)
nodeName
- name of the XML nodecontents
- contents of the XML entityMethod Detail |
---|
protected Xml getSubNode(int index)
index
- non-negative number
protected int getSubNodeIndex(Xml o)
o
- element to search for
protected java.util.ArrayList<Xml> getSubNodes()
protected Xml getParent()
protected Xml getLogicalRoot()
protected void setParent(Xml o)
o
- any kind of XML object from OpenStage SDKprivate void insert(Xml o)
o
- any kind of XML object from OpenStage SDKprotected Xml add(Xml o)
o
- any kind of XML object from OpenStage SDK
protected void logicalAdd(Xml o)
Xml
class for details like: what
is a logical root, how to use it and how it is used by OpenStage SDK.
o
- any kind of XML object from OpenStage SDKprivate void remove(Xml o)
o
- any kind of XML object from OpenStage SDK, that you wish to be removedprotected void add(java.lang.String nodeName, java.lang.Object contents)
nodeName
- name of the nodecontents
- contents, which will be converted to Stringprotected Xml addAndReturn(java.lang.String nodeName, java.lang.Object contents)
nodeName
- name of the nodecontents
- contents, which will be converted to String
protected IppItem wrapWithIppItem()
IppItem
and returns this IppItem. In case
this object is already wrapped, it simply returns the existing IppItem that wraps
the object.
IppItem
protected int subObjectsCount()
protected java.lang.StringBuffer firstAttributesToXmlString()
protected java.lang.StringBuffer attributesToXmlString()
protected java.lang.String attributeToXml(java.lang.String attributeName, java.lang.Object attributeValue)
attributeName
- name of the attributeattributeValue
- value of the attribute
protected java.lang.StringBuffer subObjectsToXmlString(int indent)
indent
- indent of the output of this function, done by tab character
protected java.lang.StringBuffer toXmlString(int indent)
indent
- indent of the output of this function, done by tab character
public boolean isEmpty()
protected java.lang.StringBuffer getXmlHeader()
public void sendTo(java.io.PrintWriter out) throws java.lang.IllegalArgumentException
out
- stream that receives sent content
java.lang.IllegalArgumentException
- when the server is trying to send an object that cannot be a root or
cannot be "made" a rootpublic java.lang.String getContents()
protected void setContents(java.lang.String contents)
contents
- new contents of this node
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |