Jump to content

how to write XSD for this example?


shulin

Recommended Posts

Hi: For the following XML , how do I write an XSD?<networknode> <configparam> ... <\configparam> <networknode> <configparam> ... <\configparam> <configparam> ... <\configparam> <networknode> <configparam> ... <\configparam> <configparam> ... <\configparam> <\networknode> <\networknode><\networknode>That is, the same name <networknode> is used for both parents and children.Thanks.shu-lin

Link to comment
Share on other sites

A quick starting schema:

<?xml version="1.0"?><xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">	<xsd:element name="networknode">		<xsd:complexType>			<xsd:sequence>				<xsd:element name="configparam" minOccurs="0" maxOccurs="unbounded" type="xsd:string"/>				<xsd:element ref="networknode" minOccurs="0" maxOccurs="unbounded"/>			</xsd:sequence>		</xsd:complexType>	</xsd:element></xsd:schema>

Provided that

  1. All configparam elements come before new networknode elements.
  2. configparam elements contain only pure text.

If you want something more, you're going to have to edit the types of the two elements.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...