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

  • Create New...