Jump to content

Possible to reference existing element to satisfy element in complex type?

Guest SCADA Guy

Recommended Posts

Guest SCADA Guy

I have a schema like following:------------------- SCHEMA ----------------------------------------------------------<?xml version="1.0" encoding="utf-8"?><xsd:schema targetNamespace="schema.xsd" elementFormDefault="qualified" xmlns="schema.xsd" xmlns:mstns="schema.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><xsd:complexType name="Type1"> <xsd:sequence> <xsd:element name="Type1.Name1" type="xsd:string"/> <xsd:element name="Type1.Name2" type="xsd:string"/> </xsd:sequence></xsd:complexType><xsd:complexType name="Type2"> <xsd:sequence> <xsd:element name="Type2.Name1" type="xsd:string"/> <xsd:element name="Type2.Name2" type="Type1"/> </xsd:sequence></xsd:complexType><xsd:element name="element1" type="Type1"/><xsd:element name="element1" type="Type2"/>------------------- /SCHEMA ----------------------------------------------------------Then, I want to know if this is possible to do somehow?-------------------- XML ----------------------------------------------------------------<ns:element1> <ns:"Type1.Name1>Josh</ns:"Type2.Name1> <ns:"Type1.Name2>JPearce</ns:"Type2.Name1></ns:element1><ns:element2> <ns:"Type2.Name1>JFred</ns:"Type2.Name1> <ns:"Type2.Name2>{Somehow insert a pointer/reference to the already defined 'ns:element1 element above}</ns:"Type2.Name2></ns:element2>-------------------- /XML --------------------------------------------------------------------I realize that there is not a unique id for the <ns:element1>, so that would have to be achieved to reference it. Is this someting that is done, or is my thinking about this off?Thank You.

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