XML Question

Jay (49)

Usenet Archive
Joined
Nov 21, 2004
Messages
3
Reaction score
0
I have a document as follows:

<graphics>
<graphic>
<tag>
<parameter/>
</tag>
<tag>
<parameter/>
</tag>
</graphic>
</graphics>

I want to add another child node called hyperlinks to the parent graphic. Does the following make sense? Can the children of graphic have two different node names. I know it is well formed, but does it make sense?

<graphics>
<graphic>
<tags>
<tag>
<parameter />
</tag>
<tag>
<parameter />
</tag>
</tags>
<hyperlinks>
<href />
</hyperlinks>
</graphic>
</graphics>
 

cr88192

Usenet Archive
Joined
Dec 25, 2003
Messages
352
Reaction score
0
Jay said:
I have a document as follows:

<graphics>
<graphic>
<tag>
<parameter/>
</tag>
<tag>
<parameter/>
</tag>
</graphic>
</graphics>

I want to add another child node called hyperlinks to the parent graphic. Does the following make sense? Can the children of graphic have two different node names. I know it is well formed, but does it make sense?

<graphics>
<graphic>
<tags>
<tag>
<parameter />
</tag>
<tag>
<parameter />
</tag>
</tags>
<hyperlinks>
<href />
</hyperlinks>
</graphic>
</graphics>
I think this would depend on the app.

imo, this change would seem "signifigant", less so would be a more minor change:
<graphics>
<graphic>
<tag>
<parameter/>
</tag>
<tag>
<parameter/>
</tag>
<hyperlinks>
<href />
</hyperlinks>
</graphic>
</graphics>

but, still, this depends on the app.

if you are writing your own app, then likely you are free to choose.

I personally like it when the means by which to add new tags and the behavior of unknown tags and such are well defined.
 

Jay (49)

Usenet Archive
Joined
Nov 21, 2004
Messages
3
Reaction score
0
thats the way i had it on my first attempts. But it didn't look correct. A parent has several children with the same <tag> with their own children and then another child with a different tag <hyperlinks> with their children. So I'm take that you agree that does make sense.

I guess the analogy would be a parent has children and then has step children.
 

Jay (49)

Usenet Archive
Joined
Nov 21, 2004
Messages
3
Reaction score
0
How would I modify this DTD to reflect this new child being added to the way you have suggested.

Thank You!

strXML = "<?xml version='1.0' ?>"
strXML = strXML & "<!DOCTYPE graphics ["
strXML = strXML & "<!ELEMENT graphics (graphic*)>"
strXML = strXML & "<!ELEMENT graphic (tag*)>"
strXML = strXML & "<!ATTLIST graphic id ID #REQUIRED>"
strXML = strXML & "<!ATTLIST graphic name CDATA #IMPLIED>" strXML = strXML & "<!ELEMENT tag (parameter*)>" strXML = strXML & "<!ATTLIST tag id ID #REQUIRED>" strXML = strXML & "<!ATTLIST tag name CDATA #IMPLIED>" strXML = strXML & "<!ELEMENT parameter EMPTY>" strXML = strXML & "<!ATTLIST parameter id ID #REQUIRED>" strXML = strXML & "<!ATTLIST parameter name CDATA #IMPLIED>]>" strXML = strXML & "<graphics/> " & vbCrLf
 

cr88192

Usenet Archive
Joined
Dec 25, 2003
Messages
352
Reaction score
0
Jay said:
thats the way i had it on my first attempts. But it didn't look correct. A parent has several children with the same <tag> with their own children and then another child with a different tag <hyperlinks> with their children. So I'm take that you agree that does make sense.

I guess the analogy would be a parent has children and then has step children.
well, imo, it depends. a lot has to do with what apps expect to be done in that case, how they might treat unknown tags, ... the app designer is free to choose.

so, this question can't really be answered in a "general" sense afaik.
 

cr88192

Usenet Archive
Joined
Dec 25, 2003
Messages
352
Reaction score
0
Jay said:
How would I modify this DTD to reflect this new child being added to the way you have suggested.

Thank You!

strXML = "<?xml version='1.0' ?>"
strXML = strXML & "<!DOCTYPE graphics ["
strXML = strXML & "<!ELEMENT graphics (graphic*)>"
strXML = strXML & "<!ELEMENT graphic (tag*)>"
strXML = strXML & "<!ATTLIST graphic id ID #REQUIRED>"
strXML = strXML & "<!ATTLIST graphic name CDATA #IMPLIED>" strXML = strXML & "<!ELEMENT tag (parameter*)>" strXML = strXML & "<!ATTLIST tag id ID #REQUIRED>" strXML = strXML & "<!ATTLIST tag name CDATA #IMPLIED>" strXML = strXML & "<!ELEMENT parameter EMPTY>" strXML = strXML & "<!ATTLIST parameter id ID #REQUIRED>" strXML = strXML & "<!ATTLIST parameter name CDATA #IMPLIED>]>" strXML = strXML & "<graphics/> " & vbCrLf
err, dunno. I don't really use nor am I really fammiliar with dtd's (nor am I that fammiliar with vb for that matter...).
 

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
548,208
Messages
3,104,798
Members
249,594
Latest member
henrywalsh

Latest Threads

Top