Fatal error : Character reference "&# org.xml.sax.SAXParseException;Is Java “pass-by-reference” or “pass-by-value”?Parsing DOM - org.xml.sax.SAXParseExceptionParsing XHTML ErrorError in parsing XML file with encoding UTF-8 and UTF-16How to get values from a xml which is not well shapedNullPointerException when importing XML-file into Processing, JavaWhy is executing Java code in comments with certain Unicode characters allowed?XML Scrap with DOM Package JAVA “  entity error”“The value of attribute must not contain the '<' character” errorJava XML nested Parser not working
Are there any efficient algorithms to solve the longest path problem in networks with cycles?
Is there a maximum distance from a planet that a moon can orbit?
When is it ok to add filler to a story?
An expansion from Ramanujan related to birthday problem
Why is C++ initial allocation so much larger than C's?
Can I compare DFT calculations with different grids?
Change the boot order with no option in UEFI settings
Links to webpages in books
Can ADFS connect to other SSO services?
Why do some games show lights shine through walls?
MH370 blackbox - is it still possible to retrieve data from it?
How to split an equation over two lines?
Would a two-seat light aircaft with a landing speed of 20 knots and a top speed of 180 knots be technically possible?
How does a blind passenger not die, if driver becomes unconscious
Should developer taking test phones home or put in office?
What do you call a weak person's act of taking on bigger opponents?
An external consultant working on an internal project tried recruiting me. Should I tell my manager?
Did Karl Marx ever use any example that involved cotton and dollars to illustrate the way capital and surplus value were generated?
Has there been any indication at all that further negotiation between the UK and EU is possible?
How risky is real estate?
What sort of mathematical problems are there in AI that people are working on?
How come I was asked by a CBP officer why I was in the US?
Are Finite Automata Turing Complete?
How to add multiple ip address in destination ip in acl rule
Fatal error : Character reference " org.xml.sax.SAXParseException;
Is Java “pass-by-reference” or “pass-by-value”?Parsing DOM - org.xml.sax.SAXParseExceptionParsing XHTML ErrorError in parsing XML file with encoding UTF-8 and UTF-16How to get values from a xml which is not well shapedNullPointerException when importing XML-file into Processing, JavaWhy is executing Java code in comments with certain Unicode characters allowed?XML Scrap with DOM Package JAVA “  entity error”“The value of attribute must not contain the '<' character” errorJava XML nested Parser not working
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
There is
<BATCHNAME> Any</BATCHNAME>
tag in my xml request having '' characters in value. Without these characters my code works perfectly,but in some cases i have these characters. It gives me following error
[Fatal Error] :144:28: Character reference "&#
org.xml.sax.SAXParseException; lineNumber: 144; columnNumber: 28; Character
reference "&# at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:257)
at
com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:339)
at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:121)
at d.b(AllCommonTasks.java:277) at...
I need these characters to be validate
I am trying this code =>
try
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
URLConnection urlConnection = new URL(urlString).openConnection();
urlConnection.addRequestProperty("Accept", "application/xml");
urlConnection.addRequestProperty("User-Agent", "Mozilla/5.0 ( compatible ) ");
Document doc = db.parse(urlConnection.getInputStream());
doc.getDocumentElement().normalize();
str = convertDocumentToString(doc);
catch(Exception e)
System.err.println("In exception 1");
e.printStackTrace();
How can I solve this?
java xml sax saxparser
add a comment |
There is
<BATCHNAME> Any</BATCHNAME>
tag in my xml request having '' characters in value. Without these characters my code works perfectly,but in some cases i have these characters. It gives me following error
[Fatal Error] :144:28: Character reference "&#
org.xml.sax.SAXParseException; lineNumber: 144; columnNumber: 28; Character
reference "&# at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:257)
at
com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:339)
at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:121)
at d.b(AllCommonTasks.java:277) at...
I need these characters to be validate
I am trying this code =>
try
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
URLConnection urlConnection = new URL(urlString).openConnection();
urlConnection.addRequestProperty("Accept", "application/xml");
urlConnection.addRequestProperty("User-Agent", "Mozilla/5.0 ( compatible ) ");
Document doc = db.parse(urlConnection.getInputStream());
doc.getDocumentElement().normalize();
str = convertDocumentToString(doc);
catch(Exception e)
System.err.println("In exception 1");
e.printStackTrace();
How can I solve this?
java xml sax saxparser
"would have been". If it is really, read the XML as text, and patch the XML version to version 1.1 for these in 1.0 forbidden control characters.
– Joop Eggen
Mar 25 at 11:49
add a comment |
There is
<BATCHNAME> Any</BATCHNAME>
tag in my xml request having '' characters in value. Without these characters my code works perfectly,but in some cases i have these characters. It gives me following error
[Fatal Error] :144:28: Character reference "&#
org.xml.sax.SAXParseException; lineNumber: 144; columnNumber: 28; Character
reference "&# at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:257)
at
com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:339)
at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:121)
at d.b(AllCommonTasks.java:277) at...
I need these characters to be validate
I am trying this code =>
try
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
URLConnection urlConnection = new URL(urlString).openConnection();
urlConnection.addRequestProperty("Accept", "application/xml");
urlConnection.addRequestProperty("User-Agent", "Mozilla/5.0 ( compatible ) ");
Document doc = db.parse(urlConnection.getInputStream());
doc.getDocumentElement().normalize();
str = convertDocumentToString(doc);
catch(Exception e)
System.err.println("In exception 1");
e.printStackTrace();
How can I solve this?
java xml sax saxparser
There is
<BATCHNAME> Any</BATCHNAME>
tag in my xml request having '' characters in value. Without these characters my code works perfectly,but in some cases i have these characters. It gives me following error
[Fatal Error] :144:28: Character reference "&#
org.xml.sax.SAXParseException; lineNumber: 144; columnNumber: 28; Character
reference "&# at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:257)
at
com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:339)
at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:121)
at d.b(AllCommonTasks.java:277) at...
I need these characters to be validate
I am trying this code =>
try
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
URLConnection urlConnection = new URL(urlString).openConnection();
urlConnection.addRequestProperty("Accept", "application/xml");
urlConnection.addRequestProperty("User-Agent", "Mozilla/5.0 ( compatible ) ");
Document doc = db.parse(urlConnection.getInputStream());
doc.getDocumentElement().normalize();
str = convertDocumentToString(doc);
catch(Exception e)
System.err.println("In exception 1");
e.printStackTrace();
How can I solve this?
java xml sax saxparser
java xml sax saxparser
edited Mar 25 at 11:37
kleopatra
45.4k16 gold badges76 silver badges165 bronze badges
45.4k16 gold badges76 silver badges165 bronze badges
asked Mar 25 at 10:17
TejpalBhTejpalBh
1831 silver badge11 bronze badges
1831 silver badge11 bronze badges
"would have been". If it is really, read the XML as text, and patch the XML version to version 1.1 for these in 1.0 forbidden control characters.
– Joop Eggen
Mar 25 at 11:49
add a comment |
"would have been". If it is really, read the XML as text, and patch the XML version to version 1.1 for these in 1.0 forbidden control characters.
– Joop Eggen
Mar 25 at 11:49
" would have been ". If it is really , read the XML as text, and patch the XML version to version 1.1 for these in 1.0 forbidden control characters.– Joop Eggen
Mar 25 at 11:49
" would have been ". If it is really , read the XML as text, and patch the XML version to version 1.1 for these in 1.0 forbidden control characters.– Joop Eggen
Mar 25 at 11:49
add a comment |
1 Answer
1
active
oldest
votes
Looking at the Wikipedia page for XML and HTML entity references, entity references that follow the &#nnnn; pattern are Unicode code points in decimal form, which means that  would be equivalent to Unicode U+0004: END OF TRANSMISSION which is a nonprinting character.
So I think the parser is right in this case to fail.
In fact if you look at the source of com.sun.org.apache.xerces.internal.impl.XMLScanner#scanCharReferenceValue, you can see that it references com.sun.org.apache.xerces.internal.util.XMLChar#isValid here:
/**
* Returns true if the specified character is valid. This method
* also checks the surrogate character range from 0x10000 to 0x10FFFF.
* <p>
* If the program chooses to apply the mask directly to the
* <code>CHARS</code> array, then they are responsible for checking
* the surrogate character range.
*
* @param c The character to check.
*/
public static boolean isValid(int c) // isValid(int):boolean
yes the characters are not valid xml. But i want those characters in xml for some cases only, there should be any way to add/allow these characters..?
– TejpalBh
Mar 25 at 10:58
One way is to move to XML 1.1 which adds support for U+0001 onwards, but not sure if you have control over the incoming XML document? See en.wikipedia.org/wiki/Valid_characters_in_XML#XML_1.1
– paltaie
Mar 25 at 11:06
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55335528%2ffatal-error-character-reference-org-xml-sax-saxparseexception%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Looking at the Wikipedia page for XML and HTML entity references, entity references that follow the &#nnnn; pattern are Unicode code points in decimal form, which means that  would be equivalent to Unicode U+0004: END OF TRANSMISSION which is a nonprinting character.
So I think the parser is right in this case to fail.
In fact if you look at the source of com.sun.org.apache.xerces.internal.impl.XMLScanner#scanCharReferenceValue, you can see that it references com.sun.org.apache.xerces.internal.util.XMLChar#isValid here:
/**
* Returns true if the specified character is valid. This method
* also checks the surrogate character range from 0x10000 to 0x10FFFF.
* <p>
* If the program chooses to apply the mask directly to the
* <code>CHARS</code> array, then they are responsible for checking
* the surrogate character range.
*
* @param c The character to check.
*/
public static boolean isValid(int c) // isValid(int):boolean
yes the characters are not valid xml. But i want those characters in xml for some cases only, there should be any way to add/allow these characters..?
– TejpalBh
Mar 25 at 10:58
One way is to move to XML 1.1 which adds support for U+0001 onwards, but not sure if you have control over the incoming XML document? See en.wikipedia.org/wiki/Valid_characters_in_XML#XML_1.1
– paltaie
Mar 25 at 11:06
add a comment |
Looking at the Wikipedia page for XML and HTML entity references, entity references that follow the &#nnnn; pattern are Unicode code points in decimal form, which means that  would be equivalent to Unicode U+0004: END OF TRANSMISSION which is a nonprinting character.
So I think the parser is right in this case to fail.
In fact if you look at the source of com.sun.org.apache.xerces.internal.impl.XMLScanner#scanCharReferenceValue, you can see that it references com.sun.org.apache.xerces.internal.util.XMLChar#isValid here:
/**
* Returns true if the specified character is valid. This method
* also checks the surrogate character range from 0x10000 to 0x10FFFF.
* <p>
* If the program chooses to apply the mask directly to the
* <code>CHARS</code> array, then they are responsible for checking
* the surrogate character range.
*
* @param c The character to check.
*/
public static boolean isValid(int c) // isValid(int):boolean
yes the characters are not valid xml. But i want those characters in xml for some cases only, there should be any way to add/allow these characters..?
– TejpalBh
Mar 25 at 10:58
One way is to move to XML 1.1 which adds support for U+0001 onwards, but not sure if you have control over the incoming XML document? See en.wikipedia.org/wiki/Valid_characters_in_XML#XML_1.1
– paltaie
Mar 25 at 11:06
add a comment |
Looking at the Wikipedia page for XML and HTML entity references, entity references that follow the &#nnnn; pattern are Unicode code points in decimal form, which means that  would be equivalent to Unicode U+0004: END OF TRANSMISSION which is a nonprinting character.
So I think the parser is right in this case to fail.
In fact if you look at the source of com.sun.org.apache.xerces.internal.impl.XMLScanner#scanCharReferenceValue, you can see that it references com.sun.org.apache.xerces.internal.util.XMLChar#isValid here:
/**
* Returns true if the specified character is valid. This method
* also checks the surrogate character range from 0x10000 to 0x10FFFF.
* <p>
* If the program chooses to apply the mask directly to the
* <code>CHARS</code> array, then they are responsible for checking
* the surrogate character range.
*
* @param c The character to check.
*/
public static boolean isValid(int c) // isValid(int):boolean
Looking at the Wikipedia page for XML and HTML entity references, entity references that follow the &#nnnn; pattern are Unicode code points in decimal form, which means that  would be equivalent to Unicode U+0004: END OF TRANSMISSION which is a nonprinting character.
So I think the parser is right in this case to fail.
In fact if you look at the source of com.sun.org.apache.xerces.internal.impl.XMLScanner#scanCharReferenceValue, you can see that it references com.sun.org.apache.xerces.internal.util.XMLChar#isValid here:
/**
* Returns true if the specified character is valid. This method
* also checks the surrogate character range from 0x10000 to 0x10FFFF.
* <p>
* If the program chooses to apply the mask directly to the
* <code>CHARS</code> array, then they are responsible for checking
* the surrogate character range.
*
* @param c The character to check.
*/
public static boolean isValid(int c) // isValid(int):boolean
answered Mar 25 at 10:46
paltaiepaltaie
1
1
yes the characters are not valid xml. But i want those characters in xml for some cases only, there should be any way to add/allow these characters..?
– TejpalBh
Mar 25 at 10:58
One way is to move to XML 1.1 which adds support for U+0001 onwards, but not sure if you have control over the incoming XML document? See en.wikipedia.org/wiki/Valid_characters_in_XML#XML_1.1
– paltaie
Mar 25 at 11:06
add a comment |
yes the characters are not valid xml. But i want those characters in xml for some cases only, there should be any way to add/allow these characters..?
– TejpalBh
Mar 25 at 10:58
One way is to move to XML 1.1 which adds support for U+0001 onwards, but not sure if you have control over the incoming XML document? See en.wikipedia.org/wiki/Valid_characters_in_XML#XML_1.1
– paltaie
Mar 25 at 11:06
yes the characters are not valid xml. But i want those characters in xml for some cases only, there should be any way to add/allow these characters..?
– TejpalBh
Mar 25 at 10:58
yes the characters are not valid xml. But i want those characters in xml for some cases only, there should be any way to add/allow these characters..?
– TejpalBh
Mar 25 at 10:58
One way is to move to XML 1.1 which adds support for U+0001 onwards, but not sure if you have control over the incoming XML document? See en.wikipedia.org/wiki/Valid_characters_in_XML#XML_1.1
– paltaie
Mar 25 at 11:06
One way is to move to XML 1.1 which adds support for U+0001 onwards, but not sure if you have control over the incoming XML document? See en.wikipedia.org/wiki/Valid_characters_in_XML#XML_1.1
– paltaie
Mar 25 at 11:06
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55335528%2ffatal-error-character-reference-org-xml-sax-saxparseexception%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
"would have been". If it is really, read the XML as text, and patch the XML version to version 1.1 for these in 1.0 forbidden control characters.– Joop Eggen
Mar 25 at 11:49