示例#1
0
  public void setAttribute(String ns, String name, String value) throws MbException {
    MbElement attr = getAttributeElement(ns, name);

    if (attr == null) {
      attr =
          getMbElement()
              .createElementAsFirstChild(XmlUtil.getAttributeType(getMbElement()), name, value);

      if (ns != null) {
        attr.setNamespace(ns);
      }
    } else {
      attr.setValue(value);
    }
  }
示例#2
0
	private void setProperty(String area, String name, Object value) throws MbException {
		checkReadOnly();
		
		MbElement areaElm = getMbElement().getFirstElementByPath(area);
		if (areaElm == null) {
			areaElm = getMbElement().createElementAsLastChild(MbElement.TYPE_NAME);
			areaElm.setName(area);
		}
		
		MbElement valueElm = areaElm.getFirstElementByPath(name);
		
		if (valueElm == null) {
			areaElm.createElementAsLastChild(MbElement.TYPE_NAME, name, value);
		} else {
			valueElm.setValue(value);
		}
	}