XmlDocument_CreateRootElement omits target scheme
Question

Hi all,

i need to create a XML root element which looks like this

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:udt="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100" elementFormDefault="qualified" version="100.D16B">

When i use the XmlDocument_CreateRootElement action from the xml extension and set the name attribute to xs:schema followed by adding the additional attributes i get the following result.

<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns:udt="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100" elementFormDefault="qualified" version="100.D16B">

For some reason the xs target schema gets ommited. Does anyone know how i can get the desired result ? (preferring a solution without writing an extension :-)

Thank you,

Stefan

I ended now up creating an Alternative Action for XmlDocument_CreateRootElement including prefix and namespaceUri. Here ist the Code


XmlDocument doc = ssXmlDocument as XmlDocument;

XmlElement root = doc.CreateElement(ssPrefix, ssName, ssNamespaceUri);

doc.AppendChild(root);

if(!String.IsNullOrEmpty(ssInnerText))

{

  root.InnerText = ssInnerText;

}

ssXmlElement = root;

Hello @Stefan Weber 

Good to see you already have a work around of your own! 

I had been researching a bit this evening, so just to share - This post posed a similar question as yours. As suggested there by Afonso Carvalho, one possible workaround may be to implement a post processing logic where for e.g. you replace "schema" with "xs:schema".

Then there are other options suggested on that thread as well. So hope in all, you now have a few options at your disposal.

Regards,

AJ

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.