You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "Leber, Thomas" <th...@omnetric.com> on 2017/02/21 17:55:34 UTC

Apache Camel disable DTD validation or resolve to relativ Path

Hi,

I'm using the camel validator component to validate an XML. The XML has a DTD declaration inside. This points to a relative path, where I don't want to have the DTD.

<!DOCTYPE ScheduleMessage SYSTEM "../scheduleV2r3/dtd/schedule-xml.dtd">

Is there any way to disable the DTD validation or resolve the declared DTD to a path where I want to have the DTD?

I tried until now to use the VM property:

-Djavax.xml.stream.supportDTD=false

but I had no luck with that.

While stepping trough the code I also noticed that, between different starts of camel, it uses once the StAX implementation and another time the SAX. Any glue why? I'm using all the time the same file and not changing the code.

This question is x-posted on http://stackoverflow.com/questions/42374455/apache-camel-disable-dtd-validation-or-resolve-to-relativ-path

Best Regards,
Thomas Leber

Re: Apache Camel disable DTD validation or resolve to relativ Path

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

I think it can help if you can find any information about Java XML /
StAX / and its XML apis et all how to turn on | off that DTD
validation, or plugin custom resolvers.

It tend to be a mess / mix of ways doing that / if all possible.

Having that we can see if there is something we can add/change in Camel.

Also try with latest release and see how it goes there.

On Tue, Feb 21, 2017 at 7:11 PM, Leber, Thomas
<th...@omnetric.com> wrote:
> Hi,
>
> I tried this also but the resolver gets not invoked when resolving the dtd, with the xsd it works fine.
>
>
>
> Mit TouchDown von meinem Android-Telefon gesendet (www.symantec.com)
>
> -----Original Message-----
> From: Claus Ibsen [claus.ibsen@gmail.com]
> Received: Dienstag, 21 Feb. 2017, 19:08
> To: users@camel.apache.org [users@camel.apache.org]
> Subject: Re: Apache Camel disable DTD validation or resolve to relativ Path
>
> You can maybe plugin a custom resource resolver and let it return null
> /empty or something.
>
> Check the docs
> https://github.com/apache/camel/blob/master/camel-core/src/main/docs/validator-component.adoc
>
> And you can find some unit tests that test this resolver
>
> On Tue, Feb 21, 2017 at 6:55 PM, Leber, Thomas
> <th...@omnetric.com> wrote:
>> Hi,
>>
>> I'm using the camel validator component to validate an XML. The XML has a DTD declaration inside. This points to a relative path, where I don't want to have the DTD.
>>
>> <!DOCTYPE ScheduleMessage SYSTEM "../scheduleV2r3/dtd/schedule-xml.dtd">
>>
>> Is there any way to disable the DTD validation or resolve the declared DTD to a path where I want to have the DTD?
>>
>> I tried until now to use the VM property:
>>
>> -Djavax.xml.stream.supportDTD=false
>>
>> but I had no luck with that.
>>
>> While stepping trough the code I also noticed that, between different starts of camel, it uses once the StAX implementation and another time the SAX. Any glue why? I'm using all the time the same file and not changing the code.
>>
>> This question is x-posted on http://stackoverflow.com/questions/42374455/apache-camel-disable-dtd-validation-or-resolve-to-relativ-path
>>
>> Best Regards,
>> Thomas Leber
>
>
>
> --
> Claus Ibsen
> -----------------
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

RE: Apache Camel disable DTD validation or resolve to relativ Path

Posted by "Leber, Thomas" <th...@omnetric.com>.
Hi,

I tried this also but the resolver gets not invoked when resolving the dtd, with the xsd it works fine.



Mit TouchDown von meinem Android-Telefon gesendet (www.symantec.com)

-----Original Message-----
From: Claus Ibsen [claus.ibsen@gmail.com]
Received: Dienstag, 21 Feb. 2017, 19:08
To: users@camel.apache.org [users@camel.apache.org]
Subject: Re: Apache Camel disable DTD validation or resolve to relativ Path

You can maybe plugin a custom resource resolver and let it return null
/empty or something.

Check the docs
https://github.com/apache/camel/blob/master/camel-core/src/main/docs/validator-component.adoc

And you can find some unit tests that test this resolver

On Tue, Feb 21, 2017 at 6:55 PM, Leber, Thomas
<th...@omnetric.com> wrote:
> Hi,
>
> I'm using the camel validator component to validate an XML. The XML has a DTD declaration inside. This points to a relative path, where I don't want to have the DTD.
>
> <!DOCTYPE ScheduleMessage SYSTEM "../scheduleV2r3/dtd/schedule-xml.dtd">
>
> Is there any way to disable the DTD validation or resolve the declared DTD to a path where I want to have the DTD?
>
> I tried until now to use the VM property:
>
> -Djavax.xml.stream.supportDTD=false
>
> but I had no luck with that.
>
> While stepping trough the code I also noticed that, between different starts of camel, it uses once the StAX implementation and another time the SAX. Any glue why? I'm using all the time the same file and not changing the code.
>
> This question is x-posted on http://stackoverflow.com/questions/42374455/apache-camel-disable-dtd-validation-or-resolve-to-relativ-path
>
> Best Regards,
> Thomas Leber



--
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Re: Apache Camel disable DTD validation or resolve to relativ Path

Posted by Claus Ibsen <cl...@gmail.com>.
You can maybe plugin a custom resource resolver and let it return null
/empty or something.

Check the docs
https://github.com/apache/camel/blob/master/camel-core/src/main/docs/validator-component.adoc

And you can find some unit tests that test this resolver

On Tue, Feb 21, 2017 at 6:55 PM, Leber, Thomas
<th...@omnetric.com> wrote:
> Hi,
>
> I'm using the camel validator component to validate an XML. The XML has a DTD declaration inside. This points to a relative path, where I don't want to have the DTD.
>
> <!DOCTYPE ScheduleMessage SYSTEM "../scheduleV2r3/dtd/schedule-xml.dtd">
>
> Is there any way to disable the DTD validation or resolve the declared DTD to a path where I want to have the DTD?
>
> I tried until now to use the VM property:
>
> -Djavax.xml.stream.supportDTD=false
>
> but I had no luck with that.
>
> While stepping trough the code I also noticed that, between different starts of camel, it uses once the StAX implementation and another time the SAX. Any glue why? I'm using all the time the same file and not changing the code.
>
> This question is x-posted on http://stackoverflow.com/questions/42374455/apache-camel-disable-dtd-validation-or-resolve-to-relativ-path
>
> Best Regards,
> Thomas Leber



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2