Example usage for org.xml.sax Attributes getValue

List of usage examples for org.xml.sax Attributes getValue

Introduction

In this page you can find the example usage for org.xml.sax Attributes getValue.

Prototype

public abstract String getValue(String qName);

Source Link

Document

Look up an attribute's value by XML qualified (prefixed) name.

Usage

From source file:cucumber.templates.xml.RefElementFactory.java

/**
 * <p>Factory method called by {@link org.apache.commons.digester.FactoryCreateRule} to supply an
 * object based on the element's attributes.
 *
 * @param attributes the element's attributes
 * @throws Exception any exception thrown will be propagated upwards
 *//*from  w  ww.j a va2 s  .com*/
@Override
public Object createObject(@NotNull final Attributes attributes) throws Exception {
    final @Nullable String t_strLocal = attributes.getValue("local");

    return new RefElement(t_strLocal);
}

From source file:cucumber.templates.xml.BeanElementFactory.java

/**
 * <p>Factory method called by {@link org.apache.commons.digester.FactoryCreateRule} to supply an
 * object based on the element's attributes.
 *
 * @param attributes the element's attributes
 * @throws Exception any exception thrown will be propagated upwards
 *///from  w  w w  .  j a v a  2s  .  c  o  m
@NotNull
@Override
public Object createObject(@NotNull final Attributes attributes) throws Exception {
    final @Nullable String t_strId = attributes.getValue("id");
    final @Nullable String t_strClass = attributes.getValue("class");

    return new BeanElement(t_strId, t_strClass);
}

From source file:net.codjo.control.common.loader.StepFactory.java

public Object createObject(Attributes attributes) throws Exception {
    // Cration du nouveau Step
    Step step;/*from   ww  w . j  a  va2 s.  co m*/
    String inheritId = attributes.getValue("inheritId");
    if (inheritId == null) {
        // Si pas d'attribut inheritId, alors on instancie simplement un nouveau Step
        step = new Step();
    } else {
        // Si un attribut inheritId est prsent, on doit hriter du step abstrait correspondant.
        // On rcupre l'objet IntegrationPlan, qui est le premier objet qui a t
        // empil dans le digester. La liste des steps abstraits est attach 
        // cet objet.
        IntegrationPlan ip = (IntegrationPlan) digester.peek(digester.getCount() - 1);
        StepsList abstractSteps = ip.getAbstractSteps();
        if (abstractSteps == null) {
            throw new IllegalArgumentException("A step inherits from abstract step " + inheritId
                    + ", but no abstract step has been declared!");
        }
        Step abstractStep = abstractSteps.getStep(inheritId);
        if (abstractStep == null) {
            throw new IllegalArgumentException("A step inherits from abstract step " + inheritId
                    + ", but this abstract step has not been declared!");
        }
        step = (Step) abstractStep.clone();
    }

    return step;
}

From source file:eu.planets_project.pp.plato.xml.plato.ChangeLogFactory.java

@Override
public Object createObject(Attributes arg0) throws Exception {
    ChangeLog c = new ChangeLog();
    TimestampFormatter formatter = new TimestampFormatter();
    c.setChangedBy(arg0.getValue("changedBy"));
    c.setCreatedBy(arg0.getValue("createdBy"));
    String changed = arg0.getValue("changed");
    String created = arg0.getValue("created");
    c.setChanged(formatter.parseTimestamp(changed));
    c.setCreated(formatter.parseTimestamp(created));
    return c;//w  ww .  j  ava  2s . c  om
}

From source file:com.notesrender.templatej.TemplateProcessor.java

private void processStartPlaceholderTag(Attributes attrs) {
    String content = _contents.get(attrs.getValue(_ATTR_ID));
    System.out.println("Content: " + content);
    _writer.print(content);/*  w w  w.  j  a  va  2 s.c om*/
    _writer.flush();
}

From source file:XMLTreeView.java

private void attachAttributeList(DefaultMutableTreeNode node, Attributes atts) {
    for (int i = 0; i < atts.getLength(); i++) {
        String name = atts.getLocalName(i);
        String value = atts.getValue(name);
        node.add(new DefaultMutableTreeNode(name + " = " + value));
    }//  w  ww .ja va 2 s  .  c o  m
}

From source file:com.threerings.stage.tools.xml.StageSceneParser.java

/**
 * Constructs a parser that can be used to parse Stage scene models.
 *//*from   w w  w .  j av  a 2 s .c o m*/
public StageSceneParser() {
    super("");

    // add a rule to parse scene colorizations
    _digester.addRule("scene/zations/zation", new Rule() {
        @Override
        public void begin(String namespace, String name, Attributes attrs) throws Exception {
            StageSceneModel yoscene = (StageSceneModel) digester.peek();
            int classId = Integer.parseInt(attrs.getValue("classId"));
            int colorId = Integer.parseInt(attrs.getValue("colorId"));
            yoscene.setDefaultColor(classId, colorId);
        }
    });

    // add rule sets for our aux scene models
    registerAuxRuleSet(new SpotSceneRuleSet() {
        @Override
        protected Location createLocation() {
            return new StageLocation();
        }
    });
    registerAuxRuleSet(new StageMisoSceneRuleSet());
}

From source file:eu.scape_project.planning.xml.plan.ChangeLogFactory.java

@Override
public ChangeLog createObject(Attributes arg0) throws Exception {
    ChangeLog c = new ChangeLog();
    TimestampFormatter formatter = new TimestampFormatter();
    c.setChangedBy(arg0.getValue("changedBy"));
    c.setCreatedBy(arg0.getValue("createdBy"));
    String changed = arg0.getValue("changed");
    String created = arg0.getValue("created");
    c.setChanged(formatter.parseTimestamp(changed));
    c.setCreated(formatter.parseTimestamp(created));
    return c;/*  w  w w.j ava 2 s  .  c om*/
}

From source file:com.w20e.socrates.factories.OptionsFactory.java

/**
 * Create a new expression based on the input string, or null if no
 * input string.//  www  .j  a  v  a 2 s.c o  m
 * @param expr String to parse
 * @return the expression created.
 * @throws Exception in case the compiler can't parse.
 */
public final OptionList createObject(final Attributes attrs) throws Exception {

    Digester dig = this.getDigester();

    RenderConfig rConfig = dig.getRoot();

    return rConfig.getOptionList(attrs.getValue("ref"));
}

From source file:com.notesrender.templatej.TemplateProcessor.java

private void processStartContentTag(Attributes attrs) {
    _isContentTag = true;
    _contentRef = attrs.getValue(_ATTR_REF);
    _contentBuilder.setLength(0);
}