Package org.xmlpull.v1

Examples of org.xmlpull.v1.XmlSerializer


    {
        this.container = new Dsmlv2Container( codec );

        this.container.setGrammar( Dsmlv2ResponseGrammar.getInstance() );

        XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
        factory.setNamespaceAware( true );
        XmlPullParser xpp = factory.newPullParser();

        container.setParser( xpp );
    }
View Full Code Here


        this.grammar = new Dsmlv2Grammar();
        this.container = new Dsmlv2Container( grammar.getLdapCodecService() );

        this.container.setGrammar( grammar );

        XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
        factory.setNamespaceAware( true );
        XmlPullParser xpp = factory.newPullParser();

        container.setParser( xpp );
    }
View Full Code Here

    {
        this.container = new Dsmlv2Container( grammar.getLdapCodecService() );
        this.container.setGrammar( grammar );
        this.grammar = grammar;

        XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
        factory.setNamespaceAware( true );
        XmlPullParser xpp = factory.newPullParser();

        container.setParser( xpp );
    }
View Full Code Here

        this.grammar = new Dsmlv2Grammar();
        this.container = new Dsmlv2Container( grammar.getLdapCodecService() );

        this.container.setGrammar( grammar );

        XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
        factory.setNamespaceAware( true );
        XmlPullParser xpp = factory.newPullParser();

        container.setParser( xpp );
    }
View Full Code Here

    {
        this.container = new Dsmlv2Container( grammar.getLdapCodecService() );
        this.container.setGrammar( grammar );
        this.grammar = grammar;
       
        XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
        factory.setNamespaceAware( true );
        XmlPullParser xpp = factory.newPullParser();

        container.setParser( xpp );
    }
View Full Code Here

    {
        this.container = new Dsmlv2Container( codec );

        this.container.setGrammar( Dsmlv2ResponseGrammar.getInstance() );

        XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
        factory.setNamespaceAware( true );
        XmlPullParser xpp = factory.newPullParser();

        container.setParser( xpp );
    }
View Full Code Here

  /** XML namespace dictionary. */
  private final XmlNamespaceDictionary namespaceDictionary;

  public final void writeTo(OutputStream out) throws IOException {
    XmlSerializer serializer = Xml.createSerializer();
    serializer.setOutput(out, getCharset().name());
    writeTo(serializer);
  }
View Full Code Here

        writeManifest(zipOut);
        zipOut.closeEntry();
    }

    protected void writeManifest(OutputStream out) throws IOException {
        XmlSerializer xml = XMLUtils.getXmlSerializer(true);
        xml.setOutput(out, "UTF-8");
        xml.startDocument("UTF-8", null);

        xml.startTag(null, "pdashReportArchive");
        xml.attribute(null, "version", "1.0");

        for (Map.Entry<String, String> e : contentTypeMap.entrySet()) {
            xml.startTag(null, "file");
            xml.attribute(null, "name", e.getKey());
            xml.attribute(null, "contentType", e.getValue());
            if (defaultFile.equals(e.getKey()))
                xml.attribute(null, "isDefault", "true");
            xml.endTag(null, "file");
        }

        xml.endTag(null, "pdashReportArchive");
        xml.endDocument();
    }
View Full Code Here

        return "text/xml";
    }

    public void runReport(ResourceCollection c, List<String> resources,
            OutputStream out) throws IOException {
        XmlSerializer ser = XMLUtils.getXmlSerializer(true);

        ser.setOutput(out, ENCODING);
        ser.startDocument(ENCODING, null);
        ser.startTag(null, DOCUMENT_TAG);

        for (String resourceName : resources) {
            long lastMod = c.getLastModified(resourceName);
            if (lastMod < 1)
                continue;

            Long checksum = c.getChecksum(resourceName);
            if (checksum == null)
                continue;

            ser.startTag(null, RESOURCE_TAG);
            ser.attribute(null, NAME_ATTR, resourceName);
            ser.attribute(null, MOD_TIME_ATTR, Long.toString(lastMod));
            ser.attribute(null, CHECKSUM_ATTR, checksum.toString());
            ser.endTag(null, RESOURCE_TAG);
        }

        ser.endTag(null, DOCUMENT_TAG);
        ser.endDocument();
    }
View Full Code Here

                String attrName = textToSafeAttrName(colName);
                resultSet.setColName(col, attrName);
            }
        }

        XmlSerializer xml = XMLUtils.getXmlSerializer(whitespace);
        xml.setOutput(outStream, ENCODING);
        xml.startDocument(ENCODING, null);

        xml.startTag(null, RESULT_SET_TAG);

        for (int row = 1; row <= resultSet.numRows(); row++) {
            xml.startTag(null, RESULT_ITEM_TAG);
            xml.attribute(null, PATH_ATTR, resultSet.getRowName(row));

            for (int col = 1; col <= resultSet.numCols(); col++) {
                String name = resultSet.getColName(col);
                SimpleData d = resultSet.getData(row, col);
                String value = (d == null ? null : d.format());

                if (inlineAttributes) {
                    if (value != null)
                        xml.attribute(null, name, value);
                } else {
                    xml.startTag(null, RESULT_DATA_TAG);
                    xml.attribute(null, NAME_ATTR, name);
                    if (value != null)
                        xml.attribute(null, VALUE_ATTR, value);
                    xml.endTag(null, RESULT_DATA_TAG);
                }
            }

            xml.endTag(null, RESULT_ITEM_TAG);
        }

        xml.endTag(null, RESULT_SET_TAG);

        xml.endDocument();
    }
View Full Code Here

TOP

Related Classes of org.xmlpull.v1.XmlSerializer

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.