Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Adobe Summit 2023 [19th to 23rd March, Las Vegas and Virtual] | Complete AEM Session & Lab list

How to select path from an XML data file?

Avatar

Level 2

I have an XML data file somewhat like the one below with up to five levels deep (variable). I want the user to be able to pick a path by navigating a tree (i.e. Canada/Alberta/Calgary) and have that path put into a data field. If they only navigate part way into the path (i.e. Mexico/Sonora) then that would go in the data field. I have some control of the structure of the XML as I am creating it from a CSV file.

Any examples or good advice that you can provide is greatly appreciated. I'm OK manipulating XML but am quite a newbie at PDF forms & Javascript.

<location>
    <country name="Canada">
        <prov-state name="British Columbia">
            <city name="Victoria" />
            <city name="Nanaimo" />
        </prov-state>
        <prov-state name="Alberta">
            <city name="Calgary" />
            <city name="Lethbridge" />
        </prov-state>
    </country>
    <country name="Mexico">
        <prov-state name="Sonora">
            <city name="Guaymas" />
        </prov-state>
    </country>
</location>

2 Replies

Avatar

Level 10

Not sure I follow ....are you going to give the user a visual representation of the XML and let them choose then you

will put the path into a field?

Paul

Avatar

Level 2

Hopefully something like that.

A visual representation like JavaScript menus would work however it doesn't have to be overly visual. Probably need to give some representation of the hierarchy in the XML file.