P
P
PhB932015-09-09 21:25:39
css
PhB93, 2015-09-09 21:25:39

How to parse xml using FTL?

There is an xml like this:

<ns1:vehicles modelId="201">
            <ns3:modelName>Acura CL</ns3:modelName>
          </ns1:vehicles>
          <ns1:vehicles modelId="202">
            <ns3:modelName>Acura EL</ns3:modelName>
          </ns1:vehicles>
          <ns1:vehicles modelId="203">
            <ns3:modelName>Acura Integra</ns3:modelName>
          </ns1:vehicles>

It is necessary to pull the data using the FTL template, I give the code of my template:
<#ftl ns_prefixes={
"ns1":"http://smev.gosuslugi.ru/rev120315",
"ns3"="urn://x-artefacts-it-ru/dob/poltava/inquiry-smev33/req-resp/1.0"
}/>
<#assign MAS = xml["//ns1:vehicles"]/>
  <listRefItems> 
    <error>
      <code>0</code>
      <message>operation completed</message>
   </error>
   <total>${MAS?size}</total>
   <items>
      <title>${itm["ns3:modelName"]?xml}</title>
      <isLeaf>true</isLeaf>
   </items>
    </#list>
</listRefItems>

But with this template, the data is pulled out as follows:
<ns1:vehicles>
            <ns3:modelName>Acura CL</ns3:modelName>
          </ns1:vehicles>

What about the modelId tag attribute? Is there any way to parse a tag attribute?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton, 2019-04-05
@Eridani

It was always interesting:
Why don't you fuck your designers for such layouts, cruelly kicking?
https://codepen.io/anon/pen/QPELBL

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question