New to XML, what do you think of this document?

B

Banaticus

http://www.banaticus.com/test/neighborhoods.xml
I've tried validating it in several online validators but either the
validation just doesn't work or I get conflicting errors. The document
works fine for what I'm using it for, to create a Google Map. But, the
Google Map isn't loading on some Win 2000 computers and I think it
could be because of this XML document. What do you all think?
 
R

Richard Tobin

Banaticus said:

You have <!ELEMENT neighborhood> which is syntactically incorrect.
It appears to contain a marker followed by a sequence of corners
so it should be something like <!ELEMENT neighborhood (marker, corner*)>.

You are declaring the attributes of marker and corner as if they were
child elements. Attributes are declared with ATTLIST declarations.
You really need to look this up in an XML textbook.

Including a long paragraph of text as an attribute (history) is not a
good idea, but is not illegal.

Any XML parser should reject this document!

-- Richard
 
B

Banaticus

"Any XML parser should reject this document!"
The document works fine for my purposes, I just need help learning how
to do the Doctype declarations so that I can have some auomated parser
check the document for me (in case I put in a " in a block of text
instead of an &quot;). Is there a website that you'd reccomend for
learning how to do this?
 
R

Richard Tobin

Banaticus said:
The document works fine for my purposes

This is not a good way to think. Using wrong XML that happens to work
because it isn't checked will just lead to trouble later on.
I just need help learning how
to do the Doctype declarations so that I can have some auomated parser
check the document for me (in case I put in a " in a block of text
instead of an &quot;).

Having a DOCTYPE won't help with that. There's (almost) only one
place where you have to use &quot; instead of ", and that's in an
attribute value delimited by ". This should be detected regardless of
whether you have a DOCTYPE.

Roughly speaking, the only thing a DOCTYPE helps with is ensuring that
you have the right attributes on your elements, and that you have the
right elements inside other elements.
Is there a website that you'd reccomend for learning how to do this?

I haven't really compared sites, but you might try

http://www.w3schools.com/dtd/

-- Richard
 
P

Peter Flynn

Banaticus said:
The document works fine for my purposes, I just need help learning how
to do the Doctype declarations so that I can have some auomated parser
check the document for me (in case I put in a " in a block of text
instead of an &quot;). Is there a website that you'd reccomend for
learning how to do this?

The XML FAQ is at http://xml.silmaril.ie/

///Peter
 
P

Peter Flynn

Banaticus said:
http://www.banaticus.com/test/neighborhoods.xml
I've tried validating it in several online validators but either the
validation just doesn't work or I get conflicting errors.

That's because it's not XML. It's just a bunch of text and pointy
brackets masquerading as XML.
The document works fine for what I'm using it for, to create a Google
Map.

Not with XML software it doesn't.
But,
the Google Map isn't loading on some Win 2000 computers and I think it
could be because of this XML document. What do you all think?

I think you need to learn a little more about XML. I've rewritten
the document to the prevailing conventions for you to examine, see
http://silmaril.ie/tmp/neighborhoods.xml

///Peter
 
B

Banaticus

Wow, that's beautiful. Now I just need to rewrite my map code at
banaticus.com/test/map.htm to use the updated code. The way the
influences are structured will sure make it easier to feed them into a
better dispay sytem. I just restructured the dtd according to the
http://www.w3schools.com/dtd/ but your way is much more elegant. After
I rewrite the map code, edit the polylines so that the 5 neighborhoods
that I have now touch up better, then I can get to work putting the
rest of the 29 neighborhoods into this truly svelte XML document.
Thanks again.
 
B

Banaticus

Thanks, but I'm going to restructure the code yet again. This time to
conform to the Google Earth KML (well, really XML) documentation. This
way I end with an XML document that's easily read and can either be
parsed by JavaScript to produce a Google Map that anyone with a good
browser can view, or it can be downloaded and parsed by someone's
individual copy of Google Earth. Thus, I get to take advantage of both
the "feature rich, but requires downloading file" and the "everyone can
use it" programs with the same XML document.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,001
Messages
2,570,254
Members
46,850
Latest member
VMRKlaus8

Latest Threads

Top