tecgraf.javautils.xml
Class XMLBasicElement

java.lang.Object
  extended by tecgraf.javautils.xml.XMLElement
      extended by tecgraf.javautils.xml.XMLBasicElement
All Implemented Interfaces:
XMLElementInterface
Direct Known Subclasses:
XMLRootElement

public abstract class XMLBasicElement
extends XMLElement

A classe XMLBasicElement representa elementos XML que têm filhos.

Author:
Andre Oliveira da Costa

Constructor Summary
protected XMLBasicElement()
          Construtor vazio.
protected XMLBasicElement(String tag)
          Cria um novo elemento com a tag especificada.
 
Method Summary
static XMLElementInterface getFirstChildWithTag(List<XMLElementInterface> children, String tagName)
          Método estático para buscar a primeira ocorrência de um elemento XML em uma lista de elementos pela sua tag.
static String getNextIdentation(String ident)
          Retorna a string correspondente ao próximo nível de identação baseado na identação corrente e na identação default definido em XMLWriter.
static void writeEndTag(String tagName, Writer stream, String ident)
          Escreve uma tag de fechamento arbitrária, com identação.
static void writeStartTag(String tagName, Writer writer, String ident)
          Escreve uma tag de abertura arbitrária, sem "\n" no final e sem atributos.
static void writeStartTag(String tagName, Writer writer, String ident, List<? extends XMLAttribute> attrs)
          Escreve uma tag de abertura arbitrária (sem "\n" no final), com uma lista de atributos (XMLAttribute) também arbitrária.
static void writeStartTagln(String tagName, Writer stream, String ident)
          Escreve uma tag de abertura arbitrária (i.e.
static void writeStartTagln(String tagName, Writer writer, String ident, List<? extends XMLAttribute> attrs)
          Escreve uma tag de abertura arbitrária (com "\n" no final), com uma lista de atributos (XMLAttribute) também arbitrária.
 
Methods inherited from class tecgraf.javautils.xml.XMLElement
appendValue, convertTextToXML, convertValueFromXML, getAppContextObject, getAppObject, getAttributeBooleanValue, getAttributeDoubleValue, getAttributeIntValue, getAttributes, getAttributeStrValue, getDoubleValue, getFloatValue, getIntValue, getLongValue, getStrValue, getStrValue, getTag, hasAttribute, hasValue, isEmpty, newAttribute, newAttribute, newAttribute, newAttribute, newAttribute, newAttribute, newAttributeList, newCharsEvent, resetAttributeList, resetValue, setAppContextObject, setAppObject, setTag, setValue, setValue, startTag, writeAttributes, writeAttributes, writeEndTag, writeEndTag, writeStartTag, writeStartTagln, writeValue, xmlEncode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface tecgraf.javautils.xml.XMLElementInterface
endTag, write
 

Constructor Detail

XMLBasicElement

protected XMLBasicElement()
Construtor vazio. Existe apenas como "ponte" para o construtor da superclasse.


XMLBasicElement

protected XMLBasicElement(String tag)
Cria um novo elemento com a tag especificada. Existe apenas como "ponte" para o construtor da superclasse.

Parameters:
tag -
Method Detail

writeStartTagln

public static void writeStartTagln(String tagName,
                                   Writer stream,
                                   String ident)
                            throws IOException
Escreve uma tag de abertura arbitrária (i.e. não a do elemento) sem atributos.

Parameters:
tagName - tag
stream - stream de saída
ident - identação
Throws:
IOException - se houve algum erro de I/O durante a escrita

writeStartTagln

public static void writeStartTagln(String tagName,
                                   Writer writer,
                                   String ident,
                                   List<? extends XMLAttribute> attrs)
                            throws IOException
Escreve uma tag de abertura arbitrária (com "\n" no final), com uma lista de atributos (XMLAttribute) também arbitrária.

Parameters:
tagName - tag
writer - stream de saída
ident - identação
attrs - lista de attributos (XMLAttribute)
Throws:
IOException - se houve algum erro de I/O durante a escrita

writeStartTag

public static void writeStartTag(String tagName,
                                 Writer writer,
                                 String ident,
                                 List<? extends XMLAttribute> attrs)
                          throws IOException
Escreve uma tag de abertura arbitrária (sem "\n" no final), com uma lista de atributos (XMLAttribute) também arbitrária.

Parameters:
tagName - tag
writer - stream de saída
ident - identação
attrs - lista de attributos (XMLAttribute)
Throws:
IOException - se houve algum erro de I/O durante a escrita

writeStartTag

public static void writeStartTag(String tagName,
                                 Writer writer,
                                 String ident)
                          throws IOException
Escreve uma tag de abertura arbitrária, sem "\n" no final e sem atributos.

Parameters:
tagName - tag
writer - stream de saída
ident - identação
Throws:
IOException - se houve algum erro de I/O na escrita

writeEndTag

public static void writeEndTag(String tagName,
                               Writer stream,
                               String ident)
                        throws IOException
Escreve uma tag de fechamento arbitrária, com identação.

Parameters:
tagName - tag
stream - stream de saída
ident - identação
Throws:
IOException - se houve algum erro de I/O durante a escrita

getNextIdentation

public static String getNextIdentation(String ident)
Retorna a string correspondente ao próximo nível de identação baseado na identação corrente e na identação default definido em XMLWriter.

Parameters:
ident - identação corrente
Returns:
string correspondente à identação no próximo nível

getFirstChildWithTag

public static XMLElementInterface getFirstChildWithTag(List<XMLElementInterface> children,
                                                       String tagName)
Método estático para buscar a primeira ocorrência de um elemento XML em uma lista de elementos pela sua tag. Esta implementação faz busca sequencial.

Parameters:
children - lista de elementos
tagName - tag a ser buscada
Returns:
o elemento caso este exista na lista, ou null caso contrário


Copyright © 2014 Tecgraf/PUC-Rio. All rights reserved.