/** * Get the JAXB Unmarshaller * * @param pkgName The package name for the jaxb context * @param schemaLocation location of the schema to validate against * @return unmarshaller * @throws JAXBException * @throws SAXException */ public static Unmarshaller getValidatingUnmarshaller(String pkgName, String schemaLocation) throws JAXBException, SAXException { Unmarshaller unmarshaller = getUnmarshaller(pkgName); Schema schema = getJAXPSchemaInstance(schemaLocation); unmarshaller.setSchema(schema); return unmarshaller; }
/** * Get the JAXB Unmarshaller for a selected set * of package names * @param pkgNames * @return * @throws JAXBException */ public static Unmarshaller getUnmarshaller(String... pkgNames) throws JAXBException { if (pkgNames == null) throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "pkgName"); int len = pkgNames.length; if (len == 0) return getUnmarshaller(pkgNames[0]); JAXBContext jc = getJAXBContext(pkgNames); return jc.createUnmarshaller(); }
/** * Get the JAXB Unmarshaller for a selected set * of package names * @param pkgNames * @return * @throws JAXBException */ public static Unmarshaller getUnmarshaller(String... pkgNames) throws JAXBException { if (pkgNames == null) throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "pkgName"); int len = pkgNames.length; if (len == 0) return getUnmarshaller(pkgNames[0]); JAXBContext jc = getJAXBContext(pkgNames); return jc.createUnmarshaller(); }
/** * Get the JAXB Unmarshaller * * @param pkgName The package name for the jaxb context * @param schemaLocation location of the schema to validate against * * @return unmarshaller * * @throws JAXBException * @throws SAXException */ public static Unmarshaller getValidatingUnmarshaller(String pkgName, String schemaLocation) throws JAXBException, SAXException { Unmarshaller unmarshaller = getUnmarshaller(pkgName); Schema schema = getJAXPSchemaInstance(schemaLocation); unmarshaller.setSchema(schema); return unmarshaller; }
/** * Get the JAXB Unmarshaller * @param pkgName The package name for the jaxb context * @param schemaLocation location of the schema to validate against * @return unmarshaller * @throws JAXBException * @throws SAXException */ public static Unmarshaller getValidatingUnmarshaller(String pkgName, String schemaLocation) throws JAXBException, SAXException { Unmarshaller unmarshaller = getUnmarshaller(pkgName); Schema schema = getJAXPSchemaInstance(schemaLocation); unmarshaller.setSchema(schema); return unmarshaller; }
/** * Get the JAXB Unmarshaller * @param pkgName The package name for the jaxb context * @param schemaLocation location of the schema to validate against * @return unmarshaller * @throws JAXBException * @throws SAXException */ public static Unmarshaller getValidatingUnmarshaller(String pkgName, String schemaLocation) throws JAXBException, SAXException { Unmarshaller unmarshaller = getUnmarshaller(pkgName); Schema schema = getJAXPSchemaInstance(schemaLocation); unmarshaller.setSchema(schema); return unmarshaller; }
/** * Get the JAXB Unmarshaller * * @param pkgName The package name for the jaxb context * @param schemaLocation location of the schema to validate against * * @return unmarshaller * * @throws JAXBException * @throws SAXException */ public static Unmarshaller getValidatingUnmarshaller(String pkgName, String schemaLocation) throws JAXBException, SAXException { Unmarshaller unmarshaller = getUnmarshaller(pkgName); Schema schema = getJAXPSchemaInstance(schemaLocation); unmarshaller.setSchema(schema); return unmarshaller; }
/** * Get the JAXB Unmarshaller for a selected set of package names * * @param pkgNames * @return * @throws JAXBException */ public static Unmarshaller getUnmarshaller(String... pkgNames) throws JAXBException { if (pkgNames == null) throw logger.nullArgumentError("pkgName"); int len = pkgNames.length; if (len == 0) return getUnmarshaller(pkgNames[0]); JAXBContext jc = getJAXBContext(pkgNames); return jc.createUnmarshaller(); }
public static Unmarshaller getValidatingUnmarshaller(String[] pkgNames, String[] schemaLocations) throws JAXBException, SAXException, IOException { StringBuilder builder = new StringBuilder(); int len = pkgNames.length; if (len == 0) throw new IllegalArgumentException(ErrorCodes.NULL_VALUE + "Packages are empty"); for (String pkg : pkgNames) { builder.append(pkg); builder.append(":"); } Unmarshaller unmarshaller = getUnmarshaller(builder.toString()); SchemaFactory schemaFactory = getSchemaFactory(); //Get the sources Source[] schemaSources = new Source[schemaLocations.length]; int i = 0; for (String schemaLocation : schemaLocations) { URL schemaURL = SecurityActions.loadResource(JAXBUtil.class, schemaLocation); if (schemaURL == null) throw new IllegalStateException(ErrorCodes.NULL_VALUE + "Schema URL :" + schemaLocation); schemaSources[i++] = new StreamSource(schemaURL.openStream()); } Schema schema = schemaFactory.newSchema(schemaSources); unmarshaller.setSchema(schema); return unmarshaller; }
public static Unmarshaller getValidatingUnmarshaller(String[] pkgNames, String[] schemaLocations) throws JAXBException, SAXException, IOException { StringBuilder builder = new StringBuilder(); int len = pkgNames.length; if (len == 0) throw new IllegalArgumentException(ErrorCodes.NULL_VALUE + "Packages are empty"); for (String pkg : pkgNames) { builder.append(pkg); builder.append(":"); } Unmarshaller unmarshaller = getUnmarshaller(builder.toString()); SchemaFactory schemaFactory = getSchemaFactory(); //Get the sources Source[] schemaSources = new Source[schemaLocations.length]; int i = 0; for (String schemaLocation : schemaLocations) { URL schemaURL = SecurityActions.loadResource(JAXBUtil.class, schemaLocation); if (schemaURL == null) throw new IllegalStateException(ErrorCodes.NULL_VALUE + "Schema URL :" + schemaLocation); schemaSources[i++] = new StreamSource(schemaURL.openStream()); } Schema schema = schemaFactory.newSchema(schemaSources); unmarshaller.setSchema(schema); return unmarshaller; }
/** * Get the JAXB Unmarshaller for a selected set of package names * * @param pkgNames * * @return * * @throws JAXBException */ public static Unmarshaller getUnmarshaller(String... pkgNames) throws JAXBException { if (pkgNames == null) throw logger.nullArgumentError("pkgName"); int len = pkgNames.length; if (len == 0) return getUnmarshaller(pkgNames[0]); JAXBContext jc = getJAXBContext(pkgNames); return jc.createUnmarshaller(); }
public static Unmarshaller getValidatingUnmarshaller(String[] pkgNames, String[] schemaLocations) throws JAXBException, SAXException, IOException { StringBuilder builder = new StringBuilder(); int len = pkgNames.length; if (len == 0) throw logger.nullValueError("Packages are empty"); for (String pkg : pkgNames) { builder.append(pkg); builder.append(":"); } Unmarshaller unmarshaller = getUnmarshaller(builder.toString()); SchemaFactory schemaFactory = getSchemaFactory(); // Get the sources Source[] schemaSources = new Source[schemaLocations.length]; int i = 0; for (String schemaLocation : schemaLocations) { URL schemaURL = SecurityActions.loadResource(JAXBUtil.class, schemaLocation); if (schemaURL == null) throw logger.nullValueError("Schema URL :" + schemaLocation); schemaSources[i++] = new StreamSource(schemaURL.openStream()); } Schema schema = schemaFactory.newSchema(schemaSources); unmarshaller.setSchema(schema); return unmarshaller; }
/** * Get the JAXB Unmarshaller for a selected set of package names * * @param pkgNames * * @return * * @throws JAXBException */ public static Unmarshaller getUnmarshaller(String... pkgNames) throws JAXBException { if (pkgNames == null) throw logger.nullArgumentError("pkgName"); int len = pkgNames.length; if (len == 0) return getUnmarshaller(pkgNames[0]); JAXBContext jc = getJAXBContext(pkgNames); return jc.createUnmarshaller(); }
public static Unmarshaller getValidatingUnmarshaller(String[] pkgNames, String[] schemaLocations) throws JAXBException, SAXException, IOException { StringBuilder builder = new StringBuilder(); int len = pkgNames.length; if (len == 0) throw logger.nullValueError("Packages are empty"); for (String pkg : pkgNames) { builder.append(pkg); builder.append(":"); } Unmarshaller unmarshaller = getUnmarshaller(builder.toString()); SchemaFactory schemaFactory = getSchemaFactory(); // Get the sources Source[] schemaSources = new Source[schemaLocations.length]; int i = 0; for (String schemaLocation : schemaLocations) { URL schemaURL = SecurityActions.loadResource(JAXBUtil.class, schemaLocation); if (schemaURL == null) throw logger.nullValueError("Schema URL :" + schemaLocation); schemaSources[i++] = new StreamSource(schemaURL.openStream()); } Schema schema = schemaFactory.newSchema(schemaSources); unmarshaller.setSchema(schema); return unmarshaller; }
public static Unmarshaller getValidatingUnmarshaller(String[] pkgNames, String[] schemaLocations) throws JAXBException, SAXException, IOException { StringBuilder builder = new StringBuilder(); int len = pkgNames.length; if (len == 0) throw logger.nullValueError("Packages are empty"); for (String pkg : pkgNames) { builder.append(pkg); builder.append(":"); } Unmarshaller unmarshaller = getUnmarshaller(builder.toString()); SchemaFactory schemaFactory = getSchemaFactory(); // Get the sources Source[] schemaSources = new Source[schemaLocations.length]; int i = 0; for (String schemaLocation : schemaLocations) { URL schemaURL = SecurityActions.loadResource(JAXBUtil.class, schemaLocation); if (schemaURL == null) throw logger.nullValueError("Schema URL :" + schemaLocation); schemaSources[i++] = new StreamSource(schemaURL.openStream()); } Schema schema = schemaFactory.newSchema(schemaSources); unmarshaller.setSchema(schema); return unmarshaller; }