public class XMLNode extends Object
| Constructor and Description |
|---|
XMLNode(Document dom)
Contructor, constructor desde un documento DOM
|
XMLNode(Element dom)
Contructor, desde un elemento DOM
|
XMLNode(File file)
Constructor, lee de un fichero
|
XMLNode(InputStream inputstream)
Constructor.
|
XMLNode(String name)
Contructor, crea un nodo con su nombre
|
XMLNode(String name,
String text)
Contructor, crea un nodo con su nombre y el texto
|
| Modifier and Type | Method and Description |
|---|---|
void |
addAtrribute(String name,
String value) |
void |
addSubNode(XMLNode s) |
String |
getAttribute(String key) |
Vector |
getAttributeNames() |
boolean |
getBoolAttribute(String key) |
String |
getCdata() |
double |
getDoubleAttribute(String key) |
int |
getIntAttribute(String key) |
String |
getName() |
int |
getNumSubNodes() |
XMLNode |
getSubNode(int index) |
XMLNode[] |
getSubnodes() |
String |
getText() |
String |
getXmlTree() |
boolean |
hasAttribute(String key) |
void |
printNode()
This method prints a node in the standard output.
|
void |
printSubNodes()
This method prints all the child nodes.
|
String |
searchAtribute(String attributeName)
Hace una busqueda de un atributo de un nodo
|
XMLNode[] |
searchMultipleNode(String label)
Hace una busqueda de nodos que se llaman igual desde uno dado(sin recursividad)
|
String[] |
searchMultipleNodeValue(String label)
Hace una busqueda de nodos que se llaman igual y devuleve el valor
|
XMLNode |
searchNode(String etiqueta)
Busca un Nodo dado una ruta de nodo del tipo "nodoRaiz:nodoPrimerNivel:...
|
String |
searchNodeAtribute(XMLNode node,
String etiqueta,
String atributo)
Hace una busqueda de una etiqueta en un nodo y devuelve
el valor del atributo correspondiente
|
String |
searchNodeValue(String etiqueta)
Hace una busqueda de una etiqueta en un nodo y devuelve
su valor
|
void |
setHeader(String header) |
void |
setText(String s) |
String |
toString() |
void |
write(File f) |
void |
write(Writer wr) |
public static final String ISNOTXML
public XMLNode(File file) throws Exception
file - Exceptionpublic XMLNode(InputStream inputstream) throws Exception
inputstream - Exceptionpublic XMLNode(Document dom) throws Exception
dom - Exceptionpublic XMLNode(String name) throws Exception
name - Exceptionpublic XMLNode(String name, String text) throws Exception
name - text - Exceptionpublic void setText(String s)
s - public void addSubNode(XMLNode s)
s - public void addAtrribute(String name, String value) throws Exception
name - value - Exceptionpublic int getNumSubNodes()
public String getName()
public String getText()
public String getCdata()
public XMLNode getSubNode(int index)
index - public XMLNode[] getSubnodes()
public Vector getAttributeNames()
public double getDoubleAttribute(String key)
key - public boolean getBoolAttribute(String key)
key - public int getIntAttribute(String key)
key - public boolean hasAttribute(String key)
key - public void setHeader(String header)
header - public void printSubNodes()
public void printNode()
node - public XMLNode searchNode(String etiqueta)
etiqueta - Ruta del campo que queremos buscar, separando los niveles por ':'public String searchAtribute(String attributeName)
nombreAtributo - Nombre del atributoattributeName - public String searchNodeValue(String etiqueta)
etiqueta - Nombre de la etiquetapublic String searchNodeAtribute(XMLNode node, String etiqueta, String atributo)
etiqueta - Nombre de la etiquetaatributo - public String[] searchMultipleNodeValue(String label)
rootNode - Nodo a partir del cual se quiere hacer la búsquedalabel - Node labelpublic XMLNode[] searchMultipleNode(String label)
nodoRaiz - Nodo a partir del cual se quiere hacer la búsquedalabel - public String getXmlTree()