Example usage for org.xml.sax.helpers AttributesImpl setLocalName

List of usage examples for org.xml.sax.helpers AttributesImpl setLocalName

Introduction

In this page you can find the example usage for org.xml.sax.helpers AttributesImpl setLocalName.

Prototype

public void setLocalName(int index, String localName) 

Source Link

Document

Set the local name of a specific attribute.

Usage

From source file:nonjsp.application.XmlXulRuleSet.java

/**
 * This method is invoked when the beginning of the matched
 * Xml element is encountered ;//from   w w  w .  j ava 2 s. c o m
 *
 * @param attributes The element's attribute list
 */
public void begin(Attributes attributes) throws Exception {
    UIComponent uic = (UIComponent) digester.peek();
    if (log.isTraceEnabled()) {
        log.trace("component: " + uic.getId());
    }
    AttributesImpl attrs = new AttributesImpl(attributes);
    for (int i = 0; i < attrs.getLength(); i++) {
        String qName = attributes.getQName(i);
        attrs.setLocalName(i, qName);
        attrs.setValue(i, attributes.getValue(qName));
        if (log.isTraceEnabled()) {
            log.trace("ComponentRule: qName: " + qName + " value: " + attributes.getValue(qName));
        }
    }
    bc.applyAttributesToComponentInstance(uic, attrs);

    if (root == null) {
        root = (UIComponent) digester.peek(digester.getCount() - 1);
    }
    root.getChildren().add(uic);

    //If component is a form, make it the root so that children will be
    //added to it
    if (uic instanceof UIForm) {
        root = uic;
    }
}

From source file:nonjsp.application.XmlXulRuleSet.java

/**
 * This method is invoked when the beginning of the matched
 * Xml element is encountered (in this case "property");
 *
 * @param attributes The element's attribute list
 *//*from w  ww  .j av a  2 s  .c  om*/
public void begin(Attributes attributes) throws Exception {
    UIComponent uic = (UIComponent) digester.peek();
    AttributesImpl attrs = new AttributesImpl(attributes);
    for (int i = 0; i < attrs.getLength(); i++) {
        String qName = attributes.getQName(i);
        attrs.setLocalName(i, qName);
        attrs.setValue(i, attributes.getValue(qName));
    }
    bc.handleNestedComponentTag(uic, "SelectOne_Option", attrs);
}

From source file:org.apache.axis.message.MessageElement.java

/**
 * set or update an attribute./*from  w ww.j  av a 2 s  .c  o m*/
 * @see org.w3c.dom.Element#setAttribute(String, String)
 * @param name attribute name
 * @param value attribute value
 * @throws DOMException
 */
public void setAttribute(String name, String value) throws DOMException {
    AttributesImpl impl = makeAttributesEditable();
    int index = impl.getIndex(name);
    if (index < 0) { // not found
        String uri = "";
        String localname = name;
        String qname = name;
        String type = "CDDATA";
        impl.addAttribute(uri, localname, qname, type, value);
    } else { // found
        impl.setLocalName(index, value);
    }
}