Category Archives: Xml

PHP – Read and repair big invalid XML files

Questions: I have to read some quite heavy XML files (between 200 MB and 1 GB) that are, for some of them, invalid. Let me give you a small example : <?xml version=”1.0″ encoding=”UTF-8″?> <rss xmlns:g=”″ version=”2.0″> <item> <title>Some article</title> <g:material><ul><li>50 % Coton</li><li>50% Lyocell</li></g:material> </item> </rss> Obviously, there is a missing </ul> closing tag in… Read More »

Accessing XML DOM child nodes by name

Questions: I want to access the textContent property of an XML object in JavaScript. The root item has several children which also have some children themselves. To get the children on the first level I just iterate through the childNodes Array of the root element. But to get the values of the “grandchilds” I would… Read More »

Select all XML attributes in SQL

Questions: I have an XML value list contained in a SQL Table Field that looks like so: <valuelist xmlns=”” name=”VL_IncCompCondVL”> <li value=”BL” item=”BLOCKED” /> <li value=”NK” item=”NO KEY” /> <li value=”FL” item=”FLOODED” /> <li value=”TD” item=”TORN DOWN” /> <li value=”UL” item=”UNABLE TO LOCATE” /> </valuelist> I want to be able to create a temp SQL… Read More »

WebAPI OData $format to xml

Questions: for my WebAPI OData application, im trying to give my client (browser) the decision what format the data output should be. as $format is not implemented yet in WebAPI OData, im using Raghuramn’s example here: var queryParams = request.GetQueryNameValuePairs(); var dollarFormat = queryParams.Where(kvp => kvp.Key == “$format”).Select(kvp => kvp.Value).FirstOrDefault(); if (dollarFormat != null)… Read More »

Exception thrown during TypedArray#getTextArray()

Questions: This is my first time creating a custom view and I’m trying to populate it with entries via XML — in a manner similar to a Spinner. I’m obviously doing something wrong here, but I’ve styled my approach after the Spinner, so I fail to see what has gone wrong. To explain the intent… Read More »

How excel reads XML file?

Questions: I have researched a lot to convert an xml file to 2d array in a same way excel does trying to make same algorithm as excel does when you open an xml file in excel. <items> <item> <sku>abc 1</sku> <title>a book 1</title> <price>42 1</price> <attributes> <attribute> <name>Number of pages 1</name> <value>123 1</value> </attribute> <attribute>… Read More »

How can I deserialize heterogeneous child nodes into a collection, using XmlSerializer?

Questions: I’m using C#/.NET to deserialize a XML file that looks akin to this: <?xml version=”1.0″ encoding=”utf-8″ ?> <Books> <Book Title=”Animal Farm” > <Thing1>””</Thing1> <Thing2>””</Thing2> <Thing3>””</Thing3> … <ThingN>””</ThingN> </Book> … More Book nodes … </Books> My classes, for the deserialized XML, look like: [XmlRoot(“Books”)] public class BookList { // Other code removed for compactness. [XmlElement(“Book”)]… Read More »

check if xml file exists with XSLT 2.0, saxon9HE

Questions: I’d like to check, whether a file exists, with xslt 2.0. However, it’s not working. I’ve tried this: <xsl:choose> <xsl:when test=”doc(iri-to-uri(concat($currFolder, ‘/’, $currSubFolder, ‘/’, @href)))”> (The path is correct) however, this results in an error, when the file isnt there. and this: <xsl:choose> <xsl:when test=”doc-available(iri-to-uri(concat($currFolder, ‘/’, $currSubFolder, ‘/’, @href)))”> doesn’t work, it tells me… Read More »

Inconsistent XSD validation of nested elements using `<xs:any>`

Questions: I’m working on a tool to help a user author XHTML-ish documents which are similar in nature to JSP files. The documents are XML and can contain any well-formed tags in the XHTML namespace, and weaved between them are elements from my product’s namespace. Among other things, the tool validates the input using XSD.… Read More »

SQLXML Bulk loading an attribute into a single table

Questions: TLDR; I am attempting to use SQLXML Bulk Loader (4.0) to load XML that looks something like this; <?xml version = “1.0” encoding = “UTF-8”?> <CarSales> <Client> <ID >3</ID> <ClientName>John Smith3</ClientName> <Country name=”Colombia”/> </Client> <Client> <ID>7</ID> <ClientName>Slow Sid</ClientName> <Country name=”Bolivia”/> </Client> <Client> <ID>10</ID> <ClientName>Missing Town</ClientName> <Country name=”Argentina”/> </Client> </CarSales> I want the Country name… Read More »