xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Irene Levina" <ir...@progress.com>
Subject Re: Problems with validation using Xerces-J
Date Thu, 07 Dec 2000 15:41:25 GMT
Hi Susan,
Hope , it will help you with validation issue

According Xerces documentation to turn on a   validation you  have to
use method setFeature() :

In addition to this you need to provide a class that implements the
ErrorHandler interface  and you need to register it with the parser.
Look at the Xerces Samples under dom.wrappers package the source file
DOMParser ( xml-xerces\java\samples\dom\wrappers\DOMParser.java.

Irene Levina.

Sean Murphy wrote:

> Hi,
> I want to use XML to encode data that I use in my application. I
> downloaded the Xerces-J software (the XML4J v3.1.0 software to be more
> exact) and I'm trying to make it do things.  However, I'm not having much
> success. This is most certainly due to my lack of understanding of how
> the system works.
> I'm working on a win98 box and using JDK 1.1.7A. XML4J v3.1.0 is a wrapper
> around Xerces-J 1.2.0.
> I have had a couple of problems - my first problem was that the parser
> generated nodes for whitespace when reading in my XML file. This was
> somewhat confusing and undesirable. I looked on the mailing list and found
> that this issue was raised before, but I didn't understand the proposed
> solution. Is it possible to easily create a DOM that does not have
> whitespace nodes?
> The second problem that I encountered is a validation problem: I cannot
> get the parser to validate the XML file. I added a <!DOCTYPE> line to my
> (very simple) XML file and created a DTD of the appropriate name in the
> same directory as the XML file, but it does not seem to have any impact.
> I was expecting the parser to throw exceptions if the XML file is not
> conformant with the DTD. I did observe that if I introduce errors into the
> DTD file that an exception is thrown, so the DTD is certainly being read.
> However, I noticed that there do not appear to be any elements in the
> DocTypeImpl object in the Document class - the DocType is correct, but it
> appears to be empty. I'm not certain about this latter point, because I
> don't understand the workings of the system, but it seems to be the case
> that the Document.DocType.elements.nodes is a null Vector, although this
> is after the parse operation, so perhaps the DTD data is discarded after
> parsing.
> I'm sure that there could be a number of reasons that can explain why my
> XML file is not being validated. I've tried tinkering with the feature and
> properties settings to no avail, and I've spent some time looking at the
> documentation, but I can't seem to figure out what the problem might be.
> Any ideas?
> [I couldn't find a specific Xerces-J users mailing list - I've had a look
> at previous postings and this doesn't appear to be off-topic; if it is,
> then let me know a more suitable forum.]
> Thanks in advance,
> Sean.
> -----
> Sean Murphy,                    Email: sean.murphy@teltec.dcu.ie
> Teltec Ireland,                 Phone: +353-1-7005080
> DCU, Dublin 9,                  Fax:   +353-1-7005092
> Ireland.
> ---------------------------------------------------------------------
> In case of troubles, e-mail:     webmaster@xml.apache.org
> To unsubscribe, e-mail:          general-unsubscribe@xml.apache.org
> For additional commands, e-mail: general-help@xml.apache.org

View raw message