How to reference a local XML Schema file correctly?

Add one more slash after file:// in the value of xsi:schemaLocation. (You have two; you need three. Think protocol://host/path where protocol is ‘file’ and host is empty here, yielding three slashes in a row.) You can also eliminate the double slashes along the path. I believe that the double slashes help with file systems that … Read more

How to parse XML using vba

Thanks for the pointers. I don’t know, whether this is the best approach to the problem or not, but here is how I got it to work. I referenced the Microsoft XML, v2.6 dll in my VBA, and then the following code snippet, gives me the required values Dim objXML As MSXML2.DOMDocument Set objXML = … Read more

XML to CSV Using XSLT

Here is a version with configurable parameters that you can set programmatically: <xsl:stylesheet version=”1.0″ xmlns:xsl=”http://www.w3.org/1999/XSL/Transform”> <xsl:output method=”text” encoding=”utf-8″ /> <xsl:param name=”delim” select=”‘,'” /> <xsl:param name=”quote” select=”‘&quot;'” /> <xsl:param name=”break” select=”‘&#xA;'” /> <xsl:template match=”https://stackoverflow.com/”> <xsl:apply-templates select=”projects/project” /> </xsl:template> <xsl:template match=”project”> <xsl:apply-templates /> <xsl:if test=”following-sibling::*”> <xsl:value-of select=”$break” /> </xsl:if> </xsl:template> <xsl:template match=”*”> <!– remove normalize-space() if you … Read more

XPath contains(text(),’some string’) doesn’t work when used with node with more than one Text subnode

The <Comment> tag contains two text nodes and two <br> nodes as children. Your xpath expression was //*[contains(text(),’ABC’)] To break this down, * is a selector that matches any element (i.e. tag) — it returns a node-set. The [] are a conditional that operates on each individual node in that node set. It matches if … Read more

Declaring a custom android UI element using XML

The Android Developer Guide has a section called Building Custom Components. Unfortunately, the discussion of XML attributes only covers declaring the control inside the layout file and not actually handling the values inside the class initialisation. The steps are as follows: 1. Declare attributes in values\attrs.xml <?xml version=”1.0″ encoding=”utf-8″?> <resources> <declare-styleable name=”MyCustomView”> <attr name=”android:text”/> <attr … Read more

How to link XML to XSD using schemaLocation or noNamespaceSchemaLocation?

How to link an XSD to an XML document depends upon whether the XML document is using namespaces or not… Without namespaces Use xsi:noNamespaceSchemaLocation to provide a hint as to the XSD to be used: XML <root xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xsi:noNamespaceSchemaLocation=”example.xsd”> <!– … –> </root> XSD <xsd:schema xmlns:xsd=”http://www.w3.org/2001/XMLSchema”> <xsd:element name=”root”> <!– … –> </xsd:element> </xsd:schema> With namespaces … Read more

How to parse XML in Bash?

This is really just an explaination of Yuzem’s answer, but I didn’t feel like this much editing should be done to someone else, and comments don’t allow formatting, so… rdom () { local IFS=\> ; read -d \< E C ;} Let’s call that “read_dom” instead of “rdom”, space it out a bit and use … Read more

What are invalid characters in XML

OK, let’s separate the question of the characters that: aren’t valid at all in any XML document. need to be escaped. The answer provided by @dolmen in “https://stackoverflow.com/questions/730133/invalid-characters-in-xml/5110103#5110103” is still valid but needs to be updated with the XML 1.1 specification. 1. Invalid characters The characters described here are all the characters that are allowed … Read more