Package org.w3c.dom

Examples of org.w3c.dom.Notation


        case Node.DOCUMENT_NODE : {
            DocumentType      docType;
            DOMImplementation domImpl;
            NamedNodeMap      map;
            Entity            entity;
            Notation          notation;
            int               i;
           
            // If there is a document type, use the SAX events to
            // serialize it.
            docType = ( (Document) node ).getDoctype();
View Full Code Here


                // No name, kids carry value
                break;
            }

            case NOTATION_NODE: {
                Notation srcnotation = (Notation)source;
                NotationImpl newnotation =
                    (NotationImpl)createNotation(source.getNodeName());
                newnotation.setPublicId(srcnotation.getPublicId());
                newnotation.setSystemId(srcnotation.getSystemId());
                // Kids carry additional value
                newnode = newnotation;
                // No name, no value
                break;
            }
View Full Code Here

        DocumentFragment frag = doc.createDocumentFragment ();
        Text  text = doc.createTextNode("Doc02TextNode");
        Comment comment = doc.createComment("Doc02Comment");
        CDATASection  cdataSec = doc.createCDATASection("Doc02CDataSection");
        DocumentType  docType = doc.getImplementation().createDocumentType("Doc02DocumentType", null, null);
        Notation notation = ((DocumentImpl) doc).createNotation("Doc02Notation");
        ProcessingInstruction pi = doc.createProcessingInstruction("Doc02PITarget",
                                    "Doc02PIData");
        NodeList    nodeList = doc.getElementsByTagName("*");
    }


   
    {
        Document doc = new DocumentImpl();
        Element     el = doc.createElement("Doc02Element");
    }
   

   
    {
        Document    doc = new DocumentImpl();
        DocumentFragment frag = doc.createDocumentFragment ();
    };
   


   
    {
        Document doc = new DocumentImpl();
        Element     el = doc.createElement("Doc02Element");
    }
   

   
    {
        Document doc = new DocumentImpl();
        Text  text = doc.createTextNode("Doc02TextNode");
    }
   

   
    {
        Document doc = new DocumentImpl();
        Comment comment = doc.createComment("Doc02Comment");
    }
   

   
    {
        Document doc = new DocumentImpl();
        CDATASection  cdataSec = doc.createCDATASection("Doc02CDataSection");
    }
   


   
    {
        Document doc = new DocumentImpl();
        DocumentType  docType = doc.getImplementation().createDocumentType("Doc02DocumentType", null, null);
    }
   


   
    {
        Document doc = new DocumentImpl();
        Notation notation = ((DocumentImpl)doc).createNotation("Doc02Notation");
    }
   


   
View Full Code Here

 
  EntityReference docReferenceEntity = doc.createEntityReference("ourEntityNode");
  docBodyLevel24.appendChild(docReferenceEntity);

  DTest make = new DTest();
  Notation docNotation = make.createNotation(doc, "ourNotationNode");
//  NotationImpl docNotation = new NotationImpl((DocumentImpl) doc, "ourNotationNode");//*****?
  DocumentType docType = (DocumentType)doc.getFirstChild();
  docType.getNotations().setNamedItem(docNotation);
 
  DocumentFragment docDocFragment = doc.createDocumentFragment();
 
//  System.out.println("This document's first element name is " + docFirstElement.getTagName() + "\n");


//***********Following are for errorTests
  Text docNode3 = doc.createTextNode(name + "docTextNode3");
  Text docNode4 = doc.createTextNode(name + "docTextNode4");
 
  Entity docEntity = (Entity) doc.getDoctype().getEntities().getNamedItem("ourEntityNode"); // Get the Entity node
  DocumentType docDocType = (DocumentType) doc.getFirstChild()// Get the DocumentType node
  EntityReference entityReferenceText = (EntityReference) doc.getLastChild().getLastChild().getLastChild().getFirstChild();
  Text entityReferenceText2 = doc.createTextNode("entityReferenceText information");
//************************************************* ERROR TESTS
  DTest tests = new DTest();

  OK &= Assertion.verify(DTest.DOMExceptionsTest(document, "appendChild", new Class[]{Node.class}, new Object[]{docBody}, DOMException.HIERARCHY_REQUEST_ERR ));
  OK &= Assertion.verify(DTest.DOMExceptionsTest(docNode3, "appendChild", new Class[]{Node.class}, new Object[]{docNode4}, DOMException.HIERARCHY_REQUEST_ERR ));
  OK &= Assertion.verify(DTest.DOMExceptionsTest(doc, "insertBefore", new Class[]{Node.class, Node.class}, new Object[]{docEntity, docFirstElement}, DOMException.HIERARCHY_REQUEST_ERR ));
  OK &= Assertion.verify(DTest.DOMExceptionsTest(doc, "replaceChild", new Class[]{Node.class, Node.class}, new Object[]{docCDATASection, docFirstElement}, DOMException.HIERARCHY_REQUEST_ERR ));

        docFirstElement.setNodeValue("This shouldn't do anything!");
  OK &= Assertion.verify(docFirstElement.getNodeValue() == null);
        docReferenceEntity.setNodeValue("This shouldn't do anything!");
  OK &= Assertion.verify(docReferenceEntity.getNodeValue() == null);
        docEntity.setNodeValue("This shouldn't do anything!");
  OK &= Assertion.verify(docEntity.getNodeValue() == null);
        doc.setNodeValue("This shouldn't do anything!");
  OK &= Assertion.verify(doc.getNodeValue() == null);
        docType.setNodeValue("This shouldn't do anything!");
  OK &= Assertion.verify(docType.getNodeValue() == null);
        docDocFragment.setNodeValue("This shouldn't do anything!");
  OK &= Assertion.verify(docDocFragment.getNodeValue() == null);
        docNotation.setNodeValue("This shouldn't do anything!");
  OK &= Assertion.verify(docNotation.getNodeValue() == null);

  OK &= Assertion.verify(DTest.DOMExceptionsTest(docReferenceEntity, "appendChild", new Class[]{Node.class}, new Object[]{entityReferenceText2 }, DOMException.NO_MODIFICATION_ALLOWED_ERR ));
  OK &= Assertion.verify(DTest.DOMExceptionsTest(docBodyLevel32, "insertBefore", new Class[]{Node.class, Node.class}, new Object[]{docTextNode11,docBody }, DOMException.NOT_FOUND_ERR ));
  OK &= Assertion.verify(DTest.DOMExceptionsTest(docBodyLevel32, "removeChild", new Class[]{Node.class}, new Object[]{docFirstElement}, DOMException.NOT_FOUND_ERR ));
  OK &= Assertion.verify(DTest.DOMExceptionsTest(docBodyLevel32, "replaceChild", new Class[]{Node.class, Node.class}, new Object[]{docTextNode11,docFirstElement }, DOMException.NOT_FOUND_ERR ));
View Full Code Here

* @author Philip W. Davis
*/
public void testNotation(org.w3c.dom.Document document)
{
  Node node, node2;
  Notation notation;
  boolean OK = true;
  String compare;
// For debugging*****  println("\n          testNotation's outputs:\n");
  notation = (Notation) document.getDoctype().getNotations().getNamedItem("ourNotationNode");
  node = notation;
  node2 = notation.cloneNode(true);//*****?
  // Check nodes for equality, both their name and value or lack thereof
  if (!(node.getNodeName().equals(node2.getNodeName()) &&       // Compares node names for equality
       (node.getNodeValue() != null && node2.getNodeValue() != null// Checks to make sure each node has a value node
      ? node.getNodeValue().equals(node2.getNodeValue())         // If both have value nodes test those value nodes for equality
      :(node.getNodeValue() == null && node2.getNodeValue() == null)))// If one node doesn't have a value node make sure both don't
 
    System.out.println("'cloneNode' did not clone the Notation node correctly");
    OK = false;
  }
  // Deep clone test comparison is in testNode & testDocument

   ((org.apache.xerces.dom.NotationImpl) notation).setPublicId("testPublicId");//*****?
  compare = "testPublicId";
  if (!compare.equals(notation.getPublicId()))
  {
    System.out.println("Warning!!! Notation's 'getPublicId' failed!");
    OK = false;
  }
   ((org.apache.xerces.dom.NotationImpl) notation).setSystemId("testSystemId");//*****?
  compare = "testSystemId";
  if (! compare.equals(notation.getSystemId()))
  {
    System.out.println("Warning!!! Notation's 'getSystemId' failed!");
    OK = false;
  }
  //  notation.setNodeValue("This shouldn't work");//!! Throws a NO_MODIFICATION_ALLOWED_ERR ********
 
View Full Code Here

        case Node.DOCUMENT_NODE : {
            DocumentType      docType;
            DOMImplementation domImpl;
            NamedNodeMap      map;
            Entity            entity;
            Notation          notation;
            int               i;
           
            // If there is a document type, use the SAX events to
            // serialize it.
            docType = ( (Document) node ).getDoctype();
View Full Code Here

                // No name, kids carry value
                break;
            }

            case NOTATION_NODE: {
                Notation srcnotation = (Notation)source;
                NotationImpl newnotation =
                (NotationImpl)createNotation(source.getNodeName());
                newnotation.setPublicId(srcnotation.getPublicId());
                newnotation.setSystemId(srcnotation.getSystemId());
                // Kids carry additional value
                newnode = newnotation;
                // No name, no value
                break;
            }
View Full Code Here

            /** Copy notations. */
            oldMap = node.getNotations();
            newMap = docType.getNotations();
            length = oldMap.getLength();
            for (int i = 0; i < length; ++i) {
                Notation oldNotation = (Notation) oldMap.item(i);
                NotationImpl newNotation = (NotationImpl) fDocumentImpl.createNotation(oldNotation.getNodeName());
                newNotation.setPublicId(oldNotation.getPublicId());
                newNotation.setSystemId(oldNotation.getSystemId());
                newMap.setNamedItem(newNotation);
            }
            append(docType);
        }
    }
View Full Code Here

                                          src.getNodeValue());
        break;
      case NOTATION_NODE:
        // NOTE:  There's no standard way to create
        // these, or add them to a doctype.  Useless.
        Notation notation = (Notation) src;
        dst = new DomNotation(this, notation.getNodeName(),
                              notation.getPublicId(),
                              notation.getSystemId());
        break;
      case ENTITY_NODE:
        // NOTE:  There's no standard way to create
        // these, or add them to a doctype.  Useless.
        Entity entity = (Entity) src;
View Full Code Here

        case Node.DOCUMENT_NODE : {
            DocumentType      docType;
            DOMImplementation domImpl;
            NamedNodeMap      map;
            Entity            entity;
            Notation          notation;
            int               i;

            // If there is a document type, use the SAX events to
            // serialize it.
            docType = ( (Document) node ).getDoctype();
View Full Code Here

TOP

Related Classes of org.w3c.dom.Notation

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.