Still haven't found a good answer my previous question below, but at least I have it generally working with the expanded Entity and hack to turn "%BigEntity" into "% BigEntity" so that I don't get parse error upon reparsing the serialized document. However, I've got a larger issue than any of that, and I think it is my last major issue to figure out....

When I add EntityReference nodes to the DOM I'm building up, they don't get expanded in the parse tree. That is, when I print out the DOM tree, all I see are the EntityReference nodes, but none of their children, even though I iterate recursively over all the child nodes. For instance, for the example listed in my previous question (below), here is the parse tree...

Document MIME type: null
Document encoding: UTF-8
DOM hierarchy:
    XercesLinkedDocument:
        DocumentTypeImpl: name=vxml
         internalSubset=
<!ENTITY % BigEntity SYSTEM "BigEntity.ent">
<!ENTITY BigEntity "
                <prompt>another prompt</prompt>
                <prompt>another prompt</prompt>
                <prompt>another prompt</prompt>
                <prompt>another prompt</prompt>
                <prompt>another prompt</prompt>
                <prompt>another prompt</prompt>
                <prompt>another prompt</prompt>
">

        ElementNSImpl: vxml
            Attributes:
                AttrImpl: version
                    TextImpl: 1.0
            ElementImpl: form
                Attributes:
                    AttrImpl: id
                        TextImpl: init
                ElementImpl: block
                    TextImpl:

                    EntityReferenceImpl: name=BigEntity
                    TextImpl:


Notice that EntityReferenceImpl has no children. I expected it to include child nodes of the EntityReference; that is, nodes representing the 7 cases of "<prompt>another prompt</prompt>" defined in the Entity "BigEntity".

I shouldn't have to manually populate the children of the EntityReference, should I? I have noticed that I get events on the EntityReference contents as I parse the document using XNI, but all I should have to do for the DOM is simply do the following, no?...

EntityReference entityRef = fDocument.createEntityReference(entityName);
        fCurrentNode.appendChild(entityRef);

...where "fCurrentNode" is the current parent node to which children are being appended. I've read that EntityReference children might be lazily expanded, so that if they aren't accessed no work is performed, but I am accessing the EntityReference children in order to print the DOM tree. Why don't they show up??? Shouldn't the DOM do this for me? It clearly has all the information it needs. What am I missing?


thanks,

Jake

At 12:32 AM 4/8/2006, you wrote:
>
>I'm having a problem with the following...
>
><?xml version="1.0" encoding="UTF-8"?>
><!DOCTYPE vxml SYSTEM "voicexml1-0.dtd" [
>       <!ENTITY % BigEntity SYSTEM "BigEntity.ent">
>       %BigEntity;
>]>
><vxml version="1.0">
>       <form id="init">
>               <block>
>                       &BigEntity;
>               </block>
>       </form>
></vxml>
>
>BigEntity.ent looks something like this...
>
><?xml version="1.0" encoding="UTF-8"?>
><!ENTITY BigEntity '
>               <prompt>another prompt</prompt>
>               <prompt>another prompt</prompt>
>               <prompt>another prompt</prompt>
>               <prompt>another prompt</prompt>
>               <prompt>another prompt</prompt>
>               <prompt>another prompt</prompt>
>               <prompt>another prompt</prompt>
>'>
>
>When internalEntityDecl(String name, XMLString text, XMLString
>nonNormalizedText, Augmentations augs) gets called, both the
>text.toString() and nonNormalizedText.toString() contain the fully
>expanded contents of the entity (a bunch of <prompt>another
>prompt</prompt> entries).  After I build this into a DOM and
>serialize it, it looks like...
>
><?xml version="1.0" encoding="UTF-8"?>
><!DOCTYPE vxml SYSTEM "voicexml1-0.dtd"
>  [
><!ENTITY %BigEntity SYSTEM "BigEntity.ent">
><!ENTITY BigEntity "
>               <prompt>another prompt</prompt>
>               <prompt>another prompt</prompt>
>               <prompt>another prompt</prompt>
>               <prompt>another prompt</prompt>
>               <prompt>another prompt</prompt>
>               <prompt>another prompt</prompt>
>               <prompt>another prompt</prompt>
>
>">
>]>
><vxml version="1.0"><form id="init"><block>&BigEntity;</block></form></vxml>
>
>Why are the contents expanded?  Why not just give me "%BigEntity;"
>from the original document?  Is there any recourse?
>
>A second problem is that reparsing this file gives me the following
>parsing error...
>
>test9.gen.xml:4: Error: White space is required after "<!ENTITY" in
>the entity declaration.
>
>The parse error seems to be with the external entity declaration
>"%BigEntity".  If I change that to "% BigEntity", the parse error
>goes away.  But, the "name" parameter passed to me in the
>externalEntityDecl() method is exactly "%BigEntity".  If the parser
>knows it can't deal with that, why doesn't it pass me "%
>BigEntity"?  Seems odd that I'd be forced to split the "%" apart from
>the rest of the entiy name manually.
>
>
>thanks,
>
>Jake
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>

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

Reply via email to