Skip to main content

Hi,

Although, I have worked with transformers but I am fully new to XMLs.

I have an XML input file, but, unlike other XMLs, when I open this xml in notepad++, its as good as a text file only. Its not parsed ad segmented. Although, I tried some transformers, but didn't work. Once these XMLs are written, I would like to split it in 50 attributes in each file. Anyone with the solution !!

I'm unclear the situation. Could you please explain about "its as good as a text file only" in more detail? If you could post a part of the actual text data (full or partial), it would help us to understand the situation exactly.


Hi Takashi,

This XML in not indented as such.

I need to read the XML and split it.


Basically it looks like a normal XML document, but is missing the XML header:

<?xml version="1.0" ?>

Firstly, try validating the document with the XMLValidator transformer (Validation Type: Syntax Only). If no error, you can then read it with the XML reader or some XML*** transformers.


Basically it looks like a normal XML document, but is missing the XML header:

<?xml version="1.0" ?>

Firstly, try validating the document with the XMLValidator transformer (Validation Type: Syntax Only). If no error, you can then read it with the XML reader or some XML*** transformers.

For XML documents, indentations are not essential. If you want to convert it to a document containing indentations, consider using the XMLFormatter transformer (Formatting Type: Pretty-Print XML).


For XML documents, indentations are not essential. If you want to convert it to a document containing indentations, consider using the XMLFormatter transformer (Formatting Type: Pretty-Print XML).

Actually, i had not taken the header in my screenshot, it contains that.

I had already tried using XML formatter, Validator but, when i use XMLFormatter, it creates lists and many other attributes and I am confused which one to take in the "Attribute with XML Text". Now also it is giving me the same issue.


For example, if you consider the "TTSACTION" element as a feature type and also consider its descendant elements as feature attributes, you can generate an XML reader feature type called "TTSACTION" when adding the XML reader to the workspace, with this parameters setting.

Then, check the "Enable Flattening" so that the descendant elements will be extracted as feature attributes.

This configuration way is called "Feature Paths". Although there are many ways to read XML documents, I think this is the most elemental way and a good starting point. See also this article: Reading XML - Simple Approach using Feature Paths


@takashiThat is exactly what I tried with TTS_INPUT and now with TTS_ACTION, but the xml validator is still not validating the xml.id3-add-test.zip


The XMLValidator just determines whether the XML document is valid or not. If it detects an error, the document cannot be parsed anyway. However, the XML you attached was valid and I was able to read it with the XML reader with the "Feature Paths" configuration. How did you set the XML reader?


@dewan For any XML reading, I would strongly recommend using FME 2016. We have added a new Tree control within the elements to match parameter that lets you preview the xml structure and select the elements you want to become feature types. This way you don't need to preview the data in an XML editor and compose the elements to match parameter yourself which can be tricky.


Reply