Closed Bug 252774 Opened 20 years ago Closed 1 month ago

XML DTD ID mapping ignored if element not present at load

Categories

(Core :: XML, defect)

x86
Linux
defect

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: timforte, Unassigned)

References

Details

Attachments

(2 files)

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7) Gecko/20040630 Firefox/0.9.1
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7) Gecko/20040630 Firefox/0.9.1

<!DOCTYPE mydocument [ 
  <!ATTLIST test   id ID #IMPLIED >
]>

If the document contains a 'test' element, then getElementById will work as
expected, and new 'test' elements can be retrieved via getElementById(id).

If the document does not contain a 'test' element, then the rule is ignored and
new 'test' elements will not have an ID.

Reproducible: Always
Steps to Reproduce:
1. load the xml file
2. create a new element of type 'test'.
3. try to retrieve the element via getElementById.
Actual Results:  
TEST is not found

Expected Results:  
TEST is found

Workaround is to ensure that all xml files have at least 1 entry of each type
that you wish to map.
Attached file XML file described
Attached file Example html/js file
The problem is that expat doesn't pass DTD info out to us, as far as I see.  So
the only way we know about that declaration in the DTD is if it actually passes
us a <test> node with the ID attribute marked out.  If that happens, we store
that information on the nodeinfo, so all later <test> nodes share it.
Should we toss this one in the content team bucket?  What's the right behavior
here anyway?
Status: UNCONFIRMED → NEW
Ever confirmed: true
I'm not sure if there are any specs that say what the 'right behaviour' is here,
so I think we should do the most usefull thing.

It would be good if we at some point during the load could dig into expat and
ask it for all id-attributes that are decleared. Namespaces are a problem
though, since DTDs are namespace unaware. What we could do though is to use the
namespace mappings on the document element, that should get it right most of the
time.
*** Bug 322561 has been marked as a duplicate of this bug. ***
QA Contact: ashshbhatt → xml

The bug assignee didn't login in Bugzilla in the last 7 months.
:peterv, could you have a look please?
For more information, please visit auto_nag documentation.

Assignee: hjtoi-bugzilla → nobody
Flags: needinfo?(peterv)
Severity: minor → S4
Status: NEW → RESOLVED
Closed: 1 month ago
Flags: needinfo?(peterv)
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: