| java.lang.Object org.sakaiproject.util.Xml
Xml | public class Xml (Code) | |
Xml is a DOM XML helper object with static functions to help with XML.
|
Method Summary | |
public static Document | createDocument() Create a new DOM Document. | public static String | decodeAttribute(Element el, String tag) Decode a string from the attribute of the element , that was made using encodeAttribute().
Parameters: el - The element. Parameters: tag - The attribute name. | public static void | encodeAttribute(Element el, String tag, String value) Place a string into the attribute of the element , encoded so special characters can be used. | protected static DocumentBuilder | getDocumentBuilder() | public static Element | propertiesToXml(Properties propsToSerialize, Document doc, Stack stack) Serialize the properties into XML, adding an element to the doc under the top of the stack element.
Parameters: propsToSerialize - The properties to serialize. Parameters: doc - The DOM doc to contain the XML (or null for a string return). Parameters: stack - The DOM elements, the top of which is the containing element of the new "resource" element. | public static Document | readDocument(String name) Read a DOM Document from xml in a file.
Parameters: name - The file name for the xml file. | public static Document | readDocumentFromStream(InputStream in) Read a DOM Document from xml in a stream. | public static Document | readDocumentFromString(String in) Read a DOM Document from xml in a string. | public static void | writeDocument(Document doc, String fileName) Write a DOM Document to an xml file. | public static String | writeDocumentToString(Document doc) Write a DOM Document to an output stream. | public static void | xmlToProperties(Properties properties, Element el) Fill in a properties from XML. |
createDocument | public static Document createDocument()(Code) | | Create a new DOM Document.
A new DOM document. |
decodeAttribute | public static String decodeAttribute(Element el, String tag)(Code) | | Decode a string from the attribute of the element , that was made using encodeAttribute().
Parameters: el - The element. Parameters: tag - The attribute name. The string; may be empty, won't be null. |
encodeAttribute | public static void encodeAttribute(Element el, String tag, String value)(Code) | | Place a string into the attribute of the element , encoded so special characters can be used.
Parameters: el - The element. Parameters: tag - The attribute name. Parameters: value - The string. |
propertiesToXml | public static Element propertiesToXml(Properties propsToSerialize, Document doc, Stack stack)(Code) | | Serialize the properties into XML, adding an element to the doc under the top of the stack element.
Parameters: propsToSerialize - The properties to serialize. Parameters: doc - The DOM doc to contain the XML (or null for a string return). Parameters: stack - The DOM elements, the top of which is the containing element of the new "resource" element. The newly added element. |
readDocument | public static Document readDocument(String name)(Code) | | Read a DOM Document from xml in a file.
Parameters: name - The file name for the xml file. A new DOM Document with the xml contents. |
readDocumentFromStream | public static Document readDocumentFromStream(InputStream in)(Code) | | Read a DOM Document from xml in a stream.
Parameters: in - The stream containing the XML A new DOM Document with the xml contents. |
readDocumentFromString | public static Document readDocumentFromString(String in)(Code) | | Read a DOM Document from xml in a string.
Parameters: in - The string containing the XML A new DOM Document with the xml contents. |
writeDocument | public static void writeDocument(Document doc, String fileName)(Code) | | Write a DOM Document to an xml file.
Parameters: doc - The DOM Document to write. Parameters: fileName - The complete file name path. |
writeDocumentToString | public static String writeDocumentToString(Document doc)(Code) | | Write a DOM Document to an output stream.
Parameters: doc - The DOM Document to write. Parameters: out - The output stream. |
xmlToProperties | public static void xmlToProperties(Properties properties, Element el)(Code) | | Fill in a properties from XML.
Parameters: properties - The properties to fill in. Parameters: el - The XML DOM element. |
|
|