Autore Topic: creazione file xml  (Letto 363 volte)

Offline blastersss

  • Nuovo arrivato
  • *
  • Post: 1
  • Respect: 0
    • Mostra profilo
  • Dispositivo Android:
    Oneplus One
  • Sistema operativo:
    Windows 7
creazione file xml
« il: 08 Novembre 2014, 20:31:16 CET »
0
Buonasera ragazzi,
vorrei sviluppare una applicazione che mi rigenera un file xml cambiando il percorso delle varie foto.

il file xml originale è:
Codice (XML): [Seleziona]
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xmml publish="1.0">
  <xmedia _id="f584ebd07e7542628e48da144ea9c412">
    <program _id="8cbbcaae48cb44bebefeea29d87e8559~1" _x="196" _y="191" _w="288" _h="384" _dir="C:\Documents and Settings\aaa\Desktop">
      <scene options="0x10" length="1" _id="1bf2618fd2ca43d99384fb8e5cc8832f" _name="Program Page  1">
        <window _designer="files" _fdismode="0" backcolor="0xFF000000" length="1" _id="e6e7893c415b4e4fa8400646d47958ee" left="49" top="0" options="0x48000020" width="192" height="384" _name="(1)File">
          <matter _id="de8f2eeaa45244c2b34c3167cd31e10d" _designer="picture" _source="macrì11_files\a.bmp" decoder="0x00504D42" _name="a.jpg">
            <effect enterid="0xFFFFFFFE" entertime="1000" leaveid="0xFFFFFFFD" leavetime="3000" delaytime="6000" options="0x00000001" />
            <source options="0x00000000" type="0x00000001">macrì11_files\a.bmp</source>
          </matter>
          <matter _id="d39755141a184514be56c471824bd4c2" _designer="picture" _source="macrì11_files\b.bmp" decoder="0x00504D42" _name="b.jpg">
            <effect enterid="0xFFFFFFFE" entertime="1000" leaveid="0xFFFFFFFD" leavetime="3000" delaytime="6000" options="0x00000001" />
            <source options="0x00000000" type="0x00000001">macrì11_files\b.bmp</source>
          </matter>
          <matter _id="0a855f17cac446099ab7bc859beb96e0" _designer="picture" _source="macrì11_files\c.bmp" decoder="0x00504D42" _name="c.jpg">
            <effect enterid="0xFFFFFFFE" entertime="1000" leaveid="0xFFFFFFFD" leavetime="3000" delaytime="6000" options="0x00000001" />
            <source options="0x00000000" type="0x00000001">macrì11_files\c.bmp</source>
          </matter>
          <matter _id="50c2ce5c817d4bf1b2bc560481441c27" _designer="picture" _source="macrì11_files\d.bmp" decoder="0x00504D42" _name="d.jpg">
            <effect enterid="0xFFFFFFFE" entertime="1000" leaveid="0xFFFFFFFD" leavetime="3000" delaytime="6000" options="0x00000001" />
            <source options="0x00000000" type="0x00000001">macrì11_files\d.bmp</source>
          </matter>
          <matter _id="9b89daf140844df49f45b5b17e4bb7fc" _designer="picture" _source="macrì11_files\e.bmp" decoder="0x00504D42" _name="e.jpg">
            <effect enterid="0xFFFFFFFE" entertime="1000" leaveid="0xFFFFFFFD" leavetime="3000" delaytime="6000" options="0x00000001" />
            <source options="0x00000000" type="0x00000001">macrì11_files\e.bmp</source>
          </matter>
          <matter _id="7ef5441e5e2b4c658323c513b4ea364e" _designer="picture" _source="macrì11_files\f.bmp" decoder="0x00504D42" _name="f.jpg">
            <effect enterid="0xFFFFFFFE" entertime="1000" leaveid="0xFFFFFFFD" leavetime="3000" delaytime="6000" options="0x00000001" />
            <source options="0x00000000" type="0x00000001">macrì11_files\f.bmp</source>
          </matter>
          <matter _id="378790c2bc3f4d6c91e4136714e49c3e" _designer="picture" _source="macrì11_files\g.bmp" decoder="0x00504D42" _name="g.jpg">
            <effect enterid="0xFFFFFFFE" entertime="1000" leaveid="0xFFFFFFFD" leavetime="3000" delaytime="6000" options="0x00000001" />
            <source options="0x00000000" type="0x00000001">macrì11_files\g.bmp</source>
          </matter>
          <matter _id="cf343843d6274d0b9d7fea7bec46a684" _designer="picture" _source="macrì11_files\h.bmp" decoder="0x00504D42" _name="h.jpg">
            <effect enterid="0xFFFFFFFE" entertime="1000" leaveid="0xFFFFFFFD" leavetime="3000" delaytime="6000" options="0x00000001" />
            <source options="0x00000000" type="0x00000001">macrì11_files\h.bmp</source>
          </matter>
          <matter _id="a15c82cacda9463eb69af30da41dde51" _designer="picture" _source="macrì11_files\i.bmp" decoder="0x00504D42" _name="i.jpg">
            <effect enterid="0xFFFFFFFE" entertime="1000" leaveid="0xFFFFFFFD" leavetime="3000" delaytime="6000" options="0x00000001" />
            <source options="0x00000000" type="0x00000001">macrì11_files\i.bmp</source>
          </matter>
          <matter _id="b7b8879a52b9451a9b74534deab09fb1" _designer="picture" _source="macrì11_files\l.bmp" decoder="0x00504D42" _name="l.jpg">
            <effect enterid="0xFFFFFFFE" entertime="1000" leaveid="0xFFFFFFFD" leavetime="3000" delaytime="6000" options="0x00000001" />
            <source options="0x00000000" type="0x00000001">macrì11_files\l.bmp</source>
          </matter>
          <matter _id="40dc37d2c0d74a348ccc2f443d55dda6" _designer="picture" _source="macrì11_files\m.bmp" decoder="0x00504D42" _name="m.jpg">
            <effect enterid="0xFFFFFFFE" entertime="1000" leaveid="0xFFFFFFFD" leavetime="3000" delaytime="6000" options="0x00000001" />
            <source options="0x00000000" type="0x00000001">macrì11_files\m.bmp</source>
          </matter>
          <matter _id="bb961ea5175d4486a384c5b2686d2db0" _designer="picture" _source="macrì11_files\n.bmp" decoder="0x00504D42" _name="n.jpg">
            <effect enterid="0xFFFFFFFE" entertime="1000" leaveid="0xFFFFFFFD" leavetime="3000" delaytime="6000" options="0x00000001" />
            <source options="0x00000000" type="0x00000001">macrì11_files\n.bmp</source>
          </matter>
          <matter _id="e6c6a9f655cb42e0a942035703c5e270" _designer="picture" _source="macrì11_files\o.bmp" decoder="0x00504D42" _name="o.jpg">
            <effect enterid="0xFFFFFFFE" entertime="1000" leaveid="0xFFFFFFFD" leavetime="3000" delaytime="6000" options="0x00000001" />
            <source options="0x00000000" type="0x00000001">macrì11_files\o.bmp</source>
          </matter>
          <matter _id="a09930bf8ace4f34b95a6013a413f2f4" _designer="picture" _source="macrì11_files\p.bmp" decoder="0x00504D42" _name="p.jpg">
            <effect enterid="0xFFFFFFFE" entertime="1000" leaveid="0xFFFFFFFD" leavetime="3000" delaytime="6000" options="0x00000001" />
            <source options="0x00000000" type="0x00000001">macrì11_files\p.bmp</source>
          </matter>
          <matter _id="577184ffff1142ffac7dff53ef3c3278" _designer="picture" _source="macrì11_files\q.bmp" decoder="0x00504D42" _name="q.jpg">
            <effect enterid="0xFFFFFFFE" entertime="1000" leaveid="0xFFFFFFFD" leavetime="3000" delaytime="6000" options="0x00000001" />
            <source options="0x00000000" type="0x00000001">macrì11_files\q.bmp</source>
          </matter>
          <matter _id="bf68fae8d7b049beb6346757ec2e3787" _designer="picture" _source="macrì11_files\r.bmp" decoder="0x00504D42" _name="r.jpg">
            <effect enterid="0xFFFFFFFE" entertime="1000" leaveid="0xFFFFFFFD" leavetime="3000" delaytime="6000" options="0x00000001" />
            <source options="0x00000000" type="0x00000001">macrì11_files\r.bmp</source>
          </matter>
          <matter _id="b1650da108b34c14b7e9091dca34b2dd" _designer="picture" _source="macrì11_files\s.bmp" decoder="0x00504D42" _name="s.jpg">
            <effect enterid="0xFFFFFFFE" entertime="1000" leaveid="0xFFFFFFFD" leavetime="3000" delaytime="6000" options="0x00000001" />
            <source options="0x00000000" type="0x00000001">macrì11_files\s.bmp</source>
          </matter>
          <matter _id="3f88058789c748f0855fa922d4b98547" _designer="picture" _source="macrì11_files\t.bmp" decoder="0x00504D42" _name="t.jpg">
            <effect enterid="0xFFFFFFFE" entertime="1000" leaveid="0xFFFFFFFD" leavetime="3000" delaytime="6000" options="0x00000001" />
            <source options="0x00000000" type="0x00000001">macrì11_files\t.bmp</source>
          </matter>
          <matter _id="d1bf2d46f84d47f1acfe0b4e0413bd46" _designer="picture" _source="macrì11_files\u.bmp" decoder="0x00504D42" _name="u.jpg">
            <effect enterid="0xFFFFFFFE" entertime="1000" leaveid="0xFFFFFFFD" leavetime="3000" delaytime="6000" options="0x00000001" />
            <source options="0x00000000" type="0x00000001">macrì11_files\u.bmp</source>
          </matter>
          <matter _id="6b8176aacf2f477ab253ea365bbdeafc" _designer="picture" _source="macrì11_files\v.bmp" decoder="0x00504D42" _name="v.jpg">
            <effect enterid="0xFFFFFFFE" entertime="1000" leaveid="0xFFFFFFFD" leavetime="3000" delaytime="6000" options="0x00000001" />
            <source options="0x00000000" type="0x00000001">macrì11_files\v.bmp</source>
          </matter>
          <matter _id="65ceede04c724166ab4ff465944bd7e5" _designer="picture" _source="macrì11_files\z.bmp" decoder="0x00504D42" _name="z.jpg">
            <effect enterid="0xFFFFFFFE" entertime="1000" leaveid="0xFFFFFFFD" leavetime="3000" delaytime="6000" options="0x00000001" />
            <source options="0x00000000" type="0x00000001">macrì11_files\z.bmp</source>
          </matter>
          <matter _id="17da4ab1747545a59b67f218963fe55f" _designer="picture" _source="macrì11_files\za.bmp" decoder="0x00504D42" _name="za.jpg">
            <effect enterid="0xFFFFFFFE" entertime="1000" leaveid="0xFFFFFFFD" leavetime="3000" delaytime="6000" options="0x00000001" />
            <source options="0x00000000" type="0x00000001">macrì11_files\za.bmp</source>
          </matter>
          <matter _id="2da42607fd0c43d68333fc1c2734ee81" _designer="picture" _source="macrì11_files\zb.bmp" decoder="0x00504D42" _name="zb.jpg">
            <effect enterid="0xFFFFFFFE" entertime="1000" leaveid="0xFFFFFFFD" leavetime="3000" delaytime="6000" options="0x00000001" />
            <source options="0x00000000" type="0x00000001">macrì11_files\zb.bmp</source>
          </matter>
          <matter _id="c98fba14aacf41f3994d6bce1f54e14f" _designer="picture" _source="macrì11_files\zc.bmp" decoder="0x00504D42" _name="zc.jpg">
            <effect enterid="0xFFFFFFFE" entertime="1000" leaveid="0xFFFFFFFD" leavetime="3000" delaytime="6000" options="0x00000001" />
            <source options="0x00000000" type="0x00000001">macrì11_files\zc.bmp</source>
          </matter>
          <matter _id="eb69d049c2f54ab5b134b6a38fb2da96" _designer="picture" _source="macrì11_files\zd.bmp" decoder="0x00504D42" _name="zd.jpg">
            <effect enterid="0xFFFFFFFE" entertime="1000" leaveid="0xFFFFFFFD" leavetime="3000" delaytime="6000" options="0x00000001" />
            <source options="0x00000000" type="0x00000001">macrì11_files\zd.bmp</source>
          </matter>
          <matter _id="0dde81cdc8e14fa19c42b8f1e3354afb" _designer="picture" _source="macrì11_files\ze.bmp" decoder="0x00504D42" _name="ze.jpg">
            <effect enterid="0xFFFFFFFE" entertime="1000" leaveid="0xFFFFFFFD" leavetime="3000" delaytime="6000" options="0x00000001" />
            <source options="0x00000000" type="0x00000001">macrì11_files\ze.bmp</source>
          </matter>
          <matter _id="7f4c82782726482f82490ae98dd31210" _designer="picture" _source="macrì11_files\zf.bmp" decoder="0x00504D42" _name="zf.jpg">
            <effect enterid="0xFFFFFFFE" entertime="1000" leaveid="0xFFFFFFFD" leavetime="3000" delaytime="6000" options="0x00000001" />
            <source options="0x00000000" type="0x00000001">macrì11_files\zf.bmp</source>
          </matter>
          <matter _id="9a1dec2d3e154fbf81fe207409495602" _designer="picture" _source="macrì11_files\zg.bmp" decoder="0x00504D42" _name="zg.jpg">
            <effect enterid="0xFFFFFFFE" entertime="1000" leaveid="0xFFFFFFFD" leavetime="3000" delaytime="6000" options="0x00000001" />
            <source options="0x00000000" type="0x00000001">macrì11_files\zg.bmp</source>
          </matter>
          <matter _id="8c742b7fdfb44944ad3b29c0a903a50d" _designer="picture" _source="macrì11_files\zh.bmp" decoder="0x00504D42" _name="zh.jpg">
            <effect enterid="0xFFFFFFFE" entertime="1000" leaveid="0xFFFFFFFD" leavetime="3000" delaytime="6000" options="0x00000001" />
            <source options="0x00000000" type="0x00000001">macrì11_files\zh.bmp</source>
          </matter>
          <matter _id="e3b0147da2944e24a73fc14221175cfd" _designer="picture" _source="macrì11_files\zi.bmp" decoder="0x00504D42" _name="zi.jpg">
            <effect enterid="0xFFFFFFFE" entertime="1000" leaveid="0xFFFFFFFD" leavetime="3000" delaytime="6000" options="0x00000001" />
            <source options="0x00000000" type="0x00000001">macrì11_files\zi.bmp</source>
          </matter>
          <matter _id="ee14877542e6466d94b5d2bdc367bf68" _designer="picture" _source="macrì11_files\zl.bmp" decoder="0x00504D42" _name="zl.jpg">
            <effect enterid="0xFFFFFFFE" entertime="1000" leaveid="0xFFFFFFFD" leavetime="3000" delaytime="6000" options="0x00000001" />
            <source options="0x00000000" type="0x00000001">macrì11_files\zl.bmp</source>
          </matter>
          <matter _id="fafd03e6115d4fa7b2b5f7eee619a0ac" _designer="picture" _source="macrì11_files\zm.bmp" decoder="0x00504D42" _name="zm.jpg">
            <effect enterid="0xFFFFFFFE" entertime="1000" leaveid="0xFFFFFFFD" leavetime="3000" delaytime="6000" options="0x00000001" />
            <source options="0x00000000" type="0x00000001">macrì11_files\zm.bmp</source>
          </matter>
          <matter _id="f15655866ce04d94b6b7d24d258cb5ce" _designer="picture" _source="macrì11_files\zn.bmp" decoder="0x00504D42" _name="zn.jpg">
            <effect enterid="0xFFFFFFFE" entertime="1000" leaveid="0xFFFFFFFD" leavetime="3000" delaytime="6000" options="0x00000001" />
            <source options="0x00000000" type="0x00000001">macrì11_files\zn.bmp</source>
          </matter>
          <matter _id="51a892a9228d4e0a86b1369e0ed8845e" _designer="picture" _source="macrì11_files\zo.bmp" decoder="0x00504D42" _name="zo.jpg">
            <effect enterid="0xFFFFFFFE" entertime="1000" leaveid="0xFFFFFFFD" leavetime="3000" delaytime="6000" options="0x00000001" />
            <source options="0x00000000" type="0x00000001">macrì11_files\zo.bmp</source>
          </matter>
          <matter _id="e7baed54f80544fe93b06a2837342026" _designer="picture" _source="macrì11_files\zq.bmp" decoder="0x00504D42" _name="zq.jpg">
            <effect enterid="0xFFFFFFFE" entertime="1000" leaveid="0xFFFFFFFD" leavetime="3000" delaytime="6000" options="0x00000001" />
            <source options="0x00000000" type="0x00000001">macrì11_files\zq.bmp</source>
          </matter>
          <matter _id="84815d9deb5e4ff69d96774f02c7d874" _designer="picture" _source="macrì11_files\zr.bmp" decoder="0x00504D42" _name="zr.jpg">
            <effect enterid="0xFFFFFFFE" entertime="1000" leaveid="0xFFFFFFFD" leavetime="3000" delaytime="6000" options="0x00000001" />
            <source options="0x00000000" type="0x00000001">macrì11_files\zr.bmp</source>
          </matter>
          <matter _id="8b574968e4614c6f85e725cbec7c955d" _designer="picture" _source="macrì11_files\zs.bmp" decoder="0x00504D42" _name="zs.jpg">
            <effect enterid="0xFFFFFFFE" entertime="1000" leaveid="0xFFFFFFFD" leavetime="3000" delaytime="6000" options="0x00000001" />
            <source options="0x00000000" type="0x00000001">macrì11_files\zs.bmp</source>
          </matter>
          <matter _id="2bba44b6a1d64f7886aafe77bd75a084" _designer="picture" _source="macrì11_files\zu.bmp" decoder="0x00504D42" _name="zu.jpg">
            <effect enterid="0xFFFFFFFE" entertime="1000" leaveid="0xFFFFFFFD" leavetime="3000" delaytime="6000" options="0x00000001" />
            <source options="0x00000000" type="0x00000001">macrì11_files\zu.bmp</source>
          </matter>
          <matter _id="815314454fa842f8944b4b902ff6c644" _designer="picture" _source="macrì11_files\zv.bmp" decoder="0x00504D42" _name="zv.jpg">
            <effect enterid="0xFFFFFFFE" entertime="1000" leaveid="0xFFFFFFFD" leavetime="3000" delaytime="6000" options="0x00000001" />
            <source options="0x00000000" type="0x00000001">macrì11_files\zv.bmp</source>
          </matter>
          <matter _id="04743451d44840b18aef5bd80b252e50" _designer="picture" _source="macrì11_files\zz.bmp" decoder="0x00504D42" _name="zz.jpg">
            <effect enterid="0xFFFFFFFE" entertime="1000" leaveid="0xFFFFFFFD" leavetime="3000" delaytime="6000" options="0x00000001" />
            <source options="0x00000000" type="0x00000001">macrì11_files\zz.bmp</source>
          </matter>
          <matter _id="c4404765776e45b5908576312985e701" _designer="picture" _source="macrì11_files\zza.bmp" decoder="0x00504D42" _name="zza.jpg">
            <effect enterid="0xFFFFFFFE" entertime="1000" leaveid="0xFFFFFFFD" leavetime="3000" delaytime="6000" options="0x00000001" />
            <source options="0x00000000" type="0x00000001">macrì11_files\zza.bmp</source>
          </matter>
          <matter _id="608028c19ee141e7935a6f09e0cd415c" _designer="picture" _source="macrì11_files\zzb.bmp" decoder="0x00504D42" _name="zzb.jpg">
            <effect enterid="0xFFFFFFFE" entertime="1000" leaveid="0xFFFFFFFD" leavetime="3000" delaytime="6000" options="0x00000001" />
            <source options="0x00000000" type="0x00000001">macrì11_files\zzb.bmp</source>
          </matter>
          <matter _id="11a8935358b7412c948f6f47e0f9ac4f" _designer="picture" _source="macrì11_files\zzc.bmp" decoder="0x00504D42" _name="zzc.jpg">
            <effect enterid="0xFFFFFFFE" entertime="1000" leaveid="0xFFFFFFFD" leavetime="3000" delaytime="6000" options="0x00000001" />
            <source options="0x00000000" type="0x00000001">macrì11_files\zzc.bmp</source>
          </matter>
          <matter _id="cc544c25251741bda7314471356a63a4" _designer="picture" _source="macrì11_files\zzd.bmp" decoder="0x00504D42" _name="zzd.jpg">
            <effect enterid="0xFFFFFFFE" entertime="1000" leaveid="0xFFFFFFFD" leavetime="3000" delaytime="6000" options="0x00000001" />
            <source options="0x00000000" type="0x00000001">macrì11_files\zzd.bmp</source>
          </matter>
          <matter _id="0481fe45148a406ba35e64a02a9fcccf" _designer="picture" _source="macrì11_files\zze.bmp" decoder="0x00504D42" _name="zze.jpg">
            <effect enterid="0xFFFFFFFE" entertime="1000" leaveid="0xFFFFFFFD" leavetime="3000" delaytime="6000" options="0x00000001" />
            <source options="0x00000000" type="0x00000001">macrì11_files\zze.bmp</source>
          </matter>
          <matter _id="5767c7a567ae47578f93782eaafc0313" _designer="picture" _source="macrì11_files\zzf.bmp" decoder="0x00504D42" _name="zzf.jpg">
            <effect enterid="0xFFFFFFFE" entertime="1000" leaveid="0xFFFFFFFD" leavetime="3000" delaytime="6000" options="0x00000001" />
            <source options="0x00000000" type="0x00000001">macrì11_files\zzf.bmp</source>
          </matter>
          <matter _id="90a1ce69a707401da80ffecbf22122b3" _designer="picture" _source="macrì11_files\zzg.bmp" decoder="0x00504D42" _name="zzg.jpg">
            <effect enterid="0xFFFFFFFE" entertime="1000" leaveid="0xFFFFFFFD" leavetime="3000" delaytime="6000" options="0x00000001" />
            <source options="0x00000000" type="0x00000001">macrì11_files\zzg.bmp</source>
          </matter>
        </window>
      </scene>
    </program>
  </xmedia>
</xmml>


utilizzando vari tutoria su internet sono arrivato alla conclusione che dovrei proseguire con questa soluzione:

Codice (Java): [Seleziona]
try {
                            FileOutputStream fos = new  FileOutputStream("userData.xml");
                            FileOutputStream fileos= getApplicationContext().openFileOutput(xmlFile, Context.MODE_PRIVATE);
                            XmlSerializer xmlSerializer = Xml.newSerializer();              
                            StringWriter writer = new StringWriter();
                            xmlSerializer.setOutput(writer);
                           
                            xmlSerializer.startDocument("UTF-8", true);
                            xmlSerializer.startTag("xmml publish", "1.0");
                            xmlSerializer.startTag("xmedia _id", "f584ebd07e7542628e48da144ea9c412");
                            xmlSerializer.startTag("program _id", "8cbbcaae48cb44bebefeea29d87e8559~1");
                           
                           
                           
                           
                       
                            xmlSerializer.endDocument();
                            xmlSerializer.flush();
                            String dataWrite = writer.toString();
                            fileos.write(dataWrite.getBytes());
                            fileos.close();
                        }


Ho un problema nella creazione del file xml.. come faccio ad inserire le righe tipo questa:
<program _id="8cbbcaae48cb44bebefeea29d87e8559~1" _x="196" _y="191" _w="288" _h="384" _dir="C:\Documents and Settings\CSA\Desktop">
che contengono più dati?
 

Grazie a tutti