Java 类org.xmlpull.v1.XmlSerializer 实例源码

项目:container    文件:FastXmlSerializer.java   
public XmlSerializer startTag(String namespace, String name) throws IOException,
        IllegalArgumentException, IllegalStateException {
    if (mInTag) {
        append(">\n");
    }
    if (mIndent) {
        appendIndent(mNesting);
    }
    mNesting++;
    append('<');
    if (namespace != null) {
        append(namespace);
        append(':');
    }
    append(name);
    mInTag = true;
    mLineStart = false;
    return this;
}
项目:JobSchedulerCompat    文件:JobStore.java   
/**
 * Write out a tag with data identifying this job's constraints. If the constraint isn't here it doesn't apply.
 */
private void writeConstraintsToXml(XmlSerializer out, JobStatus jobStatus) throws IOException {
    out.startTag(null, XML_TAG_PARAMS_CONSTRAINTS);
    if (jobStatus.needsAnyConnectivity()) {
        out.attribute(null, "connectivity", Boolean.toString(true));
    }
    if (jobStatus.needsMeteredConnectivity()) {
        out.attribute(null, "metered", Boolean.toString(true));
    }
    if (jobStatus.needsUnmeteredConnectivity()) {
        out.attribute(null, "unmetered", Boolean.toString(true));
    }
    if (jobStatus.needsNonRoamingConnectivity()) {
        out.attribute(null, "not-roaming", Boolean.toString(true));
    }
    if (jobStatus.hasIdleConstraint()) {
        out.attribute(null, "idle", Boolean.toString(true));
    }
    if (jobStatus.hasChargingConstraint()) {
        out.attribute(null, "charging", Boolean.toString(true));
    }
    if (jobStatus.hasBatteryNotLowConstraint()) {
        out.attribute(null, "battery-not-low", Boolean.toString(true));
    }
    out.endTag(null, XML_TAG_PARAMS_CONSTRAINTS);
}
项目:XPrivacy    文件:XmlUtils.java   
/**
 * Flatten a long[] into an XmlSerializer.  The list can later be read back
 * with readThisLongArrayXml().
 *
 * @param val The long array to be flattened.
 * @param name Name attribute to include with this array's tag, or null for
 *             none.
 * @param out XmlSerializer to write the array into.
 *
 * @see #writeMapXml
 * @see #writeValueXml
 * @see #readThisIntArrayXml
 */
public static final void writeLongArrayXml(long[] val, String name, XmlSerializer out)
        throws XmlPullParserException, java.io.IOException {

    if (val == null) {
        out.startTag(null, "null");
        out.endTag(null, "null");
        return;
    }

    out.startTag(null, "long-array");
    if (name != null) {
        out.attribute(null, "name", name);
    }

    final int N = val.length;
    out.attribute(null, "num", Integer.toString(N));

    for (int i=0; i<N; i++) {
        out.startTag(null, "item");
        out.attribute(null, "value", Long.toString(val[i]));
        out.endTag(null, "item");
    }

    out.endTag(null, "long-array");
}
项目:HtmlCompat    文件:XmlUtils.java   
/**
 * Flatten an int[] into an XmlSerializer.  The list can later be read back
 * with readThisIntArrayXml().
 *
 * @param val The int array to be flattened.
 * @param name Name attribute to include with this array's tag, or null for
 *             none.
 * @param out XmlSerializer to write the array into.
 *
 * @see #writeMapXml
 * @see #writeValueXml
 * @see #readThisIntArrayXml
 */
public static final void writeIntArrayXml(int[] val, String name,
                                          XmlSerializer out)
        throws XmlPullParserException, java.io.IOException {
    if (val == null) {
        out.startTag(null, "null");
        out.endTag(null, "null");
        return;
    }
    out.startTag(null, "int-array");
    if (name != null) {
        out.attribute(null, "name", name);
    }
    final int N = val.length;
    out.attribute(null, "num", Integer.toString(N));
    for (int i=0; i<N; i++) {
        out.startTag(null, "item");
        out.attribute(null, "value", Integer.toString(val[i]));
        out.endTag(null, "item");
    }
    out.endTag(null, "int-array");
}
项目:JobSchedulerCompat    文件:XmlUtils.java   
private static void writeDoubleArrayXml(double[] val, String name, XmlSerializer out)
        throws XmlPullParserException, IOException {
    if (val == null) {
        out.startTag(null, "null");
        out.endTag(null, "null");
        return;
    }

    out.startTag(null, "double-array");
    if (name != null) {
        out.attribute(null, "name", name);
    }

    final int N = val.length;
    out.attribute(null, "num", Integer.toString(N));

    for (int i = 0; i < N; i++) {
        out.startTag(null, "item");
        out.attribute(null, "value", Double.toString(val[i]));
        out.endTag(null, "item");
    }

    out.endTag(null, "double-array");
}
项目:JobSchedulerCompat    文件:XmlUtils.java   
private static void writeStringArrayXml(String[] val, String name, XmlSerializer out)
        throws XmlPullParserException, IOException {
    if (val == null) {
        out.startTag(null, "null");
        out.endTag(null, "null");
        return;
    }

    out.startTag(null, "string-array");
    if (name != null) {
        out.attribute(null, "name", name);
    }

    final int N = val.length;
    out.attribute(null, "num", Integer.toString(N));

    for (int i = 0; i < N; i++) {
        out.startTag(null, "item");
        out.attribute(null, "value", val[i]);
        out.endTag(null, "item");
    }

    out.endTag(null, "string-array");
}
项目:JobSchedulerCompat    文件:XmlUtils.java   
private static void writeBooleanArrayXml(boolean[] val, String name, XmlSerializer out)
        throws XmlPullParserException, IOException {
    if (val == null) {
        out.startTag(null, "null");
        out.endTag(null, "null");
        return;
    }

    out.startTag(null, "boolean-array");
    if (name != null) {
        out.attribute(null, "name", name);
    }

    final int N = val.length;
    out.attribute(null, "num", Integer.toString(N));

    for (int i = 0; i < N; i++) {
        out.startTag(null, "item");
        out.attribute(null, "value", Boolean.toString(val[i]));
        out.endTag(null, "item");
    }

    out.endTag(null, "boolean-array");
}
项目:microMathematics    文件:PlotContour.java   
@Override
public boolean onStartWriteXmlTag(XmlSerializer serializer, String key) throws Exception
{
    super.onStartWriteXmlTag(serializer, key);
    if (getBaseType().toString().equalsIgnoreCase(serializer.getName()))
    {
        serializer.attribute(FormulaList.XML_NS, XML_PROP_PLOT_STYLE,
                twoDPlotStyle.toString().toLowerCase(Locale.ENGLISH));
        functionView.getPlotParameters().writeToXml(serializer);
        functionView.getAxisParameters().writeToXml(serializer);
        functionView.getColorMapView().getColorMapParameters().writeToXml(serializer);
    }
    if (FormulaList.XML_TERM_TAG.equalsIgnoreCase(serializer.getName()) && key != null)
    {
        // contour-specific attributes
    }
    return false;
}
项目:JobSchedulerCompat    文件:XmlUtils.java   
public XmlSerializer endTag(String namespace, String name)
        throws IOException, IllegalArgumentException, IllegalStateException {
    if (inTag) {
        append(" />\n");
    } else {
        append("</");
        if (namespace != null) {
            append(namespace);
            append(':');
        }
        append(name);
        append(">\n");
    }
    inTag = false;
    return this;
}
项目:VirtualHook    文件:FastXmlSerializer.java   
public XmlSerializer endTag(String namespace, String name) throws IOException,
        IllegalArgumentException, IllegalStateException {
    mNesting--;
    if (mInTag) {
        append(" />\n");
    } else {
        if (mIndent && mLineStart) {
            appendIndent(mNesting);
        }
        append("</");
        if (namespace != null) {
            append(namespace);
            append(':');
        }
        append(name);
        append(">\n");
    }
    mLineStart = true;
    mInTag = false;
    return this;
}
项目:HtmlCompat    文件:XmlUtils.java   
/**
 * Flatten a byte[] into an XmlSerializer.  The list can later be read back
 * with readThisByteArrayXml().
 *
 * @param val The byte array to be flattened.
 * @param name Name attribute to include with this array's tag, or null for
 *             none.
 * @param out XmlSerializer to write the array into.
 *
 * @see #writeMapXml
 * @see #writeValueXml
 */
public static final void writeByteArrayXml(byte[] val, String name,
                                           XmlSerializer out)
        throws XmlPullParserException, java.io.IOException {
    if (val == null) {
        out.startTag(null, "null");
        out.endTag(null, "null");
        return;
    }
    out.startTag(null, "byte-array");
    if (name != null) {
        out.attribute(null, "name", name);
    }
    final int N = val.length;
    out.attribute(null, "num", Integer.toString(N));
    StringBuilder sb = new StringBuilder(val.length*2);
    for (int i=0; i<N; i++) {
        int b = val[i];
        int h = b>>4;
        sb.append(h >= 10 ? ('a'+h-10) : ('0'+h));
        h = b&0xff;
        sb.append(h >= 10 ? ('a'+h-10) : ('0'+h));
    }
    out.text(sb.toString());
    out.endTag(null, "byte-array");
}
项目:XPrivacy    文件:XmlUtils.java   
public static final void writeSetXml(Set val, String name, XmlSerializer out)
        throws XmlPullParserException, java.io.IOException {
    if (val == null) {
        out.startTag(null, "null");
        out.endTag(null, "null");
        return;
    }

    out.startTag(null, "set");
    if (name != null) {
        out.attribute(null, "name", name);
    }

    for (Object v : val) {
        writeValueXml(v, null, out);
    }

    out.endTag(null, "set");
}
项目:AndroidApktool    文件:ResPluralsValue.java   
@Override
public void serializeToResValuesXml(XmlSerializer serializer,
                                    ResResource res) throws IOException, AndrolibException {
    serializer.startTag(null, "plurals");
    serializer.attribute(null, "name", res.getResSpec().getName());
    for (int i = 0; i < mItems.length; i++) {
        ResScalarValue item = mItems[i];
        if (item == null) {
            continue;
        }

        ResScalarValue rawValue = item;

        serializer.startTag(null, "item");
        serializer.attribute(null, "quantity", QUANTITY_MAP[i]);
        serializer.text(ResXmlEncoders.enumerateNonPositionalSubstitutionsIfRequired(item.encodeAsResXmlValue()));
        serializer.endTag(null, "item");
    }
    serializer.endTag(null, "plurals");
}
项目:AndroidApktool    文件:ResBagValue.java   
@Override
public void serializeToResValuesXml(XmlSerializer serializer,
                                    ResResource res) throws IOException, AndrolibException {
    String type = res.getResSpec().getType().getName();
    if ("style".equals(type)) {
        new ResStyleValue(mParent, new Duo[0], null)
                .serializeToResValuesXml(serializer, res);
        return;
    }
    if ("array".equals(type)) {
        new ResArrayValue(mParent, new Duo[0]).serializeToResValuesXml(
                serializer, res);
        return;
    }
    if ("plurals".equals(type)) {
        new ResPluralsValue(mParent, new Duo[0]).serializeToResValuesXml(
                serializer, res);
        return;
    }

    serializer.startTag(null, "item");
    serializer.attribute(null, "type", type);
    serializer.attribute(null, "name", res.getResSpec().getName());
    serializer.endTag(null, "item");
}
项目:AndroidApktool    文件:ResArrayValue.java   
@Override
public void serializeToResValuesXml(XmlSerializer serializer,
                                    ResResource res) throws IOException, AndrolibException {
    String type = getType();
    type = (type == null ? "" : type + "-") + "array";
    serializer.startTag(null, type);
    serializer.attribute(null, "name", res.getResSpec().getName());

    // lets check if we need to add formatted="false" to this array
    for (int i = 0; i < mItems.length; i++) {
        if (mItems[i].hasMultipleNonPositionalSubstitutions()) {
            serializer.attribute(null, "formatted", "false");
            break;
        }
    }

    // add <item>'s
    for (int i = 0; i < mItems.length; i++) {
        serializer.startTag(null, "item");
        serializer.text(mItems[i].encodeAsResXmlNonEscapedItemValue());
        serializer.endTag(null, "item");
    }
    serializer.endTag(null, type);
}
项目:MKAPP    文件:ActivitySettings.java   
private void filterExport(XmlSerializer serializer) throws IOException {
    Cursor cursor = DatabaseHelper.getInstance(this).getAccess();
    int colUid = cursor.getColumnIndex("uid");
    int colVersion = cursor.getColumnIndex("version");
    int colProtocol = cursor.getColumnIndex("protocol");
    int colDAddr = cursor.getColumnIndex("daddr");
    int colDPort = cursor.getColumnIndex("dport");
    int colTime = cursor.getColumnIndex("time");
    int colBlock = cursor.getColumnIndex("block");
    while (cursor.moveToNext())
        for (String pkg : getPackages(cursor.getInt(colUid))) {
            serializer.startTag(null, "rule");
            serializer.attribute(null, "pkg", pkg);
            serializer.attribute(null, "version", Integer.toString(cursor.getInt(colVersion)));
            serializer.attribute(null, "protocol", Integer.toString(cursor.getInt(colProtocol)));
            serializer.attribute(null, "daddr", cursor.getString(colDAddr));
            serializer.attribute(null, "dport", Integer.toString(cursor.getInt(colDPort)));
            serializer.attribute(null, "time", Long.toString(cursor.getLong(colTime)));
            serializer.attribute(null, "block", Integer.toString(cursor.getInt(colBlock)));
            serializer.endTag(null, "rule");
        }
    cursor.close();
}
项目:MKAPP    文件:ActivitySettings.java   
private void forwardExport(XmlSerializer serializer) throws IOException {
    Cursor cursor = DatabaseHelper.getInstance(this).getForwarding();
    int colProtocol = cursor.getColumnIndex("protocol");
    int colDPort = cursor.getColumnIndex("dport");
    int colRAddr = cursor.getColumnIndex("raddr");
    int colRPort = cursor.getColumnIndex("rport");
    int colRUid = cursor.getColumnIndex("ruid");
    while (cursor.moveToNext())
        for (String pkg : getPackages(cursor.getInt(colRUid))) {
            serializer.startTag(null, "port");
            serializer.attribute(null, "pkg", pkg);
            serializer.attribute(null, "protocol", Integer.toString(cursor.getInt(colProtocol)));
            serializer.attribute(null, "dport", Integer.toString(cursor.getInt(colDPort)));
            serializer.attribute(null, "raddr", cursor.getString(colRAddr));
            serializer.attribute(null, "rport", Integer.toString(cursor.getInt(colRPort)));
            serializer.endTag(null, "port");
        }
    cursor.close();
}
项目:XPrivacy    文件:FastXmlSerializer.java   
public XmlSerializer endTag(String namespace, String name) throws IOException,
        IllegalArgumentException, IllegalStateException {
    mNesting--;
    if (mInTag) {
        append(" />\n");
    } else {
        if (mIndent && mLineStart) {
            appendIndent(mNesting);
        }
        append("</");
        if (namespace != null) {
            append(namespace);
            append(':');
        }
        append(name);
        append(">\n");
    }
    mLineStart = true;
    mInTag = false;
    return this;
}
项目:XPrivacy    文件:XmlUtils.java   
/**
 * Flatten a double[] into an XmlSerializer.  The list can later be read back
 * with readThisDoubleArrayXml().
 *
 * @param val The double array to be flattened.
 * @param name Name attribute to include with this array's tag, or null for
 *             none.
 * @param out XmlSerializer to write the array into.
 *
 * @see #writeMapXml
 * @see #writeValueXml
 * @see #readThisIntArrayXml
 */
public static final void writeDoubleArrayXml(double[] val, String name, XmlSerializer out)
        throws XmlPullParserException, java.io.IOException {

    if (val == null) {
        out.startTag(null, "null");
        out.endTag(null, "null");
        return;
    }

    out.startTag(null, "double-array");
    if (name != null) {
        out.attribute(null, "name", name);
    }

    final int N = val.length;
    out.attribute(null, "num", Integer.toString(N));

    for (int i=0; i<N; i++) {
        out.startTag(null, "item");
        out.attribute(null, "value", Double.toString(val[i]));
        out.endTag(null, "item");
    }

    out.endTag(null, "double-array");
}
项目:starcor.xul    文件:XulDebugMonitor.java   
public boolean getItemContent(final int itemId, final XulHttpServer.XulHttpServerRequest request, final XulHttpServer.XulHttpServerResponse response) {
    return execUiOpAndWait(itemId, new UiOpRunnable() {
        @Override
        boolean beginExec() {
            return !(_xulPage == null && _xulView == null);
        }

        @Override
        protected void exec(PageInfo pageInfo, XulPage xulPage, XulView xulView) throws Exception {
            if (xulView == null) {
                xulView = xulPage.getLayout();
            }

            XmlPullParserFactory xmlPullParserFactory = XmlPullParserFactory.newInstance();
            XmlSerializer writer = xmlPullParserFactory.newSerializer();
            writer.setOutput(response.getBodyStream(), "utf-8");

            writer.startDocument("utf-8", Boolean.TRUE);
            dumpItem(xulView, writer, request.queries);

            writer.endDocument();
            writer.flush();
        }
    });
}
项目:TPlayer    文件:FastXmlSerializer.java   
public XmlSerializer startTag(String namespace, String name) throws IOException,
        IllegalArgumentException, IllegalStateException {
    if (mInTag) {
        append(">\n");
    }
    if (mIndent) {
        appendIndent(mNesting);
    }
    mNesting++;
    append('<');
    if (namespace != null) {
        append(namespace);
        append(':');
    }
    append(name);
    mInTag = true;
    mLineStart = false;
    return this;
}
项目:microMathematics    文件:FormulaBase.java   
/**
 * XML interface: procedure returns string that contains XML representation of this formula
 */
public void writeToXml(XmlSerializer serializer, String key) throws Exception
{
    if (onStartWriteXmlTag(serializer, key))
    {
        return;
    }
    for (TermField t : terms)
    {
        serializer.startTag(FormulaList.XML_NS, FormulaList.XML_TERM_TAG);
        serializer.attribute(FormulaList.XML_NS, FormulaList.XML_PROP_KEY, t.getTermKey());
        if (onStartWriteXmlTag(serializer, t.getTermKey()))
        {
            continue;
        }
        if (t.isWritable)
        {
            t.writeToXml(serializer);
        }
        serializer.endTag(FormulaList.XML_NS, FormulaList.XML_TERM_TAG);
    }
}
项目:container    文件:FastXmlSerializer.java   
public XmlSerializer endTag(String namespace, String name) throws IOException,
        IllegalArgumentException, IllegalStateException {
    mNesting--;
    if (mInTag) {
        append(" />\n");
    } else {
        if (mIndent && mLineStart) {
            appendIndent(mNesting);
        }
        append("</");
        if (namespace != null) {
            append(namespace);
            append(':');
        }
        append(name);
        append(">\n");
    }
    mLineStart = true;
    mInTag = false;
    return this;
}
项目:HtmlCompat    文件:XmlUtils.java   
/**
 * Flatten a Map into an XmlSerializer.  The map can later be read back
 * with readThisMapXml().
 *
 * @param val The map to be flattened.
 * @param name Name attribute to include with this list's tag, or null for
 *             none.
 * @param out XmlSerializer to write the map into.
 *
 * @see #writeMapXml(Map, OutputStream)
 * @see #writeListXml
 * @see #writeValueXml
 * @see #readMapXml
 */
public static final void writeMapXml(Map val, String name, XmlSerializer out)
        throws XmlPullParserException, java.io.IOException
{
    if (val == null) {
        out.startTag(null, "null");
        out.endTag(null, "null");
        return;
    }
    Set s = val.entrySet();
    Iterator i = s.iterator();
    out.startTag(null, "map");
    if (name != null) {
        out.attribute(null, "name", name);
    }
    while (i.hasNext()) {
        Map.Entry e = (Map.Entry)i.next();
        writeValueXml(e.getValue(), (String)e.getKey(), out);
    }
    out.endTag(null, "map");
}
项目:microMathematics    文件:PlotFunction.java   
@Override
public boolean onStartWriteXmlTag(XmlSerializer serializer, String key) throws Exception
{
    super.onStartWriteXmlTag(serializer, key);
    if (getBaseType().toString().equalsIgnoreCase(serializer.getName()))
    {
        functionView.getPlotParameters().writeToXml(serializer);
        functionView.getAxisParameters().writeToXml(serializer);
        serializer.attribute(FormulaList.XML_NS, XML_PROP_FUNCTIONS_NUMBER, String.valueOf(functions.size()));
    }
    if (FormulaList.XML_TERM_TAG.equalsIgnoreCase(serializer.getName()) && key != null)
    {
        for (Function2D f : functions)
        {
            if (key.equals(f.y.getTermKey()))
            {
                f.getLineParameters().writeToXml(serializer);
            }
        }
    }
    return false;
}
项目:microMathematics    文件:ImageFragment.java   
@Override
public boolean onStartWriteXmlTag(XmlSerializer serializer, String key) throws Exception
{
    super.onStartWriteXmlTag(serializer, key);
    if (getBaseType().toString().equalsIgnoreCase(serializer.getName()))
    {
        parameters.writeToXml(serializer);
        if (parameters.embedded)
        {
            imageView.writeToXml(serializer);
        }
    }
    return false;
}
项目:starcor.xul    文件:XulDebugMonitor.java   
private void dumpItem(XulView view, XmlSerializer writer, LinkedHashMap<String, String> queries) throws Exception {
    if (view == null) {
        return;
    }
    XmlContentDumper contentDumper = new XmlContentDumper(writer);

    if (queries != null) {
        String withChildren = queries.get("with-children");
        String noProp = queries.get("skip-prop");
        String withPosition = queries.get("with-position");
        String withBindingData = queries.get("with-binding-data");
        if ("true".equals(noProp)) {
            contentDumper.setNoProp(true);
        }

        if ("true".equals(withChildren)) {
            contentDumper.setNoChildren(false);
        } else {
            contentDumper.setNoChildren(true);
        }

        if ("true".equals(withPosition)) {
            contentDumper.setNoPosition(false);
        } else {
            contentDumper.setNoPosition(true);
        }

        if ("true".equals(withBindingData)) {
            contentDumper.setNoBindingData(false);
        } else {
            contentDumper.setNoBindingData(true);
        }
    } else {
        contentDumper.setNoChildren(true);
        contentDumper.setNoPosition(true);
        contentDumper.setNoBindingData(true);
    }

    contentDumper.dumpXulView(view);
}
项目:q-mail    文件:SettingsExporter.java   
private static <T> void writeKeyAndPrettyValueFromSetting(XmlSerializer serializer, String key,
        SettingsDescription<T> setting, String valueString)
        throws IllegalArgumentException, IllegalStateException, IOException, InvalidSettingValueException {
    T value = setting.fromString(valueString);
    String outputValue = setting.toPrettyString(value);

    writeKeyAndPrettyValueFromSetting(serializer, key, outputValue);
}
项目:q-mail    文件:SettingsExporter.java   
private static <T> void writeKeyAndDefaultValueFromSetting(XmlSerializer serializer, String key,
        SettingsDescription<T> setting) throws IllegalArgumentException, IllegalStateException, IOException {
    T value = setting.getDefaultValue();
    String outputValue = setting.toPrettyString(value);

    writeKeyAndPrettyValueFromSetting(serializer, key, outputValue);
}
项目:q-mail    文件:SettingsExporter.java   
private static void writeKeyAndPrettyValueFromSetting(XmlSerializer serializer, String key, String literalValue)
        throws IllegalArgumentException, IllegalStateException, IOException {
    serializer.startTag(null, VALUE_ELEMENT);
    serializer.attribute(null, KEY_ATTRIBUTE, key);
    if (literalValue != null) {
        serializer.text(literalValue);
    }
    serializer.endTag(null, VALUE_ELEMENT);
}
项目:TPlayer    文件:FastXmlSerializer.java   
public XmlSerializer text(char[] buf, int start, int len) throws IOException,
        IllegalArgumentException, IllegalStateException {
    if (mInTag) {
        append(">");
        mInTag = false;
    }
    escapeAndAppendString(buf, start, len);
    if (mIndent) {
        mLineStart = buf[start+len-1] == '\n';
    }
    return this;
}
项目:JobSchedulerCompat    文件:JobStore.java   
/**
 * Write out fields that wouldn't be needed in the framework's APIs,
 * because JobSchedulerService is always running and never killed.
 */
private void writeCompatToXml(JobStatus jobStatus, JobInfo job, XmlSerializer out)
        throws IOException, XmlPullParserException {
    out.startTag(null, XML_TAG_COMPAT);
    Bundle compat = new Bundle();

    JobInfo.TriggerContentUri[] triggerUris = job.getTriggerContentUris();
    if (triggerUris != null) {
        compat.putParcelableArrayList("trigger-content-uris", new ArrayList<>(Arrays.asList(triggerUris)));
        compat.putLong("trigger-content-update-delay", job.getTriggerContentUpdateDelay());
        compat.putLong("trigger-content-max-delay", job.getMaxExecutionDelayMillis());
    }

    if (jobStatus.changedUris != null) {
        compat.putParcelableArrayList(
                "changed-uris",
                new ArrayList<>(jobStatus.changedUris));
        compat.putStringArrayList(
                "changed-authorities",
                new ArrayList<>(jobStatus.changedAuthorities));
    }

    compat.putBundle("transient-extras", job.getTransientExtras());

    out.attribute(null, "data", Base64.encodeToString(parcelableToByteArray(compat), Base64.DEFAULT));
    out.endTag(null, XML_TAG_COMPAT);
}
项目:JobSchedulerCompat    文件:XmlUtils.java   
public static final void writeMapXml(Map val, XmlSerializer out) throws XmlPullParserException, IOException {
    if (val == null) {
        return;
    }

    Set s = val.entrySet();
    Iterator i = s.iterator();

    while (i.hasNext()) {
        Map.Entry e = (Map.Entry) i.next();
        writeValueXml(e.getValue(), (String) e.getKey(), out);
    }
}
项目:microMathematics    文件:TextFragment.java   
@Override
public boolean onStartWriteXmlTag(XmlSerializer serializer, String key) throws Exception
{
    super.onStartWriteXmlTag(serializer, key);
    if (getBaseType().toString().equalsIgnoreCase(serializer.getName()))
    {
        parameters.writeToXml(serializer);
    }
    return false;
}
项目:microMathematics    文件:TextProperties.java   
public void writeToXml(XmlSerializer serializer) throws Exception
{
    if (textStyle != DEFAULT_TEXT_STYLE)
    {
        serializer.attribute(FormulaList.XML_NS, XML_PROP_TEXT_STYLE,
                textStyle.toString().toLowerCase(Locale.ENGLISH));
    }
    if (numbering != DEFAULT_NUMBERING)
    {
        serializer.attribute(FormulaList.XML_NS, XML_PROP_NUMBERING, String.valueOf(numbering));
    }
}
项目:microMathematics    文件:TermField.java   
/**
 * XML interface: procedure returns string that contains XML representation of this term
 */
public void writeToXml(XmlSerializer serializer) throws Exception
{
    if (!isTerm())
    {
        serializer
                .attribute(FormulaList.XML_NS, FormulaList.XML_PROP_TEXT, isEmptyOrAutoContent() ? "" : getText());
    }
    else
    {
        serializer.attribute(FormulaList.XML_NS, FormulaList.XML_PROP_CODE, term.getTermCode());
        term.writeToXml(serializer, getTermKey());
    }
}
项目:container    文件:VUserManagerService.java   
private void writeUserListLocked() {
    FileOutputStream fos = null;
    AtomicFile userListFile = new AtomicFile(mUserListFile);
    try {
        fos = userListFile.startWrite();
        final BufferedOutputStream bos = new BufferedOutputStream(fos);

        // XmlSerializer serializer = XmlUtils.serializerInstance();
        final XmlSerializer serializer = new FastXmlSerializer();
        serializer.setOutput(bos, "utf-8");
        serializer.startDocument(null, true);
        serializer.setFeature("http://xmlpull.org/v1/doc/features.html#indent-output", true);

        serializer.startTag(null, TAG_USERS);
        serializer.attribute(null, ATTR_NEXT_SERIAL_NO, Integer.toString(mNextSerialNumber));
        serializer.attribute(null, ATTR_USER_VERSION, Integer.toString(mUserVersion));

        for (int i = 0; i < mUsers.size(); i++) {
            VUserInfo user = mUsers.valueAt(i);
            serializer.startTag(null, TAG_USER);
            serializer.attribute(null, ATTR_ID, Integer.toString(user.id));
            serializer.endTag(null, TAG_USER);
        }

        serializer.endTag(null, TAG_USERS);

        serializer.endDocument();
        userListFile.finishWrite(fos);
    } catch (Exception e) {
        userListFile.failWrite(fos);
        VLog.e(LOG_TAG, "Error writing user list");
    }
}
项目:TPlayer    文件:FastXmlSerializer.java   
public XmlSerializer attribute(String namespace, String name, String value) throws IOException,
        IllegalArgumentException, IllegalStateException {
    append(' ');
    if (namespace != null) {
        append(namespace);
        append(':');
    }
    append(name);
    append("=\"");

    escapeAndAppendString(value);
    append('"');
    mLineStart = false;
    return this;
}
项目:microMathematics    文件:LineProperties.java   
public void writeToXml(XmlSerializer serializer) throws Exception
{
    serializer.attribute(FormulaList.XML_NS, XML_PROP_COLOR, String.format("#%08X", color));
    serializer.attribute(FormulaList.XML_NS, XML_PROP_WIDTH, String.valueOf(width));
    serializer.attribute(FormulaList.XML_NS, XML_PROP_LINESTYLE, lineStyle.toString().toLowerCase(Locale.ENGLISH));
    serializer.attribute(FormulaList.XML_NS, XML_PROP_SHAPETYPE, shapeType.toString().toLowerCase(Locale.ENGLISH));
    serializer.attribute(FormulaList.XML_NS, XML_PROP_SHAPESIZE, String.valueOf(shapeSize));
}
项目:AndroidApktool    文件:ResFlagsAttr.java   
@Override
protected void serializeBody(XmlSerializer serializer, ResResource res)
        throws AndrolibException, IOException {
    for (int i = 0; i < mItems.length; i++) {
        FlagItem item = mItems[i];

        serializer.startTag(null, "flag");
        serializer.attribute(null, "name", item.getValue());
        serializer.attribute(null, "value",
                String.format("0x%08x", item.flag));
        serializer.endTag(null, "flag");
    }
}