Jump to content

how to write XSD for this example?

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 post
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 post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...