JDOM / NOTES</>↗JDOM26 May 2009
package org.kodejava.jdom; import org.jdom2.Document; import org.jdom2.Element; import org.jdom2.JDOMException; import org.jdom2.input.SAXBuilder; import java.io.IOException; import java.io.StringReader; public class JDOMElementTextContent { public static void main(String[] args) { String xml = """ <root> <paragraph> Lorem ipsum dolor sit amet, consectetur adipisicing \ elit, sed do eiusmod tempor incididunt ut labore et \ dolore magna aliqua. Ut enim ad minim […]
JDOM / NOTES</>↗JDOM23 May 2009
In this example you can see how we can read xml attribute value as an integer value instead of string. JDOM provides method such as getIntValue(), getLongValue(), getFloatValue(), getDoubleValue() to get numerical values. For boolean value we can use the getBooleanValue() method. package org.kodejava.jdom; import org.jdom2.Document; import org.jdom2.Element; import org.jdom2.JDOMException; import org.jdom2.input.SAXBuilder; import java.io.IOException; import […]
JDOM / NOTES</>↗JDOM21 May 2009
The List returned by the getChildren() method call is a java.util.List. Any modification to the List object immediately reflected in the backing document. This make the manipulation of the XML document easy. You can also see how we can add a new Element to the document by calling the addContent() method. package org.kodejava.jdom; import org.jdom2.Document; […]
JDOM / NOTES</>↗JDOM18 May 2009
package org.kodejava.jdom; import org.jdom2.Document; import org.jdom2.Element; import org.jdom2.JDOMException; import org.jdom2.input.SAXBuilder; import java.io.ByteArrayInputStream; import java.io.IOException; import java.text.MessageFormat; import java.util.List; public class JDOMTraversingElement { public static void main(String[] args) { String xml = """ <root> <country name="Japan" capital="Tokyo"/> <country name="France" capital="Paris"/> <country name="Italy" capital=...
CORE API / NOTES</>↗Core API15 May 2009
UUID / GUID (Universally / Globally Unique Identifier) is frequently use in programming. Some of its usage are for creating random file names, session id in web application, transaction id and for record’s primary keys in database replacing the sequence or auto generated number. To generate UUID in Java we can use the java.util.UUID class. […]
JSP / NOTES</>↗JSP14 May 2009
In this post you will learn how to write and read object from HTTP Session in JavaServer Page. The first example that we are looking at is using the classic JSP scriptlet, this is a very old way to work with JSP, but it is good for you to know a history. We write a […]