Parsing of an entity if it appears as an attribute value.

V

Vineeth

Hi,

I am developing an application using the SAX interface provided by
"xerces-j 2.6.0". My application does not need a DTD for execution as
it is not supposed to perform any validation. I have to provide
customized entity processing for which I have implemented the
startEntity function of the LexicalHandler interface. The problem that
I am facing is with respect to any entity other than the 5 builtin
ones. If any entity for example &abcd; which is not a built-in entity
is specified in the content of any element then it gets successfully
processed using the customized entity resolution provided in the
startEntity function, but if the same entity occurs in the value of an
attribute then it is not getting processed. In such cases the
startEntity function is also not getting called. On looking up the
value of the attribute in the startElement callback, I found that the
entity is not being passed on instead it is being consumed. Only the
five built-in entites if they are present are returned back in the
call-back.

I would be grateful if anybody can suggest a solution for this
peculiar problem.

Thankx,
Vineeth
 
R

Richard Tobin

Vineeth said:
My application does not need a DTD for execution as
it is not supposed to perform any validation.

But then you say:
The problem that
I am facing is with respect to any entity other than the 5 builtin
ones.

So you *do* need a DTD. DTD's aren't just for validation. If you want to
use non-built-in entities, you need a DTD. Even if you managed to hack
around it, you would not be using XML, but a proprietary variant.

Why not use a DTD?

-- Richard
 
V

Vineeth Narayanan

Hi Richard,

I have written my own entity resolver and I will be using it to resolve
the entities. I donot have any dependency on the DTD. What I need is a
way to get at the non normalized value of the attribute. Moreover I have
a large number of DTD's due to which I donot want to keep dependency of
the conversion process on the DTD.

Thanks
Vineeth
 
V

Vineeth

But then you say:


So you *do* need a DTD. DTD's aren't just for validation. If you want to
use non-built-in entities, you need a DTD. Even if you managed to hack
around it, you would not be using XML, but a proprietary variant.

Why not use a DTD?

-- Richard


Hi Richard,

The problem with DTD is that my application does not have access to
the DTD. The basic functionality of my application is to convert the
XML document into a text based format document. I have written an
entityResolver implementing the Lexicalhandler interface, this
Resolver is called if the entity occurs in the content but it does not
get called up if the entity occur as an attribute value.

I somehow need access to the NonNormalized value of the attribute.

Any suggestions are welcome.

--Vineeth
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,239
Members
46,827
Latest member
DMUK_Beginner

Latest Threads

Top