You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by smilevasu6 <sr...@gmail.com> on 2014/12/22 11:56:10 UTC

Camel

Hi,

How can split the below text in camel so that i can fetch the value.

 <xs:element name="TABLES">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="BD_COMPANIES_T:BD_COMPANIES" type="xs:string" />
      </xs:sequence>
    </xs:complexType>
  </xs:element>

And i am trying like this

.setHeader("table1", simple("${body[1]}:${body[2]")) but its not fetching
element name.

I am expecting "table1" should have BD_COMPANIES_T and "table2" should have
BD_COMPANIES.

Please advice.



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-tp5760986.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: AW: Camel

Posted by smilevasu6 <sr...@gmail.com>.
Hi,

Can you please advice on below?



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-tp5760986p5761006.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: AW: Camel

Posted by smilevasu6 <sr...@gmail.com>.
Hi Jan,

As suggested by you, i tried like,

 from("timer://foo?period=60000")
		.bean(XSDToTemp.class,"parseXSD(/home/cloudera/Desktop/COMPANIES.xsd)")
		.setHeader("length", simple("${body.length}"))
		.setHeader("tables", simple("${body[1]}")).split().tokenize(":")

But i got the below error,

Exception in thread "main" org.apache.camel.FailedToCreateRouteException:
Failed to create route route1 at: >>> Split[tokenize{body() using token: :}
-> []] <<< in route: Route(route1)[[From[timer://foo?period=60000]] ->
[Bean[com.... because of Definition has no children on Split[tokenize{body()
using token: :} -> []]
	at
org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:912)
	at
org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:177)
	at
org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:780)
	at
org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:1982)
	at
org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:1724)
	at
org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:1598)
	at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
	at
org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:1566)
	at com.edms.emagia.SampleDynamic.main(SampleDynamic.java:55)
Caused by: java.lang.IllegalArgumentException: Definition has no children on
Split[tokenize{body() using token: :} -> []]
	at
org.apache.camel.model.ProcessorDefinition.createChildProcessor(ProcessorDefinition.java:182)
	at
org.apache.camel.model.SplitDefinition.createProcessor(SplitDefinition.java:101)
	at
org.apache.camel.model.ProcessorDefinition.makeProcessor(ProcessorDefinition.java:500)
	at
org.apache.camel.model.ProcessorDefinition.addRoutes(ProcessorDefinition.java:213)
	at
org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:909)
	... 8 more


Not a group, one by one element i have to split read and save then. I can
use those elements for later







--
View this message in context: http://camel.465427.n5.nabble.com/Camel-tp5760986p5761003.html
Sent from the Camel - Users mailing list archive at Nabble.com.

AW: Camel

Posted by "Jan Matèrne (jhm)" <ap...@materne.de>.
from(...).split().tokenize(",").to(...)
https://camel.apache.org/splitter.html

Not sure if you need a group size ( tokenize(",", 1) ).


But maybe you dont want to 'split' (like the EIP) the payload.
So have also a look at http://camel.apache.org/csv.html


Jan

> -----Ursprüngliche Nachricht-----
> Von: smilevasu6 [mailto:srinivas.thunga@gmail.com]
> Gesendet: Dienstag, 23. Dezember 2014 06:45
> An: users@camel.apache.org
> Betreff: Re: Camel
> 
> please, i am not able to find how can we split colon separated
> attributes in
> camel.
> 
> Please any one help me on this?
> 
> And i dont want to hard code the attributes like as we do Xpath.
> 
> 
> 
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-
> tp5760986p5761000.html
> Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Camel

Posted by smilevasu6 <sr...@gmail.com>.
Hi jan,

Whatever I am trying , I have posted. I am trying to read xsd with colon
(:) separated and save the attibutes.

<xs:element name=bd_company_t:bd_company />

>From here I need to fetch the element name bd_company_t and bd_company



On Tuesday, December 23, 2014, Jan Matèrne (jhm) [via Camel] <
ml-node+s465427n5761045h8@n5.nabble.com> wrote:

> If you need more assistance you should provide more details - not one
> single
> piece after the next.
> Maybe you could write a unit test (XY extends CamelTestSupport) which
> shows
> your expectations, then we could work on the route.
>
> Jan
>
> > -----Ursprüngliche Nachricht-----
> > Von: Jan Matèrne (jhm) [mailto:[hidden email]
> <http:///user/SendEmail.jtp?type=node&node=5761045&i=0>]
> > Gesendet: Dienstag, 23. Dezember 2014 09:28
> > An: '[hidden email]
> <http:///user/SendEmail.jtp?type=node&node=5761045&i=1>'
> > Betreff: AW: Camel
> >
> > from(...).split().tokenize(",").to(...)
> > https://camel.apache.org/splitter.html
> >
> > Not sure if you need a group size ( tokenize(",", 1) ).
> >
> >
> > But maybe you dont want to 'split' (like the EIP) the payload.
> > So have also a look at http://camel.apache.org/csv.html
> >
> >
> > Jan
> >
> > > -----Ursprüngliche Nachricht-----
> > > Von: smilevasu6 [mailto:[hidden email]
> <http:///user/SendEmail.jtp?type=node&node=5761045&i=2>]
> > > Gesendet: Dienstag, 23. Dezember 2014 06:45
> > > An: [hidden email]
> <http:///user/SendEmail.jtp?type=node&node=5761045&i=3>
> > > Betreff: Re: Camel
> > >
> > > please, i am not able to find how can we split colon separated
> > > attributes in camel.
> > >
> > > Please any one help me on this?
> > >
> > > And i dont want to hard code the attributes like as we do Xpath.
> > >
> > >
> > >
> > > --
> > > View this message in context:
> > http://camel.465427.n5.nabble.com/Camel-
> > > tp5760986p5761000.html
> > > Sent from the Camel - Users mailing list archive at Nabble.com.
>
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
> http://camel.465427.n5.nabble.com/Camel-tp5760986p5761045.html
>  To unsubscribe from Camel, click here
> <http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5760986&code=c3Jpbml2YXMudGh1bmdhQGdtYWlsLmNvbXw1NzYwOTg2fDE3NjU5MTYzMTM=>
> .
> NAML
> <http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>


-- 
Sent from Gmail Mobile




--
View this message in context: http://camel.465427.n5.nabble.com/Camel-tp5760986p5761046.html
Sent from the Camel - Users mailing list archive at Nabble.com.

AW: Camel

Posted by "Jan Matèrne (jhm)" <ap...@materne.de>.
If you need more assistance you should provide more details - not one single
piece after the next.
Maybe you could write a unit test (XY extends CamelTestSupport) which shows
your expectations, then we could work on the route.

Jan

> -----Ursprüngliche Nachricht-----
> Von: Jan Matèrne (jhm) [mailto:apache@materne.de]
> Gesendet: Dienstag, 23. Dezember 2014 09:28
> An: 'users@camel.apache.org'
> Betreff: AW: Camel
> 
> from(...).split().tokenize(",").to(...)
> https://camel.apache.org/splitter.html
> 
> Not sure if you need a group size ( tokenize(",", 1) ).
> 
> 
> But maybe you dont want to 'split' (like the EIP) the payload.
> So have also a look at http://camel.apache.org/csv.html
> 
> 
> Jan
> 
> > -----Ursprüngliche Nachricht-----
> > Von: smilevasu6 [mailto:srinivas.thunga@gmail.com]
> > Gesendet: Dienstag, 23. Dezember 2014 06:45
> > An: users@camel.apache.org
> > Betreff: Re: Camel
> >
> > please, i am not able to find how can we split colon separated
> > attributes in camel.
> >
> > Please any one help me on this?
> >
> > And i dont want to hard code the attributes like as we do Xpath.
> >
> >
> >
> > --
> > View this message in context:
> http://camel.465427.n5.nabble.com/Camel-
> > tp5760986p5761000.html
> > Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Camel

Posted by smilevasu6 <sr...@gmail.com>.
please, i am not able to find how can we split colon separated attributes in
camel.

Please any one help me on this?

And i dont want to hard code the attributes like as we do Xpath.



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-tp5760986p5761000.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel

Posted by smilevasu6 <sr...@gmail.com>.
Yes I will receive xsd and want to get attributes of xsd only. But the
attributes are colon (:) separated. I want to split and save the attributes
for later use. Please advice

On Monday, December 22, 2014, winniwinter [via Camel] <
ml-node+s465427n5760993h96@n5.nabble.com> wrote:

> So you receive the xsd and want to get the attributes of the xml?!
>
> Maybe you should try it with xpath. If this works you can use the xpath
> within your route:
>
> http://camel.apache.org/xpath.html
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
> http://camel.465427.n5.nabble.com/Camel-tp5760986p5760993.html
>  To unsubscribe from Camel, click here
> <http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5760986&code=c3Jpbml2YXMudGh1bmdhQGdtYWlsLmNvbXw1NzYwOTg2fDE3NjU5MTYzMTM=>
> .
> NAML
> <http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>


-- 
Sent from Gmail Mobile




--
View this message in context: http://camel.465427.n5.nabble.com/Camel-tp5760986p5760994.html
Sent from the Camel - Users mailing list archive at Nabble.com.