Page 1 of 1

XML single tag

Posted: Tue Dec 24, 2013 9:57 am
by kennyapril
I am parsing an XML document using XML input stage but only open and close tags can be parsed into records and single tags appear as tags for the null records.how do I see null in place of <Faxno/>.....

Please let me know if any changes need to be applied

Posted: Wed Dec 25, 2013 10:45 am
by eostic
Put /text() at the end of the string in the Description property.

Posted: Fri Jan 03, 2014 7:57 am
by kennyapril
I used /text() in the description and it worked fine when used external source as input giving the file location but when I replaced the external source stage with original file using sequential file changing the property from file path to XML file in XML input stage... the records are not getting parsed.

I see below warnings

XML input document parsing failed. Reason: Xalan fatal error (publicId: , systemId: , line: 1, column: 513): Invalid character (Unicode: 0x0)


XML input document parsing failed. Reason: Xalan fatal error (publicId: , systemId: , line: 1, column: 3): There are more end tags than start tags

XML input document parsing failed. Reason: Xalan fatal error (publicId: , systemId: , line: 1, column: 1): Invalid document structure


also FYI when opened the file which I gave as source. it opens in an Internet explorer as XML.

Please suggest me if I need to do any changes

Posted: Fri Jan 03, 2014 8:04 am
by eostic
You have the answer. You should only be using external Source Stage and pass as url (radio button in the stage) when reading xml documents from disk.

Ernie

Posted: Wed Jan 08, 2014 5:22 pm
by kennyapril
But in my situation I cannot use only external source as after parsing this XML. I need to read the CLOB field directly from a table.

Now after increasing the APT_MAX_DELIMITED_SIZE and using the sequential file as input I got rid of all the warnings and I can view the XML also in Sequential file but when parsing I see only one warning now..

XML_Input,0: Warning: CLOB.XML_Input: XML input document parsing failed. Reason: Xalan fatal error (publicId: , systemId: , line: 348, column: 31): Expected an element name

Please suggest me if I can do anything to get rid of this warning and get the parsed records.

Posted: Wed Jan 08, 2014 10:21 pm
by eostic
If it works with External Source and not with the Sequential Stage, then your xml Stage is probably just fine....the Sequential Stage is trashing the xml.....because there are likely some special characters, stray CRLFs, or other things that are "noise" for xml, but might lead the Sequential Stage astray.

If you are going to be reading from a database, great! Use that for your testing. Put the documents into a database and then use a proper Connector as your source Stage.

Ernie

Posted: Thu Jan 09, 2014 11:01 am
by kennyapril
I will try using table as input. thank you very much for the input.

Posted: Thu Jan 09, 2014 11:29 am
by kennyapril
Yes Ernie, as you said the issue is with the data in the columns when used a sequential file. Now I used the tables directly as source and it works fine.

Thanks again for all the information:)

Posted: Thu Jan 09, 2014 12:51 pm
by eostic
Great! The reason is that the sequential stage is looking for consistent records -- which it usually has. XML, on the other hand, is anything but consistent....odd characters, CRLFs, LFs, CR's, etc. can appear anywhere in the document --- xml parsers ignore all of that..... but the sequential stage isn't easily configured to handle such things, and may unexpectedly parse your xml into more than one row --- thus killing the downstream xml Stage that expects a "whole" document.

Ernie