It looks like you are exploding (fragmenting) each element of your xml into a separate feature, rather than flattening them.
If you inspect the features just before the writer do you have 20 of them, or just 4?
It looks like you are exploding (fragmenting) each element of your xml into a separate feature, rather than flattening them.
If you inspect the features just before the writer do you have 20 of them, or just 4?
Like i said, i'm new to FME, so i'm not yet comfortable with the lingo. Does this photo help?
Like i said, i'm new to FME, so i'm not yet comfortable with the lingo. Does this photo help?
Ideally you could post a fragment of your xml structure, on the xml reader itself the parameters of interest are 'elements to match' and 'flatten options', but without knowing the structure of the xml it's hard to make recommendations.
Ideally you could post a fragment of your xml structure, on the xml reader itself the parameters of interest are 'elements to match' and 'flatten options', but without knowing the structure of the xml it's hard to make recommendations.
Here's a what i typed into "elements to match"
and here is a sample of my XML file
What you want in your elements to match is simply "log"
Enable flattening and you should end up with one feature per log, with the date, time and channel attributes you want.
What you want in your elements to match is simply "log"
Enable flattening and you should end up with one feature per log, with the date, time and channel attributes you want.
Awesome! It worked! thank you very much. There's only one more problem, sometimes the XML files are formated this way with no indenting:
When i run these files, i get the following errors;
What you want in your elements to match is simply "log"
Enable flattening and you should end up with one feature per log, with the date, time and channel attributes you want.
The XML parser should parse XML documents regardless of whether it has indentations or not. I don't think that missing indentations causes the error.
According to the error message you have posted, there seems to be an invalid character in the line 43. I guess that the encoding declaration in the XML header may be missing or may not match the actual encoding of the XML documentation.
Check if the XML header (the first row of the document) matches the actual encoding.
The XML parser should parse XML documents regardless of whether it has indentations or not. I don't think that missing indentations causes the error.
According to the error message you have posted, there seems to be an invalid character in the line 43. I guess that the encoding declaration in the XML header may be missing or may not match the actual encoding of the XML documentation.
Check if the XML header (the first row of the document) matches the actual encoding.
everything matches. I have a degree symbol in line 43 (for both types of XML files), and it seems to not like it in the above "non-indented" XML file
everything matches. I have a degree symbol in line 43 (for both types of XML files), and it seems to not like it in the above "non-indented" XML file
Can you share a sample XML file that reproduces the error?
Can you share a sample XML file that reproduces the error?
Issue File.txti had to upload as text file
What you want in your elements to match is simply "log"
Enable flattening and you should end up with one feature per log, with the date, time and channel attributes you want.
Thanks for sharing the sample XML file.
The error is caused by that the XML document has been created with ANSI encoding (non-standard for XML), whereas the XML declaration doesn't contain a correct encoding attribute.
Try specifying the correct encoding explicitly in the XML declaration (the first row), as in:
<?xml version="1.0" encoding="ISO-8859-1"?>
or
<?xml version="1.0" encoding="windows-1252"?>
See also here: How XML deals with different character sets
Awesome! It worked! thank you very much. There's only one more problem, sometimes the XML files are formated this way with no indenting:
When i run these files, i get the following errors;
Thanks for sharing the sample XML file.
The error is caused by that the XML document has been created with ANSI encoding (non-standard for XML), whereas the XML declaration doesn't contain a correct encoding attribute.
Try specifying the correct encoding explicitly in the XML declaration (the first row), as in:
<?xml version="1.0" encoding="ISO-8859-1"?>
or
<?xml version="1.0" encoding="windows-1252"?>
See also here: How XML deals with different character sets
Thanks for sharing the sample XML file.
The error is caused by that the XML document has been created with ANSI encoding (non-standard for XML), whereas the XML declaration doesn't contain a correct encoding attribute.
Try specifying the correct encoding explicitly in the XML declaration (the first row), as in:
<?xml version="1.0" encoding="ISO-8859-1"?>
or
<?xml version="1.0" encoding="windows-1252"?>
See also here: How XML deals with different character sets
The first row is exactly the same for the files that I do not have any issues with?
Also, i'll be working with thousands of files, is there a way to change this declaration within FME?
What you want in your elements to match is simply "log"
Enable flattening and you should end up with one feature per log, with the date, time and channel attributes you want.
I guess that the files you were able to read without error 1] don't contain any invalid characters like the degrees symbol fortunately, or 2] are created with UTF-8 encoding.
Anyway, for the files raising the error, a possible workaround is:
- Use a Text File reader to read the entire document at once with specifying the correct encoding.
- Change the encoding to UTF-8 (XML standard) with the AttributeEncoder.
- Parse and flatten the XML with the XMLFragmenter.
I guess that the files you were able to read without error [1] don't contain any invalid characters like the degrees symbol fortunately, or [2] are created with UTF-8 encoding.
Anyway, for the files raising the error, a possible workaround is:
- Use a Text File reader to read the entire document at once with specifying the correct encoding.
- Change the encoding to UTF-8 (XML standard) with the AttributeEncoder.
- Parse and flatten the XML with the XMLFragmenter.
This did not work either. It's odd because the other files have a degree symbol as well and it works just fine.
I guess that the files you were able to read without error [1] don't contain any invalid characters like the degrees symbol fortunately, or [2] are created with UTF-8 encoding.
Anyway, for the files raising the error, a possible workaround is:
- Use a Text File reader to read the entire document at once with specifying the correct encoding.
- Change the encoding to UTF-8 (XML standard) with the AttributeEncoder.
- Parse and flatten the XML with the XMLFragmenter.
Do you mind sending me a template with a CSV writter? I've been at this all day and still cant figure it out.
This did not work either. It's odd because the other files have a degree symbol as well and it works just fine.
What error appeared?
I guess that the files you were able to read without error [1] don't contain any invalid characters like the degrees symbol fortunately, or [2] are created with UTF-8 encoding.
Anyway, for the files raising the error, a possible workaround is:
- Use a Text File reader to read the entire document at once with specifying the correct encoding.
- Change the encoding to UTF-8 (XML standard) with the AttributeEncoder.
- Parse and flatten the XML with the XMLFragmenter.
Learned something new today, thanks!