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

[198] Re: Internal Entities



 浅海です。

ASAMI Tomoharu <dp8t-asm@asahi-net.or.jp> writes:
>  SmartDocのバグっぽいです。
>  ちょっと調べてみます。

 調べてみました。
 結論からいうと、パーサの出力がこうなっているみたいです。

(1) DOMパーサはXercesは'a'が重なる
(2) DOMパーサはProjectXは'a'が重ならない
(3) SAXパーサはXerces, ProjectXとも'a'は重ならない

 どうしたもんでしょう。
# Apacheにレポート???
## 嗚呼英語が...

---junk.sdoc(清さんのものを改修)---
<?xml version='1.0' encoding='EUC-JP' ?>
<!DOCTYPE doc [
<!ENTITY A 'a'>
<!ENTITY Ba '&A;'>
<!ENTITY Bb '&#38;A;'>
<!ENTITY Ca '&Ba;'>
<!ENTITY Cb '&#38;Ba;'>
<!ENTITY Cc '&Bb;'>
<!ENTITY Cd '&#38;Bb;'>
]>
<doc xml:lang='ja'>
<head><title>Test</title></head>
<body>
<p>&A;</p>
<p>&Ba;</p>
<p>&Bb;</p>
<p>&Ca;</p>
<p>&Cb;</p>
<p>&Cc;</p>
<p>&Cd;</p>
</body>
</doc>

---Xerces(1.2)で作ったDOMツリーをXercesのSerializeでXMLドキュメント化---
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE doc [
<!ENTITY A 'a'>
<!ENTITY Ba '&A;'>
<!ENTITY Bb '&#38;A;'>
<!ENTITY Ca '&Ba;'>
<!ENTITY Cb '&#38;Ba;'>
<!ENTITY Cc '&Bb;'>
<!ENTITY Cd '&#38;Bb;'>
]>
<doc xml:lang="ja"> <head>
        <title>Test</title>
    </head> <body> <p>a</p> <p>aa</p> <p>aa</p> <p>aa</p> <p>aa</p>
        <p>aa</p> <p>aa</p> </body> </doc>

---Xercesのツリーを出力(ツリー出力は浅海作(バグの可能性あり))---
doc
    doctype [doc]
    element [doc]
    @[xml:lang=ja]
        text [\n]
        element [head]
            element [title]
                text [Test]
        text [\n]
        element [body]
            text [\n]
            element [p]
                entityRef [A]
                    text [a]
            text [\n]
            element [p]
                entityRef [Ba]
                    entityRef [A]
                        text [a]
                        text [a]
            text [\n]
            element [p]
                entityRef [Bb]
                    entityRef [A]
                        text [a]
                        text [a]
            text [\n]
            element [p]
                entityRef [Ca]
                    entityRef [Ba]
                        entityRef [A]
                            text [a]
                        entityRef [A]
                            text [a]
            text [\n]
            element [p]
                entityRef [Cb]
                    entityRef [Ba]
                        entityRef [A]
                            text [a]
                        entityRef [A]
                            text [a]
            text [\n]
            element [p]
                entityRef [Cc]
                    entityRef [Bb]
                        entityRef [A]
                            text [a]
                        entityRef [A]
                            text [a]
            text [\n]
            element [p]
                entityRef [Cd]
                    entityRef [Bb]
                        entityRef [A]
                            text [a]
                        entityRef [A]
                            text [a]
            text [\n]
        text [\n]

---ProjectX (JAXP 1.0)では正常に動作しているよう---
doc
    doctype [doc]
    element [doc]
    @[xml:lang=ja]
        text [\n]
        element [head]
            element [title]
                text [Test]
        text [\n]
        element [body]
            text [\n]
            element [p]
                entityRef [A]
                    text [a]
            text [\n]
            element [p]
                entityRef [Ba]
                    entityRef [A]
                        text [a]
            text [\n]
            element [p]
                entityRef [Bb]
                    entityRef [A]
                        text [a]
            text [\n]
            element [p]
                entityRef [Ca]
                    entityRef [Ba]
                        entityRef [A]
                            text [a]
            text [\n]
            element [p]
                entityRef [Cb]
                    entityRef [Ba]
                        entityRef [A]
                            text [a]
            text [\n]
            element [p]
                entityRef [Cc]
                    entityRef [Bb]
                        entityRef [A]
                            text [a]
            text [\n]
            element [p]
                entityRef [Cd]
                    entityRef [Bb]
                        entityRef [A]
                            text [a]
            text [\n]
        text [\n]

---しかしXercesのSAX1では期待したようにイベントが上がっている---
locator [publicId = null, systemId = file:/C:/tmp/x/lib/tmp/j.sdoc (1/1)]
startDocument
    startElement [doc]
    @[xml:lang(CDATA) = ja]
        characters [\n]
        startElement [head]
            startElement [title]
                characters [Test]
            endElement [title]
        endElement [head]
        characters [\n]
        startElement [body]
            characters [\n]
            startElement [p]
                characters [a]
            endElement [p]
            characters [\n]
            startElement [p]
                characters [a]
            endElement [p]
            characters [\n]
            startElement [p]
                characters [a]
            endElement [p]
            characters [\n]
            startElement [p]
                characters [a]
            endElement [p]
            characters [\n]
            startElement [p]
                characters [a]
            endElement [p]
            characters [\n]
            startElement [p]
                characters [a]
            endElement [p]
            characters [\n]
            startElement [p]
                characters [a]
            endElement [p]
            characters [\n]
        endElement [body]
        characters [\n]
    endElement [doc]
endDocument

--- ProjectXのSAX1も同様に期待通りの動きをしている---
locator [publicId = null, systemId = file:/C:/tmp/x/lib/tmp/j.sdoc (1/1)]
startDocument
    startElement [doc]
    @[xml:lang(CDATA) = ja]
        characters [\n]
        startElement [head]
            startElement [title]
                characters [Test]
            endElement [title]
        endElement [head]
        characters [\n]
        startElement [body]
            characters [\n]
            startElement [p]
                characters [a]
            endElement [p]
            characters [\n]
            startElement [p]
                characters [a]
            endElement [p]
            characters [\n]
            startElement [p]
                characters [a]
            endElement [p]
            characters [\n]
            startElement [p]
                characters [a]
            endElement [p]
            characters [\n]
            startElement [p]
                characters [a]
            endElement [p]
            characters [\n]
            startElement [p]
                characters [a]
            endElement [p]
            characters [\n]
            startElement [p]
                characters [a]
            endElement [p]
            characters [\n]
        endElement [body]
        characters [\n]
    endElement [doc]
endDocument