XML Question

J

Jay

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>
 
C

cr88192

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.
 
J

Jay

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.
 
J

Jay

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
 
C

cr88192

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.
 
C

cr88192

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
473,999
Messages
2,570,243
Members
46,835
Latest member
lila30

Latest Threads

Top