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