/** * Return an <code>XSModel</code> that represents components in * the schema grammars in this pool implementation. * * @return an <code>XSModel</code> representing this schema grammar */ public XSModel toXSModel() { return toXSModel(Constants.SCHEMA_VERSION_1_0); }
/** * Parses the content of XML Schema documents specified as the list of URI * references. If the URI contains a fragment identifier, the behavior * is not defined by this specification. * @param uriList The list of URI locations. * @return An XSModel representing the schema documents. */ public XSModel loadURIList(StringList uriList) { int length = uriList.getLength(); try { fGrammarPool.clear(); for (int i = 0; i < length; ++i) { fSchemaLoader.loadGrammar(new XMLInputSource(null, uriList.item(i), null)); } return fGrammarPool.toXSModel(); } catch (Exception e) { fSchemaLoader.reportDOMFatalError(e); return null; } }
/** * Parse an XML Schema document from a location identified by a URI * reference. If the URI contains a fragment identifier, the behavior is * not defined by this specification. * @param uri The location of the XML Schema document to be read. * @return An XSModel representing this schema. */ public XSModel loadURI(String uri) { try { fGrammarPool.clear(); return ((XSGrammar) fSchemaLoader.loadGrammar(new XMLInputSource(null, uri, null))).toXSModel(); } catch (Exception e){ fSchemaLoader.reportDOMFatalError(e); return null; } }
public void putGrammar(Grammar grammar) { SchemaGrammar cachedGrammar = toSchemaGrammar(super.getGrammar(grammar.getGrammarDescription())); if (cachedGrammar != null) { SchemaGrammar newGrammar = toSchemaGrammar(grammar); if (newGrammar != null) { mergeSchemaGrammars(cachedGrammar, newGrammar); } } else { super.putGrammar(grammar); } }
/** * Parses the content of XML Schema documents specified as a list of * <code>LSInput</code>s. * @param is The list of <code>LSInput</code>s from which the XML * Schema documents are to be read. * @return An XSModel representing the schema documents. */ public XSModel loadInputList(LSInputList is) { final int length = is.getLength(); try { fGrammarPool.clear(); for (int i = 0; i < length; ++i) { fSchemaLoader.loadGrammar(fSchemaLoader.dom2xmlInputSource(is.item(i))); } return fGrammarPool.toXSModel(); } catch (Exception e) { fSchemaLoader.reportDOMFatalError(e); return null; } }
/** * Parse an XML Schema document from a resource identified by a * <code>LSInput</code> . * @param is The <code>LSInput</code> from which the source * document is to be read. * @return An XSModel representing this schema. */ public XSModel load(LSInput is) { try { fGrammarPool.clear(); return ((XSGrammar) fSchemaLoader.loadGrammar(fSchemaLoader.dom2xmlInputSource(is))).toXSModel(); } catch (Exception e) { fSchemaLoader.reportDOMFatalError(e); return null; } }
public XSModel toXSModel(short schemaVersion) { ArrayList list = new ArrayList(); for (int i = 0; i < fGrammars.length; i++) { for (Entry entry = fGrammars[i] ; entry != null ; entry = entry.next) { if (entry.desc.getGrammarType().equals(XMLGrammarDescription.XML_SCHEMA)) { list.add(entry.grammar); } } } int size = list.size(); if (size == 0) { return toXSModel(new SchemaGrammar[0], schemaVersion); } SchemaGrammar[] gs = (SchemaGrammar[])list.toArray(new SchemaGrammar[size]); return toXSModel(gs, schemaVersion); }