Jump to content

how to write XSD for this example?


shulin
 Share

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

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