You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by anakin59490 <je...@voila.fr> on 2012/11/09 11:28:49 UTC

xslt: component

Hello,

I would like to check a xml file with a xsd file.

I try to use the  xslt: component but it doesn't work. 

this is my xml file: 

<?xml version="1.0"?>

<element_racine xmlns:xsi="schema.xsd">
  
  <nombre>90</nombre>
  <nombre>80</nombre>
  <nombre>99</nombre>
</element_racine>



this is my xsd file :

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
 
<xsd:simpleType name="entre50et100">
<xsd:restriction base="xsd:positiveInteger">
  <xsd:minExclusive value="50"/>
  <xsd:maxExclusive value="100"/>
</xsd:restriction>
</xsd:simpleType>
 
<xsd:element name="nombre" type="entre50et100"/>
 
<xsd:element name="element_racine">
<xsd:complexType>
<xsd:sequence>
  <xsd:element ref="nombre" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>




and this is my route :

    public void configure() {
 
        // error channel
    
errorHandler(deadLetterChannel("file:dead/?fileName=${date:now:yyyy-MM-dd}/${id}").useOriginalMessage());
 
    	// Incoming file
 
		from("file:input/test.xml")
    		.log("Starting to process file")
    		.to("xslt:META-INF/XSDDocument/test.xsd")
    		.bean(Services.class, "check")
    		.to("direct:unknownIncoming");
 
    }


I put a breakpoint in check method. When i use debugger, there is a error
message : 

"Failed to create route route1 at: >>>
To[xslt:META-INF/XSDDocument/test.xsd] <<< in route:
Route[[From[file:input/?noop=true&initia... because of Failed to resolve
endpoint: xslt://META-INF/XSDDocument/test.xsd due to: *Impossible de
compiler la feuille de style*

I translate : *"Failed to compile stylesheet" *

Thank you for your help







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

Re: xslt: component

Posted by anakin59490 <je...@voila.fr>.
OK.

i will study XSLT to know how to transform my xml

Thank you all for your help !



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

Re: xslt: component

Posted by Christian Müller <ch...@gmail.com>.
For XSLT transformation you need a XSLT file.

For validation, you can use the XSD file.

You can use maven to check which version of the dependency the camel-xslt
component use.

Sent from a mobile device
Am 09.11.2012 13:23 schrieb "anakin59490" <je...@voila.fr>:

> Ok !
>
> Do you think that i could transform my xml in another xml (the same without
> specifics tags) with Xalan and a xsd file ? Do you use xalan 2.7.1 ? (i
> found this version on maven repository...)
>
>
>
> thank you
>
>
>
>
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/xslt-component-tp5722391p5722399.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Re: xslt: component

Posted by anakin59490 <je...@voila.fr>.
Ok !

Do you think that i could transform my xml in another xml (the same without
specifics tags) with Xalan and a xsd file ? Do you use xalan 2.7.1 ? (i
found this version on maven repository...)



thank you







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

Re: xslt: component

Posted by Bob Jolliffe <bo...@gmail.com>.
On 9 November 2012 11:46, anakin59490 <je...@voila.fr> wrote:

> Thank you very much Bob !!
>
> It works !!
>
> In fact check, was my first step, but i used xslt: component because i must
> transform my xml file in an other xml file (the same without specifics
> tags).
>
> But i thought that it could do both (check and transform).
>
> I work with camel version 2.9. I've read on several forums that we can use
> Xalan or camel-saxon.
>
> Which is the more reliable ?
>

Difficult question.  There are licencing issues around saxon which has
always caused me to avoid it.  But it is very good, and particularly
necessary if you need to do xslt 2.0.

I use the built-in xalan.

>
> thank you
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/xslt-component-tp5722391p5722397.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Re: xslt: component

Posted by anakin59490 <je...@voila.fr>.
Thank you very much Bob !! 

It works !!

In fact check, was my first step, but i used xslt: component because i must
transform my xml file in an other xml file (the same without specifics
tags).

But i thought that it could do both (check and transform).

I work with camel version 2.9. I've read on several forums that we can use
Xalan or camel-saxon.

Which is the more reliable ?

thank you



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

Re: xslt: component

Posted by Bob Jolliffe <bo...@gmail.com>.
Hi

I think you are confusing processing/transforming xml file with xslt and
validating it with xsd.

It looks like this describes what you need:
http://camel.apache.org/validation.html


Bob



On 9 November 2012 10:28, anakin59490 <je...@voila.fr> wrote:

> Hello,
>
> I would like to check a xml file with a xsd file.
>
> I try to use the  xslt: component but it doesn't work.
>
> this is my xml file:
>
> <?xml version="1.0"?>
>
> <element_racine xmlns:xsi="schema.xsd">
>
>   <nombre>90</nombre>
>   <nombre>80</nombre>
>   <nombre>99</nombre>
> </element_racine>
>
>
>
> this is my xsd file :
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> elementFormDefault="qualified">
>
> <xsd:simpleType name="entre50et100">
> <xsd:restriction base="xsd:positiveInteger">
>   <xsd:minExclusive value="50"/>
>   <xsd:maxExclusive value="100"/>
> </xsd:restriction>
> </xsd:simpleType>
>
> <xsd:element name="nombre" type="entre50et100"/>
>
> <xsd:element name="element_racine">
> <xsd:complexType>
> <xsd:sequence>
>   <xsd:element ref="nombre" maxOccurs="unbounded"/>
> </xsd:sequence>
> </xsd:complexType>
> </xsd:element>
> </xsd:schema>
>
>
>
>
> and this is my route :
>
>     public void configure() {
>
>         // error channel
>
>
> errorHandler(deadLetterChannel("file:dead/?fileName=${date:now:yyyy-MM-dd}/${id}").useOriginalMessage());
>
>         // Incoming file
>
>                 from("file:input/test.xml")
>                 .log("Starting to process file")
>                 .to("xslt:META-INF/XSDDocument/test.xsd")
>                 .bean(Services.class, "check")
>                 .to("direct:unknownIncoming");
>
>     }
>
>
> I put a breakpoint in check method. When i use debugger, there is a error
> message :
>
> "Failed to create route route1 at: >>>
> To[xslt:META-INF/XSDDocument/test.xsd] <<< in route:
> Route[[From[file:input/?noop=true&initia... because of Failed to resolve
> endpoint: xslt://META-INF/XSDDocument/test.xsd due to: *Impossible de
> compiler la feuille de style*
>
> I translate : *"Failed to compile stylesheet" *
>
> Thank you for your help
>
>
>
>
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/xslt-component-tp5722391.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>