Java Code Examples for xmlkit.XMLKit.Element#add()

The following examples show how to use xmlkit.XMLKit.Element#add() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ClassReader.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public Element visitBootstrapMethods(BootstrapMethods_attribute bm, Element p) {
    Element e = new Element(x.getCpString(bm.attribute_name_index));
    for (BootstrapMethods_attribute.BootstrapMethodSpecifier bsm : bm.bootstrap_method_specifiers) {
        Element be = new Element("BootstrapMethodSpecifier");
        be.setAttr("ref", x.getCpString(bsm.bootstrap_method_ref));
        if (bsm.bootstrap_arguments.length > 0) {
            Element bme = new Element("MethodArguments");
            for (int index : bsm.bootstrap_arguments) {
                bme.add(x.getCpString(index));
            }
            bme.trimToSize();
            be.add(bme);
        }
        be.trimToSize();
        e.add(be);
    }
    e.trimToSize();
    if (!x.keepOrder) {
        e.sort();
    }
    p.add(e);
    return null;
}
 
Example 2
Source File: ClassReader.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
public Element visitLocalVariableTypeTable(LocalVariableTypeTable_attribute lvtt,
                                                Element p) {
    String name = x.getCpString(lvtt.attribute_name_index);
    for (LocalVariableTypeTable_attribute.Entry e : lvtt.local_variable_table) {
        Element l = new Element(name);
        l.setAttr("bci", "" + e.start_pc);
        l.setAttr("span", "" + e.length);
        l.setAttr("name", x.getCpString(e.name_index));
        l.setAttr("type", x.getCpString(e.signature_index));
        l.setAttr("slot", "" + e.index);
        l.trimToSize();
        p.add(l);
    }
    return null; // already added to parent
}
 
Example 3
Source File: ClassReader.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
private void parseAnnotation(Annotation anno, Element p) {
    Element ea = new Element("Annotation");
    ea.setAttr("name", "" + x.getCpString(anno.type_index));
    for (Annotation.element_value_pair evp : anno.element_value_pairs) {
        Element evpe = new Element("Element");
        evpe.setAttr("tag", "" + evp.value.tag);
        evpe.setAttr("value", x.getCpString(evp.element_name_index));
        Element child = aev.visit(evp.value, evpe);
        if (child != null) {
            evpe.add(child);
        }
        ea.add(evpe);
    }
    ea.trimToSize();
    p.add(ea);
}
 
Example 4
Source File: ClassReader.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
public Element visitBootstrapMethods(BootstrapMethods_attribute bm, Element p) {
    Element e = new Element(x.getCpString(bm.attribute_name_index));
    for (BootstrapMethods_attribute.BootstrapMethodSpecifier bsm : bm.bootstrap_method_specifiers) {
        Element be = new Element("BootstrapMethodSpecifier");
        be.setAttr("ref", x.getCpString(bsm.bootstrap_method_ref));
        if (bsm.bootstrap_arguments.length > 0) {
            Element bme = new Element("MethodArguments");
            for (int index : bsm.bootstrap_arguments) {
                bme.add(x.getCpString(index));
            }
            bme.trimToSize();
            be.add(bme);
        }
        be.trimToSize();
        e.add(be);
    }
    e.trimToSize();
    if (!x.keepOrder) {
        e.sort();
    }
    p.add(e);
    return null;
}
 
Example 5
Source File: ClassReader.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Element visitRuntimeInvisibleAnnotations(RuntimeInvisibleAnnotations_attribute ria,
                                                Element p) {
    Element e = new Element(x.getCpString(ria.attribute_name_index));
    parseAnnotations(ria.annotations, e);
    e.trimToSize();
    p.add(e);
    return null;
}
 
Example 6
Source File: ClassReader.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Element visitSourceID(SourceID_attribute sid, Element p) {
    Element e = new Element(x.getCpString(sid.attribute_name_index));
    e.add(x.getCpString(sid.sourceID_index));
    e.trimToSize();
    p.add(e);
    return null;
}
 
Example 7
Source File: ClassReader.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Element visitLineNumberTable(LineNumberTable_attribute lnt, Element p) {
    String name = x.getCpString(lnt.attribute_name_index);
    for (LineNumberTable_attribute.Entry e : lnt.line_number_table) {
        Element l = new Element(name);
        l.setAttr("bci", "" + e.start_pc);
        l.setAttr("line", "" + e.line_number);
        l.trimToSize();
        p.add(l);
    }
    return null; // already added to parent
}
 
Example 8
Source File: ClassReader.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Element visitRuntimeVisibleTypeAnnotations(RuntimeVisibleTypeAnnotations_attribute rvta, Element p) {
    Element e = new Element(x.getCpString(rvta.attribute_name_index));
    for (TypeAnnotation pa : rvta.annotations) {
        parseTypeAnnotations(pa, e);
    }
    e.sort();
    p.add(e);
    return null;
}
 
Example 9
Source File: ClassReader.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Element visitArray(Array_element_value a, Element p) {
 Element el = new Element("Array");
    for (Annotation.element_value v : a.values) {
       Element child = visit(v, el);
       if (child != null) {
           el.add(child);
       }
    }
    el.trimToSize();
    return el;
}
 
Example 10
Source File: ClassReader.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Element visitAnnotation(Annotation_element_value a, Element p) {
    Element el = new Element("Annotation");
    Annotation anno = a.annotation_value;
    for (Annotation.element_value_pair evp : anno.element_value_pairs) {
        Element child = visit(evp.value, el);
        if (child != null) {
            el.add(child);
        }
    }
    el.trimToSize();
    return el;
}
 
Example 11
Source File: ClassReader.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Element visitAnnotationDefault(AnnotationDefault_attribute ad, Element p) {
    Element e = new Element(x.getCpString(ad.attribute_name_index));
    e.setAttr("tag", "" + ad.default_value.tag);
    Element child = aev.visit(ad.default_value, e);
    if (child != null) {
        e.add(child);
    }
    e.trimToSize();
    p.add(e);
    return null;
}
 
Example 12
Source File: ClassReader.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Element visitRuntimeInvisibleParameterAnnotations(RuntimeInvisibleParameterAnnotations_attribute ripa,
                                                         Element p) {
    Element e = new Element(x.getCpString(ripa.attribute_name_index));
    for (Annotation[] pa : ripa.parameter_annotations) {
        parseAnnotations(pa, e);
    }
    p.add(e);
    return null;
}
 
Example 13
Source File: ClassReader.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Element visitRuntimeInvisibleParameterAnnotations(RuntimeInvisibleParameterAnnotations_attribute ripa,
                                                         Element p) {
    Element e = new Element(x.getCpString(ripa.attribute_name_index));
    for (Annotation[] pa : ripa.parameter_annotations) {
        parseAnnotations(pa, e);
    }
    p.add(e);
    return null;
}
 
Example 14
Source File: ClassReader.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Element visitExceptions(Exceptions_attribute e, Element p) {
    Element ee = new Element(x.getCpString(e.attribute_name_index));
    for (int idx : e.exception_index_table) {
        Element n = new Element("Item");
        n.setAttr("class", x.getCpString(idx));
        ee.add(n);
    }
    ee.trimToSize();
    p.add(ee);
    return null;
}
 
Example 15
Source File: ClassReader.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Element visitSignature(Signature_attribute s, Element p) {
    String aname = x.getCpString(s.attribute_name_index);
    String sname = x.getCpString(s.signature_index);
    Element se = new Element(aname);
    se.add(sname);
    se.trimToSize();
    p.add(se);
    return null;
}
 
Example 16
Source File: ClassReader.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Element visitTableSwitch(Instruction i, int i1, int i2, int i3,
                                int[] ints, Void p) {
    Element ie = new Element(i.getMnemonic());
    int pc = i.getPC();
    ie.setAttr("lab", "" + (pc + i1));
    for (int k : ints) {
        Element c = new Element("Case");
        c.setAttr("num", "" + (k + i2));
        c.setAttr("lab", "" + (pc + k));
        c.trimToSize();
        ie.add(c);
    }
    return ie;
}
 
Example 17
Source File: ClassReader.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Element visitCharacterRangeTable(CharacterRangeTable_attribute crt,
                                        Element p) {
    Element e = new Element(x.getCpString(crt.attribute_name_index));
    for (CharacterRangeTable_attribute.Entry ce : crt.character_range_table) {
        e.setAttr("start_pc", "" + ce.start_pc);
        e.setAttr("end_pc", "" + ce.end_pc);
        e.setAttr("range_start", "" + ce.character_range_start);
        e.setAttr("range_end", "" + ce.character_range_end);
        e.setAttr("flags", x.flagString(ce.flags, "Method"));
    }
    e.trimToSize();
    p.add(e);
    return null;
}
 
Example 18
Source File: ClassReader.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Element visitLookupSwitch(Instruction i, int i1, int i2, int[] ints,
                                 int[] ints1, Void p) {
    Element ie = new Element(i.getMnemonic());
    int pc = i.getPC();
    ie.setAttr("lab", "" + (pc + i1));
    for (int k = 0 ; k < i2 ; k++) {
        Element c = new Element("Case");
        c.setAttr("num", "" + (ints[k]));
        c.setAttr("lab", "" + (pc + ints1[k]));
        c.trimToSize();
        ie.add(c);
    }
    return ie;
}
 
Example 19
Source File: ClassReader.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Element visitAnnotation(Annotation_element_value a, Element p) {
    Element el = new Element("Annotation");
    Annotation anno = a.annotation_value;
    for (Annotation.element_value_pair evp : anno.element_value_pairs) {
        Element child = visit(evp.value, el);
        if (child != null) {
            el.add(child);
        }
    }
    el.trimToSize();
    return el;
}
 
Example 20
Source File: ClassReader.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Element visitRuntimeVisibleTypeAnnotations(RuntimeVisibleTypeAnnotations_attribute rvta, Element p) {
    Element e = new Element(x.getCpString(rvta.attribute_name_index));
    for (TypeAnnotation pa : rvta.annotations) {
        parseTypeAnnotations(pa, e);
    }
    e.sort();
    p.add(e);
    return null;
}