473,388 Members | 989 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

making reference to other elements...

Hello,

I have the following case that I am trying to put in XML Schema.
I have the classes HelpItem, Document and Message that work as follows:

One HelpItem contains several Document and Message instances.
Thus, in XML Document and Message are child elements of HelpItem.

However, a Message may have a reference to one or several existing
Docuemnt instances, and also may have a reference to one or several
Message instances (its replies) and another Message that it is the
parent Message (the Message that I am replying to).

How can I make the references to the documents and other messages (I
hope that the reference to the messages is correct in the example bellow)?

The following information is to keep it more clear:

class Message
- referencedDocuments List
- conversation List //messages that reply the current one (optional)
- parentMessage Message //the message that I am replying to
end class

<xs:element name="Document" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="id" type="xs:ID" use="required"/>
... other attributes here
</xs:complexType>
</xs:element>
<xs:element name="Message" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="id" type="xs:ID" use="required"/>
<xs:attribute name="parentMessage" type="xs:IDREF" use="optional"/>
<xs:attribute name="conversation" type="xs:IDREFS" use="optional"/>
... other attributes here
</xs:complexType>
</xs:element>
Jul 20 '05 #1
3 2049


Pablo Gomes Ludermir wrote:

I have the following case that I am trying to put in XML Schema.
I have the classes HelpItem, Document and Message that work as follows:

One HelpItem contains several Document and Message instances.
Thus, in XML Document and Message are child elements of HelpItem.

However, a Message may have a reference to one or several existing
Docuemnt instances, and also may have a reference to one or several
Message instances (its replies) and another Message that it is the
parent Message (the Message that I am replying to).

How can I make the references to the documents and other messages (I
hope that the reference to the messages is correct in the example bellow)?

The following information is to keep it more clear:

class Message
- referencedDocuments List
- conversation List //messages that reply the current one (optional)
- parentMessage Message //the message that I am replying to
end class

<xs:element name="Document" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="id" type="xs:ID" use="required"/>
... other attributes here
</xs:complexType>
</xs:element>
<xs:element name="Message" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="id" type="xs:ID" use="required"/>
<xs:attribute name="parentMessage" type="xs:IDREF" use="optional"/>
<xs:attribute name="conversation" type="xs:IDREFS" use="optional"/>
... other attributes here
</xs:complexType>
</xs:element>


On a first look your use of xs:ID and xs:IDREF and xs:IDREFS seems fine
to me. Or are you getting any error messages from a schema processor?

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 20 '05 #2
Well, XMLSpy did not make any complaints. But the point was that I don't
know how to figure out the reference from the message to the document
element.
And another thing is that the ID is not on the local scope of the
element, but of the whole document. Is there a way to keep the ID unique
on the scope of the element?

Regards,
Pablo

Martin Honnen wrote:


Pablo Gomes Ludermir wrote:

I have the following case that I am trying to put in XML Schema.
I have the classes HelpItem, Document and Message that work as follows:

One HelpItem contains several Document and Message instances.
Thus, in XML Document and Message are child elements of HelpItem.

However, a Message may have a reference to one or several existing
Docuemnt instances, and also may have a reference to one or several
Message instances (its replies) and another Message that it is the
parent Message (the Message that I am replying to).

How can I make the references to the documents and other messages (I
hope that the reference to the messages is correct in the example
bellow)?

The following information is to keep it more clear:

class Message
- referencedDocuments List
- conversation List //messages that reply the current one (optional)
- parentMessage Message //the message that I am replying to
end class

<xs:element name="Document" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="id" type="xs:ID" use="required"/>
... other attributes here
</xs:complexType>
</xs:element>
<xs:element name="Message" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="id" type="xs:ID" use="required"/>
<xs:attribute name="parentMessage" type="xs:IDREF"
use="optional"/>
<xs:attribute name="conversation" type="xs:IDREFS"
use="optional"/>
... other attributes here
</xs:complexType>
</xs:element>

On a first look your use of xs:ID and xs:IDREF and xs:IDREFS seems fine
to me. Or are you getting any error messages from a schema processor?

Jul 20 '05 #3


Pablo Gomes Ludermir wrote:

And another thing is that the ID is not on the local scope of the
element, but of the whole document. Is there a way to keep the ID unique
on the scope of the element?


xs:ID needs to be unique inside of the complete document but you can use
xs:key to define keys in the scope of an element, see the example in
http://www.w3.org/TR/xmlschema-0/#sp...ysAndtheirRefs

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: |-|erc | last post by:
Hi! Small challenge for you. The index.php uses this file and calls layout(). Take a look at www.chatty.net this file draws the chat login box on the right. I traced the CHAT button it submits...
6
by: LRW | last post by:
I have no idea if this is more a PHP question or Javascript question, because my problem hinges equally on both. I have a PHP script that queries a database and creates a list of rows for each...
4
by: MT | last post by:
Hi all, this sounds like an easy enough thing to do, but after spending 45 minutes searching google and various javascript sites I can't find out how to make a textfield (textbox or whatever you...
1
by: Hal Vaughan | last post by:
I have a case where the user can select several choices from my 1st <SELECT> element. The user's choice on the 1st <SELECT> effects what the possible choices are for the 2nd element. Currently...
5
by: JC | last post by:
hi all First of all, sorry for my (bad) english, I have a javascript: <script type="text/javascript"> <!-- function gointo(td,color){td.style.cursor='default';td.bgColor=color;} function...
4
by: Logico | last post by:
Hi everybody, I need to do a function in javascript to check or uncheck all checkboxes with the same id. I want this function to work in every form and every page of my site, as I will use the same...
0
by: Richard Gregory | last post by:
Hi, I have the wsdl below, for an Axis web service, and when I select Add Web Refernce in Visual Studio the proxy is missing a class representing the returnedElementsType (see reference.cs below...
10
by: JurgenvonOerthel | last post by:
Consider the classes Base, Derived1 and Derived2. Both Derived1 and Derived2 derive publicly from Base. Given a 'const Base &input' I want to initialize a 'const Derived1 &output'. If the...
7
by: arnuld | last post by:
this programme gives unusual output. i am not able to find out where the semantic bug lies: /* C++ Primer - 4/e * * an example from section section 7.2.4, page 241 * STATEMENT * write a...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.