Creating an XML document using namespaces in Java

There are a number of ways of doing this. Just a couple of examples: Using XOM import nu.xom.Document; import nu.xom.Element; public class XomTest { public static void main(String[] args) { XomTest xomTest = new XomTest(); xomTest.testXmlDocumentWithNamespaces(); } private void testXmlDocumentWithNamespaces() { Element root = new Element(“my:example”, “urn:example.namespace”); Document document = new Document(root); Element element = … Read more

C++, static vs. namespace vs. singleton

As noted, using global variables is generally bad engineering practice, unless absolutely needed of course (mapping hardware for example, but that doesn’t happen THAT often). Stashing everything in a class is something you would do in a Java-like language, but in C++ you don’t have to, and in fact using namespaces here is a superior … Read more

Modules vs. Namespaces: What is the correct way to organize a large typescript project?

tl;dr: Do not choose the past. Choose the future: Modules. In early drafts of the ES6 modules specification, there was an inline modules notion, which then has been eliminated in September 2013. However, this notion was already implemented by the TypeScript team, in 2012, with the first beta versions of the language: it was internal … Read more

Getting “Can’t find the drive. The drive called ‘IIS’ does not exist.”

The drive is provided by the WebAdministration module, so you need to install/import that module first. How you install the module depends on your actual system and whether you use GUI or PowerShell. On a Windows Server 2008 R2 for instance you’d install the module with the following PowerShell commands: Import-Module ServerManager Add-WindowsFeature Web-Scripting-Tools After … Read more

XSLT Transform XML with Namespaces

You need to provide a namespace prefix in your xslt for the elements you are transforming. For some reason (at least in a Java JAXP parser) you can’t simply declare a default namespace. This worked for me: <xsl:stylesheet version=”1.0″ xmlns:t=”http://www.test.com/” xmlns:xsl=”http://www.w3.org/1999/XSL/Transform” xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xmlns:xslFormatting=”urn:xslFormatting”> <xsl:output method=”html” indent=”no”/> <xsl:template match=”/t:ArrayOfBrokerage”> <xsl:for-each select=”t:Brokerage”> Test </xsl:for-each> </xsl:template> </xsl:stylesheet> This … Read more