|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.jfw.util.XmlUtils
public final class XmlUtils
Various utils for manage xml strings.
Constructor Summary | |
---|---|
XmlUtils()
|
Method Summary | |
---|---|
static java.lang.String |
changeEncode(java.lang.String xml,
java.lang.String newEncode)
Change the encode declared in xml tag with the encode declared in parameter newEncode. |
static java.util.ArrayList |
getElements(org.w3c.dom.Document xmlDocument,
java.lang.String parentTag)
Get all values of tags inside an other tag. |
static java.util.HashMap |
getElementsValues(org.w3c.dom.Document xmlDocument,
java.util.ArrayList elements)
Get all values of given tags. |
static java.util.ArrayList |
getElementText(java.lang.String element,
java.lang.String xml)
Get all text delimited by a tag. |
static java.util.ArrayList |
getElementValues(org.w3c.dom.Document xmlDocument,
java.lang.String element)
Get all values of a tag. |
static java.lang.String |
getFirstValueOfTag(org.w3c.dom.Document xmlDocument,
java.lang.String element)
Get the first value of a tag. |
static org.w3c.dom.Document |
getXMLDocument(java.lang.String xml,
java.io.File xsdFile)
Get a Document object. |
static org.w3c.dom.Document |
getXMLDocument(java.lang.String path,
java.lang.String fileName,
java.io.File xsdFile)
Get a Document object. |
static boolean |
isUTF8(java.lang.String xml)
Check if an xml string, declared in xml tag as UTF-8, use UTF-8 encode. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public XmlUtils()
Method Detail |
---|
public static org.w3c.dom.Document getXMLDocument(java.lang.String xml, java.io.File xsdFile) throws java.lang.Exception
Document
object.
xml
- xml string.xsdFile
- an xsd file. If null then no xsd validation will done.
Document
object.
java.lang.Exception
public static org.w3c.dom.Document getXMLDocument(java.lang.String path, java.lang.String fileName, java.io.File xsdFile) throws java.lang.Exception
Document
object.
path
- the path of the xml file.fileName
- the name of xml file.xsdFile
- an xsd file. If null then no xsd validation will done.
Document
object.
java.lang.Exception
public static java.util.ArrayList getElementValues(org.w3c.dom.Document xmlDocument, java.lang.String element)
xmlDocument
- a Document
object.element
- the tag name.
public static java.util.HashMap getElementsValues(org.w3c.dom.Document xmlDocument, java.util.ArrayList elements)
xmlDocument
- a Document
object.elements
- an ArrayList of String with names of the tags.
public static java.util.ArrayList getElementText(java.lang.String element, java.lang.String xml)
element
- the name of the tag.xml
- the xml string.
public static java.util.ArrayList getElements(org.w3c.dom.Document xmlDocument, java.lang.String parentTag)
xmlDocument
- a Document
object.parentTag
- the name of the tag to elaborate.
public static java.lang.String getFirstValueOfTag(org.w3c.dom.Document xmlDocument, java.lang.String element)
xmlDocument
- a Document
object.element
- the name of the tag.
public static boolean isUTF8(java.lang.String xml) throws java.lang.Exception
xml
- the xml string to check.
java.lang.Exception
public static java.lang.String changeEncode(java.lang.String xml, java.lang.String newEncode)
xml
- the xml to check.newEncode
- the encode to set in tag xml.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |