Nest tags

T

terry

Hi,

Is it legal or formal to nest tag names? My code is in the following.
The <name> is nested. I used java to read the xml file but it seems to
not know the nested structure. I need to write the nest structure as
it is a multi-level catalog description. That means a catalog is a
sub-catalog of the another. If it is illegal or not formal, how to
solve this?

Thanks!

<?xml version='1.0' encoding='utf-8'?>
<root>
<name>
All
</name>
<name>
<name>
Connector
</name>
<name>
Inline
</name>
<name>
PCB
</name>
</name>
<name>
Crystal_and_Resonator
</name>

:
:
 
M

Morris M. Keesan

Hi,

Is it legal or formal to nest tag names? My code is in the following.
The <name> is nested. I used java to read the xml file but it seems to
not know the nested structure. ....
<name>
<name>
Connector
</name>
<name>
Inline
</name>
<name>
PCB
</name>
</name>

Yes, this is legal, easily expressed in a DTD. An XML application that
comes immediately to mind is XBEL,
<http://pyxml.sourceforge.net/topics/xbel/>, the bookmark exchange
language, in which folders can contain other folders. If your java is
not seeing the structure, it's probably a bug in the parser you're
using, or more likely a bug in your own code.
 
T

terry

Morris M. Keesan said:
Yes, this is legal, easily expressed in a DTD. An XML application that
comes immediately to mind is XBEL,
<http://pyxml.sourceforge.net/topics/xbel/>, the bookmark exchange
language, in which folders can contain other folders. If your java is
not seeing the structure, it's probably a bug in the parser you're
using, or more likely a bug in your own code.

Could u explain how to use DTD to do this?
 
K

Keith M. Corbett

terry said:
Yes, this is legal, easily expressed in a DTD. An XML application that
comes immediately to mind is XBEL,
<http://pyxml.sourceforge.net/topics/xbel/>, the bookmark exchange
language, in which folders can contain other folders. If your java is
not seeing the structure, it's probably a bug in the parser you're
using, or more likely a bug in your own code.

Could u explain how to use DTD to do this?[/QUOTE]

You could write a DTD to inform XML processors to enforce structure rules,
such as "a 'name' element may contain zero or more 'name' elements".

This probably won't help with your current problem.

But what is your current problem, exactly? It is not at all clear what you
mean by "[my program does] not know the nested structure". If you need
further help, you should provide details about your program and the problem
you are seeing.

/kmc
 

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,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top