 |
| XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

July 1st, 2013, 01:36 PM
|
|
Authorized User
|
|
Join Date: Mar 2007
Posts: 33
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Catching Detailed XML Formatting Errors?
Hi Gang!
What method would you use to catch an XML formatting error that gives you more detail on where this error is (possibly line nr, etc.)
For instance I do have an enormous XML file and the generic IE 10 just doesn't cut it.
If this helps
I am using this header in my xml:
<?xml version="1.0" encoding="ISO-8859-1"?>
and this in my xsl:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
thanks!
gabriel
|
|

July 1st, 2013, 01:44 PM
|
 |
Wrox Author
|
|
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
|
|
What do you mean by a "formatting" error? Do you mean the XML isn't well-formed?
XML parsers vary widely in the quality of their diagnostics on this. If the parser you are using isn't giving good enough diagnostics, try a different one.
Generally the browser is not a good diagnostic environment, because browser vendors assume the user is non-technical and won't understand any technical detail. (But some browsers have good developer consoles.)
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference
|
|

July 1st, 2013, 01:58 PM
|
|
Authorized User
|
|
Join Date: Mar 2007
Posts: 33
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thanks for the reply -
Yes I meant well formed indeed. Do you have a suggestion for a proper diagnostic environment?
thanks,
Gabriel.
|
|

July 1st, 2013, 06:44 PM
|
 |
Wrox Author
|
|
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
|
|
I use oXygen. The diagnostics on well-formedness errors aren't always wonderful but you can usually find the errors quite quickly.
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference
|
|

July 2nd, 2013, 10:19 AM
|
|
Authorized User
|
|
Join Date: Mar 2007
Posts: 33
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thanks much for the tip!
Now, here's a question following this issue.
How can I have my customers (non-technical) reporting back the row/column of a bad formed XML?
I noticed Firefox's xml parser displays the not well-formed XML's location but Internet Explorer does not. Can I somehow make this possible in Internet Explorer via a message box maybe?
thanks,
G
|
|

July 3rd, 2013, 10:34 AM
|
 |
Friend of Wrox
|
|
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
|
|
It shouldn't really be your customers responsibility to validate your XML, that should be your job. If it is code you are generating, then you should be using a standards compliant XML processor so that whatever it generates is always valid - you can even develop your own schema, so you know it also validates against that.
If the users upload the XML then you should be validating it on upload.
Does that answer your question?
|
|

July 3rd, 2013, 10:46 AM
|
|
Authorized User
|
|
Join Date: Mar 2007
Posts: 33
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thanks Sam -
INdeed the users should not troubleshooting my XML, but it might help to report back the error just like many other apps that send in a report when it's crashing (Firefox for instance).
Since most of my customers are using Internet Explorer to view the code I am somewhat litmited to the parser that ships with each IE version. Speaking of, the IE 10 is horrible. The parser errors for a simple not well formed XML are displayed like Asian characters all over the browser window (while firefox shows the column and row number).
Do you have any suggestions for another processor I could use? Would a DTD schema apply in the case if Internet Explorer?
Thanks much,
gabi.
|
|

July 3rd, 2013, 11:14 AM
|
 |
Friend of Wrox
|
|
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
|
|
Again, if you are generating the XML, you should be validating you are providing valid XML - presumably in the back end of your system.
I doubt very much there is a way to get IE's built in XML parser to give you more information that you are seeing now.
|
|

July 3rd, 2013, 11:23 AM
|
|
Authorized User
|
|
Join Date: Mar 2007
Posts: 33
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Sam -
Thanks again.
gabi
|
|

July 3rd, 2013, 11:40 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
|
|
It is possible to replace IE's built-in in stylesheet that displays the XML, but I don't think you can replace the error messages (or add to them). Your users will just have to use Firefox or a proper debugging environment, such as oXygen.
You could also write something yourself, in theory, but I'd be tempted to review the business requirements before taking such a huge step.
|
|
 |