Dépôt officiel du code source de l'ERP OpenConcerto
/trunk/OpenConcerto/src/org/openconcerto/xml/Step.java |
---|
26,7 → 26,7 |
/** |
* A step in {@link SimpleXMLPath}. There's only 2 types of step, those which go to {@link Element} |
* and those which go to {@link Attribute}. |
* and those which go to {@link Attribute}. Thread-safe if its {@link #getPredicate() predicate} is. |
* |
* @author Sylvain CUAZ |
* |
38,6 → 38,18 |
attribute, child, ancestor, descendantOrSelf |
} |
private static final Step<Attribute> ANY_ATTRIBUTE = createAttributeStep(null, null); |
private static final Step<Element> ANY_CHILD_ELEMENT = createElementStep(Axis.child, null, null); |
/** |
* Return a step that match any attribute. |
* |
* @return the equivalent of <code>@*</code>. |
*/ |
public static Step<Attribute> getAnyAttributeStep() { |
return ANY_ATTRIBUTE; |
} |
public static Step<Attribute> createAttributeStep(final String name, final String ns) { |
return createAttributeStep(name, ns, null); |
} |
46,6 → 58,15 |
return new Step<Attribute>(Axis.attribute, name, ns, Attribute.class, pred); |
} |
/** |
* Return a step that match any child element. |
* |
* @return the equivalent of <code>*</code>. |
*/ |
public static Step<Element> getAnyChildElementStep() { |
return ANY_CHILD_ELEMENT; |
} |
public static Step<Element> createElementStep(final String name, final String ns) { |
return createElementStep(name, ns, null); |
} |
91,6 → 112,10 |
return this.name; |
} |
public final IPredicate<T> getPredicate() { |
return this.pred; |
} |
protected final Namespace getNS(final Element elem) { |
return this.ns == null ? Namespace.NO_NAMESPACE : elem.getNamespace(this.ns); |
} |