You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Utsav Boobna <Ut...@lri.fr> on 2003/05/20 10:42:24 UTC

XML parser

Hi,
	Presently I am working on a project whose aim is to validify an 
invalid XML document. For it, I need a XML validating parser, to which I 
call from my Java program giving it the root of the DOM tree of the XML 
document and it should return to the program , the pointer to the node 
which contains the error (if the document is invalid) and NULL (if the 
document is valid). Does any such parser exits ? or, is there any parser 
available to which I can easily modify to get the desired ersult.

Utsav



---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


Re: XML parser

Posted by "K. Venugopal" <k....@sun.com>.

Shital Joshi wrote:

>hi there,
>
>If I am using SAX Parser + schema to validate the XML document, can I still
>get the name of element where schema validation failed? I guess I have to
>implement startElement() method and in the errorHandler I can get the
>current element name from the startElement() method. Is this a correct
>approach?
>
Yes thats right .
Regards
venu

>
>-Shital Joshi
>MFG Systems
>
>
>
>-----Original Message-----
>From: K. Venugopal [mailto:k.venugopal@sun.com]
>Sent: Tuesday, May 20, 2003 5:26 AM
>To: xerces-j-user@xml.apache.org
>Subject: Re: XML parser
>
>
>Hi Utsav ,
>
>With  xerces you could get the location where error has occured . For
>this you need to set a error handler and query the current
>node in the error handler as shown below .
>
>eg:
>       Element node =
>(Element)parser.getProperty("http://apache.org/xml/properties/dom/current-el
>ement-node");
>
>For more information refer to
>http://xml.apache.org/xerces2-j/properties.html
>
>Hope this helps .
>
>Regards
>venu
>
>  
>
>>Hi,
>>	Presently I am working on a project whose aim is to validify an
>>invalid XML document. For it, I need a XML validating parser, to which I
>>call from my Java program giving it the root of the DOM tree of the XML
>>document and it should return to the program , the pointer to the node
>>which contains the error (if the document is invalid) and NULL (if the
>>document is valid). Does any such parser exits ? or, is there any parser
>>available to which I can easily modify to get the desired ersult.
>>
>>Utsav
>>
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
>>For additional commands, e-mail: xerces-j-user-help@xml.apache.org
>>
>>
>>
>>    
>>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
>For additional commands, e-mail: xerces-j-user-help@xml.apache.org
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
>For additional commands, e-mail: xerces-j-user-help@xml.apache.org
>
>  
>


RE: XML parser

Posted by Rahul Srivastava <rs...@firstam.com>.
 > Ragunath Marudhachalam wrote...
 > 
 > You have to set
 > 
 > parser.setFeature( 
 > "http://apache.org/xml/features/dom/defer-node-expansion"
 > ,false);
 > 
 > and in the errorhandler's callback function,
 > 
 > Element node = 
 > (Element)parser.getProperty("http://apache.org/xml/properties
 > /dom/current-element-node");

That's correct, but it will work only when DOM parsing. Setting these
features/properties on a SAX parser would not hesitate to throw
SAXNotRecognizedException.

-Rahul.


 > 
 > 	if (node != null)
 >                 System.out.println(node.getNodeName());
 > 
 > 
 > Ragu
 > CircuitVision
 > 
 > 
 > 
 > -----Original Message-----
 > From: Shital Joshi [mailto:shital@mfgsys.com]
 > Sent: Wednesday, May 21, 2003 10:19 AM
 > To: xerces-j-user@xml.apache.org
 > Subject: RE: XML parser
 > 
 > 
 > hi there,
 > 
 > If I am using SAX Parser + schema to validate the XML 
 > document, can I still get the name of element where schema 
 > validation failed? I guess I have to implement 
 > startElement() method and in the errorHandler I can get the 
 > current element name from the startElement() method. Is this 
 > a correct approach?
 > 
 > -Shital Joshi
 > MFG Systems
 > 
 > 
 > 
 > -----Original Message-----
 > From: K. Venugopal [mailto:k.venugopal@sun.com]
 > Sent: Tuesday, May 20, 2003 5:26 AM
 > To: xerces-j-user@xml.apache.org
 > Subject: Re: XML parser
 > 
 > 
 > Hi Utsav ,
 > 
 > With  xerces you could get the location where error has 
 > occured . For this you need to set a error handler and query 
 > the current node in the error handler as shown below .
 > 
 > eg:
 >        Element node = 
 > (Element)parser.getProperty("http://apache.org/xml/properties
 > /dom/current-el
 > ement-node");
 > 
 > For more information refer to 
 > http://xml.apache.org/xerces2-j/properties.html
 > 
 > Hope this helps .
 > 
 > Regards
 > venu
 > 
 > >Hi,
 > >	Presently I am working on a project whose aim is to validify an 
 > >invalid XML document. For it, I need a XML validating 
 > parser, to which 
 > >I call from my Java program giving it the root of the DOM 
 > tree of the 
 > >XML document and it should return to the program , the 
 > pointer to the 
 > >node which contains the error (if the document is invalid) 
 > and NULL (if 
 > >the document is valid). Does any such parser exits ? or, is 
 > there any 
 > >parser available to which I can easily modify to get the desired 
 > >ersult.
 > >
 > >Utsav
 > >
 > >
 > >
 > >------------------------------------------------------------
 > ---------
 > >To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
 > >For additional commands, e-mail: xerces-j-user-help@xml.apache.org
 > >
 > >
 > >
 > 
 > 
 > 
 > ---------------------------------------------------------------------
 > To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
 > For additional commands, e-mail: xerces-j-user-help@xml.apache.org
 > 
 > 
 > 
 > ---------------------------------------------------------------------
 > To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
 > For additional commands, e-mail: xerces-j-user-help@xml.apache.org
 > 
 > 
 > ---------------------------------------------------------------------
 > To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
 > For additional commands, e-mail: xerces-j-user-help@xml.apache.org
 > 
 > 



---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


RE: XML parser

Posted by Simon Kitching <si...@ecnetwork.co.nz>.
On Thu, 2003-05-22 at 09:18, Shital Joshi wrote:
> hi there,
> 
> I tried setting this property:
> 
> parser.setFeature( "http://apache.org/xml/features/dom/defer-node-expansion"
> ,false);
> 
> But it gives me SAXNotSupportedException. I am using Xercers-j 2.4. Any
> ideas why?

Perhaps you aren't actually using Xerces 2.4 at all, but are instead
accidentally using some other xml parser (probably the crimson parser
bundled with the JDK). Try printing parser.getClass().getName() and see
what the actual parser class is..

Regards,

Simon


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


allow space for type in schema

Posted by Shital Joshi <sh...@mfgsys.com>.
hi there,

how can i allow space or empty string for an element, with datatype defined
as <xsd:decimal> in the corresponding schema?

i tried "nillable=true" attribute, then different facets but it didn't work.
:(

any ideas?

thanks a lot,
-Shital Joshi



---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


RE: XML parser

Posted by Rahul Srivastava <rs...@firstam.com>.
 > Shital Joshi wrote...
 > 
 > I tried setting this property:
 > 
 > parser.setFeature( 
 > "http://apache.org/xml/features/dom/defer-node-expansion"
 > ,false);
 > 
 > But it gives me SAXNotSupportedException. I am using 
 > Xercers-j 2.4. Any ideas why?

That's because you are trying to set a DOM Feature on a SAX parser
configuration.

-Rahul.


 > 
 > -Shital Joshi
 > MFG Systems
 > 
 > 
 > 
 > -----Original Message-----
 > From: Doug Helton [mailto:dhelton@ideorlando.org]
 > Sent: Wednesday, May 21, 2003 10:42 AM
 > To: xerces-j-user@xml.apache.org
 > Subject: RE: XML parser
 > 
 > 
 > Shital,
 > 	If you are trying to get this just to debug, you can 
 > get the line number of the error from the exception, which 
 > usually puts you at the end of the element that has the 
 > error.  If you are trying to display the name for users you 
 > will probably have to follow Ragunath's suggestion or what 
 > you planned would work as well.
 > 
 > Doug
 > 
 > -----Original Message-----
 > From: Ragunath Marudhachalam 
 > [mailto:rmarudhachalam@circuitvision.com]
 > Sent: Wednesday, May 21, 2003 10:28 AM
 > To: xerces-j-user@xml.apache.org
 > Subject: RE: XML parser
 > 
 > 
 > You have to set
 > 
 > parser.setFeature( 
 > "http://apache.org/xml/features/dom/defer-node-expansion"
 > ,false);
 > 
 > and in the errorhandler's callback function,
 > 
 > Element node = 
 > (Element)parser.getProperty("http://apache.org/xml/properties
 > /dom/current-el
 > ement-node");
 > 
 > 	if (node != null)
 >                 System.out.println(node.getNodeName());
 > 
 > 
 > Ragu
 > CircuitVision
 > 
 > 
 > 
 > -----Original Message-----
 > From: Shital Joshi [mailto:shital@mfgsys.com]
 > Sent: Wednesday, May 21, 2003 10:19 AM
 > To: xerces-j-user@xml.apache.org
 > Subject: RE: XML parser
 > 
 > 
 > hi there,
 > 
 > If I am using SAX Parser + schema to validate the XML 
 > document, can I still get the name of element where schema 
 > validation failed? I guess I have to implement 
 > startElement() method and in the errorHandler I can get the 
 > current element name from the startElement() method. Is this 
 > a correct approach?
 > 
 > -Shital Joshi
 > MFG Systems
 > 
 > 
 > 
 > -----Original Message-----
 > From: K. Venugopal [mailto:k.venugopal@sun.com]
 > Sent: Tuesday, May 20, 2003 5:26 AM
 > To: xerces-j-user@xml.apache.org
 > Subject: Re: XML parser
 > 
 > 
 > Hi Utsav ,
 > 
 > With  xerces you could get the location where error has 
 > occured . For this you need to set a error handler and query 
 > the current node in the error handler as shown below .
 > 
 > eg:
 >        Element node = 
 > (Element)parser.getProperty("http://apache.org/xml/properties
 > /dom/current-el
 > ement-node");
 > 
 > For more information refer to 
 > http://xml.apache.org/xerces2-j/properties.html
 > 
 > Hope this helps .
 > 
 > Regards
 > venu
 > 
 > >Hi,
 > >	Presently I am working on a project whose aim is to validify an 
 > >invalid XML document. For it, I need a XML validating 
 > parser, to which 
 > >I call from my Java program giving it the root of the DOM 
 > tree of the 
 > >XML document and it should return to the program , the 
 > pointer to the 
 > >node which contains the error (if the document is invalid) 
 > and NULL (if 
 > >the document is valid). Does any such parser exits ? or, is 
 > there any 
 > >parser available to which I can easily modify to get the desired 
 > >ersult.
 > >
 > >Utsav
 > >
 > >
 > >
 > >------------------------------------------------------------
 > ---------
 > >To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
 > >For additional commands, e-mail: xerces-j-user-help@xml.apache.org
 > >
 > >
 > >
 > 
 > 
 > 
 > ---------------------------------------------------------------------
 > To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
 > For additional commands, e-mail: xerces-j-user-help@xml.apache.org
 > 
 > 
 > 
 > ---------------------------------------------------------------------
 > To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
 > For additional commands, e-mail: xerces-j-user-help@xml.apache.org
 > 
 > 
 > ---------------------------------------------------------------------
 > To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
 > For additional commands, e-mail: xerces-j-user-help@xml.apache.org
 > 
 > 
 > ---------------------------------------------------------------------
 > To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
 > For additional commands, e-mail: xerces-j-user-help@xml.apache.org
 > 
 > 
 > ---------------------------------------------------------------------
 > To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
 > For additional commands, e-mail: xerces-j-user-help@xml.apache.org
 > 
 > 



---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


RE: XML parser

Posted by Shital Joshi <sh...@mfgsys.com>.
hi there,

I tried setting this property:

parser.setFeature( "http://apache.org/xml/features/dom/defer-node-expansion"
,false);

But it gives me SAXNotSupportedException. I am using Xercers-j 2.4. Any
ideas why?

-Shital Joshi
MFG Systems



-----Original Message-----
From: Doug Helton [mailto:dhelton@ideorlando.org]
Sent: Wednesday, May 21, 2003 10:42 AM
To: xerces-j-user@xml.apache.org
Subject: RE: XML parser


Shital,
	If you are trying to get this just to debug, you can get the line number of
the error from the exception, which usually puts you at the end of the
element that has the error.  If you are trying to display the name for users
you will probably have to follow Ragunath's suggestion or what you planned
would work as well.

Doug

-----Original Message-----
From: Ragunath Marudhachalam [mailto:rmarudhachalam@circuitvision.com]
Sent: Wednesday, May 21, 2003 10:28 AM
To: xerces-j-user@xml.apache.org
Subject: RE: XML parser


You have to set

parser.setFeature( "http://apache.org/xml/features/dom/defer-node-expansion"
,false);

and in the errorhandler's callback function,

Element node =
(Element)parser.getProperty("http://apache.org/xml/properties/dom/current-el
ement-node");

	if (node != null)
                System.out.println(node.getNodeName());


Ragu
CircuitVision



-----Original Message-----
From: Shital Joshi [mailto:shital@mfgsys.com]
Sent: Wednesday, May 21, 2003 10:19 AM
To: xerces-j-user@xml.apache.org
Subject: RE: XML parser


hi there,

If I am using SAX Parser + schema to validate the XML document, can I still
get the name of element where schema validation failed? I guess I have to
implement startElement() method and in the errorHandler I can get the
current element name from the startElement() method. Is this a correct
approach?

-Shital Joshi
MFG Systems



-----Original Message-----
From: K. Venugopal [mailto:k.venugopal@sun.com]
Sent: Tuesday, May 20, 2003 5:26 AM
To: xerces-j-user@xml.apache.org
Subject: Re: XML parser


Hi Utsav ,

With  xerces you could get the location where error has occured . For
this you need to set a error handler and query the current
node in the error handler as shown below .

eg:
       Element node =
(Element)parser.getProperty("http://apache.org/xml/properties/dom/current-el
ement-node");

For more information refer to
http://xml.apache.org/xerces2-j/properties.html

Hope this helps .

Regards
venu

>Hi,
>	Presently I am working on a project whose aim is to validify an
>invalid XML document. For it, I need a XML validating parser, to which I
>call from my Java program giving it the root of the DOM tree of the XML
>document and it should return to the program , the pointer to the node
>which contains the error (if the document is invalid) and NULL (if the
>document is valid). Does any such parser exits ? or, is there any parser
>available to which I can easily modify to get the desired ersult.
>
>Utsav
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
>For additional commands, e-mail: xerces-j-user-help@xml.apache.org
>
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


RE: XML parser

Posted by Doug Helton <dh...@ideorlando.org>.
Shital,
	If you are trying to get this just to debug, you can get the line number of
the error from the exception, which usually puts you at the end of the
element that has the error.  If you are trying to display the name for users
you will probably have to follow Ragunath's suggestion or what you planned
would work as well.

Doug

-----Original Message-----
From: Ragunath Marudhachalam [mailto:rmarudhachalam@circuitvision.com]
Sent: Wednesday, May 21, 2003 10:28 AM
To: xerces-j-user@xml.apache.org
Subject: RE: XML parser


You have to set

parser.setFeature( "http://apache.org/xml/features/dom/defer-node-expansion"
,false);

and in the errorhandler's callback function,

Element node =
(Element)parser.getProperty("http://apache.org/xml/properties/dom/current-el
ement-node");

	if (node != null)
                System.out.println(node.getNodeName());


Ragu
CircuitVision



-----Original Message-----
From: Shital Joshi [mailto:shital@mfgsys.com]
Sent: Wednesday, May 21, 2003 10:19 AM
To: xerces-j-user@xml.apache.org
Subject: RE: XML parser


hi there,

If I am using SAX Parser + schema to validate the XML document, can I still
get the name of element where schema validation failed? I guess I have to
implement startElement() method and in the errorHandler I can get the
current element name from the startElement() method. Is this a correct
approach?

-Shital Joshi
MFG Systems



-----Original Message-----
From: K. Venugopal [mailto:k.venugopal@sun.com]
Sent: Tuesday, May 20, 2003 5:26 AM
To: xerces-j-user@xml.apache.org
Subject: Re: XML parser


Hi Utsav ,

With  xerces you could get the location where error has occured . For
this you need to set a error handler and query the current
node in the error handler as shown below .

eg:
       Element node =
(Element)parser.getProperty("http://apache.org/xml/properties/dom/current-el
ement-node");

For more information refer to
http://xml.apache.org/xerces2-j/properties.html

Hope this helps .

Regards
venu

>Hi,
>	Presently I am working on a project whose aim is to validify an
>invalid XML document. For it, I need a XML validating parser, to which I
>call from my Java program giving it the root of the DOM tree of the XML
>document and it should return to the program , the pointer to the node
>which contains the error (if the document is invalid) and NULL (if the
>document is valid). Does any such parser exits ? or, is there any parser
>available to which I can easily modify to get the desired ersult.
>
>Utsav
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
>For additional commands, e-mail: xerces-j-user-help@xml.apache.org
>
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


RE: XML parser

Posted by Ragunath Marudhachalam <rm...@circuitvision.com>.
You have to set

parser.setFeature( "http://apache.org/xml/features/dom/defer-node-expansion"
,false);

and in the errorhandler's callback function,

Element node =
(Element)parser.getProperty("http://apache.org/xml/properties/dom/current-el
ement-node");

	if (node != null)
                System.out.println(node.getNodeName());


Ragu
CircuitVision



-----Original Message-----
From: Shital Joshi [mailto:shital@mfgsys.com]
Sent: Wednesday, May 21, 2003 10:19 AM
To: xerces-j-user@xml.apache.org
Subject: RE: XML parser


hi there,

If I am using SAX Parser + schema to validate the XML document, can I still
get the name of element where schema validation failed? I guess I have to
implement startElement() method and in the errorHandler I can get the
current element name from the startElement() method. Is this a correct
approach?

-Shital Joshi
MFG Systems



-----Original Message-----
From: K. Venugopal [mailto:k.venugopal@sun.com]
Sent: Tuesday, May 20, 2003 5:26 AM
To: xerces-j-user@xml.apache.org
Subject: Re: XML parser


Hi Utsav ,

With  xerces you could get the location where error has occured . For
this you need to set a error handler and query the current
node in the error handler as shown below .

eg:
       Element node =
(Element)parser.getProperty("http://apache.org/xml/properties/dom/current-el
ement-node");

For more information refer to
http://xml.apache.org/xerces2-j/properties.html

Hope this helps .

Regards
venu

>Hi,
>	Presently I am working on a project whose aim is to validify an
>invalid XML document. For it, I need a XML validating parser, to which I
>call from my Java program giving it the root of the DOM tree of the XML
>document and it should return to the program , the pointer to the node
>which contains the error (if the document is invalid) and NULL (if the
>document is valid). Does any such parser exits ? or, is there any parser
>available to which I can easily modify to get the desired ersult.
>
>Utsav
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
>For additional commands, e-mail: xerces-j-user-help@xml.apache.org
>
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


RE: XML parser

Posted by Shital Joshi <sh...@mfgsys.com>.
hi there,

If I am using SAX Parser + schema to validate the XML document, can I still
get the name of element where schema validation failed? I guess I have to
implement startElement() method and in the errorHandler I can get the
current element name from the startElement() method. Is this a correct
approach?

-Shital Joshi
MFG Systems



-----Original Message-----
From: K. Venugopal [mailto:k.venugopal@sun.com]
Sent: Tuesday, May 20, 2003 5:26 AM
To: xerces-j-user@xml.apache.org
Subject: Re: XML parser


Hi Utsav ,

With  xerces you could get the location where error has occured . For
this you need to set a error handler and query the current
node in the error handler as shown below .

eg:
       Element node =
(Element)parser.getProperty("http://apache.org/xml/properties/dom/current-el
ement-node");

For more information refer to
http://xml.apache.org/xerces2-j/properties.html

Hope this helps .

Regards
venu

>Hi,
>	Presently I am working on a project whose aim is to validify an
>invalid XML document. For it, I need a XML validating parser, to which I
>call from my Java program giving it the root of the DOM tree of the XML
>document and it should return to the program , the pointer to the node
>which contains the error (if the document is invalid) and NULL (if the
>document is valid). Does any such parser exits ? or, is there any parser
>available to which I can easily modify to get the desired ersult.
>
>Utsav
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
>For additional commands, e-mail: xerces-j-user-help@xml.apache.org
>
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


Re: XML parser

Posted by "K. Venugopal" <k....@sun.com>.
Hi Utsav ,

With  xerces you could get the location where error has occured . For 
this you need to set a error handler and query the current
node in the error handler as shown below .

eg:   
       Element node = 
(Element)parser.getProperty("http://apache.org/xml/properties/dom/current-element-node");

For more information refer to 
http://xml.apache.org/xerces2-j/properties.html

Hope this helps .

Regards
venu

>Hi,
>	Presently I am working on a project whose aim is to validify an 
>invalid XML document. For it, I need a XML validating parser, to which I 
>call from my Java program giving it the root of the DOM tree of the XML 
>document and it should return to the program , the pointer to the node 
>which contains the error (if the document is invalid) and NULL (if the 
>document is valid). Does any such parser exits ? or, is there any parser 
>available to which I can easily modify to get the desired ersult.
>
>Utsav
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
>For additional commands, e-mail: xerces-j-user-help@xml.apache.org
>
>  
>



---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org