xerces-c-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Frank Zhou <fcho...@yahoo.com>
Subject Re: Replacement for 2.7.0 depecated API getRootElemId in 3.0.1
Date Tue, 07 Jul 2009 05:50:04 GMT

Can you do something like this:

  DTDValidator&  x = (DTDValidator&)m_parser->getValidator();
  DTDGrammar*    grammar = (DTDGrammar*) x.getGrammar();
  XMLDTDDescription* description 
    = (XMLDTDDescription*)grammar->getGrammarDescription();
  XMLCh* rootName = description->getRootName();

Thanks!
Frank

--- On Mon, 7/6/09, Gelle, Sreenivasulu <sreenivasulu.gelle@sap.com> wrote:

> From: Gelle, Sreenivasulu <sreenivasulu.gelle@sap.com>
> Subject: Replacement for 2.7.0 depecated API getRootElemId in 3.0.1
> To: c-users@xerces.apache.org, c-dev@xerces.apache.org
> Cc: "Ho, XuanLoan" <xuanloan.ho@sap.com>, "Zhou, Xiaofan" <xiaofan.zhou@sap.com>
> Date: Monday, July 6, 2009, 9:31 PM
> HI All,
> 
>  
> 
> I am upgrading Xerces from 2.7.0 to 3.0.1. I am having a
> problem when I
> am trying to get the root element for a given DTD. Your
> inputs are
> appreciated to fix this upgrade issue.
> 
>  
> 
>  
> 
> When using 2.7.0, I have the following piece of code to get
> the root
> node of the DTD:
> 
>  
> 
>                
>         DTDValidator&   
>            x
> = (DTDValidator&)m_parser->getValidator();
> 
>  
> 
>                
>         DTDGrammar*     
>                
>      grammar =
> (DTDGrammar*) x.getGrammar();
> 
>                
>         U4       
>             root_id =
> grammar->getRootElemId();
> 
>                
>        
> NameIdPoolEnumerator<DTDElementDecl> elemEnum =
> grammar->getElemEnumerator();
> 
>                
>        
> while(elemEnum.hasMoreElements())
> 
>                
>         {
> 
>                
>                
>     const DTDElementDecl& curElem =
> elemEnum.nextElement();
> 
>                
>                
>     if(root_id  == curElem.getId())
> 
>                
>                
>     {
> 
>                
>                
>                
> //Getting the root
> element name.
> 
>                
>                
>                
> rootName =
> (UChar*)curElem.getFullName();
> 
>                
>                
>                
> break;
> 
>                
>                
>     }
> 
>                
>         }
> 
>  
> 
> In the above code, m_parser is an instance of SAXParser,
> and it parse an
> XML with a DTD associated with it using <!DOCTYPE
> .../>.
> 
>  
> 
> Now in 3.0.1, I noticed that the interface getRootElemId()
> does not
> exist in DTDGrammar class anymore. 
> 
> What is the alternative way to get the root element? Can
> anyone point me
> to the new interface?
> 
>  
> 
> Thanks
> 
> -Srini
> 
>  
> 
>  
> 
>  
> 
>  
> 
> 


      

Mime
View raw message