Examples of createProcessingInstruction()


Examples of org.w3c.dom.Document.createProcessingInstruction()

            case XMLStreamConstants.PROCESSING_INSTRUCTION:
                parent.appendChild(doc.createProcessingInstruction(reader.getPITarget(), reader.getPIData()));

                break;
            case XMLStreamConstants.ENTITY_REFERENCE:
                parent.appendChild(doc.createProcessingInstruction(reader.getPITarget(), reader.getPIData()));

                break;
            default:
                break;
            }
View Full Code Here

Examples of org.w3c.dom.Document.createProcessingInstruction()

                case Node.ENTITY_REFERENCE_NODE: {
                    node = factory.createEntityReference(place.getNodeName());
                    break;
                }
                case Node.PROCESSING_INSTRUCTION_NODE: {
                    node = factory.createProcessingInstruction(place.getNodeName(),
                                                               place.getNodeValue());
                    break;
                }
                case Node.TEXT_NODE: {
                    node = factory.createTextNode(place.getNodeValue());
View Full Code Here

Examples of org.w3c.dom.Document.createProcessingInstruction()

        root.appendChild(createResultsElement((ResultSet) queryResult,
            doc));
      }
      DOMSource source = new DOMSource(doc);
      if (applyStyle) {
        ProcessingInstruction instruction = doc
            .createProcessingInstruction("xml-stylesheet",
                "type=\"text/xsl\" href=\"" + styleSheetUri + "\"");
        doc.insertBefore(instruction, root);
        if (applyServerSide) {
          return applyStyleServerSide(source, styleSheetUri);
View Full Code Here

Examples of org.w3c.dom.Document.createProcessingInstruction()

    assertEquals("<svg:span><svg:br /></svg:span>", rendered);
  }

  public final void testProcessingInstructions() {
    Document doc = DomParser.makeDocument(null, null);
    ProcessingInstruction pi = doc.createProcessingInstruction("foo", "bar");
    assertEquals("<?foo bar?>", Nodes.render(pi, MarkupRenderMode.XML));
  }

  public final void testDocumentType() throws ParseException {
    String[] docTypes = {
View Full Code Here

Examples of org.w3c.dom.Document.createProcessingInstruction()

           { "xml", "foo" }, { "XmL", "foo" },
           { "foo?><script>alert(1)</script>", "<?bar baz" },
           { "ok", "foo?><script>alert(1)</script><?foo bar" },
         }) {
      try {
        ProcessingInstruction pi = doc.createProcessingInstruction(
            badPi[0], badPi[1]);
        Nodes.render(pi, MarkupRenderMode.XML);
      } catch (UncheckedUnrenderableException ex) {
        continue// OK
      } catch (DOMException ex) {
View Full Code Here

Examples of org.w3c.dom.Document.createProcessingInstruction()

    }
  }

  public final void testProcessingInstructionInHtml() {
    Document doc = DomParser.makeDocument(null, null);
    ProcessingInstruction pi = doc.createProcessingInstruction(
        "foo", "<script>alert(1)</script>");
    Element el = doc.createElementNS(Namespaces.HTML_NAMESPACE_URI, "div");
    el.appendChild(pi);
    assertEquals(
        "<div><?foo <script>alert(1)</script>?></div>",
View Full Code Here

Examples of org.w3c.dom.Document.createProcessingInstruction()

        DOMTestUtil.execute(new DOMTestUtil.Test() {
            public void execute(DocumentBuilderFactory dbf) throws Exception {
                Document doc = dbf.newDocumentBuilder().newDocument();
               
                doc.appendChild(doc.createComment("some comment"));
                doc.appendChild(doc.createProcessingInstruction("pi", "data"));
               
                // Document Object Model (DOM) Level 3 Core Specification, section 1.1.1
                // says that text nodes are not allowed as children of a document.
                try {
                    doc.appendChild(doc.createTextNode("    "));
View Full Code Here

Examples of org.w3c.dom.Document.createProcessingInstruction()

                } catch (DOMException ex) {
                    assertEquals(DOMException.HIERARCHY_REQUEST_ERR, ex.code);
                }
               
                // PIs and comments after the document element are allowed
                doc.appendChild(doc.createProcessingInstruction("pi", "data"));
                doc.appendChild(doc.createComment("some comment"));
               
                // Again, text nodes are not allowed
                try {
                    doc.appendChild(doc.createTextNode("    "));
View Full Code Here

Examples of org.w3c.dom.Document.createProcessingInstruction()

   */
  protected static Document prepareSaving(XMPMetadata metadata,
      boolean intoXPacket) {
    Document newdoc = (Document) metadata.getFuturOwner().cloneNode(true);
    if (intoXPacket) {
      ProcessingInstruction beginXPacket = newdoc
          .createProcessingInstruction("xpacket", "begin=\""
              + metadata.getXpacketBegin() + "\" id=\""
              + metadata.getXpacketId() + "\"");
      newdoc.appendChild(beginXPacket);
    }
View Full Code Here

Examples of org.w3c.dom.Document.createProcessingInstruction()

    Element elem = (Element) metadata.getContainerElement().cloneNode(true);
    newdoc.adoptNode(elem);
    xmpMeta.appendChild(elem);

    if (intoXPacket) {
      ProcessingInstruction endXPacket = newdoc
          .createProcessingInstruction("xpacket", metadata
              .getEndXPacket());
      newdoc.appendChild(endXPacket);
    }
    return newdoc;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.