> cvc-elt.1: Cannot find the declaration of element 'apartment'.
You can't Validate without a DTD or Schema. Your document doesn't
specify either; ergo, validation is not an (ahem) valid operation. (At
least, not unless you use some other mechanism to tell the parser what
to validate it against.)
Without those, all you can test it for is well-formedness.
Also, without those there is no way to tell which attributes are or are
not IDs, so getElementById is useless to you.
Also, note that per the DOM spec, an Element has no nodeValue. It's the
application code's responsibity to extract a meaningful value. (The
XPath convention is that an element's value is the concatenation of all
its Text descendants; DOM Level 3 offers a call specifically to retrieve
that value, but of course the question then becomes whether that's what
you want and whether the DOM you're working with supports that feature.
So far I've avoided javascript, so I'd rather not try to guess your
issues on that front. I will point out that "innerHTML" isn't part of
the standard W3C DOM API. I believe it's a Microsoftism, and should
probably be avoided if you care about portability.
The w3schools website has a... questionable ... reputation as far as
accuracy and focus on standards are concerned. You might want to look
for other tutorials.
|