Showing posts with label XML. Show all posts
Showing posts with label XML. Show all posts

Tuesday, February 10, 2015

XML - WstxParsingException: Illegal processing instruction target ("xml")

I got the following error when I was restarting JBoss AS 7.
com.ctc.wstx.exc.WstxParsingException: Illegal processing instruction target ("xml"); xml (case insensitive) is reserved by the specs.

JBoss complained it could not parse the standalone.xml.
Soon I realized that I accidentally added a empty line before the xml declaration. Something like:
[empty line]
<?xml version="1.0" encoding="utf-8"?>
[other xml content]
So please keep in mind whenever you encounter this error, do check your xml file and put the xml declaration as the first line of the file.


Create a Successful Online Store at Bigcommerce! Try it Free Now!

Saturday, January 24, 2015

Apache Camel Ampersand URL | Apache Camel - Include an Ampersand in an URL

Camel URL Ampersand Issue

Recently I encountered a problem when I was using the Exec component to run multiple Windows batch files at one go.
All my parameters were put in an XML file, so I had something like:
<exec executable="cmd" argument="/c c:/batch1.bat;c:/batch2.bat"/>
However, with these settings, only the first batch file was executed.
After some search, I changed the configuration to
<exec executable="cmd" argument="/c c:/batch1.bat;&amp;c:/batch2.bat"/>
This time Camel complained it did not recognize some parameters (c:/batch2.bat). This was because Camel treats '&' as URL delimiter.

Use RAW  to Escape Ampersand

I managed to solve it by using the syntax RAW:
<exec executable="cmd" argument="RAW(/c c:/batch1.bat;&amp;c:/batch2.bat)"/>

What I want to mention is that RAW must be used to enclose the whole value of a parameter, not a part. So the following does not work:
<exec executable="cmd" argument="/c RAW(c:/batch1.bat;&amp;c:/batch2.bat)"/>

Check more details here.


Create a Successful Online Store at Bigcommerce! Try it Free Now!