[Solved] XLST – Copy XML tag and replace attribute value [closed]

XSLT based solution. Input XML <config> <connection port=”4404″ type=”tcp”> <selection name=”test-mode” enabled=”true”/> </connection> <connection port=”4405″ type=”tcp”> <selection name=”test-mode” enabled=”true”/> </connection> <connection port=”4406″ type=”tcp”> <selection name=”test-mode” enabled=”true”/> </connection> <option> <maxNumberOfDownloads>10</maxNumberOfDownloads> </option> </config> XSLT <?xml version=”1.0″?> <xsl:stylesheet version=”1.0″ xmlns:xsl=”http://www.w3.org/1999/XSL/Transform”> <xsl:output method=”xml” encoding=”utf-8″ indent=”yes” omit-xml-declaration=”yes”/> <xsl:strip-space elements=”*”/> <xsl:template match=”@*|node()”> <xsl:copy> <xsl:apply-templates select=”@*|node()”/> </xsl:copy> </xsl:template> <xsl:template match=”connection[@port]”> <xsl:copy> <xsl:apply-templates … Read more

[Solved] Android – Blocks in XML

I would suggest you to use MaterialLeanBack library. You will get a sample example in the code for understanding. Usage In your layout <com.github.florent37.materialleanback.MaterialLeanBack android:id=”@+id/materialLeanBack” android:layout_width=”match_parent” android:layout_height=”match_parent” app:mlb_background=”@color/background” app:mlb_lineSpacing=”30dp” app:mlb_paddingBottom=”30dp” app:mlb_paddingLeft=”30dp” app:mlb_paddingRight=”30dp” app:mlb_paddingTop=”40dp” app:mlb_titleColor=”@android:color/white” /> Requires compile ‘com.github.florent37:materialleanback:1.0.0@aar’ compile ‘com.android.support:cardview-v7:22.2.1’ compile ‘com.android.support:recyclerview-v7:22.2.1’ compile ‘com.nineoldandroids:library:2.4.0’ 0 solved Android – Blocks in XML

[Solved] How to debug “Error parsing XML: mismatched tag”?

You are forgot to close the “com.whatsapp.preference.WaPreference” tag at two places. <?xml version=”1.0″ encoding=”utf-8″?> <PreferenceScreen android:title=”@string/GB_Mods” xmlns:android=”http://schemas.android.com/apk/res/android” xmlns:cmwmobile=”http://schemas.android.com/apk/res/com.whatsapp”> <PreferenceCategory android:title=”HPWhatsApp 4.0″ android:key=”cat_wa”> <com.whatsapp.preference.WaPreference android:icon=”@drawable/ic_preguntas” android:title=”HPWhatsApp WEB” android:key=”settings_faq” /> <com.whatsapp.preference.WaPreference android:icon=”@drawable/ic_actualizaciones” android:title=”@string/updatess” android:key=”updates_key” /> <!– start <com.whatsapp.preference.WaPreference> –> <com.whatsapp.preference.WaPreference android:icon=”@drawable/ic_Thanks” android:title=”Donar” android:summary=”Donar al desarrollador” > <intent android:action=”android.intent.action.VIEW” android:data=”https://paypal.me/Hectorc4rp” /> <!– close your </com.whatsapp.preference.WaPreference> here –> </com.whatsapp.preference.WaPreference> … Read more

[Solved] Update xml node data, how [duplicate]

Try my solution, string xml = @”<categories> <category> <id>1</id> <name>Computer</name> <description>Information tech.</description> <active>False</active> </category> <category> <id>2</id> <name>Cate1</name> <description>MMukh</description> <active>True</active> </category> </categories>”; XDocument xDoc = XDocument.Parse(xml); int id = 1; var items = xDoc.XPathSelectElement(“//category[id=” + id + “]”) .Elements() .ToDictionary(e => e.Name.LocalName, e => (string)e); if (items != null) { // display these fields to the … Read more

[Solved] set response encoding from XML

Try setting the encoding to the encoding from the code page 1252. The example below uses a simple service to serve the file, and setting the encoding to UTF-8 shows the same problem you have; setting it to the correct encoding works. public class StackOverflow_7044842 { const string xml = @”<ajax-response> <response> <item> <number></number> <xxx>Não … Read more

[Solved] How to sort easily a XML file in C#? [closed]

This might work for you var xml = new XmlDocument(); xml.LoadXml(“<colors>” + “<green>150</green>” + “<red>18</red>” + “<blue>920</blue>” + “<orange>80</orange>” + “<purple>77</purple>” + “</colors>”); var lst = new Dictionary<string,int>(); foreach (XmlNode n in xml[“colors”].ChildNodes) lst.Add(n.Name, int.Parse(n.InnerText)); var sb = new StringBuilder(); foreach (KeyValuePair<string, int> n in lst.OrderBy(kvp => kvp.Value)) sb.AppendFormat(“#define {0} {1} // <{0}>\n”, n.Key, n.Value); … Read more

[Solved] Java translator [closed]

So, the first thing you want to decide is which technology you want to choose. If you want to use Java I would recommend building a rest service with spring. Takes about 5 minutes with those two guides: Rest Web Service: https://spring.io/guides/gs/rest-service/ Rest Client: https://spring.io/guides/gs/consuming-rest/ IDE: Springt Tool Suite Just follow the instruction! Your task … Read more

[Solved] Group Similar nodes in XML using XLST

This is a pretty straightforward grouping problem. If you’re limited to XSLT 1.0, you need to use Muenchian Grouping. If you’re using XSLT 2.0+, you can use xsl:for-each-group. Examples… XSLT 1.0 <xsl:stylesheet version=”1.0″ xmlns:xsl=”http://www.w3.org/1999/XSL/Transform”> <xsl:output indent=”yes”/> <xsl:strip-space elements=”*”/> <xsl:key name=”class” match=”text” use=”substring-before(substring-after(normalize-space(@class), ‘ ‘),’ ‘)”/> <!–identity template–> <xsl:template match=”@*|node()”> <xsl:copy> <xsl:apply-templates select=”@*|node()”/> </xsl:copy> </xsl:template> <xsl:template … Read more

[Solved] XSLT – XSD files – Where to find the schema.xsd file – Please suggest

You can find the XML Schema for Schemas here. However, you probably do not need it unless you’re trying to validate an XSD (as opposed to validating an XML document instance with against an XSD). See also: xmlns, xmlns:xsi, xsi:schemaLocation, and targetNamespace? How to link XML to XSD using schemaLocation or noNamespaceSchemaLocation? Must an XML … Read more

[Solved] Property Feed for Website [closed]

Rightmove doesn’t ‘automatically’ populate its listings. Agents upload their properties to Rightmove in one of two ways: 1) Directly – using the agent website, RMPlus 2) Using the Rightmove ADF The ADF uses feeds provided by – surprise surprise – feed providers!! The biggest feed that Rightmove handle is from Vebra. I think the files … Read more

[Solved] I’m making weightSum but it can’t be sorted

add android:layout_gravity=”center_vertical” to both your ImageView and your Button, that will give you the alignment you depicted in your image. <LinearLayout android:layout_width=”match_parent” android:layout_height=”wrap_content” android:orientation=”horizontal” android:weightSum=”100″ > <ImageView android:layout_width=”fill_parent” android:layout_height=”wrap_content” android:layout_gravity=”center_vertical” android:layout_weight=”80″ android:gravity=”right” android:src=”https://stackoverflow.com/questions/25706451/@drawable/image” /> <Button android:id=”@+id/blah” android:layout_width=”fill_parent” android:layout_height=”wrap_content” android:layout_gravity=”center_vertical” android:layout_weight=”20″ android:gravity=”left” android:text=”Blah blah blah blah” android:textSize=”15sp” /> </LinearLayout> Also you didn’t set the height for … Read more

[Solved] How can I register beans from Spring XML file at runtime?

Thanks to comment of cheffe where he links to another question/answer, I’ve came to the following solution: @Autowired GenericApplicationContext context; private void loadBeans(String beansXml) { XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader(context); xmlReader.setValidationMode(XmlBeanDefinitionReader.VALIDATION_XSD); xmlReader.loadBeanDefinitions(new InputSource(new StringReader(beansXml))); } The problem seems to be the creation of the new GenericApplicationContext. It looks like the beans are only in this … Read more

[Solved] Building class to dezerialize from this? can’t get it to work

You probably have an encoding issue with your code. The following works using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Xml; using System.Xml.Linq; using System.Globalization; namespace ConsoleApplication3 { class Program1 { const string URL = “https://www.sciencedaily.com/rss/top/technology.xml”; static void Main(string[] args) { XDocument doc = XDocument.Load(URL); List<Item> items = doc.Descendants(“item”).Select(x => new Item() { title … Read more

[Solved] php explode on xml file

If what you are looking for is a way to cleanup the corrupt XML file, you can just add the string that gets missing when the explode is run. It is all a bit hackish, but it works. $file=”/Users/jasenburkett/Sites/jobsark/feed.xml”; $data = file_get_contents($file); $split = “</JobSearchResults>”; // Split on this $parts = explode($split, $data); // Make … Read more