org.exolab.castor.xml.Unmarshaller Java Examples
The following examples show how to use
org.exolab.castor.xml.Unmarshaller.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: UncertaintyReader.java From OpenDA with GNU Lesser General Public License v3.0 | 6 votes |
public static Object unMarshallString(Reader reader, Class objectClass) throws IOException { Unmarshaller unmarshaller = new Unmarshaller(objectClass); Object castor; try { InputSource is = new InputSource(reader); is.setSystemId("stringBuffer"); castor = unmarshaller.unmarshal(is); reader.close(); } catch (MarshalException marshalException) { //TODO Juzer throw proper exception so that calling function can handle it throw new IOException(marshalException.getMessage()); } catch (ValidationException validationException) { throw new IOException(validationException.getMessage()); } return castor; }
Example #2
Source File: CastorMarshaller.java From java-technology-stack with MIT License | 5 votes |
/** * Template method that allows for customizing of the given Castor {@link Unmarshaller}. */ protected void customizeUnmarshaller(Unmarshaller unmarshaller) { unmarshaller.setValidation(this.validating); unmarshaller.setWhitespacePreserve(this.whitespacePreserve); unmarshaller.setIgnoreExtraAttributes(this.ignoreExtraAttributes); unmarshaller.setIgnoreExtraElements(this.ignoreExtraElements); unmarshaller.setObject(this.rootObject); unmarshaller.setReuseObjects(this.reuseObjects); unmarshaller.setClearCollections(this.clearCollections); if (this.namespaceToPackageMapping != null) { this.namespaceToPackageMapping.forEach(unmarshaller::addNamespaceToPackageMapping); } if (this.entityResolver != null) { unmarshaller.setEntityResolver(this.entityResolver); } if (this.classDescriptorResolver != null) { unmarshaller.setResolver(this.classDescriptorResolver); } if (this.idResolver != null) { unmarshaller.setIDResolver(this.idResolver); } if (this.objectFactory != null) { unmarshaller.setObjectFactory(this.objectFactory); } if (this.beanClassLoader != null) { unmarshaller.setClassLoader(this.beanClassLoader); } }
Example #3
Source File: Castor.java From marshalsec with MIT License | 5 votes |
/** * {@inheritDoc} * * @see marshalsec.MarshallerBase#unmarshal(java.lang.Object) */ @Override public Object unmarshal ( String data ) throws Exception { XMLContext context = new XMLContext(); Unmarshaller unmarshaller = context.createUnmarshaller(); return unmarshaller.unmarshal(new StringReader(data)); }
Example #4
Source File: CastorMarshaller.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Override protected Object unmarshalSaxReader(XMLReader xmlReader, InputSource inputSource) throws XmlMappingException, IOException { UnmarshalHandler unmarshalHandler = createUnmarshaller().createHandler(); try { ContentHandler contentHandler = Unmarshaller.getContentHandler(unmarshalHandler); xmlReader.setContentHandler(contentHandler); xmlReader.parse(inputSource); return unmarshalHandler.getObject(); } catch (SAXException ex) { throw new UnmarshallingFailureException("SAX reader exception", ex); } }
Example #5
Source File: CastorMarshaller.java From spring4-understanding with Apache License 2.0 | 5 votes |
/** * Template method that allows for customizing of the given Castor {@link Unmarshaller}. */ protected void customizeUnmarshaller(Unmarshaller unmarshaller) { unmarshaller.setValidation(this.validating); unmarshaller.setWhitespacePreserve(this.whitespacePreserve); unmarshaller.setIgnoreExtraAttributes(this.ignoreExtraAttributes); unmarshaller.setIgnoreExtraElements(this.ignoreExtraElements); unmarshaller.setObject(this.rootObject); unmarshaller.setReuseObjects(this.reuseObjects); unmarshaller.setClearCollections(this.clearCollections); if (this.namespaceToPackageMapping != null) { for (Map.Entry<String, String> mapping : this.namespaceToPackageMapping.entrySet()) { unmarshaller.addNamespaceToPackageMapping(mapping.getKey(), mapping.getValue()); } } if (this.entityResolver != null) { unmarshaller.setEntityResolver(this.entityResolver); } if (this.classDescriptorResolver != null) { unmarshaller.setResolver(this.classDescriptorResolver); } if (this.idResolver != null) { unmarshaller.setIDResolver(this.idResolver); } if (this.objectFactory != null) { unmarshaller.setObjectFactory(this.objectFactory); } if (this.beanClassLoader != null) { unmarshaller.setClassLoader(this.beanClassLoader); } }
Example #6
Source File: CastorMarshaller.java From java-technology-stack with MIT License | 5 votes |
@Override protected Object unmarshalSaxReader(XMLReader xmlReader, InputSource inputSource) throws XmlMappingException, IOException { UnmarshalHandler unmarshalHandler = createUnmarshaller().createHandler(); try { ContentHandler contentHandler = Unmarshaller.getContentHandler(unmarshalHandler); xmlReader.setContentHandler(contentHandler); xmlReader.parse(inputSource); return unmarshalHandler.getObject(); } catch (SAXException ex) { throw new UnmarshallingFailureException("SAX reader exception", ex); } }
Example #7
Source File: CastorMarshaller.java From java-technology-stack with MIT License | 4 votes |
private Unmarshaller createUnmarshaller() { Assert.state(this.xmlContext != null, "CastorMarshaller not initialized"); Unmarshaller unmarshaller = this.xmlContext.createUnmarshaller(); customizeUnmarshaller(unmarshaller); return unmarshaller; }
Example #8
Source File: CastorMarshaller.java From spring4-understanding with Apache License 2.0 | 4 votes |
private Unmarshaller createUnmarshaller() { Unmarshaller unmarshaller = this.xmlContext.createUnmarshaller(); customizeUnmarshaller(unmarshaller); return unmarshaller; }
Example #9
Source File: HintValueType.java From ralasafe with MIT License | 2 votes |
/** * Method unmarshal. * * @param reader * @throws org.exolab.castor.xml.MarshalException if object is * null or if any SAXException is thrown during marshaling * @throws org.exolab.castor.xml.ValidationException if this * object is an invalid instance according to the schema * @return the unmarshaled org.ralasafe.db.sql.xml.HintValueType */ public static org.ralasafe.db.sql.xml.HintValueType unmarshal( final java.io.Reader reader) throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { return (org.ralasafe.db.sql.xml.HintValueType) Unmarshaller.unmarshal(org.ralasafe.db.sql.xml.HintValueType.class, reader); }
Example #10
Source File: InExpressionType.java From ralasafe with MIT License | 2 votes |
/** * Method unmarshal. * * @param reader * @throws org.exolab.castor.xml.MarshalException if object is * null or if any SAXException is thrown during marshaling * @throws org.exolab.castor.xml.ValidationException if this * object is an invalid instance according to the schema * @return the unmarshaled org.ralasafe.db.sql.xml.InExpressionType */ public static org.ralasafe.db.sql.xml.InExpressionType unmarshal( final java.io.Reader reader) throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { return (org.ralasafe.db.sql.xml.InExpressionType) Unmarshaller.unmarshal(org.ralasafe.db.sql.xml.InExpressionType.class, reader); }
Example #11
Source File: Operand.java From ralasafe with MIT License | 2 votes |
/** * Method unmarshal. * * @param reader * @throws org.exolab.castor.xml.MarshalException if object is * null or if any SAXException is thrown during marshaling * @throws org.exolab.castor.xml.ValidationException if this * object is an invalid instance according to the schema * @return the unmarshaled org.ralasafe.db.sql.xml.Operand */ public static org.ralasafe.db.sql.xml.Operand unmarshal( final java.io.Reader reader) throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { return (org.ralasafe.db.sql.xml.Operand) Unmarshaller.unmarshal(org.ralasafe.db.sql.xml.Operand.class, reader); }
Example #12
Source File: NotInExprType.java From ralasafe with MIT License | 2 votes |
/** * Method unmarshal. * * @param reader * @throws org.exolab.castor.xml.MarshalException if object is * null or if any SAXException is thrown during marshaling * @throws org.exolab.castor.xml.ValidationException if this * object is an invalid instance according to the schema * @return the unmarshaled org.ralasafe.db.sql.xml.NotInExprType */ public static org.ralasafe.db.sql.xml.NotInExprType unmarshal( final java.io.Reader reader) throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { return (org.ralasafe.db.sql.xml.NotInExprType) Unmarshaller.unmarshal(org.ralasafe.db.sql.xml.NotInExprType.class, reader); }
Example #13
Source File: ParameterType.java From ralasafe with MIT License | 2 votes |
/** * Method unmarshal. * * @param reader * @throws org.exolab.castor.xml.MarshalException if object is * null or if any SAXException is thrown during marshaling * @throws org.exolab.castor.xml.ValidationException if this * object is an invalid instance according to the schema * @return the unmarshaled org.ralasafe.db.sql.xml.ParameterType */ public static org.ralasafe.db.sql.xml.ParameterType unmarshal( final java.io.Reader reader) throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { return (org.ralasafe.db.sql.xml.ParameterType) Unmarshaller.unmarshal(org.ralasafe.db.sql.xml.ParameterType.class, reader); }
Example #14
Source File: LeftOfIn.java From ralasafe with MIT License | 2 votes |
/** * Method unmarshal. * * @param reader * @throws org.exolab.castor.xml.MarshalException if object is * null or if any SAXException is thrown during marshaling * @throws org.exolab.castor.xml.ValidationException if this * object is an invalid instance according to the schema * @return the unmarshaled org.ralasafe.db.sql.xml.LeftOfIn */ public static org.ralasafe.db.sql.xml.LeftOfIn unmarshal( final java.io.Reader reader) throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { return (org.ralasafe.db.sql.xml.LeftOfIn) Unmarshaller.unmarshal(org.ralasafe.db.sql.xml.LeftOfIn.class, reader); }
Example #15
Source File: QueryRef.java From ralasafe with MIT License | 2 votes |
/** * Method unmarshal. * * @param reader * @throws org.exolab.castor.xml.MarshalException if object is * null or if any SAXException is thrown during marshaling * @throws org.exolab.castor.xml.ValidationException if this * object is an invalid instance according to the schema * @return the unmarshaled org.ralasafe.db.sql.xml.QueryRefType */ public static org.ralasafe.db.sql.xml.QueryRefType unmarshal( final java.io.Reader reader) throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { return (org.ralasafe.db.sql.xml.QueryRefType) Unmarshaller.unmarshal(org.ralasafe.db.sql.xml.QueryRef.class, reader); }
Example #16
Source File: UserCategories.java From ralasafe with MIT License | 2 votes |
/** * Method unmarshal. * * @param reader * @throws org.exolab.castor.xml.MarshalException if object is * null or if any SAXException is thrown during marshaling * @throws org.exolab.castor.xml.ValidationException if this * object is an invalid instance according to the schema * @return the unmarshaled org.ralasafe.db.sql.xml.UserCategories */ public static org.ralasafe.db.sql.xml.UserCategories unmarshal( final java.io.Reader reader) throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { return (org.ralasafe.db.sql.xml.UserCategories) Unmarshaller.unmarshal(org.ralasafe.db.sql.xml.UserCategories.class, reader); }
Example #17
Source File: GroupByType.java From ralasafe with MIT License | 2 votes |
/** * Method unmarshal. * * @param reader * @throws org.exolab.castor.xml.MarshalException if object is * null or if any SAXException is thrown during marshaling * @throws org.exolab.castor.xml.ValidationException if this * object is an invalid instance according to the schema * @return the unmarshaled org.ralasafe.db.sql.xml.GroupByType */ public static org.ralasafe.db.sql.xml.GroupByType unmarshal( final java.io.Reader reader) throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { return (org.ralasafe.db.sql.xml.GroupByType) Unmarshaller.unmarshal(org.ralasafe.db.sql.xml.GroupByType.class, reader); }
Example #18
Source File: SimpleValue.java From ralasafe with MIT License | 2 votes |
/** * Method unmarshal. * * @param reader * @throws org.exolab.castor.xml.MarshalException if object is * null or if any SAXException is thrown during marshaling * @throws org.exolab.castor.xml.ValidationException if this * object is an invalid instance according to the schema * @return the unmarshaled org.ralasafe.db.sql.xml.SimpleValueType */ public static org.ralasafe.db.sql.xml.SimpleValueType unmarshal( final java.io.Reader reader) throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { return (org.ralasafe.db.sql.xml.SimpleValueType) Unmarshaller.unmarshal(org.ralasafe.db.sql.xml.SimpleValue.class, reader); }
Example #19
Source File: ContextValueType.java From ralasafe with MIT License | 2 votes |
/** * Method unmarshal. * * @param reader * @throws org.exolab.castor.xml.MarshalException if object is * null or if any SAXException is thrown during marshaling * @throws org.exolab.castor.xml.ValidationException if this * object is an invalid instance according to the schema * @return the unmarshaled org.ralasafe.db.sql.xml.ContextValueType */ public static org.ralasafe.db.sql.xml.ContextValueType unmarshal( final java.io.Reader reader) throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { return (org.ralasafe.db.sql.xml.ContextValueType) Unmarshaller.unmarshal(org.ralasafe.db.sql.xml.ContextValueType.class, reader); }
Example #20
Source File: Table.java From ralasafe with MIT License | 2 votes |
/** * Method unmarshal. * * @param reader * @throws org.exolab.castor.xml.MarshalException if object is * null or if any SAXException is thrown during marshaling * @throws org.exolab.castor.xml.ValidationException if this * object is an invalid instance according to the schema * @return the unmarshaled org.ralasafe.db.sql.xml.TableType */ public static org.ralasafe.db.sql.xml.TableType unmarshal( final java.io.Reader reader) throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { return (org.ralasafe.db.sql.xml.TableType) Unmarshaller.unmarshal(org.ralasafe.db.sql.xml.Table.class, reader); }
Example #21
Source File: Left.java From ralasafe with MIT License | 2 votes |
/** * Method unmarshal. * * @param reader * @throws org.exolab.castor.xml.MarshalException if object is * null or if any SAXException is thrown during marshaling * @throws org.exolab.castor.xml.ValidationException if this * object is an invalid instance according to the schema * @return the unmarshaled org.ralasafe.db.sql.xml.Left */ public static org.ralasafe.db.sql.xml.Left unmarshal( final java.io.Reader reader) throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { return (org.ralasafe.db.sql.xml.Left) Unmarshaller.unmarshal(org.ralasafe.db.sql.xml.Left.class, reader); }
Example #22
Source File: VariableType.java From ralasafe with MIT License | 2 votes |
/** * Method unmarshal. * * @param reader * @throws org.exolab.castor.xml.MarshalException if object is * null or if any SAXException is thrown during marshaling * @throws org.exolab.castor.xml.ValidationException if this * object is an invalid instance according to the schema * @return the unmarshaled org.ralasafe.db.sql.xml.VariableType */ public static org.ralasafe.db.sql.xml.VariableType unmarshal( final java.io.Reader reader) throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { return (org.ralasafe.db.sql.xml.VariableType) Unmarshaller.unmarshal(org.ralasafe.db.sql.xml.VariableType.class, reader); }
Example #23
Source File: From.java From ralasafe with MIT License | 2 votes |
/** * Method unmarshal. * * @param reader * @throws org.exolab.castor.xml.MarshalException if object is * null or if any SAXException is thrown during marshaling * @throws org.exolab.castor.xml.ValidationException if this * object is an invalid instance according to the schema * @return the unmarshaled org.ralasafe.db.sql.xml.FromType */ public static org.ralasafe.db.sql.xml.FromType unmarshal( final java.io.Reader reader) throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { return (org.ralasafe.db.sql.xml.FromType) Unmarshaller.unmarshal(org.ralasafe.db.sql.xml.From.class, reader); }
Example #24
Source File: IsNotNullExpr.java From ralasafe with MIT License | 2 votes |
/** * Method unmarshal. * * @param reader * @throws org.exolab.castor.xml.MarshalException if object is * null or if any SAXException is thrown during marshaling * @throws org.exolab.castor.xml.ValidationException if this * object is an invalid instance according to the schema * @return the unmarshaled org.ralasafe.db.sql.xml.IsNotNullExprType */ public static org.ralasafe.db.sql.xml.IsNotNullExprType unmarshal( final java.io.Reader reader) throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { return (org.ralasafe.db.sql.xml.IsNotNullExprType) Unmarshaller.unmarshal(org.ralasafe.db.sql.xml.IsNotNullExpr.class, reader); }
Example #25
Source File: UserCategory.java From ralasafe with MIT License | 2 votes |
/** * Method unmarshal. * * @param reader * @throws org.exolab.castor.xml.MarshalException if object is * null or if any SAXException is thrown during marshaling * @throws org.exolab.castor.xml.ValidationException if this * object is an invalid instance according to the schema * @return the unmarshaled org.ralasafe.db.sql.xml.UserCategoryType */ public static org.ralasafe.db.sql.xml.UserCategoryType unmarshal( final java.io.Reader reader) throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { return (org.ralasafe.db.sql.xml.UserCategoryType) Unmarshaller.unmarshal(org.ralasafe.db.sql.xml.UserCategory.class, reader); }
Example #26
Source File: NotInExpr.java From ralasafe with MIT License | 2 votes |
/** * Method unmarshal. * * @param reader * @throws org.exolab.castor.xml.MarshalException if object is * null or if any SAXException is thrown during marshaling * @throws org.exolab.castor.xml.ValidationException if this * object is an invalid instance according to the schema * @return the unmarshaled org.ralasafe.db.sql.xml.NotInExprType */ public static org.ralasafe.db.sql.xml.NotInExprType unmarshal( final java.io.Reader reader) throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { return (org.ralasafe.db.sql.xml.NotInExprType) Unmarshaller.unmarshal(org.ralasafe.db.sql.xml.NotInExpr.class, reader); }
Example #27
Source File: Operator.java From ralasafe with MIT License | 2 votes |
/** * Method unmarshal. * * @param reader * @throws org.exolab.castor.xml.MarshalException if object is * null or if any SAXException is thrown during marshaling * @throws org.exolab.castor.xml.ValidationException if this * object is an invalid instance according to the schema * @return the unmarshaled org.ralasafe.db.sql.xml.Operator */ public static org.ralasafe.db.sql.xml.Operator unmarshal( final java.io.Reader reader) throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { return (org.ralasafe.db.sql.xml.Operator) Unmarshaller.unmarshal(org.ralasafe.db.sql.xml.Operator.class, reader); }
Example #28
Source File: OrderByType.java From ralasafe with MIT License | 2 votes |
/** * Method unmarshal. * * @param reader * @throws org.exolab.castor.xml.MarshalException if object is * null or if any SAXException is thrown during marshaling * @throws org.exolab.castor.xml.ValidationException if this * object is an invalid instance according to the schema * @return the unmarshaled org.ralasafe.db.sql.xml.OrderByType */ public static org.ralasafe.db.sql.xml.OrderByType unmarshal( final java.io.Reader reader) throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { return (org.ralasafe.db.sql.xml.OrderByType) Unmarshaller.unmarshal(org.ralasafe.db.sql.xml.OrderByType.class, reader); }
Example #29
Source File: BusinessData.java From ralasafe with MIT License | 2 votes |
/** * Method unmarshal. * * @param reader * @throws org.exolab.castor.xml.MarshalException if object is * null or if any SAXException is thrown during marshaling * @throws org.exolab.castor.xml.ValidationException if this * object is an invalid instance according to the schema * @return the unmarshaled org.ralasafe.db.sql.xml.BusinessDataType */ public static org.ralasafe.db.sql.xml.BusinessDataType unmarshal( final java.io.Reader reader) throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { return (org.ralasafe.db.sql.xml.BusinessDataType) Unmarshaller.unmarshal(org.ralasafe.db.sql.xml.BusinessData.class, reader); }
Example #30
Source File: Variable2.java From ralasafe with MIT License | 2 votes |
/** * Method unmarshal. * * @param reader * @throws org.exolab.castor.xml.MarshalException if object is * null or if any SAXException is thrown during marshaling * @throws org.exolab.castor.xml.ValidationException if this * object is an invalid instance according to the schema * @return the unmarshaled org.ralasafe.db.sql.xml.VariableType */ public static org.ralasafe.db.sql.xml.VariableType unmarshal( final java.io.Reader reader) throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { return (org.ralasafe.db.sql.xml.VariableType) Unmarshaller.unmarshal(org.ralasafe.db.sql.xml.Variable2.class, reader); }