|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectutilidades.ParserNeutro
public class ParserNeutro
Clase que contiene métodos estáticos para escribir con formato XML cadenas que ya tienen algún formato XHTML y comprobar que sean cadenas XML válidas.
Constructor Summary | |
---|---|
ParserNeutro()
|
Method Summary | |
---|---|
static MensajeEstado |
compruebaInstruccionesXHTML(java.lang.String fragmento)
Comprueba un campo de instrucciones de un test o un ítem. |
static void |
escribeInstruccionesXML(java.lang.String xhtml,
XMLStreamWriter xsw)
Método que escribe un String con formato XHTML en un XMLStreamWriter
. |
static void |
escribeTextoXML(java.lang.String texto,
XMLStreamWriter xsw)
Escribe todos los caracteres con el método writeCharacters(String) , excepto
los nueva línea, que los sustituye por el equivalente XHTML <br /> y los escribe
mediante el método writeEmptyElement en el XMLStreamWriter . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ParserNeutro()
Method Detail |
---|
public static void escribeInstruccionesXML(java.lang.String xhtml, XMLStreamWriter xsw) throws XMLStreamException
String
con formato XHTML en un XMLStreamWriter
. En primer lugar elimina las entidades " " que se puedan encontrar en
las instrucciones, ya que no son soportadas por la norma, sustituyéndolas por caracteres
de espacio en blanco normales. Luego crea un parser "StAX",
XMLStreamReader
, que va leyendo los eventos XML del String
y
escribiéndolos según el evento que corresponda en el XMLStreamWriter
.
xhtml
- string con el texto XHTML a enviar al Writer XMLxsw
- xmlStreamWriter con el que escribir el código XML
XMLStreamException
- si hay algún error en la estructura del código XML leído o
al escribirlojavax.xml.stream.XMLStreamReader
,
javax.xml.stream.XMLStreamWriter
public static void escribeTextoXML(java.lang.String texto, XMLStreamWriter xsw) throws XMLStreamException
writeCharacters(String)
, excepto
los nueva línea, que los sustituye por el equivalente XHTML <br /> y los escribe
mediante el método writeEmptyElement
en el XMLStreamWriter
.
texto
- cadena de texto plano a escribir sustituyendo los nueva línea
por su carácter equivalente <br />xsw
- xmlStreamWriter con el que escribir el código XML
XMLStreamException
- si hay algún error en la estructura del código XML leído o
al escribirlojavax.xml.stream.XMLStreamReader
,
javax.xml.stream.XMLStreamWriter
public static MensajeEstado compruebaInstruccionesXHTML(java.lang.String fragmento)
fragmento
- string con la cadena XHTML a comprobar
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |