PDA

View Full Version : Generating a form from XML


Cyber-Drugs
01-11-2006, 11:07 PM
Hey guys,

I have the following XML Structure:

<?xml version="1.0" encoding="iso-8859-1" ?>
- <data>
- <InspectorCat>
<ID>1</ID>
<Name>Name</Name>
<Value>Workstation 9000</Value>
</InspectorCat>
- <InspectorCat>
<ID>2</ID>
<Name>Manufacturer</Name>
<Value>Dell</Value>
</InspectorCat>
</data>

I want it to display like this:


Name [Workstation 9000]
Manufacturer [Dell]

Where the text in square brackets are textboxes, and each entry is played directly beneath the previous one.

Can somebody point me in the rigth direction please?

Cheers. :)

Gibberish
01-12-2006, 12:03 AM
Is the XML all you have created? Any actionscript?

Are you wanting to do it all in actionscript or use an XML Connector?

Cyber-Drugs
01-12-2006, 11:58 AM
I have a flash application I am slowly developing and this is one of the additional functions I need to add.

I have no actionScript set up yet to convert this yet as I am unsure how to do so. Any help would be appreciated, with either ActionScript or an XML Connector, whichever is better recommended.

Cheers. :)

skjc
01-12-2006, 12:05 PM
hi,

yes it is pretty straightforward but your xml is not well structured.

you have text nodes that have a relationship with text nodes - better to have the element node relating to the text node or include attributes.

<root>
<equipment>
<name>workstation9000</name>
<manufacturer>dell</manufacturer>
</equipment>
<equipment>
.
.
.

</root>

or

<name eqpt="workstation 9000" /> etc.

i prefer the former as it much easier to traverse and better structured.

Cyber-Drugs
01-12-2006, 12:29 PM
Thanks for the update with the XML Structure, I will alter mine to match accordingly.

I now still need to know how to create text and textboxes.

I am thinking possibly making a textarea box, setting it to display HTML and writing the contents of it as HTML, would this work?

skjc
01-12-2006, 12:50 PM
your xml structure should reflect the structure of your 'real life' work. Read about xml: http://www.w3schools.com/xml/default.asp

forget the html - there are lots of tutorials on traversing and displaying xml in flash - just do a search (there are prolly some on here).

Cyber-Drugs
01-12-2006, 01:19 PM
I have read all the docs on w3c in regards to XML quite a few months ago, it doesn't help me with my flash problem, which is the reason I made this thread, to find a solution to my flash problem.

Anyone else able to help me out?

skjc
01-12-2006, 01:55 PM
as is said there are tutorials on here

http://www.actionscript.org/tutorials/intermediate/XML/index.shtml

hth