Example usage for org.w3c.dom Notation getPublicId

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

Introduction

In this page you can find the example usage for org.w3c.dom Notation getPublicId.

Prototype

public String getPublicId();

Source Link

Document

The public identifier of this notation.

Usage

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  va2s. c  om

    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();
    }/* w w  w .j  av  a 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/*  ww  w  .ja  va2  s . co m*/
        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 w  w w.  j av  a 2  s . c  om
        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");
}