I have a form that make xml request, after that i recieve xml respond
that look like this:
<root>
<item>
<id>1</id>
<name>name</name>
<description>description</description>
</item>
<item>
<id>2</id>
<name>name</name>
<description>description</description>
</item>
</root>
Now I want to put this data in to the table and render it in to template. Further I want use separate element. For example user have to choose one of these elements and make order. As I understand to do this, i should parse this data using some library for example lxml, then covert it to the dictionary and than render to template, am i right or there is other way to do this? Thanks a lot.
Related
I am stuck on below,
I have set content type as XML in my proxy.
As below:
<parameter name="transport.jms.ContentType">
<rules xmlns="">
<jmsProperty>contentType</jmsProperty>
<default>application/xml</default>
</rules>
</parameter>
Sending below message into the queue which is correct one
<Data>
<name>abc</name>
<account>1212</account>
</Data>
But if any tag is missing in it as below. I dont want lose that message instead I want it to store in one special queue
<Data>
<name>abc
<account>1212</account>
Any guidance will be appreciated.Thanks
I'm working on a WiX installer using the Visual Studio 'Votive' integration.
I'm authoring a simple custom table using <CustomTable> and I want to place it in a separate file within a <Fragment>.
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<CustomTable Id="CustomActionData">
<Column Id="Id" Category="Identifier" PrimaryKey="yes" Type="int" Width="4" />
<Column Id="AssemblyFile" Category="Text" Type="string" PrimaryKey="no" />
<Column Id="TypeName" Category="Text" Type="string" PrimaryKey="no" />
<Row>
<Data Column="Id">1</Data>
<Data Column="AssemblyFile">MyAssembly.dll</Data>
<Data Column="TypeName">MyAssembly.TypeName</Data>
</Row>
</CustomTable>
</Fragment>
</Wix>
The trouble is, WiX/Votive doesn't include the fragment because nothing references it. There is no such thing as a <CustomTableRef>. <Fragment> is, however, a valid parent of <CustomTable>, so there must be a way of making WiX include it.
Any suggestions? How do I reference a custom table within a fragment?
Ideally there'd be a CustomTableRef but that doesn't exist. (Feel free to file a suggestion.) So you need another Element/ElementRef pair. Try Property/PropertyRef instead.
The way this works with WiX custom actions is that a compiler extension writes the custom table rows directly so there's no authoring that needs to be linked in.
I'm new to WSO2 Data Services Server and I trying to figure out how to get complex element types working correctly with the web scraper. Using the interface I seem to be able to define the object, but I'm not sure how to use it once it is defined. Below is the Data Service XML...
<data name="ComplexTypeExample">
<description>A Description</description>
<config id="GetPrices">
<property name="web_harvest_config">./samples/resources/GetPrices.xml</property>
</config>
<query id="getSonyPrices" useConfig="GetPrices">
<scraperVariable>priceInfoSony</scraperVariable>
<result element="CameraInfo" rowName="Record">
<element column="Pic" name="Pic" xsdType="string"/>
<element column="Desc" name="Desc" xsdType="string"/>
<element name="Inventory" namespace="">
<element name="Item" namespace="">
<element column="Grade" name="Grade" xsdType="string"/>
<element column="Price" name="Price" xsdType="string"/>
</element>
</element>
</result>
</query>
<operation name="getSonyPricesOperation">
<description>Gets prices of KM/Sony cameras</description>
<call-query href="getSonyPrices"/>
</operation>
</data>
What I am trying to do is figure out how to get the Inventory element to be an array of Item types. Something like this...
<Record>
<Pic>Camera.jpg</Pic>
<Desc>A camera made by some company</Desc>
<Inventory>
<Item>
<Grade>Good</Grade>
<Price>$200</Price>
</Item>
<Item>
<Grade>Not So Good</Grade>
<Price>$100</Price>
</Item>
<Item>
<Grade>Broken</Grade>
<Price>$10</Price>
</Item>
</Inventory>
</Record>
Can anyone provide some hints as to where I'm going wrong?
Looks like you have done your complex element mapping correctly according to your result set .. Are you having trouble scraping the values? If so you have to provide us with the scraping configuration, and also you have to write the xslt file also according to your complex elements.
Please refer the following guide for web scraping
I'm processing remote XML (by just providing URL to XSLT processor) and I can't make it "fetch" additional XML resources. I read similar questions here, but none of them seem like applicable here.
Here is excerpt of remote XML that is being processed:
...
<item>
<position>1</position>
<rec id="05a59ca2"/>
</item>
<item>
<position>2</position>
<rec id="48e7c3f1"/>
</item>
...
Now these id attributes can be used to refer remote XML source (http://some-server/id) where additional details about each record is stored, and I would like to be able to process them with same XSLT without using other tools, for convenience and simplicity.
So, can I process remote XML files with XSLT?
You can most certainly do this using the document function
example:
<xsl:variable name="url" select="concat('http://mysite.com/',$id)" />
<xsl:variable name="IDmeta" select="document($url)"/>
to test you can do
<xsl:copy-of select="$IDmeta"/>
to see what the format is
reference
http://www.w3schools.com/xsl/func_document.asp
Suppose I have some XML like this:
<section name="SampleSection">
<item name="ScoredItem1">
<attributes>
<scored data_type="boolean" value="true"/>
</attributes>
</item>
<item name="UnscoredItem1">
<attributes>
<scored data_type="boolean" value="false"/>
</attributes>
</item>
<item key="(3272fbb5:22)" name="ScoredItem2">
<attributes>
<scored data_type="boolean" value="true"/>
</attributes>
</item>
</section>
Now, I know, using XSLT, I can count the items that have a scored attribute like this:
<xsl:variable name="scoredItems" select="item/attributes/scored"/>
<xsl:value-of select="count($scoredItems)"/>
This will give me a value of 3, of course.
Suppose I only want to count those items for which scored is true. How do I do that using XSLT? (This should return a value of 2 for this example.
Do it like this:
<xsl:variable name="scoredItems"
select=
"item/attributes/scored[#value='true']"/>