コード例 #1
0
  public void load(IXMLElement xml) throws Exception {
    super.load(xml);

    final int priority = parameters().getAttribute(PARAM_PRIORITY, 3);
    this.socials = new MudObjectInterpreter(getName(), priority, this);

    for (Enumeration enu = xml.enumerateChildren(); enu.hasMoreElements(); ) {

      IXMLElement nxt = (IXMLElement) enu.nextElement();
      String nom = nxt.getName();

      if (nom.equals(Social.MARKUP)) {

        this.socials.addCommand(Social.loadSocial(nxt));

      } else if (nom.equals(PROPERTY_SOCIALS)) {

        loadSocialsElement(nxt);
      }
    }
  }
コード例 #2
0
  public void loadSocialsElement(IXMLElement xml) throws Exception {
    String src = xml.getAttribute(PROPERTY_SRC, null);

    // If the passed xml element just points to a file
    if (src != null) {
      IXMLParser xmp = new StdXMLParser();
      xmp.setBuilder(new StdXMLBuilder());
      xmp.setValidator(new NonValidator());
      xmp.setReader(StdXMLReader.fileReader(src));

      xml = (XMLElement) xmp.parse();
      xmp = null;
    }

    int count = 0;
    for (Enumeration enu = xml.getChildrenNamed(Social.MARKUP).elements();
        enu.hasMoreElements();
        count++) {

      IXMLElement nxt = (IXMLElement) enu.nextElement();
      this.socials.addCommand(Social.loadSocial(nxt));
    }
  }