How to validate XML data against DTD

Solution Verified - Updated -

Issue

I am trying to validate xml data against dtd file and tried using like below and it is throwing error as "Failed to resolve endpoint: validator://file:dtd/pce_security.dtd due to: The markup in the document preceding the root element must be well-formed."

    <doTry>
         <to uri="validator:file:dtd/pce_security.dtd"></to>
            <to uri="mock:valid"></to>
        <doCatch>
            <exception>org.apache.camel.ValidationException</exception>
            <to uri="mock:invalid"></to>
            <log message="Catch: Error in parsing ${body}"></log>
        </doCatch>
        <doFinally>
            <to uri="mock:finally"></to>
            <log message="Finally: Error in parsing ${body}"></log>
        </doFinally> 
       </doTry>     

By looking at web it seems camel validator does not support dtd. Could you please check and let us know how to validate xml data against dtd.

Environment

  • Red Hat JBoss Fuse 6.1.0

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content