Subjects
Home
VOTE Move XML Commons to Xerces
Commented: (XERCESJ 589) Bug with pattern restriction on long strings
: Xerces J 2 8 1 Release on Wednesday, September 13th
: Xerces J 2 9 0 Release on Wednesday, November 22nd
Commented: (XERCESJ 1066) Restriction+choice+substitutionGroup error
Commented: (XERCESJ 1178) Error getting prefix for an attribute with no n
Updated: (XERCESJ 1244) XMLSchemaValidator does not contribute element 's
Some consideration about the xerces DOM implementation
Updated: (XERCESJ 1066) Restriction+choice+substitutionGroup error
Commented: (XERCESJ 1227) Poor performance / OutOfMemoryError for sequenc
retain exception stack traces
Updated: (XERCESJ 1193) NPE or hang when parsing using the "continue afte
Future of NekoHTML
Commented: (XERCESJ 1203) NPE in XMLDTDProcessor
DOM Level 3 APIs for Xalan J and a new Xalan release (2 7 1)
: xml commons external 1 3 04 Release on Wednesday, November 22nd
Commented: (XERCESJ 1247) Incorrect location information on SAX when usin
XInclude exceptions how to mirror Xerces J functionality into Xerces C++?
First proposal on SoC project "Add support for the StAX (JSR 173) cursor API
: xml commons resolver 1 2 Release on Wednesday, November 22nd
Typo in RangeToken java Please check
Validator features
java lang ClassCastException when adopting Node
using the org apache xerces impl xs identity package
Updated: (XERCESJ 1257) buffer overflow in UTF8Reader for characters out
Problem with ref attributes and schema validation
Updated: (XERCESJ 122) XMLSchemaValidator does not contribute element 's d
Performance problem under load Xerces with Weblogic 9 x
remove ignored memory allocation
Commented: (XERCESJ 1177) SAXXMLStreamReader doesn 't always report namesp
Commented: (XERCESJ 977) Null pointer exception during DOM parsing
Commented: (XERCESJ 1197) Code cleanup for org apache xml serialize
Commented: (XERCESJ 1201) Initial contribution for StAX Event API
Updated: (XERCESJ 1061) Regex "$ " and "^ " characters treated as special c
Commented: (XERCESJ 1199) SAXXMLStreamReader should attempt to register a
Commented: (XERCESJ 1061) Regex "$ " and "^ " characters treated as special
Updated: (XERCESJ 589) Bug with pattern restriction on long strings
StackOverflow
xerces Range unnecessarily not garbage collectable if not detached
Updated: (XERCESJ 1178) Error getting prefix for an attribute with no nam
Bug in xs:redefine
Commented: (XERCESJ 1204) Can not set XMLEntityResolver for LSParser
Updated: (XERCESJ 1253) Prototype for SoC2007 project "Add support for th
Updated: (XERCESJ 1259) Add SteamFilter Function to SoC2007 project "Add
Assigned: (XERCESJ 444) SAXException thrown by EntityResolver is reported
Google Summer of Code 2007
Xerces J and XInclude relative path issue
Assigned: (XERCESJ 206) Stack overflow when using a schema validation
Commented: (XERCESJ 1215) Restrictions involving two levels of substituti
Closed: (XERCESJ 1203) NPE in XMLDTDProcessor
non overriding equals methoda
Resolved: (XERCESJ 1079) invalid value returned for TOTALDIGITS facet in
Xerces AS3 port
Updated: (XERCESJ 325) Regular Expression; Pattern "| " clause order de
Updated: (XERCESJ 1196) Javadoc generation fails on Java SE 5 0
Closed: (XERCESJ 1202) DTD validation on XIncluded documents when the sch
Created: (XERCESJ 1124) Nonspecific schema error message
a bug in xerces
Updated: (XERCESJ 1201) Initial contribution for StAX Event API
Closed: (XERCESJ 1254) Empty uris in targetNamespace attribute not report
Links
Home
Oracle database error code
 
Search:  
Power your search with and, or, +, -, or "some phrase" operators.
error handling in schema validation

error handling in schema validation

2003-01-09       - By Kiran Bhumana
Reply:     1     2  

I have it fixed .

I had the contentHandler set and not ErrorHandler
setErrorHandler was what I missed.

-----Original Message-----
From: Kiran Bhumana
Sent: Thursday, January 09, 2003 4:00 PM
To: xerces-j-user@(protected)
Subject: error handling in schema validation


I am trying to trap the errors being printed to the screen, during
validation by
overwriting the methods of the import
org.xml.sax.helpers.DefaultHandler;.

The errors look like this, but they don't seem to be going through the
apis
Such as,
   public void error (SAXParseException e)
           throws SAXException
   {
           System.out.println ("in error ");
           errorStringList.append(e.toString());
   }
   
public void fatalError (SAXParseException e)
           throws SAXException
   {
           System.out.println ("in Fatal error ");
           errorStringList.append(e.toString());
           //          throw e;
   }

the errors printed onto the screen are,  

shiporder
orderperson
[Error] shiporder.xml:6:9: cvc-complex-type.2.4.a: Invalid content
starting with elem
ent 'name'. The content must match
'(("":orderperson),("":shipto),("":item){1-UNBOUND
ED})'.
name
address
city
country
[Fatal Error] shiporder.xml:10:4: The element type "shiporder" must be
terminated by
the matching end-tag "</shiporder>".
org.xml.sax.SAXParseException: The element type "shiporder" must be
terminated by the
matching end-tag "</shiporder>".


What am I missing something here ?

Thank you,
Kiran B.


<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas
-microsoft-com:office:word" xmlns:st1="urn:schemas-microsoft-com:office
:smarttags" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">


<meta name=ProgId content=Word.Document>
<meta name=Generator content="Microsoft Word 10">
<meta name=Originator content="Microsoft Word 10">
<link rel=File-List href="cid:filelist.xml@(protected)">
<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
name="time"/>
<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
name="date"/>
<!--[if gte mso 9]><xml>
<o:OfficeDocumentSettings>
 <o:DoNotRelyOnCSS/>
</o:OfficeDocumentSettings>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:WordDocument>
 <w:SpellingState>Clean</w:SpellingState>
 <w:GrammarState>Clean</w:GrammarState>
 <w:DocumentKind>DocumentEmail</w:DocumentKind>
 <w:EnvelopeVis/>
 <w:Compatibility>
  <w:BreakWrappedTables/>
  <w:SnapToGridInCell/>
  <w:WrapTextWithPunct/>
  <w:UseAsianBreakRules/>
 </w:Compatibility>
 <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
</w:WordDocument>
</xml><![endif]--><!--[if !mso]>
<style>
st1\:*{behavior:url(#default#ieooui) }
</style>
<![endif]-->
<style>
<!--
/* Font Definitions */
@(protected)
  {font-family:Tahoma;
  panose-1:2 11 6 4 3 5 4 4 2 4;
  mso-font-charset:0;
  mso-generic-font-family:swiss;
  mso-font-pitch:variable;
  mso-font-signature:553679495 -2147483648 8 0 66047 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
  {mso-style-parent:"";
  margin:0in;
  margin-bottom:.0001pt;
  mso-pagination:widow-orphan;
  font-size:12.0pt;
  font-family:"Times New Roman";
  mso-fareast-font-family:"Times New Roman";}
a:link, span.MsoHyperlink
  {color:blue;
  text-decoration:underline;
  text-underline:single;}
a:visited, span.MsoHyperlinkFollowed
  {color:purple;
  text-decoration:underline;
  text-underline:single;}
span.EmailStyle17
  {mso-style-type:personal;
  mso-style-noshow:yes;
  mso-ansi-font-size:10.0pt;
  mso-bidi-font-size:10.0pt;
  font-family:Arial;
  mso-ascii-font-family:Arial;
  mso-hansi-font-family:Arial;
  mso-bidi-font-family:Arial;
  color:windowtext;}
span.EmailStyle18
  {mso-style-type:personal-reply;
  mso-style-noshow:yes;
  mso-ansi-font-size:10.0pt;
  mso-bidi-font-size:10.0pt;
  font-family:Arial;
  mso-ascii-font-family:Arial;
  mso-hansi-font-family:Arial;
  mso-bidi-font-family:Arial;
  color:navy;}
span.SpellE
  {mso-style-name:"";
  mso-spl-e:yes;}
span.GramE
  {mso-style-name:"";
  mso-gram-e:yes;}
@(protected) Section1
  {size:8.5in 11.0in;
  margin:1.0in 1.25in 1.0in 1.25in;
  mso-header-margin:.5in;
  mso-footer-margin:.5in;
  mso-paper-source:0;}
div.Section1
  {page:Section1;}
-->
</style>
<!--[if gte mso 10]>
<style>
/* Style Definitions */
table.MsoNormalTable
  {mso-style-name:"Table Normal";
  mso-tstyle-rowband-size:0;
  mso-tstyle-colband-size:0;
  mso-style-noshow:yes;
  mso-style-parent:"";
  mso-padding-alt:0in 5.4pt 0in 5.4pt;
  mso-para-margin:0in;
  mso-para-margin-bottom:.0001pt;
  mso-pagination:widow-orphan;
  font-size:10.0pt;
  font-family:"Times New Roman";}
</style>
<![endif]-->
</head>

<body lang=EN-US link=blue vlink=purple style='tab-interval:.5in'>

<div class=Section1>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>I have it <span class=GramE>fixed .</span>
<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>I had the <span class=SpellE
>contentHandler</span>
set and not <span class=SpellE>ErrorHandler</span> <o:p></o:p></span></font></p>

<p class=MsoNormal><span class=SpellE><span class=GramE><font size=2
color=navy face=Arial><span style='font-size:10.0pt;font-family:Arial;
color:navy'>setErrorHandler</span></font></span></span><font size=2 color=navy
face=Arial><span style='font-size:10.0pt;font-family:Arial;color:navy'> was what
I missed. <o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=2 face=Tahoma><span
style='font-size:10.0pt;font-family:Tahoma'>-----Original Message-----<br>
<b><span style='font-weight:bold'>From:</span></b> Kiran Bhumana <br>
<b><span style='font-weight:bold'>Sent:</span></b> </span></font><st1:date
Month="1" Day="9" Year="2003"><font size=2 face=Tahoma><span style='font-size:
10.0pt;font-family:Tahoma'>Thursday, January 09, 2003</span></font></st1:date>
<font
size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'> </span><
/font><st1:time
Hour="16" Minute="0"><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma'>4:00 PM</span></font></st1:time><font size=2 face=Tahoma>
<span
style='font-size:10.0pt;font-family:Tahoma'><br>
<b><span style='font-weight:bold'>To:</span></b> xerces-j-user@(protected)
<br>
<b><span style='font-weight:bold'>Subject:</span></b> error handling in schema
validation</span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=3 face="Times New Roman"
><span
style='font-size:12.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'>I am trying to trap the errors being
printed to the screen, during validation by <o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'>overwriting the methods of the
import <u>org.xml.sax.helpers.DefaultHandler</u>;.<o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'>The errors look like this, but they
don&#8217;t seem to be going through the apis <o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'>Such as, <o:p></o:p></span></font><
/p>

<p class=MsoNormal style='margin-left:.5in'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'><span style='mso-spacerun:yes'>&nbsp
;&nbsp;&nbsp;
</span>public void error (SAXParseException e)<o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'><span style='mso-tab-count:1'>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>throws
SAXException<o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'><span style='mso-spacerun:yes'>&nbsp
;&nbsp;&nbsp;
</span>{<o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'><span style='mso-tab-count:1'>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>System.out
.println
(&quot;in error &quot;);<o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'><span style='mso-tab-count:1'>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span
>errorStringList.append(e.toString());<o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'><span style='mso-spacerun:yes'>&nbsp
;&nbsp;&nbsp;
</span>}<o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'><span style='mso-spacerun:yes'>&nbsp
;&nbsp;&nbsp;
</span><o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'>public void fatalError
(SAXParseException e)<o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'><span style='mso-tab-count:1'>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>throws
SAXException<o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'><span style='mso-spacerun:yes'>&nbsp
;&nbsp;&nbsp;
</span>{<o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'><span style='mso-tab-count:1'>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>System.out
.println
(&quot;in Fatal error &quot;);<o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'><span style='mso-tab-count:1'>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span
>errorStringList.append(e.toString());<o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'><span style='mso-tab-count:1'>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>//<span
style='mso-tab-count:1'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span>throw e;<o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'><span style='mso-spacerun:yes'>&nbsp
;&nbsp;&nbsp;
</span>}<o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'>the errors printed onto the screen
are,<span style='mso-spacerun:yes'>&nbsp; </span><o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'>shiporder<o:p></o:p></span></font><
/p>

<p class=MsoNormal style='margin-left:.5in'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'>orderperson<o:p></o:p></span></font>
</p>

<p class=MsoNormal style='margin-left:.5in'><font size=2 color=red face=Arial>
<span
style='font-size:10.0pt;font-family:Arial;color:red'>[Error] shiporder.xml:6:9:
cvc-complex-type.2.4.a: Invalid content starting with elem<o:p></o:p></span><
/font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=2 color=red face=Arial>
<span
style='font-size:10.0pt;font-family:Arial;color:red'>ent 'name'. The content
must match
'((&quot;&quot;:orderperson),(&quot;&quot;:shipto),(&quot;&quot;:item){1
-UNBOUND<o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=2 color=red face=Arial>
<span
style='font-size:10.0pt;font-family:Arial;color:red'>ED})'.<o:p></o:p></span><
/font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'>name<o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'>address<o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'>city<o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'>country<o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=2 color=red face=Arial>
<span
style='font-size:10.0pt;font-family:Arial;color:red'>[Fatal Error]
shiporder.xml:10:4: The element type &quot;shiporder&quot; must be terminated
by<o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=2 color=red face=Arial>
<span
style='font-size:10.0pt;font-family:Arial;color:red'>the matching end-tag
&quot;&lt;/shiporder&gt;&quot;.<o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=2 color=red face=Arial>
<span
style='font-size:10.0pt;font-family:Arial;color:red'>org.xml.sax
.SAXParseException:
The element type &quot;shiporder&quot; must be terminated by the<o:p></o:p><
/span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=2 color=red face=Arial>
<span
style='font-size:10.0pt;font-family:Arial;color:red'><span
style='mso-spacerun:yes'>&nbsp;</span>matching end-tag
&quot;&lt;/shiporder&gt;&quot;.<o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'>What am I missing something here ?<o
:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'>Thank you,<o:p></o:p></span></font><
/p>

<p class=MsoNormal style='margin-left:.5in'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'>Kiran B.<o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

</div>

</body>

</html>