RE: [xml] xmlreader + entities



Is there a way to get notification of entity declarations with the
xmlreader interface?  I see there is a node type (6) for 
them, but when
I parse a simple document with entity declarations parsing 
doesn't stop
at those nodes.  If I can't get them as the document is 
being parsed,
can I look them up afterwards in some internal structure?

   Hum, I think we tried to follow the behaviour from C# XmlTextReader
interface, maybe we missed that when going over comparison 
with Stephane
Bidoul. Do you want to see the entities declarations or references ?

For entity references, the situation is quite clear.

C# has 2 modes in XmlValidatingTextReader:
1. the default one that expands all entities and another
2. one that resolves only character entities.

In the first mode, EntityReference nodes are not exposed.
In the second mode, EntityReference nodes are exposed
(node type 5). On such a node, one can call ResolveEntity()
to "enter" the entity. When the entity ends, a EndEntity
node is returned (node type 16). 

Libxml2 has the same behaviour as MS C#, except that
ResolveEntity() is currently not implemented.

For entity declarations, I'm unsure.

I have not found a way to have C# XmlReader return Entity nodes.
On the DocumentType node, it seems to return 
the text of the internal subset as node value...

-sbi




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]