コード例 #1
0
 protected WXSSchema nouveauSchemaInclu(
     final URL urlSchemaParent,
     final String schemaLocation,
     final String espaceImport,
     final WXSSchema schemaParent)
     throws JaxeException {
   try {
     final URL urls = resoudreURI(getURLParent(urlSchemaParent), schemaLocation);
     if (urls == null)
       throw new JaxeException("include/import : location not found : " + schemaLocation);
     for (WXSSchema schemaInclu : schemasInclu)
       if (schemaInclu.getURL().toURI().normalize().equals(urls.toURI().normalize())) {
         ajouterEspaces(
             schemaInclu, schemaParent, espaceImport); // une chance de plus de trouver un pr?fixe
         return (schemaInclu);
       }
     final WXSSchema schemaInclu = new WXSSchema(lireDocument(urls), urls, this, schemaParent);
     ajouterEspaces(schemaInclu, schemaParent, espaceImport);
     schemasInclu.add(schemaInclu);
     schemaInclu.inclusions();
     return (schemaInclu);
   } catch (final MalformedURLException ex) {
     throw new JaxeException("include/import : MalformedURLException: " + ex.getMessage(), ex);
   } catch (final URISyntaxException ex) {
     throw new JaxeException("include/import : URISyntaxException: " + ex.getMessage(), ex);
   } catch (final TransformerException ex) {
     throw new JaxeException("include/import : TransformerException: " + ex.getMessage(), ex);
   }
 }
コード例 #2
0
  public JaxeWXS(final URL schemaURL, final Config cfg) throws JaxeException {
    this.cfg = cfg;
    schemasInclu = new HashSet<WXSSchema>();
    espaceVersPrefixe = new HashMap<String, String>();

    schema = new WXSSchema(lireDocument(schemaURL), schemaURL, this, null);
    ajouterEspaces(schema, null, null);
    schemasInclu.add(schema);
    schema.inclusions();

    lTousElements = new LinkedHashSet<WXSElement>();
    for (final WXSSchema sch : schemasInclu) lTousElements.addAll(sch.listeTousElements());
    for (final WXSSchema sch : schemasInclu)
      sch
          .resoudreReferences(); // WXSAny.resoudreReferences() a besoin de cet objet JaxeWXS, c'est
                                 // donc appel? plus tard
    hRefElementVersWXS = new HashMap<Element, WXSElement>();
    hRefAttributVersWXS = new HashMap<Element, WXSAttribute>();
    hNomVersWXS = new HashMap<String, ArrayList<WXSElement>>();
    for (WXSElement element : lTousElements) {
      hRefElementVersWXS.put(element.getDOMElement(), element);
      if (element.getName() != null && element.getRef() == null) {
        ArrayList<WXSElement> listeWXS = hNomVersWXS.get(element.getName());
        if (listeWXS == null) {
          listeWXS = new ArrayList<WXSElement>();
          hNomVersWXS.put(element.getName(), listeWXS);
        }
        listeWXS.add(element);
      }
    }
    for (WXSElement element : lTousElements) {
      final ArrayList<WXSAttribute> attributs = element.listeAttributs();
      if (attributs != null) {
        for (WXSAttribute attribut : attributs)
          hRefAttributVersWXS.put(attribut.getDOMElement(), attribut);
      }
    }
  }