Example usage for org.w3c.dom Notation getNodeName

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

Introduction

In this page you can find the example usage for org.w3c.dom Notation 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();
    factory.setValidating(true);//from ww  w  . ja v a 2 s.  c o  m

    factory.setExpandEntityReferences(false);

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

    NamedNodeMap notations = doc.getDoctype().getNotations();
    for (int i = 0; i < notations.getLength(); i++) {
        Notation notation = (Notation) notations.item(i);

        String notationName = notation.getNodeName();
        String notationPublicId = notation.getPublicId();
        String notationSystemId = notation.getSystemId();
    }
}

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())));

    NamedNodeMap notations = doc.getDoctype().getNotations();

    for (int i = 0; i < notations.getLength(); i++) {
        Notation notation = (Notation) notations.item(i);

        String notationName = notation.getNodeName();
        System.out.println(notationName);
        String notationPublicId = notation.getPublicId();
        String notationSystemId = notation.getSystemId();
    }//  ww  w.j a  va 2 s  .  co m
}

From source file:TreeDumper2.java

private void dumpNotationNode(Notation node, String indent) {
    System.out.println(indent + "NOTATION");
    System.out.print(indent + "  " + node.getNodeName() + "=");
    if (node.getPublicId() != null)
        System.out.println(node.getPublicId());
    else//from   w w  w .  j  a  v  a2 s.com
        System.out.println(node.getSystemId());
}

From source file:fr.gouv.finances.dgfip.xemelios.utils.TextWriter.java

private void notation(Writer writer, Notation notation) throws IOException {
    if (prettyPrint) {
        checkTextBuffer(writer);//from   ww w  . j  a va2s  . c o m
        indent(writer);
    }

    writer.write("<!NOTATION ");
    writer.write(notation.getNodeName());
    String pubID = notation.getPublicId();
    String sysID = notation.getSystemId();
    if (pubID != null) {
        writer.write(" PUBLIC ");
        writer.write(pubID);
        if (sysID != null) {
            writer.write(' ');
            writer.write(sysID);
        }
    } else if (sysID != null) {
        writer.write(" SYSTEM ");
        writer.write(sysID);
    }
    writer.write(">\n");
}