/** * Constructor. * * @param loc locator for class information (<code>null</code> if none) * @param custom binding customization information (used for creating names as needed) * @param urinames map from namespace URI to schema file name */ public SchemaGen(IClassLocator loc, GlobalCustom custom, Map urinames) { m_locator = loc; m_custom = custom; m_classSimpletypes = new HashMap(); m_uriNames = urinames; m_uriSchemas = new HashMap(); m_formatCache = new FormatterCache(loc); m_context = new ValidationContext(loc); m_detailDirectory = new DetailDirectory(custom, m_context); }
ValidationContext vctx = new ValidationContext(loc); FileInputStream is = new FileInputStream(file); BindingElement binding = BindingElement.validateBinding(root.getFileName(), file.toURI().toURL(), is, vctx);
new org.jibx.binding.model.ValidationContext(new DummyClassLocator()); BindingElement binding = BindingElement.readBinding(url.openStream(), name, null, true, vctx);
new org.jibx.binding.model.ValidationContext(new DummyClassLocator()); BindingElement binding = BindingElement.readBinding(url.openStream(), name, null, true, vctx);
FileInputStream is = new FileInputStream(file); try { ValidationContext vctx = new ValidationContext(parms.getLocator()); BindingElement binding = BindingElement.validateBinding(name, url, is, vctx); if (vctx.getErrorCount() == 0 && vctx.getFatalCount() == 0) {
/** * Write the binding definitions file(s). This method can only be used after * {@link #buildDataModel(boolean, boolean, Map, Map)} is called. * * @param name root binding definition file name (use customization, or default, if <code>null</code>) * @param pack target package for binding (<code>null</code> if unspecified) * @param pregens pregenerated bindings to be included in root binding * @param handler validation error and code generation problem handler * @throws JiBXException error * @throws IOException error */ public void writeBindings(String name, String pack, List pregens, ProblemHandler handler) throws JiBXException, IOException { if (name == null) { name = m_global.getBindingFileName(); if (name == null) { name = "binding.xml"; } } m_rootHolder = m_bindingDirectory.configureFiles(name, pack, pregens); IClassLocator iloc = new DummyClassLocator(); org.jibx.binding.model.ValidationContext vctx = new org.jibx.binding.model.ValidationContext(iloc); if (m_bindingDirectory.validateBindings(m_rootHolder, m_targetDir, vctx)) { m_bindingDirectory.writeBindings(m_targetDir); } else { reportBindingProblems(vctx, handler); throw new JiBXException("Terminating due to errors in bindings"); } }