Jump to content

xml create dinamically questions


faustf
 Share

Recommended Posts

hi guys

i must create   dinamically  a  xml   i  have  a  format

$_XML_item_insert = '< ? Xml version = "1.0" encoding = "utf-8"?> ' & _
        '< AddFixedPriceItemRequest xmlns = "urn: ebay: API: eBLBaseComponents">' & _
        '<ErrorLanguage>' & $aSiteID[4] & '</ErrorLanguage>' & _
        '<WarningLevel>' & 'Alta' & '</??WarningLevel>' & _
        '<Item>' & _
        '<Nazione>' &  $aSiteID[4] & '</Country>' & _
        '<Valuta>' & $valuta_money & '</valuta>' & _
        '<Description><! [CDATA ['& $sHTML_Raw &'NWT]]>' & _
        '<DispatchTimeMax>' & $iLTimeDispatch & '</DispatchTimeMax>' & _
        '<ListingDuration>' & $sLDay_ok & ' </ListingDuration>  ' & _
        '<ListingType> ' & $sbidtype & '    </ListingType>  ' & _
        '<PaymentMethods>  PayPal</PaymentMethods>' & _
        '<PayPalEmailAddress>    ' & $sPaypalMail& '</ PayPalEmailAddress> ' & _
        '<PostalCode>  ' & $postalcode & '  < / PostalCode> ' & _
        '<PrimaryCategory>' & _
        '<IDCategoria>  ' & $IDcategory & '</IDCategoria>   ' & _
        '</PrimaryCategory>' & _
        '<Titolo>  ' & $titolo & '  </title>' & _
        '<PictureDetails>' & _
        '<PictureURL>' & 'http : / / i12.ebayimg.com / 03 / i / 04 / 8a / 5f / a1_1_sbl.JPG' & '</PictureURL> ' & _
        '<PictureURL>' & 'http : / / i22.ebayimg.com / 01 / i / 04 / 8E/53 / 69_1_sbl.JPG' & '</PictureURL>' & _
        '<PictureURL>' & 'http : / / i4.ebayimg.ebay.com / 01 / i / 000 / 77 / 3c / d88f_1_sbl.JPG' & '</PictureURL>' & _
        '</PictureDetails>' & _

i just insert a variable   but   in part pictureurl   i must insert   many  or less (depend )  foto  i  select   and insert foto  and url formatted in array  ,  the  question  is:

  how  is possible insert for inside xml ?????

i can do  in this mode ?

'</PictureDetails>' & _

for  ....... to  .....

next

        '</PictureDetails>' & _

???

or  i must  use  temporary txt and  with filread  compose a xml ?

 

 

Edited by faustf
Link to comment
Share on other sites

First of all, your xml structure is broken mulitple places. Normally i would advise you to load the XML structure into something like "Microsoft.XMLDOM", process data with it and export the xml via the .XML property. This way you'll ensure the structure is correct.

But if you wish to just do it quick and dirty i suggest something like this:

$_XML = '< ? Xml version = "1.0" encoding = "utf-8"?> ' & _
        '< AddFixedPriceItemRequest xmlns = "urn: ebay: API: eBLBaseComponents">' & _
        '<ErrorLanguage>' & 0 & '</ErrorLanguage>' & _
        '<WarningLevel>' & 'Alta' & '</??WarningLevel>' & _
        '<Item>' & _
        '<Nazione>' &  0 & '</Country>' & _
        '<Valuta>' & 0 & '</valuta>' & _
        '<Description><! [CDATA ['& 0 &'NWT]]>' & _
        '<DispatchTimeMax>' & 0 & '</DispatchTimeMax>' & _
        '<ListingDuration>' & 0 & ' </ListingDuration>  ' & _
        '<ListingType> ' & 0 & '    </ListingType>  ' & _
        '<PaymentMethods>  PayPal</PaymentMethods>' & _
        '<PayPalEmailAddress>    ' & 0& '</ PayPalEmailAddress> ' & _
        '<PostalCode>  ' & 0 & '  < / PostalCode> ' & _
        '<PrimaryCategory>' & _
        '<IDCategoria>  ' & 0 & '</IDCategoria>   ' & _
        '</PrimaryCategory>' & _
        '<Titolo>  ' & 0 & '  </title>' & _
        '<PictureDetails>'
Dim $aArray = ["http : / / i12.ebayimg.com / 03 / i / 04 / 8a / 5f / a1_1_sbl.JPG", "http : / / i22.ebayimg.com / 01 / i / 04 / 8E/53 / 69_1_sbl.JPG", "http : / / i4.ebayimg.ebay.com / 01 / i / 000 / 77 / 3c / d88f_1_sbl.JPG"]
For $sItem In $aArray
    $_XML &= '<PictureURL>' & $sItem & '</PictureURL>'
Next
$_XML &= '</PictureDetails>'

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...