Hi,

"ravikanth gangarapu" <[EMAIL PROTECTED]> writes:

> Hi,
>    Actually, I was trying to put a DOM_Document object in to the
>    session.It's a hash reference(?). I dont know why ApacheSession
>    variable( it's a hash too eg. %session) didnot accept that. So, i
>    avoided that and now working. Thanks for help.

Be careful. There's two dangerous issues here:
* C++ objects
* tied objects

All the XML::Xerces objects are all thin Perl wrappers around complex
C++ objects. If you store one of these objects in an Apache::Session,
you might experience very ugly core-dumps because memory is deleted
out from under you. It might work, it might not - I've never tested it
that way. I'd like to hear how it works for you.

Also, those objects appear as hash-references because all the objects
have been tied (using tie()) to a hash in order to be able to access
C++ data members directly - there are a few Xerces-C classes, the
exception classes, that don't provide setter/getter methods.

They are *not* hashes, they just look like one, so if you attempt to
store data in them:

   $parser->{some_field} = 'some_data';

You're likely to get a Perl error about 'Not able to find STORE',
because the class that implements the tied hash doesn't have a STORE()
method defined.

> Can I ask you a question? How can I tell Xerces not to try to read a
> DTD or schema when it comes across such a thing in a xml document? i
> just want to edit the xml. so, i have only xml files and dont have
> DTDs or schemas in that directory and I get runtime exception.

By definition, the parser *has* to parse the DTD if it's
specified. So, you have two choices:

1) don't include a DOCTYPE
2) write an entity resolver

If you have control over the XML files you're parsing, 1) is
simpler. If you don't, then you will have to write an entity resolver
that returns an empty InputSource to the caller when it gets a request
for a DTD.

HTH,
jas.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to