Package nu.xom

Examples of nu.xom.DocType


    public void testCantUseDocTypeAsXPathContextNode() {
    
        Element root = new Element("root");
        Document doc = new Document(root);
        DocType doctype = new DocType("root");
        doc.setDocType(doctype);
       
        try {
            doctype.query("/");
            fail("Allowed DocType as context node");
        }
        catch (XPathException success) {
            assertNotNull(success.getMessage());
        }
View Full Code Here


        try {
            // Separate out the basic I/O by parsing document,
            // and then serializing into a byte array. This caches
            // the document and removes any dependence on the DTD.
            Document doc = parser.build(args[0]);
            DocType type = doc.getDocType();
            if (type != null) {
                doc.removeChild(type);  
            }
            ByteArrayOutputStream out = new ByteArrayOutputStream();
            Serializer serializer = new Serializer(out);
View Full Code Here

        return new ProcessingInstruction(pi.getTarget(), pi.getValue());
    }

   
    private Node copy(DocType doctype) {
        return new DocType(
          doctype.getRootElementName(),
          doctype.getPublicID(),
          doctype.getSystemID());
    }
View Full Code Here

        return new ProcessingInstruction(pi.getTarget(), pi.getValue());
    }

   
    private Node copy(DocType doctype) {
        return new DocType(
          doctype.getRootElementName(),
          doctype.getPublicID(),
          doctype.getSystemID());
    }
View Full Code Here

        try {   
            // Separate out the basic I/O by parsing document,
            // and then serializing into a byte array.
            // This caches the and removes any dependence on the DTD.
            Document doc = parser.build(args[0]);
            DocType type = doc.getDocType();
            if (type != null) {
                doc.removeChild(type);  
            }
            ByteArrayOutputStream out = new ByteArrayOutputStream();
            Serializer serializer = new Serializer(out);
View Full Code Here

      }
     
      // If we get this far, then the document is valid XML.
      // Check to see whether the document is actually XHTML
      boolean valid = true;      
      DocType doctype = document.getDocType();
   
      if (doctype == null) {
        System.out.println("No DOCTYPE");
        valid = false;
      }
      else {
        // verify the DOCTYPE
        String name     = doctype.getRootElementName();
        String publicID = doctype.getPublicID();
     
        if (!name.equals("html")) {
          System.out.println(
           "Incorrect root element name " + name);
          valid = false;
View Full Code Here

  public static void main(String[] args) {
    
    try {
      // Create the document
      DocType svgDOCTYPE = new DocType(
       "svg", "-//W3C//DTD SVG 1.0//EN",
       "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd"
      );
      
      // Fill the document
View Full Code Here

        return new Nodes(result);
    }

    public Nodes makeDocType(String rootElementName,
      String publicID, String systemID) {
        return new Nodes(new DocType("html",
          "PUBLIC \"-//W3C//DTD XHTML Basic 1.0//EN\"",
          "http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd"));   
    }
View Full Code Here

        return new Nodes(element);     
    }

    public Nodes makeDocType(String rootElementName,
      String publicID, String systemID) {
        return new Nodes(new DocType("html",
          "PUBLIC \"-//W3C//DTD XHTML Basic 1.0//EN\"",
          "http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd"));   
    }
View Full Code Here

        Element parent = new Element("parent");
        Text child = new Text("child");
        parent.appendChild(child);
       
        try {
            parent.replaceChild(child, new DocType("root"));
            fail("allowed doctype child of element");
        }
        catch (IllegalAddException success) {
            assertEquals(parent, child.getParent());
            assertEquals(1, parent.getChildCount());
View Full Code Here

TOP

Related Classes of nu.xom.DocType

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.