Package org.apache.cocoon.generation

Examples of org.apache.cocoon.generation.JXTemplateGenerator$ProcessingInstruction


  @Test
  @Ignore
  // TODO
  public void testOutputFragmentContent() {
    roundTripFragment(new ProcessingInstruction("jdomtest", ""));
    roundTripFragment(new Comment("comment"));
    roundTripFragment(new CDATA("foo"));
    roundTripFragment(new Element("root"));
    roundTripFragment(new Text("bar"));
  }
View Full Code Here


            break;
          case EntityRef:
            assertEquals(((EntityRef)a).getName(), ((EntityRef)b).getName());
            break;
          case ProcessingInstruction:
            ProcessingInstruction pa = (ProcessingInstruction)a;
            ProcessingInstruction pb = (ProcessingInstruction)b;
            assertEquals(pa.getTarget(), pb.getTarget());
            assertEquals(pa.getData(), pb.getData());
            break;
        }
      } else if (ap instanceof Attribute) {
        compare ((Attribute)ap, (Attribute)bp);
      } else if (ap instanceof Document) {
View Full Code Here

 
  @Test
  public void testOutputElementIgnoreTrAXEscapingPIs() {
    Element root = new Element("root");
    root.addContent(new Text("&"));
    root.addContent(new ProcessingInstruction(Result.PI_DISABLE_OUTPUT_ESCAPING, ""));
    root.addContent(new Text(" && "));
    root.addContent(new ProcessingInstruction(Result.PI_ENABLE_OUTPUT_ESCAPING, ""));
    root.addContent(new Text("&"));
    String expect = "<root>&amp; && &amp;</root>";
    String excompact = "<root>&amp;&&&amp;</root>";
    String expretty = "<root>\n  &amp;\n  \n  &&\n  \n  &amp;\n</root>";
    String extfw = "<root>\n  &amp;\n  \n   && \n  \n  &amp;\n</root>";
View Full Code Here

          }
        } else if (event.isEntityReference()) {
          current.addContent(factory.entityRef(
              ((javax.xml.stream.events.EntityReference)event).getName()));
        } else if (event.isProcessingInstruction()) {
          final ProcessingInstruction pi = factory.processingInstruction(
              ((javax.xml.stream.events.ProcessingInstruction)event).getTarget(),
              ((javax.xml.stream.events.ProcessingInstruction)event).getData());
          if (current == null) {
            document.addContent(pi);
          } else {
View Full Code Here

     *  very useful if you want to emit HTML directly into the stream.
     *
     */
    private void disableOutputEscaping()
    {
        addElement( new ProcessingInstruction(Result.PI_DISABLE_OUTPUT_ESCAPING, "") );
    }
View Full Code Here

    }

    protected String getStyleSheet(final Document doc) {
        String styleSheet = null;
        for (final Content c : doc.getContent(new ContentFilter(ContentFilter.PI))) {
            final ProcessingInstruction pi = (ProcessingInstruction) c;
            if ("text/xsl".equals(pi.getPseudoAttributeValue("type"))) {
                styleSheet = pi.getPseudoAttributeValue("href");
                break;
            }
        }
        return styleSheet;
    }
View Full Code Here

TOP

Related Classes of org.apache.cocoon.generation.JXTemplateGenerator$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.