javax.xml.bind.JAXBException Implementation of JAXB-API has not been found on module path or classpath

Add these dependencies into your pom/gradle: Gradle: compile(‘javax.xml.bind:jaxb-api:2.3.0’) compile(‘javax.activation:activation:1.1’) compile(‘org.glassfish.jaxb:jaxb-runtime:2.3.0’) Pom: <!– https://mvnrepository.com/artifact/javax.xml.bind/jaxb-api –> <dependency> <groupId>javax.xml.bind</groupId> <artifactId>jaxb-api</artifactId> <version>2.3.0-b170201.1204</version> </dependency> <!– https://mvnrepository.com/artifact/javax.activation/activation –> <dependency> <groupId>javax.activation</groupId> <artifactId>activation</artifactId> <version>1.1</version> </dependency> <!– https://mvnrepository.com/artifact/org.glassfish.jaxb/jaxb-runtime –> <dependency> <groupId>org.glassfish.jaxb</groupId> <artifactId>jaxb-runtime</artifactId> <version>2.3.0-b170127.1453</version> </dependency>

Parsing XML in Cocoa

Here’s how it works: There’s a class called NSXMLParser. It’s used to parse XML files. However, NSXMLParser is stupid. All it knows how to do is parse XML, but it doesn’t know what it’s supposed to do with the information it finds. Enter a delegate. A delegate is like a nanny. Since the XMLParser doesn’t … Read more

How to retrieve style attributes programmatically from styles.xml

It is possible to retrieve custom styles from styles.xml programmatically. Define some arbitrary style in styles.xml: <style name=”MyCustomStyle”> <item name=”android:textColor”>#efefef</item> <item name=”android:background”>#ffffff</item> <item name=”android:text”>This is my text</item> </style> Now, retrieve the styles like this // The attributes you want retrieved int[] attrs = {android.R.attr.textColor, android.R.attr.background, android.R.attr.text}; // Parse MyCustomStyle, using Context.obtainStyledAttributes() TypedArray ta = obtainStyledAttributes(R.style.MyCustomStyle, … Read more

How do you remove invalid hexadecimal characters from an XML-based data source prior to constructing an XmlReader or XPathDocument that uses the data?

It may not be perfect (emphasis added since people missing this disclaimer), but what I’ve done in that case is below. You can adjust to use with a stream. /// <summary> /// Removes control characters and other non-UTF-8 characters /// </summary> /// <param name=”inString”>The string to process</param> /// <returns>A string with no control characters or … Read more

Android – Change app Theme on onClick [duplicate]

Following blog can solve your problem: http://mrbool.com/how-to-change-the-layout-theme-of-an-android-application/25837 Copying the blog code for quick reference: Assuming that you already defined following three themes in the XML file R.style.FirstTheme, R.style.SecondTheme and R.style.ThirdTheme import android.app.Activity; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; public class ChangeThemeActivity extends Activity implements OnClickListener { /** Called when the activity is first created. */ … Read more

Convert Xml to Table SQL Server

This is the answer, hope it helps someone 🙂 First there are two variations on how the xml can be written: 1 <row> <IdInvernadero>8</IdInvernadero> <IdProducto>3</IdProducto> <IdCaracteristica1>8</IdCaracteristica1> <IdCaracteristica2>8</IdCaracteristica2> <Cantidad>25</Cantidad> <Folio>4568457</Folio> </row> <row> <IdInvernadero>3</IdInvernadero> <IdProducto>3</IdProducto> <IdCaracteristica1>1</IdCaracteristica1> <IdCaracteristica2>2</IdCaracteristica2> <Cantidad>72</Cantidad> <Folio>4568457</Folio> </row> Answer: SELECT Tbl.Col.value(‘IdInvernadero[1]’, ‘smallint’), Tbl.Col.value(‘IdProducto[1]’, ‘smallint’), Tbl.Col.value(‘IdCaracteristica1[1]’, ‘smallint’), Tbl.Col.value(‘IdCaracteristica2[1]’, ‘smallint’), Tbl.Col.value(‘Cantidad[1]’, ‘int’), Tbl.Col.value(‘Folio[1]’, ‘varchar(7)’) FROM @xml.nodes(‘//row’) Tbl(Col) … Read more

XPath: select text node

Having the following XML: <node>Text1<subnode/>text2</node> How do I select either the first or the second text node via XPath? Use: /node/text() This selects all text-node children of the top element (named “node”) of the XML document. /node/text()[1] This selects the first text-node child of the top element (named “node”) of the XML document. /node/text()[2] This … Read more

SVG rounded corner

Here is how you can create a rounded rectangle with SVG Path: <path d=”M100,100 h200 a20,20 0 0 1 20,20 v200 a20,20 0 0 1 -20,20 h-200 a20,20 0 0 1 -20,-20 v-200 a20,20 0 0 1 20,-20 z” /> Explanation m100,100: move to point(100,100) h200: draw a 200px horizontal line from where we are … Read more