Example usage for org.w3c.dom Notation getSystemId

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

Introduction

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

Prototype

public String getSystemId();

Source Link

Document

The system 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);/*ww  w  . j  a v  a 2  s  . com*/

    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 ava2 s  .  com*/
}

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 av  a  2s .c om*/
        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 ww . j a  v  a  2s  .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");
}