ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Parser error while parsing special characters using XMLNSC

Post new topic  Reply to topic
 Parser error while parsing special characters using XMLNSC « View previous topic :: View next topic » 
Author Message
Sneh4nsu
PostPosted: Wed Oct 25, 2017 10:14 am    Post subject: Parser error while parsing special characters using XMLNSC Reply with quote

Novice

Joined: 11 Aug 2017
Posts: 12

Code:
DECLARE my_xml CHARACTER '<tag>&</tag>';
CREATE LASTCHILD OF OutputRoot DOMAIN('XMLNSC')
                  PARSE(my_xml,546,1208);


Throwing 'An xml parsing error has occurred' but instead if I parse <tag>hello</tag> it is getting parsed. As far as I know the XLMNSC parser escape the special characters(here &) to &amp;
Please help me!!
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Oct 25, 2017 10:23 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

What happens if you try:

Code:
CREATE LASTCHILD OF OutputRoot DOMAIN('XMLNSC') NAME 'tag' VALUE '&';

_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Sneh4nsu
PostPosted: Wed Oct 25, 2017 10:43 am    Post subject: Reply with quote

Novice

Joined: 11 Aug 2017
Posts: 12

Vitor wrote:
What happens if you try:

Code:
CREATE LASTCHILD OF OutputRoot DOMAIN('XMLNSC') NAME 'tag' VALUE '&';


Output is having no value
My question is does XMLNSC parser automatically escape special characters or we need to specify certain encodings
In my case Im having a large string with some special characters.
Help needed
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Wed Oct 25, 2017 10:45 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20696
Location: LI,NY

Sneh4nsu wrote:
Vitor wrote:
What happens if you try:

Code:
CREATE LASTCHILD OF OutputRoot DOMAIN('XMLNSC') NAME 'tag' VALUE '&';


Output is having no value
My question is does XMLNSC parser automatically escape special characters or we need to specify certain encodings
In my case Im having a large string with some special characters.
Help needed

If you do it right the XMLNSC parser will escape the special characters for you.

Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Vitor
PostPosted: Wed Oct 25, 2017 11:10 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

Sneh4nsu wrote:
Output is having no value


Then there's a bug in my code

Sneh4nsu wrote:
My question is does XMLNSC parser automatically escape special characters


Yes

Sneh4nsu wrote:
or we need to specify certain encodings


No
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Sneh4nsu
PostPosted: Wed Oct 25, 2017 11:13 am    Post subject: Reply with quote

Novice

Joined: 11 Aug 2017
Posts: 12

Vitor wrote:
Sneh4nsu wrote:
Output is having no value


Then there's a bug in my code

Sneh4nsu wrote:
My question is does XMLNSC parser automatically escape special characters


Yes

Sneh4nsu wrote:
or we need to specify certain encodings


No


every time I execute the code I am getting this:'The entity name must immediately follow the '&' in the entity reference'
I guess the parser is looking for &amp;
Back to top
View user's profile Send private message
timber
PostPosted: Wed Oct 25, 2017 1:09 pm    Post subject: Reply with quote

Grand Master

Joined: 25 Aug 2015
Posts: 1280

Let me get this straight. You are executing this code:
Code:
DECLARE my_xml CHARACTER '<tag>&</tag>';
CREATE LASTCHILD OF OutputRoot DOMAIN('XMLNSC')
                  PARSE(my_xml,546,1208);
and you are surprised that you are getting an error?!

Please do this.
1. Put that XML into a file with extension '.xml'
2. Open that XML file in your favourite web browser
What does the web browser's XML parser say?
If you want additional proof, try the XML parser from any other product.

IIB escapes special characters when writing XML. It does not auto-magically fix broken XML documents when parsing. Instead, it correctly points out that your XML is badly-formed.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Parser error while parsing special characters using XMLNSC
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.