Return-Path: X-Original-To: apmail-xerces-c-users-archive@www.apache.org Delivered-To: apmail-xerces-c-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 97F059C94 for ; Fri, 23 Sep 2011 06:16:04 +0000 (UTC) Received: (qmail 55307 invoked by uid 500); 23 Sep 2011 06:16:04 -0000 Delivered-To: apmail-xerces-c-users-archive@xerces.apache.org Received: (qmail 55188 invoked by uid 500); 23 Sep 2011 06:16:00 -0000 Mailing-List: contact c-users-help@xerces.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: c-users@xerces.apache.org Delivered-To: mailing list c-users@xerces.apache.org Received: (qmail 55154 invoked by uid 99); 23 Sep 2011 06:15:59 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 23 Sep 2011 06:15:59 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [131.239.30.132] (HELO ntmamx2.progress.com) (131.239.30.132) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 23 Sep 2011 06:15:54 +0000 Received: from ntmamx2.progress.com (127.0.0.1) by ntmamx2.progress.com (MlfMTA v3.2r9) id hfgi1g0171sm for ; Fri, 23 Sep 2011 02:15:31 -0400 (envelope-from ) Received: from progress.com ([172.16.3.168]) by ntmamx2.progress.com (SonicWALL 7.2.3.3283) with ESMTP (AIO); Fri, 23 Sep 2011 02:15:31 -0400 Received: from NTMAEXCAS02.bedford.progress.com (ntmaexcas02 [10.128.13.36]) by progress.com (8.13.8/8.13.8) with ESMTP id p8N6FXtT002281 for ; Fri, 23 Sep 2011 02:15:33 -0400 (EDT) Received: from [10.133.176.36] (10.133.176.36) by NTMAEXCAS02.bedford.progress.com (10.128.13.37) with Microsoft SMTP Server (TLS) id 8.2.213.0; Fri, 23 Sep 2011 02:15:33 -0400 Message-ID: <4E7C2403.6030009@progress.com> Date: Fri, 23 Sep 2011 08:15:31 +0200 From: Alberto Massari User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0.2) Gecko/20110902 Thunderbird/6.0.2 MIME-Version: 1.0 To: Subject: Re: Please Help : XercesDOMParser and DOMLSParser Schema validation is not the same References: <32503845.post@talk.nabble.com> In-Reply-To: <32503845.post@talk.nabble.com> Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit X-EMS-Proccessed: +CmIlJ+kdV7Z341JADFd9w== X-EMS-STAMP: i548ZsZCR83YAi82rMZJ7w== X-Mlf-Version: 7.2.3.3283 X-Mlf-UniqueId: o201109230615310203879 Hi Suresh, if you want to re-use during the parsing the grammar that you manually load, you need to add the third argument of loadGrammar, setting it to true. Otherwise you are parsing the schema, but not caching it for later use. Alberto Il 23/09/2011 00:17, unique_suresh ha scritto: > Hi All, > > I am new to Xerces lib and XML approach here. I have created XSD and also I > created test.xml file. Where I want to validate xml with test.xsd file. Here > I want to provide namespace p for all the elements by default and including > attributes. However I have got two sample code from internet I am trying to > run both of them. > > Files : test.xml test.xsd > > Code : > load-grammar-dom uses DOMLSParser class to load grammer and validate xml. > SchemaValidator.cpp uses XercesDOMParser class to load grammer and validate > xml. > > > Here is my problem, > > 1. Using DOMLSParser validate works fine I dont see any issues with the code > / files > > > Output: > ./load-grammar-dom test.xsd test.xml > loading test.xsd > parsing test.xml > Validation successful !!! > > > 2. Using XercesDOMParser I am getting error message saying " At line 2 > Column 89, no declaration found for element 'p:test_in' . I dont understand > that one approach says xml is fine this approach says something wrong. > Please help > > Output: > ./SchemaValidator test.xsd test.xml > ===> At line 2 Column 89, no declaration found for element 'p:test_in' > <==== > XML file doesn't conform to the schema > > > Question : > 1. Why DOMLSParser works but XercesDOMParser complaining about element. > 2. can you someone explaining to me that difference between DOMLSParser and > XercesDOMParser classes and their pros and cons. > > PS : I am very new to xml and xerces lib. Any help would appropriated. > > > http://old.nabble.com/file/p32503845/test.xml test.xml > http://old.nabble.com/file/p32503845/test.xsd test.xsd > http://old.nabble.com/file/p32503845/SchemaValidator.cpp SchemaValidator.cpp > http://old.nabble.com/file/p32503845/load-grammar-dom.cpp > load-grammar-dom.cpp > > > Thanks > Suresh. > >