Search in sources :

Example 1 with AttrType

use of org.eclipse.wst.xml.xpath2.processor.internal.types.AttrType in project webtools.sourceediting by eclipse.

the class AttributeTest method createAttrForXSDType.

private AnyType createAttrForXSDType(Node node, StaticContext sc) {
    Attr attr = (Attr) node;
    TypeModel typeModel = sc.getTypeModel();
    TypeDefinition typedef = typeModel.getType(attr);
    if (typedef != null) {
        if (typedef.derivedFrom(type().namespace(), type().local(), getDerviationTypes())) {
            anyType = new AttrType(attr, sc.getTypeModel());
        }
    } else {
        anyType = new AttrType(attr, sc.getTypeModel());
    }
    return anyType;
}
Also used : AttrType(org.eclipse.wst.xml.xpath2.processor.internal.types.AttrType) TypeModel(org.eclipse.wst.xml.xpath2.api.typesystem.TypeModel) Attr(org.w3c.dom.Attr) TypeDefinition(org.eclipse.wst.xml.xpath2.api.typesystem.TypeDefinition)

Example 2 with AttrType

use of org.eclipse.wst.xml.xpath2.processor.internal.types.AttrType in project webtools.sourceediting by eclipse.

the class AttributeTest method createAttrType.

private AnyType createAttrType(Item at, StaticContext sc) {
    anyType = new AttrType();
    NodeType nodeType = (NodeType) at;
    Node node = nodeType.node_value();
    if (node == null) {
        return anyType;
    }
    String nodeName = node.getLocalName();
    if (wild()) {
        if (type() != null) {
            anyType = createAttrForXSDType(node, sc);
        }
    } else if (nodeName.equals(name().local())) {
        if (type() != null) {
            anyType = createAttrForXSDType(node, sc);
        } else {
            anyType = new AttrType((Attr) node, sc.getTypeModel());
        }
    }
    return anyType;
}
Also used : AttrType(org.eclipse.wst.xml.xpath2.processor.internal.types.AttrType) NodeType(org.eclipse.wst.xml.xpath2.processor.internal.types.NodeType) Node(org.w3c.dom.Node)

Example 3 with AttrType

use of org.eclipse.wst.xml.xpath2.processor.internal.types.AttrType in project webtools.sourceediting by eclipse.

the class FnIDREF method processAttributes.

private static ResultBuffer processAttributes(Node node, List idrefs, ResultBuffer rs, EvaluationContext ec) {
    if (!node.hasAttributes()) {
        return rs;
    }
    NamedNodeMap attributeList = node.getAttributes();
    for (int atsub = 0; atsub < attributeList.getLength(); atsub++) {
        Attr atNode = (Attr) attributeList.item(atsub);
        NodeType atType = new AttrType(atNode, ec.getStaticContext().getTypeModel());
        if (atType.isID()) {
            if (hasID(idrefs, atNode)) {
                if (!isDuplicate(node, rs)) {
                    ElementType element = new ElementType((Element) node, ec.getStaticContext().getTypeModel());
                    rs.add(element);
                }
            }
        }
    }
    return rs;
}
Also used : ElementType(org.eclipse.wst.xml.xpath2.processor.internal.types.ElementType) NamedNodeMap(org.w3c.dom.NamedNodeMap) AttrType(org.eclipse.wst.xml.xpath2.processor.internal.types.AttrType) NodeType(org.eclipse.wst.xml.xpath2.processor.internal.types.NodeType) Attr(org.w3c.dom.Attr)

Example 4 with AttrType

use of org.eclipse.wst.xml.xpath2.processor.internal.types.AttrType in project webtools.sourceediting by eclipse.

the class FnID method processAttributes.

private static void processAttributes(Node node, List idrefs, ResultBuffer rs, EvaluationContext context) {
    if (!node.hasAttributes()) {
        return;
    }
    NamedNodeMap attributeList = node.getAttributes();
    for (int atsub = 0; atsub < attributeList.getLength(); atsub++) {
        Attr atNode = (Attr) attributeList.item(atsub);
        NodeType atType = new AttrType(atNode, context.getStaticContext().getTypeModel());
        if (atType.isID()) {
            if (hasIDREF(idrefs, atNode)) {
                if (!isDuplicate(node, rs)) {
                    ElementType element = new ElementType((Element) node, context.getStaticContext().getTypeModel());
                    rs.add(element);
                }
            }
        }
    }
}
Also used : ElementType(org.eclipse.wst.xml.xpath2.processor.internal.types.ElementType) NamedNodeMap(org.w3c.dom.NamedNodeMap) AttrType(org.eclipse.wst.xml.xpath2.processor.internal.types.AttrType) NodeType(org.eclipse.wst.xml.xpath2.processor.internal.types.NodeType) Attr(org.w3c.dom.Attr)

Aggregations

AttrType (org.eclipse.wst.xml.xpath2.processor.internal.types.AttrType)4 NodeType (org.eclipse.wst.xml.xpath2.processor.internal.types.NodeType)3 Attr (org.w3c.dom.Attr)3 ElementType (org.eclipse.wst.xml.xpath2.processor.internal.types.ElementType)2 NamedNodeMap (org.w3c.dom.NamedNodeMap)2 TypeDefinition (org.eclipse.wst.xml.xpath2.api.typesystem.TypeDefinition)1 TypeModel (org.eclipse.wst.xml.xpath2.api.typesystem.TypeModel)1 Node (org.w3c.dom.Node)1