@Override public void parse(URL url) throws IOException { _source = url; super.parse(url); }
/** * Override this method to clear any state and ready the parser for * a new document. Subclasses should call * <code>super.reset()</code> to clear superclass state. */ protected void reset() { super.reset(); _package = null; _class = null; }
/** * Whether parsed resource names are cached to avoid duplicate parsing. */ public void setCaching(boolean caching) { _caching = caching; if (!caching) clear(); }
/** * Returns a SAXException with the source file name and the given error * message. */ protected SAXException getException(String msg) { return new SAXException(getSourceName() + currentLocation() + ": " + msg); }
Object schemaSource = getSchemaSource(); if (schemaSource != null && _schemaBug) { if (_log != null && _log.isTraceEnabled()) schemaSource = null; boolean validating = _validating && (getDocType() != null || schemaSource != null); if (validating) { schema = schemaSource; if (schema == null && getDocType() != null) xml = new DocTypeReader(xml, getDocType()); is.setSystemId(sourceName); parser.parse(is, this); finish(); } catch (SAXException se) { IOException ioe = new IOException(se.toString()); throw ioe; } finally { reset();
/** * Parse the schema relating to the given class. The schemas will * be added to the current schema group. */ protected void finish() { // now resolve pk, idx, fk info super.finish(); if (!_delay) resolveConstraints(); }
public void error(SAXParseException se) throws SAXException { throw getException(se.toString()); }
/** * Add current comments to the given entity. By default, assumes entity * is {@link Commentable}. */ protected void addComments(Object obj) { String[] comments = currentComments(); if (comments.length > 0 && obj instanceof Commentable) ((Commentable) obj).setComments(comments); }
public void endElement(String uri, String name, String qName) throws SAXException { if (_depth < _ignore) endElement(qName); _text = null; if (_comments != null) _comments.clear(); if (_depth == _ignore) _ignore = Integer.MAX_VALUE; _depth--; }
/** * Return true if the given source is parsed. Otherwise, record that * it will be parsed. */ protected boolean parsed(String src) { if (!_caching) return false; if (_parsed == null) _parsed = new HashMap<ClassLoader, Set<String>>(); ClassLoader loader = currentClassLoader(); Set<String> set = _parsed.get(loader); if (set == null) { set = new HashSet<String>(); _parsed.put(loader, set); } boolean added = set.add(src); if (!added && _log != null && _log.isTraceEnabled()) _log.trace(_loc.get("already-parsed", src)); return !added; }
Object schemaSource = getSchemaSource(); if (schemaSource != null && _schemaBug) { if (_log != null && _log.isTraceEnabled()) schemaSource = null; boolean validating = _validating && (getDocType() != null || schemaSource != null); setParsing(true); _sourceName = sourceName; if (validating) { schema = schemaSource; if (schema == null && getDocType() != null) xml = new DocTypeReader(xml, getDocType()); is.setSystemId(sourceName); parser.parse(is, this); finish(); } catch (SAXException se) { IOException ioe = new IOException(se.toString()); reset();
/** * Returns a SAXException with the source file name and the given error * message. */ protected SAXException getException(String msg) { return new SAXException(getSourceName() + currentLocation() + ": " + msg); }
/** * Parse the schema relating to the given class. The schemas will * be added to the current schema group. */ protected void finish() { // now resolve pk, idx, fk info super.finish(); if (!_delay) resolveConstraints(); }
public void fatalError(SAXParseException se) throws SAXException { throw getException(se.toString()); }
/** * Add current comments to the given entity. By default, assumes entity * is {@link Commentable}. */ protected void addComments(Object obj) { String[] comments = currentComments(); if (comments.length > 0 && obj instanceof Commentable) ((Commentable) obj).setComments(comments); }
public void endElement(String uri, String name, String qName) throws SAXException { if (_depth < _ignore) { endElement(qName); _extendedNamespace = (_extendedNamespace > 0) ? _extendedNamespace - 1 : 0; _openjpaNamespace = (_openjpaNamespace > 0) ? _openjpaNamespace - 1 : 0; } else if (_depth ==_ignore) { _extendedNamespace = (_extendedNamespace > 0) ? _extendedNamespace - 1 : 0; _openjpaNamespace = (_openjpaNamespace > 0) ? _openjpaNamespace - 1 : 0; } _text = null; if (_comments != null) _comments.clear(); if (_depth == _ignore) _ignore = Integer.MAX_VALUE; _depth--; }
/** * Return true if the given source is parsed. Otherwise, record that * it will be parsed. */ protected boolean parsed(String src) { if (!_caching) return false; if (_parsed == null) _parsed = new HashMap<ClassLoader, Set<String>>(); ClassLoader loader = currentClassLoader(); Set<String> set = _parsed.get(loader); if (set == null) { set = new HashSet<String>(); _parsed.put(loader, set); } boolean added = set.add(src); if (!added && _log != null && _log.isTraceEnabled()) _log.trace(_loc.get("already-parsed", src)); return !added; }
Object schemaSource = getSchemaSource(); if (schemaSource != null && _schemaBug) { if (_log != null && _log.isTraceEnabled()) schemaSource = null; boolean validating = _validating && (getDocType() != null || schemaSource != null); setParsing(true); _sourceName = sourceName; if (validating) { schema = schemaSource; if (schema == null && getDocType() != null) xml = new DocTypeReader(xml, getDocType()); is.setSystemId(sourceName); parser.parse(is, this); finish(); } catch (SAXException se) { IOException ioe = new IOException(se.toString()); reset();
public void parse(MetaDataIterator itr) throws IOException { parse(itr, false); }
/** * Returns a SAXException with the source file name and the given error * message. */ protected SAXException getException(String msg) { return new SAXException(getSourceName() + currentLocation() + ": " + msg); }