Ask a Question related to Macromedia Exchange Dreamweaver Extensions, Design and Development.

  1. #1

    Default format xml data

    Grasping for straws here, a newbi to spry and xml. I am trying to display
    numbers from an xml file. I have a number ei. 25450 which I need to display as
    $25,450.00.

    Question #1 Do I format this in the xpath statement? Or do I add a xsl file??
    Below, please find a sample form the xml file. <Price> is the element I need to
    format. As

    Question #2 how do I get just the first jpg from the <Image> node, (order =
    ?1?). Is this a separate dataset?

    My xpath is var dstoys = new
    Spry.Data.XMLDataSet("../images/rvusa/database_export.xml",
    "Inventory/Dealer/Location/Units/Unit[Type ='Toy Hauler']");


    <Inventory>
    <Dealer>
    <ID>422</ID>
    <Name><![CDATA[client]]></Name>
    <Location>
    <ID>458</ID>
    <Address>11572 Road</Address>
    <City>Any Town</City>
    <State>WA</State>
    <ZipCode>98000</ZipCode>
    <Phone>123-123-1234</Phone>
    <Units>
    <Unit>
    <ID>482252</ID>
    <Type><![CDATA[Park Model]]></Type>
    <Condition><![CDATA[New]]></Condition>
    <Stock_Number><![CDATA[1865]]></Stock_Number>
    <Year><![CDATA[2008]]></Year>
    <Manufacturer><![CDATA[Kropf]]></Manufacturer>
    <Model><![CDATA[SESRLP]]></Model>
    <Length>36</Length>
    <MSRP>0</MSRP>
    <Price>61545</Price>
    <Sale_Price>0</Sale_Price>
    <Description><![CDATA[Large bathroom with walk-in laundry room.
    Front living room, nice entertainment center. All residential appliances, 8"
    I-beam chassis with full outriggers, 2x4 sidewall framing 16" on-center. 50
    year vinyl siding, fiberglass insulation R-22 in the roof, R-11 in the
    sidewalls and floor.]]></Description>
    <Chassis><![CDATA[]]></Chassis>
    <Engine_Manufacturer><![CDATA[]]></Engine_Manufacturer>
    <Engine_Model><![CDATA[]]></Engine_Model>
    <Fuel_Type><![CDATA[]]></Fuel_Type>
    <Interior_Color><![CDATA[Rustic]]></Interior_Color>
    <Exterior_Color><![CDATA[Tan]]></Exterior_Color>
    <Sleep_Capacity />
    <Water_Capacity />
    <Num_Air_Conditioners>1</Num_Air_Conditioners>
    <Mileage />
    <Trailer_Weight />
    <Num_Slideouts>0</Num_Slideouts>
    <VIN><![CDATA[]]></VIN>
    <Is_Special><![CDATA[False]]></Is_Special>
    <Is_Sold><![CDATA[False]]></Is_Sold>
    <Is_Consignment><![CDATA[False]]></Is_Consignment>
    <Is_New_Arrival><![CDATA[False]]></Is_New_Arrival>
    <Is_On_Deposit><![CDATA[False]]></Is_On_Deposit>
    <Is_On_order><![CDATA[False]]></Is_On_order>
    <Images>
    <Image
    order="1"><![CDATA[http://mydomain.com/images/482252_1.jpg]]></Image>
    <Image
    order="2"><![CDATA[http://mydomain.com/images/482252_2.jpg]]></Image>
    <Image
    order="3"><![CDATA[http://mydomain.com/images/482252_3.jpg]]></Image>
    <Image

    nickj123 Guest

  2. Similar Questions and Discussions

    1. Linking data, searching data, and format the data file
      I'm sorta new to flash and integrating data and components...I'm usu. an interface designer. I'm trying to link a combo box to a file doesn't...
    2. Data format question
      I have a webservice giving me some data out of my database, and based on a value in the dataset I need to set the font of that piece of data to a...
    3. extract data with csv format
      Hi.. could anyone tell me how do I have the data in csv format, so whenenver i click at the lick and dreamweaver page will save the file as csv to c...
    4. Format cfgrid data
      One of the fields I want to display in a cfgrid is a Social Security number. I want to mask it, and only show the last 4 digits. I.e. ...
    5. Data format and display
      Hello list, I have a table that contains this raw data: epr_procode | epr_tipo | epr_mes | epr_valor | zert_title...
  3. #2

    Default Re: format xml data

    This may be out of your control, and I'm no expert myself, but I think this xml
    sample isn't very well-formed. If you've created a javascript xml object, then
    you should be able to reference the specific child node by calling it by name.
    Check the Dreamweaver documentation for the appropriate call. Look for the
    Dreamweaver DOM. That might help some.

    XML is very unforgiving, so if any of it's structure isn't right, you may not
    get an error message to tell you what went wrong. I ended up parsing my xml
    file using javascript string object's functions to extract the nodes I needed.
    Evenutally, I ended up creating my own xml editor extension.

    Getting back to your xml, use only lowercase. Personally, I would use more
    attributes for parent nodes then nest the other nodes and close them off
    sooner. Then enter the price as an attribute of the stock item. When the price
    is extracted from the file to display to the user, format the display field as
    the propper currency type. You might also want to add the "currency" attribute
    to tell your formatter how to convert and display the price.

    <inventory>
    <item id="482252" stocknumber="1865" price="25450.00" currency="us">
    <dealer id="422" name="client" location="458">
    <address city="Any Town" state="WA" zip="98000" />
    </dealer>
    <description><![CDATA[Text goes here]></description>
    <engine>
    <manufacturer></manufacturer>
    <model></model>
    <fueltype></fueltype>
    <length></length>
    </engine.
    </item>
    <item id="">
    [another one]
    </item>
    </inventory>

    Hope this helps.

    rprevost Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139