473,322 Members | 1,523 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,322 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 2045


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: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.