Jump to content

XML forming question


jounindude
 Share

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...