Jump to content

XML forming question


jounindude

Recommended Posts

Here is some XML I made. I keep getting a not well formed error. What's wrong (ignore the absence of style info and a DTD):

<?xml version="1.0" encoding="UTF-8"?><geometry><coordplane><point><x="3"/><y="7"/></point><line><m="1"/><b="4"/></line><segment id="segment1"><x1="2"/><y1="2"/><x2="5"/><y2="3"/></segment></coordplane></geometry>

Link to comment
Share on other sites

What exactly are you thinking with

<x="3"/><y="7"/>

<m="1"/><b="4"/>

<x1="2"/><y1="2"/><x2="5"/><y2="3"/>

?XML doesn't have such a construct.You could write those down as elements, i.e.

<x>3</x><y>7</y>

<m>1</m><b>4</b>

<x1>2</x1><y1>2</y1><x2>5</x2><y2>3</y2>

or as attributes to their parent element, i.e.

<point x="3" y="7" />

<line m="1" b="4" />

<segment id="segment1" x1="2" y1="2" x2="5" y2="3" />

or maybe, just maybe, as arributes in a new element, like for example "coordinate", i.e.

<coordinate x="3" y="7" />

<coordinate m="1" b="4" />

<coordinate id="segment1" x1="2" y1="2" x2="5" y2="3" />

Pretty much anything else. Your current construct simply doesn't exist in XML.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...