Page 1 of 1

XML Parsing

Posted: Sat Mar 08, 2008 11:02 am
by prasanna2100
HI All,
I have a DB2 table ,where one of the column is a XML file .
I have to read the column and parse it to get the value.

suggestions please


Thanks in advance
PrasannaKumar

Posted: Sat Mar 08, 2008 11:47 am
by chulett
Read the column from the table and pass it to an XML Input stage for parsing. Mark the source column as an XML Document and supply the correct XPath expressions.

Posted: Sun Mar 09, 2008 5:30 pm
by eostic
...it's also worth noting that the XML stages support the concept of "pass thru"... meaning that any other "non-xml" column whose name exists on the input link and also the output link (but with no xpath syntax in the Description property) will be "passed - thru" the Stage without incident. So you can parse the one column and the others just come along for the ride....

Ernie

Posted: Sun Mar 09, 2008 5:31 pm
by eostic
...it's also worth noting that the XML stages support the concept of "pass thru"... meaning that any other "non-xml" column whose name exists on the input link and also the output link (but with no xpath syntax in the Description property) will be "passed - thru" the Stage without incident. So you can parse the one column and the others just come along for the ride....

Ernie

Posted: Mon Mar 31, 2008 5:51 pm
by prasanna2100
Hi,
When i try to parse a XML file ,Which is a Column in my DB2 Table
by providing the XPath in the XML InputStage , iam getting an error


'XML_Input_10,0: Warning: xmltest1.XML_Input_10: Xalan warning (publicId: , systemId: , line: 0, column: 0): An exception occurred! Type:RuntimeException, Message:Warning: The primary document entity could not be opened. Id=TransactionDetails.xsd'

Please advice.

Thanks in advance

Posted: Mon Mar 31, 2008 6:45 pm
by eostic
Take a look at the document closely...it probably has a SchemaLocation or xsi:noNameSpaceSchemaLocation= attribute inside the header. This is the xml schema for the document....the stage is looking for it. Is the document in the database table already validated? If so, just pass the column string into a Transformer before the XMLStage and use some string functions to remove the attribute entirely.

Ernie

Posted: Mon Mar 31, 2008 10:24 pm
by dsdoubt
How can we parse the data based on Schema?
If we have a XML schema and is there a way to reject the records which doest fall under given schema

Posted: Tue Apr 01, 2008 10:53 am
by eostic
A good discussion...probably should be a new thread....but the XML Schema can be used to bring in meta data for a given document (you can import a schema or an xml instance document itself to garner column names).... and then afterwards, you have an option to use the XML Schema to perform in-line validation.....

Ernie