Hi again,
I think I've found a solution to this. In
scanStartTag(), if the current tag is metadata, I set
fValidate to false, which is pushed onto the element
stack as normal.
Hence validation is turned off for any of the
metadata's children. When the metadata closes,
fValidate will be set to the value from it's parent,
which has been popped off the element stack.
Here's the code change (starts line 1410 of
IGXMLScanner.cpp):
bool IGXMLScanner::scanStartTag(bool& gotData)
{
// Assume we will still have data until proven
otherwise. It will only
// ever be false if this is the root and its
empty.
gotData = true;
// Get the QName. In this case, we are not doing
namespaces, so we just
// use it as is and don't have to break it into
parts.
if (!fReaderMgr.getName(fQNameBuf))
{
emitError(XMLErrs::ExpectedElementName);
fReaderMgr.skipToChar(chOpenAngle);
return false;
}
// NEW CODE
#ifdef DONT_VALIDATE_METADATA
// check if metadata here
static const XMLCh fgMetadata[] =
{
chLatin_m, chLatin_e, chLatin_t, chLatin_a,
chLatin_d, chLatin_a, chLatin_t, chLatin_a, chNull
};
if(XMLString::equals(fQNameBuf.getRawBuffer(),
fgMetadata))
{
fValidate = false;
}
#endif // DONT_VALIDATE_METADATA
// END NEW CODE
Just thought I'd share my solution, it seems to work
okay! Again, any thoughts or suggestions appreciated.
Rgds,
Andrew Fuller
--- Andrew Fuller <[EMAIL PROTECTED]>
wrote: > Hi,
>
> I'm using Xerces v2.3.0 on Win2K. My application
> uses
> a XercesDOMParser with DTD validation turned on to
> parse and validate VXML documents.
>
> While I require DTD validation, I wish the parser to
> ignore instances of a certain element, specifically
> <metadata>, and any of its children. The <metadata>
> element is declared in the DTD, but I must allow the
> document to specify any children inside it - which
> obviously isn't normally possible with a
> DTD-validating parser.
>
> Has anybody got any suggestions how to go about
> this?
> I've checked the docs and mail archives without much
> success. Would I have to implement my own scanner
> similar to IGXMLScanner, which in scanStartTag(),
> checks the element name, and only calls
> fElemStack.addChild() if its not <metadata>?
>
> Please note that I don't wish do go down the schema
> route, or turn off DTD validation.
>
> Any suggestions welcome - apologies if this is a
> dumb
> re-post!
>
> rgds
> Andrew Fuller
>
>
>
>
>
>
>
>
>
___________________________________________________________
> BT Yahoo! Broadband - Free modem offer, sign up
> online today and save �80 http://btyahoo.yahoo.co.uk
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
>
___________________________________________________________
Yahoo! Messenger - Communicate instantly..."Ping"
your friends today! Download Messenger Now
http://uk.messenger.yahoo.com/download/index.html
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]