Ask a Question related to Macromedia Exchange Dreamweaver Extensions, Design and Development.
-
nickj123 #1
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
-
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... -
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... -
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... -
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. ... -
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... -
rprevost #2
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



Reply With Quote

