Page 1 of 1

Annotations (Tools Tip)

Posted: Mon Apr 02, 2007 11:04 pm
by longbow22
Hello All
2 part question.

This is my very first xml project, and am using oxygen 8.0
Part 1
When I display my data in the Grid view, I can see all my data fine.
I have a couple fields that I am doing validation on, that to works fine.
When I click one of those fields, I als see all of my valid values, however they
are not sorted properly i.e.
0
10
11
12 ...
2
21
22 ...
How can I sort these values properly?
Part 2
The values I listed above actually have a text description associated with them, can i display some kinda tooltip in the grid view that displays the meaning of each value?

Posted: Tue Apr 03, 2007 11:26 am
by sorin_ristache
Hello,

The grid editor displays the XML elements and their content in the order that they appear in your document. You can sort the elements of a table in the grid editor based on the values of a column of the table by right-clicking on the column header and selecting Sort ascending or Sort descending.

Where is the text description stored? If it is stored in the same XML document it should also appear in the grid editor. If it is stored as annotation in the schema of the document it is displayed as tooltip when you hover the mouse over the element with the annotation. This is valid for both the grid editor and the text editor.


Regards,
Sorin

Re: Annotations (Tools Tip)

Posted: Tue Apr 03, 2007 12:49 pm
by sorin_ristache
Hello,
longbow22 wrote:When I click one of those fields, I als see all of my valid values, however they are not sorted properly
Do you mean you see a popup menu with all the values that can be inserted and that are enumerated in the schema as being valid values? In that case you see the order 0, 10, 11, 20, 21, etc. because they are sorted alphabetically, not numerically. We will add an enhancement request for sorting the values numerically when all the valid values are numbers.
longbow22 wrote:The values I listed above actually have a text description associated with them, can i display some kinda tooltip in the grid view that displays the meaning of each value?
If a valid value specified in the schema has the text description associated as an annotation of that value, that is inside an xs:annotation element for an XML Schema, then the description is displayed in a tooltip window near the popup window. What schema type do you use and how do you specify the text description? Can you give an example?


Regards,
Sorin

Tooltip

Posted: Tue Apr 03, 2007 2:41 pm
by longbow22
Hopefully this is enough for you to understand what I am trying to do.


<xs:element name="field1_rule">
<xs:annotation>
<xs:documentation>Field 1 Rule Values</xs:documentation> This works as a popup tooltip for the entire column.
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:enumeration value="1" id="NONE"/> Would like to display this text next to the value
<xs:enumeration value="2" id="ALLOW"/> Would like to display this text next to the value
<xs:enumeration value="3" id="AUTO"/> Would like to display this text next to the value
<xs:enumeration value="4" id="SETNAME"/> Would like to display this text next to the value
<xs:enumeration value="5" id="LOGON_N_KEY"/> Would like to display this text next to the value
<xs:enumeration value="6" id="BIND_LOGON"/> Would like to display this text next to the value
</xs:restriction>
</xs:simpleType>
</xs:element>

Posted: Tue Apr 03, 2007 3:12 pm
by sorin_ristache
Hello,

If you want to see NONE, ALLOW, AUTO, SETNAME, etc. as tooltip next to the values 1, 2, 3, 4, etc. you have to add these strings as annotations for the enumeration values:

Code: Select all

<xs:element name="field1_rule">
<xs:annotation>
<xs:documentation>Field 1 Rule Values</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:enumeration value="1" id="NONE">
<xs:annotation>
<xs:documentation>NONE</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="2" id="ALLOW">
<xs:annotation>
<xs:documentation>ALLOW</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="3" id="AUTO">
<xs:annotation>
<xs:documentation>AUTO</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="4" id="SETNAME">
<xs:annotation>
<xs:documentation>SETNAME</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="5" id="LOGON_N_KEY">
<xs:annotation>
<xs:documentation>LOGON_N_KEY</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="6" id="BIND_LOGON">
<xs:annotation>
<xs:documentation>BIND_LOGON</xs:documentation>
</xs:annotation>
</xs:enumeration>
</xs:restriction>
</xs:simpleType>
</xs:element>

It does not matter if the enumeration values have an id attribute. Only the annotation text is displayed as tooltip next to the content completion popup.


Regards,
Sorin

Tooltip

Posted: Tue Apr 03, 2007 7:31 pm
by longbow22
Ok that worked like a champ..now on to the next question.
I have 1 field that has several positions, I want to check each position against a set of values, each posiiton has its own possible set of values. I have encluded 2 of the positions in the code below, of course it don't work or I wouldn't be posting here..lol
I hope I explained that well enough for you to understand what I am trying to do.
Again, this is my very FIRST attempt at XML.

Code: Select all


<xs:element name="req_except">
<xs:complexType>
<xs:all>
<xs:element name="SL_Header_Type" type="xs:string"/>
<xs:element value="0">
<xs:annotation>
<xs:documentation>No Header Used</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element value="1">
<xs:annotation>
<xs:documentation>Messages are preceded by a 20-byte header</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element value="2">
<xs:annotation>
<xs:documentation>Messages are preceded by a 19-byte custom header</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element value="A">
<xs:annotation>
<xs:documentation>Messages are preceded by a 40-byte APPC header</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="SL_MonDev" type="xs:string"/>
<xs:element value="A">
<xs:annotation>
<xs:documentation>Value A</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element value="B">
<xs:annotation>
<xs:documentation>Value B</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element value="C">
<xs:annotation>
<xs:documentation>Value C</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="SL_Strip" type="xs:string"/>

Re: Tooltip

Posted: Wed Apr 04, 2007 11:17 am
by sorin_ristache
longbow22 wrote:I want to check each position against a set of values, each posiiton has its own possible set of values.
Do you mean you want to create an XML document based on this schema and you want to check that the value of the element SL_Header_Type is one of 0, 1, 2, A? You can create an enumeration type that is a restriction of string, for example:

Code: Select all

<xs:element name="req_except">
<xs:complexType>
<xs:all>
<xs:element name="SL_Header_Type">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="0">
<xs:annotation>
<xs:documentation>No Header Used</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="1">
<xs:annotation>
<xs:documentation>Messages are preceded by a 20-byte header</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="2">
<xs:annotation>
<xs:documentation>Messages are preceded by a 19-byte custom header</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="A">
<xs:annotation>
<xs:documentation>Messages are preceded by a 40-byte APPC header</xs:documentation>
</xs:annotation>
</xs:enumeration>
</xs:restriction>
</xs:simpleType>
</xs:element>

<xs:element name="SL_MonDev">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="A">
<xs:annotation>
<xs:documentation>Value A</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="B">
<xs:annotation>
<xs:documentation>Value B</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="C">
<xs:annotation>
<xs:documentation>Value C</xs:documentation>
</xs:annotation>
</xs:enumeration>
</xs:restriction>
</xs:simpleType>
</xs:element>

<xs:element name="SL_Strip" type="xs:string"/>
</xs:all>
</xs:complexType>
</xs:element>
You can create an XML document based on the schema in oXygen by going to menu File -> New, selecting XML Document in the New dialog and selecting the schema in the XML Schema tab of the Create an XML document dialog.


Regards,
Sorin

Tooltip

Posted: Wed Apr 04, 2007 8:15 pm
by longbow22
Alrighty then, so far I'm digging xml/oxygen. I have one more question.
I have 2 different elements that need to use the exact same values for validation.
Is there a way for both elements to use the same validation rules without having to duplicate code?

Posted: Thu Apr 05, 2007 9:44 am
by sorin_ristache
Define a type and declare the two elements to be of this type. For example:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

<xs:simpleType name="threeValuesType">
<xs:restriction base="xs:string">
<xs:enumeration value="A">
<xs:annotation>
<xs:documentation>Value A</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="B">
<xs:annotation>
<xs:documentation>Value B</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="C">
<xs:annotation>
<xs:documentation>Value C</xs:documentation>
</xs:annotation>
</xs:enumeration>
</xs:restriction>
</xs:simpleType>

<xs:element name="SL_MonDev" type="threeValuesType"/>

<xs:element name="otherElement" type="threeValuesType"/>
</xs:schema>
Regards,
Sorin

Tooltip

Posted: Thu Apr 05, 2007 2:30 pm
by longbow22
Wow

Thanks all for the quick reply, in just a few short days I have learned alot about xml and oxygen.

Tooltip

Posted: Thu Apr 05, 2007 2:38 pm
by longbow22
Ok

I have 1 field that I have to valid against 1000 or so values, can I put all those values in a different xsd file and call it from the current xsd file. That way I don't need to clutter up my main xsd file with 1000 restriction values.

That make sense?

Thanks

LB

Posted: Thu Apr 05, 2007 4:14 pm
by george
Sure, put the type declaration in a separate file and use xs:include to refer to that file.

Best Regards,
George

Posted: Mon Apr 09, 2007 3:25 pm
by longbow22
George

Can you give a small example of what you explained about putting my data in a seperate file and referencing it from my main xsd?

Also, I took a spreadsheet with my 1000 or so lookup values and created an xml file, I don't want that do I? Should all that data be in an xsd file instead?

Confused

LB

Posted: Wed Apr 11, 2007 11:52 am
by george
What I said is that you can thave instead of a single file

Code: Select all


<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

<xs:simpleType name="threeValuesType">
<xs:restriction base="xs:string">
<xs:enumeration value="A">
<xs:annotation>
<xs:documentation>Value A</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="B">
<xs:annotation>
<xs:documentation>Value B</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="C">
<xs:annotation>
<xs:documentation>Value C</xs:documentation>
</xs:annotation>
</xs:enumeration>
</xs:restriction>
</xs:simpleType>

<xs:element name="SL_MonDev" type="threeValuesType"/>

<xs:element name="otherElement" type="threeValuesType"/>
</xs:schema>
two files, one containing your "main" schema and the other the declaration of the simple type with all its restrictions (3, 10, 1000, etc.):

Code: Select all


<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

<xs:include schemaLocation="myRestrictedType.xsd"/>

<xs:element name="SL_MonDev" type="threeValuesType"/>

<xs:element name="otherElement" type="threeValuesType"/>
</xs:schema>
and myRestrictedType.xsd containing

Code: Select all


<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:simpleType name="threeValuesType">
<xs:restriction base="xs:string">
<xs:enumeration value="A">
<xs:annotation>
<xs:documentation>Value A</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="B">
<xs:annotation>
<xs:documentation>Value B</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="C">
<xs:annotation>
<xs:documentation>Value C</xs:documentation>
</xs:annotation>
</xs:enumeration>
</xs:restriction>
</xs:simpleType>
</xs:schema>
Best Regards,
George