Alberto,

Thanks a lot for your help!
I have to use DOMBuliderImpl. Method getGrammarResolver is inaccessible for
this one.
How do I get XMLElementDecl from SchemaGrammar?
By the way, NodeName of my element ("title") is not necessarily unique in my
XSD.

Regards,
Michael

> --- Ursprüngliche Nachricht ---
> Von: Alberto Massari <[EMAIL PROTECTED]>
> An: [email protected]
> Betreff: Re: xs:appinfo
> Datum: Fri, 16 Dec 2005 13:15:50 +0100
> 
> Hi Micael,
> you can query the parser for the grammar used during validation, like 
> in this pseudo-code
> 
> parser.setGenerateSyntheticAnnotations(true);
> //or, if using SAX2 or DomBuilder
> parser.setFeature(XMLUni::fgXercesGenerateSyntheticAnnotations,true);
> 
> // parse your file with validation on
> 
> GrammarResolver* r=parser.getGrammarResolver();
> SchemaGrammar* g=(SchemaGrammar*)r->getGrammar("urn:my:namespace");
> XMLElementDecl* 
> elem=g->getElemDecl(r->getStringPool()->getId("urn:my:namespace"), 
> "titel", 0, Grammar::TOP_LEVEL_SCOPE);
> XSAnnotation* a=g->getAnnotation(elem);
> XMLCh* text=a->getAnnotationString();
> 
> Hope this helps,
> Alberto
> 
> At 21.02 14/12/2005 +0100, Michael Hagedorn wrote:
> >Hi All,
> >
> >After parsing a document I need to acces xs:appinfo information
> >associated with an element and I'v have no idea how to do it - execpt to
> >parse XSD file too.
> >
> >sample snippet (xsd):
> >             <xs:element name="titel" type="xtest:type.Titel">
> >                 <xs:annotation>
> >                     <xs:appinfo>KEY=7E</xs:appinfo>
> >                 </xs:annotation>
> >             </xs:element>
> >
> >Thanks for your help,
> >Michael
> 
> 

Reply via email to