Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
select option
Mich
Have retrieve some values from a database into an XML file. I now need to get the values from the XML file into a drop down select in the DCT. Any ideas how to approach this would be greatly appreciated? Thanks
Find more posts tagged with
Comments
Migrateduser
You could use an inline in the DCT or callServer in FormAPI. With a Perl inline you can do something like this to parse your XML file:
use XML::XPath;
use XML::XPath::XMLParser;
...
if ( ! open( INPUT, "${xmlfile}" ))
{
#handle error
}
my ${content} = join( "", <INPUT> );
close( INPUT );
my ${xpath} = XML::XPath->new( xml => ${content}, );
my ${result} = "";
my ${nodeset} = ${xpath}->find( "/xpath/query" );
foreach my ${node} ( ${nodeset}->get_nodelist())
{
${result} .= XML::XPath::XMLParser::as_string( ${node} );
}
You probably want to wrap each item in the foreach with an option element, then wrap that with a substitution element.
Edited by john on 04/16/03 12:44 PM (server time).