Package org.jdom

Examples of org.jdom.ProcessingInstruction


        } catch (IllegalStateException e) {
        }
        ProxyElement element = new ProxyElement(details, odomFactory);
        proxy.addContent(element);
        try {
            proxy.addContent(new ProcessingInstruction("a", ""));
            fail("Expected an UnsupportedOperationException");
        } catch (UnsupportedOperationException e) {
        }
        try {
            proxy.addContent(new EntityRef("a"));
View Full Code Here


            proxy.removeContent(new Element(("a")));
//            fail("Expected an UnsupportedOperationException");
//        } catch (UnsupportedOperationException e) {
//        }
        try {
            proxy.removeContent(new ProcessingInstruction("a", ""));
            fail("Expected an UnsupportedOperationException");
        } catch (UnsupportedOperationException e) {
        }
        try {
            proxy.removeContent(new EntityRef("a"));
View Full Code Here

            else if (value instanceof Text || value instanceof CDATA) {
                String string = ((Text) value).getText();
                element.addContent(new Text(string));
            }
            else if (value instanceof ProcessingInstruction) {
                ProcessingInstruction pi =
                    (ProcessingInstruction) ((ProcessingInstruction) value)
                        .clone();
                element.addContent(pi);
            }
            else if (value instanceof Comment) {
View Full Code Here

        format.setOmitEncoding(true);
        format.setLineSeparator("\n");
        serializer.setFormat(format);

        // Create "?moml" processing instruction.
        ProcessingInstruction moml = new ProcessingInstruction("moml", "\n"
                + serializer.outputString(group) + "\n");
        configure.addContent(moml);

        // Generate index file.
        FileOutputStream out = null;
View Full Code Here

    }

    private ResultsWriter() {
        Element root = new Element(RUN);
        this.xsltPath = JTR.getProperty("xslt.path");
        ProcessingInstruction instruction = new ProcessingInstruction("xml-stylesheet", "type='text/xsl' href='" + getXsltPath() + "run.xsl'");
        runResultsDocument = new Document();
        runResultsDocument.addContent(instruction);
        runResultsDocument.setRootElement(root);
        if (JTR.options.getOption("testtype").getValue()!=null) {
            runResultsDocument.getRootElement().setAttribute("type", JTR.options.getOption("testtype").getValue());
View Full Code Here

        currentFileName = getResultsFolder() + File.separator + suite.getName() + ".xml";
        Element root = new Element(SUITE);
        root.setAttribute("name", suite.getName());
        root.setAttribute("start", DATE_FORMAT.format(new Date()));
        root.setAttribute("num_of_groups", String.valueOf(suite.getVisibleTestList().size()));
        ProcessingInstruction instruction = new ProcessingInstruction("xml-stylesheet", "type='text/xsl' href='" + getXsltPath() + "suite.xsl'");
        suiteResultsDocument = new Document();
        suiteResultsDocument.addContent(instruction);
        suiteResultsDocument.setRootElement(root);
        writeSuiteFile();
        runResultsDocument.getRootElement().addContent((Content) root.clone());
View Full Code Here

  @Override
  public void serialize( @NotNull T object, @NotNull OutputStream out ) throws IOException {
    Document document = new Document();
    //Add the format version
    document.addContent( new ProcessingInstruction( PI_TARGET_FORMAT, getFormatVersion().toString() ) );

    //Create the root
    Element root = new Element( getDefaultElementName() );
    document.setRootElement( root );
View Full Code Here

  @NotNull
  public T deserialize( @NotNull InputStream in ) throws IOException, VersionException {
    try {
      Document document = new SAXBuilder().build( in );

      ProcessingInstruction processingInstruction = getFormatInstruction( document );

      Version formatVersion = parseVersion( processingInstruction );

      Version.verifyMatch( getFormatVersion(), formatVersion );
View Full Code Here

            Attribute attr = null;
            if (node instanceof Element) {
                Element element = (Element)node;
                attr = element.getAttribute(localName, namespace);
            } else if (node instanceof ProcessingInstruction) {
                ProcessingInstruction pi = (ProcessingInstruction)node;
                if ("target".equals(localName))
                    attr = new Attribute("target", pi.getTarget());
                else if ("data".equals(localName))
                    attr = new Attribute("data", pi.getData());
                else
                    attr = new Attribute(localName, pi.getValue(localName));
            } else if (node instanceof DocType) {
                DocType doctype = (DocType)node;
                if ("publicId".equals(localName))
                    attr = new Attribute("publicId", doctype.getPublicID());
                else if ("systemId".equals(localName))
View Full Code Here

                if(attr != null) {
                    result.add(attr);
                }
            }
        } else if (node instanceof ProcessingInstruction) {
            ProcessingInstruction pi = (ProcessingInstruction)node;
            if ("target".equals(localName)) {
                result.add(new Attribute("target", pi.getTarget()));
            }
            else if ("data".equals(localName)) {
                result.add(new Attribute("data", pi.getData()));
            }
            else {
                result.add(new Attribute(localName, pi.getValue(localName)));
            }
        } else if (node instanceof DocType) {
            DocType doctype = (DocType)node;
            if ("publicId".equals(localName)) {
                result.add(new Attribute("publicId", doctype.getPublicID()));
View Full Code Here

TOP

Related Classes of org.jdom.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.