Package org.ametys.core.util
Class XMLUtils
java.lang.Object
org.apache.cocoon.xml.XMLUtils
org.ametys.core.util.XMLUtils
- All Implemented Interfaces:
LogEnabled
,Component
,Serviceable
Component with XML utils methods
-
Field Summary
Modifier and TypeFieldDescriptionprotected ServiceManager
Avalon service managerstatic final String
The avalon roleFields inherited from class org.apache.cocoon.xml.XMLUtils
EMPTY_ATTRIBUTES
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
createElementIfNotNull
(ContentHandler contentHandler, String localName, String stringValue) Create a start and endElement with a empty Namespace and without Attributes If the string value isnull
, the element is not createdstatic void
createElementIfNotNull
(ContentHandler contentHandler, String localName, String stringValue, Attributes attributes) Create a start and endElement with a empty Namespace and without Attributes If the string value isnull
, the element is not createdstatic void
createI18nElementIfNotNull
(ContentHandler contentHandler, String localName, I18nizable i18n) Create a start and endElement with a empty Namespace and without Attributes with the givenI18nizable
If theI18nizable
isnull
, the element is not createdprotected Logger
Returns theLogger
.void
service
(ServiceManager manager) void
Called at creation time to provide aLogger
.toString
(InputStream is) Get a XML as a string and extract the text onlyMethods inherited from class org.apache.cocoon.xml.XMLUtils
createElement, createElement, createElement, createElement, createElementNS, createElementNS, createElementNS, createElementNS, createPropertiesForXML, data, defaultSerializeToXMLFormat, defaultSerializeToXMLFormat, endElement, endElement, getConsumer, getConsumer, serialize, serializeNode, serializeNode, serializeNodeToXML, startElement, startElement, startElement, startElement, stripDuplicateAttributes, valueOf, valueOf, valueOf, valueOf, valueOf
-
Field Details
-
ROLE
The avalon role -
_manager
Avalon service manager
-
-
Constructor Details
-
XMLUtils
public XMLUtils()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
getLogger
Returns theLogger
.- Returns:
- the
Logger
.
-
setLogger
Description copied from interface:LogEnabled
Called at creation time to provide aLogger
.- Specified by:
setLogger
in interfaceLogEnabled
- Parameters:
logger
- aLogger
for messages.
-
createI18nElementIfNotNull
public static void createI18nElementIfNotNull(ContentHandler contentHandler, String localName, I18nizable i18n) throws SAXException Create a start and endElement with a empty Namespace and without Attributes with the givenI18nizable
If theI18nizable
isnull
, the element is not created- Parameters:
contentHandler
- theContentHandler
that will receive the SAX eventslocalName
- The local name (without prefix)i18n
- theI18nizable
to SAX- Throws:
SAXException
- if an error occurs during the SAX events generation
-
createElementIfNotNull
public static void createElementIfNotNull(ContentHandler contentHandler, String localName, String stringValue) throws SAXException Create a start and endElement with a empty Namespace and without Attributes If the string value isnull
, the element is not created- Parameters:
contentHandler
- theContentHandler
that will receive the SAX eventslocalName
- The local name (without prefix)stringValue
- The content of the Element- Throws:
SAXException
- if an error occurs during the SAX events generation
-
createElementIfNotNull
public static void createElementIfNotNull(ContentHandler contentHandler, String localName, String stringValue, Attributes attributes) throws SAXException Create a start and endElement with a empty Namespace and without Attributes If the string value isnull
, the element is not created- Parameters:
contentHandler
- theContentHandler
that will receive the SAX eventslocalName
- The local name (without prefix)stringValue
- The content of the Elementattributes
- The attributes attached to the element. If there are no attributes, it shall be an empty Attributes object.- Throws:
SAXException
- if an error occurs during the SAX events generation
-
toString
Get a XML as a string and extract the text only- Parameters:
is
- The inputstream of XML- Returns:
- The text or null if the XML is not well formed
-