Access DOM attribute with XML namespace on Freemarker template - freemarker

I have the following XML.
<n:wmi xmlns:inventory="http://www.example.com/XMLSchema/mp/v1/item/ItemInventory.xsd" >
<items processMode="INCREMENTAL">
<item partnerItemId="SM-290754-US">
<action>UPDATE</action>
<inventory:availability code="AC" onHandQty="124" />
</item>
</items>
I want to access the "code" attribute in Freemarker template. Following is my freemarker template.
I tried the following templates. But none of them are working.
<#ftl ns_prefixes={"inventory":"http://www.example.com/XMLSchema/mp/v1/item/ItemInventory.xsd"}>${item["inventory:availability[#code]"]}
and
<#ftl ns_prefixes={"inventory":"http://www.example.com/XMLSchema/mp/v1/item/ItemInventory.xsd"}>${item["inventory:availability.#code"]}

I did some more investigation. The correct xpath will be
${item["inventory:availability/#code"]}

Related

How to set a default values in multi select dynamically using magento 2 UI Component

I tried to set a default value in staticly.
below code is working fine.
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="default" xsi:type="string">1,5,6</item>
</item>
</argument>
I need to set a default value dynamically in UI component.
Have any idea about that?
I need to set a default value dynamically in UI component.

How to remove required field in checkout

How to change the required field to an optional field on the checkout page that can be enabled and disabled from the backend like a middle name?
Add this code in the checkout_index_index.xml to remove the required entry at the respective item name. For example, I have removed the required for first name.
<item name="firstname" xsi:type="array">
<item name="validation" xsi:type="array">
<item name="required-entry" xsi:type="boolean">false</item>
</item>
</item>

Modifying apk's language

I am trying to modify the language of an apk. I changed all the strings. the app has 2 languages chinese and english. I was able to change the values of chinese to arabic language. But the issue is I dont know from where I can modify the selection text. Now if I choose chinese it will change to arabic. But the selection still says chinese and english.
Language selection
Now I have found some clues but I am not good at coding so I need help.
I found this code 'bg_language_text_unfocsed.xml':
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_focused="true">
<bitmap
android:src="#ref/0x7f070068" />
</item>
<item
android:state_focused="false">
<shape>
<stroke
android:width="dimension(1073741873)"
android:color="#ref/0x7f05009a" />
</shape>
</item>
</selector>

Maven-pdf-plugin: How to include nested items in pdf?

I'm generating a pdf document from my maven site documentation using the maven-pdf-plugin. The documentation is written in Markdown.
Unfortunately the generated document does not include nested <item> tags.
For example, I have the the following content in my site.xml:
<menu name="Documentation">
<item name="Sweets" href="sweets/sweets.html" collapse="true">
<item name="Chocolate" href="sweets/chocolate.html"/>
<item name="Bublegum" href="sweets/bublegum.html"/>
<item name="Marzipan" href="sweets/marzipan.html"/>
</item>
</menu>
In the resulting pdf I have the contents of sweets.html, but not the content of all the sub items.
I also tried using a pdf.xml file with the following content included:
<toc name="Table of Contents" depth="4">
<item name="Sweets" ref="sweets/sweets.md">
<item name="Chocolate" ref="sweets/chocolate.md"/>
<item name="Bublegum" ref="sweets/bublegum.md"/>
<item name="Marzipan" ref="sweets/marzipan.md"/>
</item>
</toc>
Which gave me the same result.
Looking at the document model reference, it should be possible to nest <item> tags.
What am I doing wrong?
Here is some additional information:
Maven: 3.3.1
maven-pdf-plugin: 1.2
doxia-module-markdown: 1.6
Using maven-pdf-plugin Version 1.3 fixed the problem.

xpath internal link parsing

I have got a soap response from a webservice where it looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<Body>
<multiref id="1">
<cpuclock>2300</cpuclock>
<memoryComponent>
<item href="#2"/>
<item href="#3"/>
</memoryComponent>
</multiref>
<multiref id="2" type="ns2:MemoryComponent">
<type>RAM</type>
<quantity>2048</quantity>
</multiref>
<multiref id="3" type="ns3:MemoryComponent">
<type>RAM</type>
<quantity>1024</quantity>
</multiref>
</Body>
What I am trying to achieve is to recover the memoryComponent elements.
Since I am using the XMLUtil of VBScript/QTP, I've been trying to workaround using XPATH (by predicates). Ends-with is not supported by my QTP framework version.
Any suggestions?
TIA!
I've found a way to retrieve the elements I wanted.
Set childElements = XMLFile.ChildElementsByPath("/Body/multiref[contains(#type,'MemoryComponent')]")
This workaround suits my needs pretty well.
Thanks!

Resources