Imported GNU Classpath 0.19 + gcj-import-20051115.

* sources.am: Regenerated.
       * Makefile.in: Likewise.
       * scripts/makemake.tcl: Use glob -nocomplain.

From-SVN: r107049
This commit is contained in:
Mark Wielaard
2005-11-15 23:20:01 +00:00
parent 02e549bfaa
commit 8f523f3a10
1241 changed files with 97711 additions and 25284 deletions
+33 -17
View File
@@ -210,13 +210,15 @@ public class DomDocument
*/
public Element getElementById(String id)
{
DomDoctype doctype = (DomDoctype) getDoctype();
if (doctype == null || !doctype.hasIds()
|| id == null || id.length() == 0)
if (id == null || id.length() == 0)
{
return null;
}
DomDoctype doctype = (DomDoctype) getDoctype();
if (doctype != null && !doctype.hasIds())
{
doctype = null;
}
// yes, this is linear in size of document.
// it'd be easy enough to maintain a hashtable.
@@ -233,25 +235,39 @@ public class DomDocument
if (current.getNodeType() == ELEMENT_NODE)
{
DomElement element = (DomElement) current;
DTDElementTypeInfo info =
doctype.getElementTypeInfo(current.getNodeName());
if (info != null &&
id.equals(element.getAttribute(info.idAttrName)))
if (doctype != null)
{
return element;
}
else if (element.userIdAttrs != null)
{
for (Iterator i = element.userIdAttrs.iterator();
i.hasNext(); )
DTDElementTypeInfo info =
doctype.getElementTypeInfo(current.getNodeName());
if (info != null &&
id.equals(element.getAttribute(info.idAttrName)))
{
Node idAttr = (Node) i.next();
if (id.equals(idAttr.getNodeValue()))
return element;
}
else if (element.userIdAttrs != null)
{
for (Iterator i = element.userIdAttrs.iterator();
i.hasNext(); )
{
return element;
Node idAttr = (Node) i.next();
if (id.equals(idAttr.getNodeValue()))
{
return element;
}
}
}
}
// xml:id
String xmlId = element.getAttribute("xml:id");
if (xmlId == null)
{
xmlId = element.getAttributeNS(XMLConstants.XML_NS_URI,
"id");
}
if (id.equals(xmlId))
{
return element;
}
}
// descend?