Newbie questions on creating XML

Hi there,

I need to transform XLS to a certain XML-schema.
Unfortunately I´m not really familiar with xml at all, but it looks like EDT could do this job for me.
Currently I am stuck at two points:
1st.: I need to create a node that contains a space in the node-name. EDT converts spaces to hyphens and I have not manages to escape this by now.
2nd: Referring to the sample I receive I need to add attributes to the root node - but found no way to archive this so far.
Thank you so much for any advice in advance.

Spaces are not allowed in XML node names, by the XML standard.

If you really want to break the standard perhaps you could read the XML file back in as plain text and use a Replace transform to turn underscores into spaces? Then write it back out as plain text.


Hi Andy,

thank you so much for this swift reply.
Unfortunately the schema requires me to use spaces as well as colons. (Colons seem to be working - just a warning is shown.)
I will use the plaintext replace.
In regards of the root node.
In my example it currently looks like this - so I´m trying to reproduce it as good as possible:

<?xml version="1.0" encoding="UTF-8"?>

I managed to add these attributes to all other nodes so far, but not to the root.
Sorry for this dumb questions.

Sorry, misread that second question. There is currently no away to directly add attributes to the root XML node. But you could read the XML file back in as plain text and use a Replace transform to add the attributes. Then write it back out as plain text.

That should work if there are underscores in the data. Otherwise you might need to use a regex Replace.

Thank you for this great support.
Yes I will do so - this has already been an option I planned to use if there is no other way.
I will probably run into some more questions as I have to complete the conversion by Monday :upside_down_face:

1 Like

I´m stuck with a new question: I need to create “empty” nodes with just attributes in them.
If the node has no “value” EDT does not attach the attributes to it. As soon as I enter any value it works. Can I get this working somehow - or will I have to use a plaintext replace afterwards as well and replace my “> <” with “><”?
Thank you in advance.

It is on the wishlist to have an option to output empty nodes in XML or JSON. Until then you will have to use Replace.

Okay, thank you!
Will use Replace.

Hi Andy,

its urgent - could you help?
I thought I got it finally all working as I was able to create all XMLs needed, but now I uploaded them to the system I created them for - and they all fail because the order of the nodes seem to be important…
Certainly I sorted my rows but in the end the nested nodes and the ones with even more children in them get sorted after the ones without children or less children.
Can I use somehow a plaintext reorder to solve this?
I found no transform so far that could do this job for me - and manual reordering is no option, as we are talking about 2000+ files.
Thank you in advance,

I found a way… plaintext → transpose → reorder cols → transpose :slight_smile:

Glad you sort it. I’m not sure I have ever heard or XML depending on the order of the nodes.

I just learned it could be important in some cases. Found one possible explanation: “XML node order can matter is where an application is using a streaming parser. Having dependent elements in the expected order can allow the application to be significantly more efficient processing the XML data”
I guess this applies to the system I need to deliver.
Is there any chance EDT could take care of the node order in XMLs in future versions?
My workaround works now - but its very static and if I get more or less lines in an XML it will require a new transform every time.

Your quote just says that the XML can be a bit faster to parse in a particular order in some situations. But it should be able to input it in any order, even if it takes slightly longer.

What software are you exporting the XML to?

I have overcome some of the XML limitations of EDT by getting as much of possible done with EDT and then using XSLT to get the rest of the way. XSLT is a W3C standard language for transforming XML to XML (and other formats such as HTML, plain text, etc.). All kinds of transformations are possible with XSLT including converting elements to attributes, sorting, filtering, adding namespaces, etc. If you can post a before/example sample, I can post some XSLT code.

That would be great thanks. XSLT is something we hope to investigate in future.