You are not logged in.
Announcement
Unanswered posts
|
Pages: 1

Hi,
I want to load xml in contextLoad
tContextLoad needs key and value
My xml is like this :
<config>
<HOSTNAME>toto</HOSTNAME>
<DATABASE>titi</DATABASE>
...
</config>
i configure my columns like this
loop : "/config/*"
key : "name()"
value : "node()"
but when i execute this, i have exception :
Exception in component tFileInputXML_1
org.dom4j.XPathException: Exception occurred evaluting XPath: The result of the XPath expression is not a Node. It was: HOSTNAME of type: java.lang.String
at org.dom4j.xpath.DefaultXPath.selectSingleNode(DefaultXPath.java:169)
please help me,
or how to convert this with key and value columns ?
cdt,
arnaud
Offline
Hello
or how to convert this with key and value columns ?
Why don't you use a tFileXMLInput to extract data from your xml file?
Best regards
shong
Offline
Hello Dosy07
Please upload some screenshots of your job with detailed information.
Best regards
shong
Offline

offcourse,
and the exception :
Starting job Chargement_context_config at 08:46 27/11/2008.
Exception in component tFileInputXML_1
org.dom4j.XPathException: Exception occurred evaluting XPath: The result of the XPath expression is not a Node. It was: HOSTNAME of type: java.lang.String
at org.dom4j.xpath.DefaultXPath.selectSingleNode(DefaultXPath.java:169)
at reprise_action_nova_20081124.chargement_context_config_0_1.Chargement_context_config.tFileInputXML_1Process(Chargement_context_config.java:458)
at reprise_action_nova_20081124.chargement_context_config_0_1.Chargement_context_config.runJobInTOS(Chargement_context_config.java:694)
at reprise_action_nova_20081124.chargement_context_config_0_1.Chargement_context_config.main(Chargement_context_config.java:608)
Job Chargement_context_config ended at 08:46 27/11/2008. [exit code=1]
Offline
Hello
"name" ,"node" are not node in your xml file. Your job should be like as the screenshot shows.
please download the user documentation and see the use case.
Best regards,
shong
Offline

To use a tcontextLoad
i need key and value columns
My xml is like this
<config>
<mybase>
<hostname>titi<hostname>
<database>toto</database>
<port>10000</port
</mybase>
</config>
i need to this output to use tContextLoad :
key|value
hostname;titi
database;toto
port;10000
then the xpath is
loop : "/config/mybase/*"
key : "name()"
value : "node()"
if i configure this
key : "node()"
value : "node()"
its work :
key|value
titi;titi
toto;toto
10000;10000
but i dont have the name of node for the context name.
if i used name() instead node(), i have exception :
org.dom4j.XPathException :
hostname of type: java.lang.String
If i use your solution, i dont have key/value columns to use it in tcontextLoad
In french :
pour utiliser le tcontextLoad
j'ai besoin de 2 colonnes key/value
mon fichier xml ressemble à ceci (je ne suis pas propriétaire du fichier)
<config>
<mybase>
<hostname>titi<hostname>
<database>toto</database>
<port>10000</port
</mybase>
</config>
j'ai besoin en sortie d'un truc qui ressemble à ceci :
key|value
hostname;titi
database;toto
port;10000
donc le xpath devient :
loop : "/config/mybase/*"
key : "name()"
value : "node()"
cela fonctionne avec un outils de requête xpath
Si je configure ceci sous Talend
key : "node()"
value : "node()"
Cela fonctionne :
key|value
titi;titi
toto;toto
10000;10000
mais la fonction name() renvoie une String hors talend a besoin d'un objet Node, d'où l'exception :
org.dom4j.XPathException :
hostname of type: java.lang.String
Je ne sais pas comment contourner ce problème
cdt,
arnaud
Offline

Hello dosy07,
Can you report a bug on our bugtracker ?
Thx
Offline
Pages: 1