Yet another XML namespace trouble

How would I let Xojo write XML file with this namespace here:

xmlns=“urn:oasis:names:tc:xliff:document:2.0”

When using the following code:

root = document.AppendChild(document.CreateElement(“urn:oasis:names:tc:xliff:document:2.0”,“xliff”))

Then result XML will be:

That is a good question
I’ve been looking into XLIFF 2.0 as well - possibly as an export type of locale files so XLIFF enabled tools can do localizations - not JUST Lingua
I’ve not spent enough time on it to have an answer for you :frowning:

I am a little bit worried that its a limitation or bug in the Xojo XML implementation that namespaces like that cannot be created.

Hmmm

  dim x as new XmlDocument
  dim root as xmlnode
  
  root = x.AppendChild(x.CreateElement("urn:oasis:names:tc:xliff:document:2.0","xliff"))
  
  dim s as string = x.ToString
  
  break

when I look at s it contains

<?xml version="1.0" encoding="UTF-8"?><xliff xmlns="urn:oasis:names:tc:xliff:document:2.0"/>

This matches the XLIFF samples I’ve created by hand that all verify using the OKAPI online validator at http://okapi-lynx.appspot.com/validation which validate XLIFF 2

So at what point does it loose the namespace like in my case ? Must be then when I save it to file ?

As far ar I can see then the namespace gets lost on the pretty print transform:

Dim prettyXML As String = xmlDoc.Transform(kPrettyPrintXSL)

Björn did you ever figure out a way to use the kPrettyPrintXSL transform but retain the namespace you wanted? I just ran into this same issue and thought I’d ask before going down the path of not using the xsl transform.