Package org.w3c.dom

Examples of org.w3c.dom.ProcessingInstruction


        //type and href are required to be set
        NodeList nl = doc.getChildNodes();
        for (int i = 0, len = nl.getLength(); i < len; i++) {
            Node node = nl.item(i);
            if (node.getNodeType() != Node.PROCESSING_INSTRUCTION_NODE) continue;
            ProcessingInstruction piNode = (ProcessingInstruction) node;
            if (!piNode.getTarget().equals("xml-stylesheet")) continue;
            StylesheetInfo info = new StylesheetInfo();
            info = new StylesheetInfo();
            info.setOrigin(StylesheetInfo.AUTHOR);
            String pi = piNode.getData();
            Matcher m = _alternatePattern.matcher(pi);
            if (m.matches()) {
                int start = m.end();
                String alternate = pi.substring(start + 1, pi.indexOf(pi.charAt(start), start + 1));
                //TODO: handle alternate stylesheets
View Full Code Here


        case Node.TEXT_NODE:{
            DOMNormalizer.isXMLCharWF(fErrorHandler, fError, fLocator, node.getNodeValue(), xml11Version);
            break;
        }
        case Node.PROCESSING_INSTRUCTION_NODE:{
            ProcessingInstruction pinode = (ProcessingInstruction)node ;
            String target = pinode.getTarget();
            if (verifyNames) {
                if (xml11Version) {
                    wellformed = XML11Char.isXML11ValidName(target);
                } else {
                    wellformed = XMLChar.isValidName(target);
                }

                if (!wellformed) {
                    String msg =
                        DOMMessageFormatter.formatMessage(
                            DOMMessageFormatter.DOM_DOMAIN,
                            "wf-invalid-character-in-node-name",
                            new Object[] { "Element", node.getNodeName()});
                    DOMNormalizer.reportDOMError(
                        fErrorHandler,
                        fError,
                        fLocator,
                        msg,
                        DOMError.SEVERITY_FATAL_ERROR,
                        "wf-invalid-character-in-node-name");
                }
            }             
            DOMNormalizer.isXMLCharWF(fErrorHandler, fError, fLocator, pinode.getData(), xml11Version);
            break;
        }       
        }
              
    }
View Full Code Here

                                         node.getNodeName(),
                                         new AttList(atts, m_dh));
      break;
    case Node.PROCESSING_INSTRUCTION_NODE :
    {
      ProcessingInstruction pi = (ProcessingInstruction) node;
      String name = pi.getNodeName();

      // String data = pi.getData();
      if (name.equals("xslt-next-is-raw"))
      {
        nextIsRaw = true;
      }
      else
      {
        this.m_contentHandler.processingInstruction(pi.getNodeName(),
                                                    pi.getData());
      }
    }
    break;
    case Node.CDATA_SECTION_NODE :
    {
View Full Code Here

     * adds processing instruction node to DOM.
     */
    public void processingInstruction(String target, String data) {
  appendTextNode();
  final Node last = (Node)_nodeStk.peek();
  ProcessingInstruction pi = _document.createProcessingInstruction(
    target, data);
  if (pi != null){
          if (last == _root && _nextSibling != null)
              last.insertBefore(pi, _nextSibling);
          else
View Full Code Here

                    result.add(attr);
                }
            }
        }
        else if (node instanceof ProcessingInstruction) {
            ProcessingInstruction pi = (ProcessingInstruction)node;
            if ("target".equals(localName)) {
                result.add(createAttribute(pi, "target", pi.getTarget()));
            }
            else if ("data".equals(localName)) {
                result.add(createAttribute(pi, "data", pi.getData()));
            }
            else {
                // TODO: DOM has no facility for parsing data into
                // name-value pairs...
                ;
View Full Code Here

  public void processingInstruction(String target, String data)
      throws SAXException {
    if (mergeAdjacentText && textInTextBuffer) {
      completeCurrentTextNode();
    }
    ProcessingInstruction pi = (ProcessingInstruction) documentFactory.createProcessingInstruction(target, data);
    if (currentElement != null) {
      ((org.w3c.dom.Element) currentElement).appendChild(pi);
    } else {
      getDocument().appendChild(pi);
    }
View Full Code Here

        public void processingInstruction(String target,
                String data) throws SAXException {

            checkClosed();

            ProcessingInstruction processingInstruction;

            processingInstruction =
                getDocument().createProcessingInstruction(target, data);

            getCurrentNode().appendChild(processingInstruction);
View Full Code Here

    final Document doc = Util.createXML("KF");
    final Element root = (Element) doc.getDocumentElement();

    // Create and add the xml-stylesheet instruction
    final ProcessingInstruction pi
      = doc.createProcessingInstruction("xml-stylesheet",
                                        "type='text/xsl' href='mvn_dep_mgmt.xsl'");
    doc.insertBefore(pi, root);

    root.setAttribute("version", version);
View Full Code Here

    }
   
    if (ch == '<') {
      ch = read();
      if (ch == '?') {
        ProcessingInstruction pi = parsePi();
        if (pi.getNodeName().equals("xml")) {
          encoding = XmlUtil.getPIAttribute(pi.getNodeValue(), "encoding");
          if (encoding != null)
            is.setEncoding(encoding);
        }
        else
          top.appendChild(pi);
View Full Code Here

          addText(parent);
          ch = parseScriptlet(parent);
          break;
        } else if (ch == '?') {
          addText(parent);
          ProcessingInstruction pi = parsePi();
          parent.appendChild(pi);
          ch = read();
          break;
        } else if (ch == '!') {
          addText(parent);
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.