Hi, i’m trying to generate an XML file, with a known structurem based on the data of an Excel table. I was able to convert the Excel data to XML using the Column to XML and XML Column Combiner nodes. iI was also able to create the XML file using the XML Writer Node.
Currently i have issues in these Nodes.
Column to XML: One of the columns of the XML has a Prefix defining it, with a xmlns and an URL. Whenever i try to create the XML Column with the prefix on it i get this error:
“Execute failed: org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 18; The preffix “DI_Misc” of the element “DI_Misc:DocType” is not declared”
Are there any suggestions on how to create this column ?
PS: I need to create this column to then combine it under the column that has the XMLNS and URL defined.
XML Column Combiner: The XML has a Default Naming Space (aka xmlns=“URL”). If i try and configure it as a “Custom Attribute” in the “XML Element Properties” the output created replicaticates the xmlns attribute to the combined columns but with no URL (aka )
PS: I thought about adding a prefix to all the combined columns, but then i get back to the other error i mentioned in this post.
I was able to figure out each of the 2 issues with a workaround.
I created the columns using “Column to XML” WITHOUT the prefix on their name. Then i combined the columns inside the one that had the Prefix and XMLNS defined. Afterwards I used the “STRING REPLACER” node on the combined columns to replace the name of the columns without the prefix to the name with prefix to finally convert this result back to XML using “String to XML Node”.
PS: Trying to create it as string with the prefix first and then transforming it to XML doesn’t work since the “String to XML” Node converts some entities (ie “<”) to their predefined values.
I used the same approach for this. I Created the XML with the XMLNS default naming space to then use “String Replacer” Node to replace the “xmlns=”“” extra values into “”.
PS: I’m not an expert in KNIME nor XML but as far as i understand this feature (replicating default naming spaces to the combined columns with empty URLs) is a bug and shouldn’t happen.