public class ImmoXmlUtils extends Object
Modifier and Type | Field and Description |
---|---|
static ObjectFactory |
FACTORY
the factory for creation of JAXB objects
|
static String |
NAMESPACE
the XML target namespace of this format
|
static String |
PACKAGE
the package, where generated JAXB classes are located
|
static ImmoXmlVersion |
VERSION
the latest implemented version of this format
|
Modifier and Type | Method and Description |
---|---|
static ImmoXmlDocument |
createDocument(Document doc)
Creates a
ImmoXmlDocument from a Document . |
static ImmoXmlDocument |
createDocument(File xmlFile)
Creates a
ImmoXmlDocument from a File . |
static ImmoXmlDocument |
createDocument(InputStream input)
Creates a
ImmoXmlDocument from an InputStream . |
static ImmoXmlDocument |
createDocument(String xmlString)
Creates a
ImmoXmlDocument from a String . |
static Marshaller |
createMarshaller()
Creates a
Marshaller to write JAXB objects into XML. |
static Marshaller |
createMarshaller(String encoding,
boolean formatted)
Creates a
Marshaller to write JAXB objects into XML. |
static Unmarshaller |
createUnmarshaller()
Creates a
Unmarshaller to read JAXB objects from XML. |
static Element |
createUserDefinedSimplefield(Document doc,
String name,
String value)
Helper method to create a <user_defined_simplefield> element with a
"feldname" attribute and a string value.
|
static JAXBContext |
getContext()
Returns the
JAXBContext for this format. |
static DateFormat |
getDateFormat()
Returns the preferred date format for this format.
|
static ObjectFactory |
getFactory()
Returns the
ObjectFactory for this format. |
static void |
initContext(ClassLoader classloader)
Intializes the
JAXBContext for this format. |
static Calendar |
parseDate(String value) |
static Calendar |
parseDateTime(String value) |
static Double |
parseDecimal(String value) |
static String |
printDate(Calendar value) |
static String |
printDateTime(Calendar value) |
static String |
printDecimal(Double value) |
public static final ImmoXmlVersion VERSION
public static final String NAMESPACE
public static final String PACKAGE
public static final ObjectFactory FACTORY
public static ImmoXmlDocument createDocument(InputStream input) throws SAXException, IOException, ParserConfigurationException
ImmoXmlDocument
from an InputStream
.input
- XML inputSAXException
- if XML is invalidIOException
- if reading failedParserConfigurationException
- if the parser is not properly configuredpublic static ImmoXmlDocument createDocument(File xmlFile) throws SAXException, IOException, ParserConfigurationException
ImmoXmlDocument
from a File
.xmlFile
- XML fileSAXException
- if XML is invalidIOException
- if reading failedParserConfigurationException
- if the parser is not properly configuredpublic static ImmoXmlDocument createDocument(String xmlString) throws SAXException, IOException, ParserConfigurationException
ImmoXmlDocument
from a String
.xmlString
- XML stringSAXException
- if XML is invalidIOException
- if reading failedParserConfigurationException
- if the parser is not properly configuredpublic static ImmoXmlDocument createDocument(Document doc)
ImmoXmlDocument
from a Document
.doc
- XML documentpublic static Marshaller createMarshaller() throws JAXBException
Marshaller
to write JAXB objects into XML.JAXBException
- if a problem with JAXB occuredpublic static Marshaller createMarshaller(String encoding, boolean formatted) throws JAXBException
Marshaller
to write JAXB objects into XML.encoding
- encoding of written XMLformatted
- if written XML is pretty printedJAXBException
- if a problem with JAXB occuredpublic static Unmarshaller createUnmarshaller() throws JAXBException
Unmarshaller
to read JAXB objects from XML.JAXBException
- if a problem with JAXB occuredpublic static Element createUserDefinedSimplefield(Document doc, String name, String value)
doc
- document, for which the element is createdname
- value of the "feldname" attribute in the created elementvalue
- text value of the created elementpublic static JAXBContext getContext() throws JAXBException
JAXBContext
for this format.JAXBException
- if a problem with JAXB occuredpublic static DateFormat getDateFormat()
public static ObjectFactory getFactory()
ObjectFactory
for this format.public static void initContext(ClassLoader classloader) throws JAXBException
JAXBContext
for this format.classloader
- the classloader to load the generated JAXB classes withJAXBException
- if a problem with JAXB occuredCopyright © 2015 OpenEstate. All rights reserved.