
br.com.jhonsapp.bootstrap.document.service.ocr.xml.DocumentXML Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bootstrap-document Show documentation
Show all versions of bootstrap-document Show documentation
A complete architecture for creating and managing documents.
The newest version!
package br.com.jhonsapp.bootstrap.document.service.ocr.xml;
import java.io.StringReader;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.transform.stream.StreamSource;
import br.com.jhonsapp.bootstrap.document.service.exception.DocumentServiceException;
import br.com.jhonsapp.bootstrap.document.service.message.DocumentMessage;
@XmlRootElement(name = "asprise-ocr")
@XmlAccessorType(XmlAccessType.FIELD)
public class DocumentXML {
@XmlAttribute(name="input")
private String input;
@XmlAttribute(name="version-format")
private String versionFormat;
@XmlAttribute(name="time-start")
private String timeStart;
private Page[] page;
@XmlAttribute(name="runtime")
private String runtime;
public String getInput ()
{
return input;
}
public void setInput (String input)
{
this.input = input;
}
public String getVersionFormat ()
{
return versionFormat;
}
public void setVersionFormat (String versionFormat)
{
this.versionFormat = versionFormat;
}
public String getTimeStart ()
{
return timeStart;
}
public void setTimeStart (String timeStart)
{
this.timeStart = timeStart;
}
public Page[] getPage ()
{
return page;
}
public void setPage (Page[] page)
{
this.page = page;
}
public String getRuntime ()
{
return runtime;
}
public void setRuntime (String runtime)
{
this.runtime = runtime;
}
@Override
public String toString()
{
return "ClassPojo [input = "+input+", version-format = "+versionFormat+", time-start = "+timeStart+", page = "+page+", runtime = "+runtime+"]";
}
public static DocumentXML buildDocumentXMLByStringXml(String stringXml) {
JAXBContext context = null;
try {
context = JAXBContext.newInstance(DocumentXML.class);
Unmarshaller unmarshaller = context.createUnmarshaller();
return (DocumentXML) unmarshaller.unmarshal(
new StreamSource(new StringReader(stringXml))
);
} catch (JAXBException e) {
throw new DocumentServiceException(DocumentMessage.read_document_problem);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy