Example usage for org.w3c.dom Entity getNodeName

List of usage examples for org.w3c.dom Entity getNodeName

Introduction

In this page you can find the example usage for org.w3c.dom Entity getNodeName.

Prototype

public String getNodeName();

Source Link

Document

The name of this node, depending on its type; see the table above.

Usage

From source file:Main.java

public static void main(String[] argv) throws Exception {
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    Document doc = factory.newDocumentBuilder().parse(new InputSource(new StringReader(getXMLData())));

    Map entityValues = new HashMap();
    getEntityValues(doc, entityValues);// www. java2 s.  com

    NamedNodeMap entities = doc.getDoctype().getEntities();
    for (int i = 0; i < entities.getLength(); i++) {
        Entity entity = (Entity) entities.item(i);
        System.out.println(entity);
        String entityName = entity.getNodeName();
        System.out.println(entityName);
        String entityPublicId = entity.getPublicId();
        System.out.println(entityPublicId);
        String entitySystemId = entity.getSystemId();
        System.out.println(entitySystemId);
        Node entityValue = (Node) entityValues.get(entityName);
        System.out.println(entityValue);
    }
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    factory.setValidating(true);//from   w w w .  ja v  a  2  s.c  o  m
    factory.setExpandEntityReferences(false);

    Document doc = factory.newDocumentBuilder().parse(new File("filename"));

    Map entityValues = new HashMap();
    getEntityValues(doc, entityValues);

    NamedNodeMap entities = doc.getDoctype().getEntities();
    for (int i = 0; i < entities.getLength(); i++) {
        Entity entity = (Entity) entities.item(i);
        System.out.println(entity);
        String entityName = entity.getNodeName();
        System.out.println(entityName);
        String entityPublicId = entity.getPublicId();
        System.out.println(entityPublicId);
        String entitySystemId = entity.getSystemId();
        System.out.println(entitySystemId);
        Node entityValue = (Node) entityValues.get(entityName);
        System.out.println(entityValue);
    }
}

From source file:TreeDumper2.java

private void dumpEntityNode(Entity node, String indent) {
    System.out.println(indent + "ENTITY: " + node.getNodeName());
}