Package org.w3c.dom

Examples of org.w3c.dom.ProcessingInstruction


    text.clear();
    while (ch >= 0) {
      if (ch == '?') {
        if ((ch = read()) == '>') {
          ProcessingInstruction pi;
          pi =  xsl.createProcessingInstruction(name, text.toString());
          text.clear();
          return pi;
        }
        else
View Full Code Here


     * "default.xsl" if none is found.
     */
    private String getStylesheetHref(Document doc)
      throws XPathException
    {
      ProcessingInstruction pi = null;

      pi = (ProcessingInstruction) XPath.find("//processing-instruction('xml-stylesheet')", doc);
     
      if (pi == null)
        return null;

      String value = pi.getNodeValue();
   
      return XmlUtil.getPIAttribute(value, "href");
    }
View Full Code Here

  public static void toSAX(Node node, ContentHandler handler)
    throws SAXException
  {
    for (; node != null; node = node.getNextSibling()) {
      if (node instanceof ProcessingInstruction) {
        ProcessingInstruction pi = (ProcessingInstruction) node;

        handler.processingInstruction(pi.getNodeName(), pi.getData());
      }
      else if (node instanceof DocumentFragment) {
        toSAX(node.getFirstChild(), handler);
      }
    }
View Full Code Here

    /**
     * adds processing instruction node to DOM.
     */
    public void processingInstruction(String target, String data) {
  final Node last = (Node)_nodeStk.peek();
  ProcessingInstruction pi = _document.createProcessingInstruction(
    target, data);
  if (pi != nulllast.appendChild(pi);
    }
View Full Code Here

            break;
        case Node.ENTITY_REFERENCE_NODE:
            writer.writeEntityRef(((EntityReference)n).getNodeValue());
            break;
        case Node.PROCESSING_INSTRUCTION_NODE:
            ProcessingInstruction pi = (ProcessingInstruction)n;
            writer.writeProcessingInstruction(pi.getTarget(), pi.getData());
            break;
        case Node.DOCUMENT_NODE:
            writeDocument((Document)n, writer, repairing);
            break;
        case Node.DOCUMENT_FRAGMENT_NODE: {
View Full Code Here

        } else if (n instanceof Comment) {
            writer.writeComment(((Comment)n).getData());
        } else if (n instanceof EntityReference) {
            writer.writeEntityRef(((EntityReference)n).getNodeValue());
        } else if (n instanceof ProcessingInstruction) {
            ProcessingInstruction pi = (ProcessingInstruction)n;
            writer.writeProcessingInstruction(pi.getTarget(), pi.getData());
        } else if (n instanceof Document) {
            writeDocument((Document)n, writer, repairing);
        }
    }
View Full Code Here

        } else if (n instanceof Comment) {
            writer.writeComment(((Comment)n).getData());
        } else if (n instanceof EntityReference) {
            writer.writeEntityRef(((EntityReference)n).getNodeValue());
        } else if (n instanceof ProcessingInstruction) {
            ProcessingInstruction pi = (ProcessingInstruction)n;
            writer.writeProcessingInstruction(pi.getTarget(), pi.getData());
        } else if (n instanceof Document) {
            writeDocument((Document)n, writer, repairing);
        }
    }
View Full Code Here

     */
    protected String extractXSLProcessingInstruction(Document doc) {
        Node child = doc.getFirstChild();
        while (child != null) {
            if (child.getNodeType() == child.PROCESSING_INSTRUCTION_NODE) {
                ProcessingInstruction pi
                    = (ProcessingInstruction)child;
               
                HashTable table = new HashTable();
                DOMUtilities.parseStyleSheetPIData(pi.getData(),
                                                   table);

                Object type = table.get(PSEUDO_ATTRIBUTE_TYPE);
                if (XSL_PROCESSING_INSTRUCTION_TYPE.equals(type)) {
                    Object href = table.get(PSEUDO_ATTRIBUTE_HREF);
View Full Code Here

        } else if (n instanceof Comment) {
            writer.writeComment(((Comment)n).getData());
        } else if (n instanceof EntityReference) {
            writer.writeEntityRef(((EntityReference)n).getNodeValue());
        } else if (n instanceof ProcessingInstruction) {
            ProcessingInstruction pi = (ProcessingInstruction)n;
            writer.writeProcessingInstruction(pi.getTarget(), pi.getData());
        } else if (n instanceof Document) {
            writeDocument((Document)n, writer, repairing);
        }
    }
View Full Code Here

     *
     * @param node The ProcessingInstruction Node to serialize
     */
    protected void serializePI(ProcessingInstruction node)
        throws SAXException {
        ProcessingInstruction pi = node;
        String name = pi.getNodeName();

        // well-formed=true
        if ((fFeatures & WELLFORMED) != 0) {
            isPIWellFormed(node);
        }

        // apply the LSSerializer filter
        if (!applyFilter(node, NodeFilter.SHOW_PROCESSING_INSTRUCTION)) {
            return;
        }

        // String data = pi.getData();
        if (name.equals("xslt-next-is-raw")) {
            fNextIsRaw = true;
        } else {
            this.fSerializer.processingInstruction(name, pi.getData());
        }
    }
View Full Code Here

TOP

Related Classes of org.w3c.dom.ProcessingInstruction

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.