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

The following examples show how to use xmlkit.XMLKit.Element#sort() . 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
@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
@Override
public Element visitModuleHashes(ModuleHashes_attribute attr, Element p) {
    Element e = new Element(x.getCpString(attr.attribute_name_index));
    e.setAttr("Algorithm", x.getCpString(attr.algorithm_index));
    for (Entry entry : attr.hashes_table) {
        Element ee = new Element("Entry");
        String mn = x.getCpString(entry.module_name_index);
        ee.setAttr("module_name", mn);
        ee.setAttr("hash_length", "" + entry.hash.length);
        StringBuilder sb = new StringBuilder();
        for (byte b: entry.hash) {
            sb.append(String.format("%02x", b & 0xff));
        }
        ee.setAttr("hash", sb.toString());
        ee.trimToSize();
        e.add(ee);
    }
    e.trimToSize();
    e.sort();
    p.add(e);
    return null;
}
 
Example 3
@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 4
@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
@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 6
protected  void readAttributesFor(ClassFile c, Attributes attrs, Element x) {
    Element container = new Element();
    AttributeVisitor av = new AttributeVisitor(this, c);
    for (Attribute a : attrs) {
        av.visit(a, container);
    }
    if (!keepOrder) {
        container.sort();
    }
    x.addAll(container);
}
 
Example 7
@Override
public Element visitRuntimeInvisibleTypeAnnotations(RuntimeInvisibleTypeAnnotations_attribute rita, Element p) {
    Element e = new Element(x.getCpString(rita.attribute_name_index));
    for (TypeAnnotation pa : rita.annotations) {
        parseTypeAnnotations(pa, e);
    }
    e.sort();
    p.add(e);
    return null;
}
 
Example 8
protected  void readAttributesFor(ClassFile c, Attributes attrs, Element x) {
    Element container = new Element();
    AttributeVisitor av = new AttributeVisitor(this, c);
    for (Attribute a : attrs) {
        av.visit(a, container);
    }
    if (!keepOrder) {
        container.sort();
    }
    x.addAll(container);
}
 
Example 9
protected  void readAttributesFor(ClassFile c, Attributes attrs, Element x) {
    Element container = new Element();
    AttributeVisitor av = new AttributeVisitor(this, c);
    for (Attribute a : attrs) {
        av.visit(a, container);
    }
    if (!keepOrder) {
        container.sort();
    }
    x.addAll(container);
}
 
Example 10
@Override
public Element visitRuntimeInvisibleTypeAnnotations(RuntimeInvisibleTypeAnnotations_attribute rita, Element p) {
    Element e = new Element(x.getCpString(rita.attribute_name_index));
    for (TypeAnnotation pa : rita.annotations) {
        parseTypeAnnotations(pa, e);
    }
    e.sort();
    p.add(e);
    return null;
}
 
Example 11
protected  void readAttributesFor(ClassFile c, Attributes attrs, Element x) {
    Element container = new Element();
    AttributeVisitor av = new AttributeVisitor(this, c);
    for (Attribute a : attrs) {
        av.visit(a, container);
    }
    if (!keepOrder) {
        container.sort();
    }
    x.addAll(container);
}
 
Example 12
@Override
public Element visitRuntimeInvisibleTypeAnnotations(RuntimeInvisibleTypeAnnotations_attribute rita, Element p) {
    Element e = new Element(x.getCpString(rita.attribute_name_index));
    for (TypeAnnotation pa : rita.annotations) {
        parseTypeAnnotations(pa, e);
    }
    e.sort();
    p.add(e);
    return null;
}
 
Example 13
@Override
public Element visitRuntimeInvisibleTypeAnnotations(RuntimeInvisibleTypeAnnotations_attribute rita, Element p) {
    Element e = new Element(x.getCpString(rita.attribute_name_index));
    for (TypeAnnotation pa : rita.annotations) {
        parseTypeAnnotations(pa, e);
    }
    e.sort();
    p.add(e);
    return null;
}
 
Example 14
@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 15
@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 16
@Override
public Element visitModulePackages(ModulePackages_attribute attr, Element p) {
    Element e = new Element(x.getCpString(attr.attribute_name_index));
    for (int i : attr.packages_index) {
        Element ee = new Element("Package");
        String pkg = x.getCpString(i);
        ee.setAttr("package", pkg);
        e.add(ee);
    }
    e.trimToSize();
    e.sort();
    p.add(e);
    return null;
}
 
Example 17
@Override
public Element visitRuntimeInvisibleTypeAnnotations(RuntimeInvisibleTypeAnnotations_attribute rita, Element p) {
    Element e = new Element(x.getCpString(rita.attribute_name_index));
    for (TypeAnnotation pa : rita.annotations) {
        parseTypeAnnotations(pa, e);
    }
    e.sort();
    p.add(e);
    return null;
}
 
Example 18
protected  void readAttributesFor(ClassFile c, Attributes attrs, Element x) {
    Element container = new Element();
    AttributeVisitor av = new AttributeVisitor(this, c);
    for (Attribute a : attrs) {
        av.visit(a, container);
    }
    if (!keepOrder) {
        container.sort();
    }
    x.addAll(container);
}
 
Example 19
@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 20
@Override
public Element visitRuntimeInvisibleTypeAnnotations(RuntimeInvisibleTypeAnnotations_attribute rita, Element p) {
    Element e = new Element(x.getCpString(rita.attribute_name_index));
    for (TypeAnnotation pa : rita.annotations) {
        parseTypeAnnotations(pa, e);
    }
    e.sort();
    p.add(e);
    return null;
}