Hi Niclas,
JavaDoc says: "The DOM implementation must have information that says which
attributes are of type ID. Attributes with the name "ID" are not of type ID
unless so defined. Implementations that do not know whether attributes are
of type ID or not are expected to return null."
You need define the "Id" first,
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html [ <!ELEMENT html (body) >
<!ELEMENT body (ul*) >
<!ATTLIST ul id ID #REQUIRED> ]>
<html>
<body>
<ul id="bookings"/>
</body>
</html>
Cheers,
Qingyue
On Sat, Aug 22, 2009 at 7:10 PM, Niclas Hedhman <[email protected]> wrote:
> Gang,
> I hate XML!! And desperately need someone to assist;
>
> I got the following HTML;
> <html>
> <body>
> <ul id="bookings"/>
> </body>
> </html>
>
> Couldn't be simpler, right??
>
> Ok, I parse that with;
> InputStream pageResource = pageClass.getResourceAsStream( pageName
> );
> Document dom = documentBuilder.parse( pageResource );
> and then do
>
> Element bookingList = dom.getElementById( "bookings" );
>
> Can someone tell me why "null" is returned??
>
>
> Cheers
> --
> Niclas Hedhman, Software Developer
> http://www.qi4j.org - New Energy for Java
>
> I live here; http://tinyurl.com/2qq9er
> I work here; http://tinyurl.com/2ymelc
> I relax here; http://tinyurl.com/2cgsug
>
> _______________________________________________
> qi4j-dev mailing list
> [email protected]
> http://lists.ops4j.org/mailman/listinfo/qi4j-dev
>
_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev