Hi,
Manuel Odesser wrote:
Hi all,
I'd like to thank everyone I had answer from ! A problem remains : I
cannot find a practical sample to create a simple .xsd and its .xcu
counterpart. Here are my guess, could someone tell me if I cannot access
my values because of the xml or the java code ?
The code. But I have some comments on your XML as well. See inline
comments for more:
myaddon.xsd :
<?xml version="1.0" encoding="UTF-8"?>
<oor:component-schema
oor:name="Settings"
oor:package="org.mycomp.mypackage"
xsi:schemaLocation="http://openoffice.org/2001/registry
component-schema.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:oor="http://openoffice.org/2001/registry"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xml:lang='en-US'>
<import oor:component="org.openoffice.Office.Common"/>
You don't need that <import>. You don't use any templates from that
component.
<templates>
<group oor:name="URLs">
<prop oor:name="dataPath" oor:type="xs:string"/>
</group>
</templates>
You also don't need the entire <templates> part, as you don't use that
feature in your data below.
<oor:component>
<group oor:name="URLs">
<prop oor:name="dataPath" oor:type="oor:string">
<value>%config%/data/terminologie_fr_FR.dat</value>
Is that really a fundamental, never-to-be-changed, default for this
item? Otherwise you should omit the <value> here.
Please note that the 'origin' substitution offered by unopkg doesn't
work with values in a schema.
</prop>
</group>
</oor:component>
</oor:component-schema>
myaddon.xcu :
<?xml version="1.0" encoding="UTF-8"?>
<oor:component-data
xmlns:oor="http://openoffice.org/2001/registry"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
oor:name="Settings"
oor:package="org.mycomp.mypackage">
<node oor:name="URLs">
<prop oor:name="dataPath" oor:type="xs:string">
<value>%config%/data/terminologie_fr_FR.dat</value>
If your value here is identical to the default in the schema - in case
you didn't follow my advice above and if you don't need 'origin'
substitution -, then you don't need this <prop> (actually you don't need
the xcu at all in that case).
As a side note: the type="xs:string" isn't needed here, as that is known
from the schema.
</prop>
</node>
</oor:component-data>
Now to the code
the code :
PropertyValue properties[] = new PropertyValue[1];
PropertyValue property = new PropertyValue();
property.Name = "nodepath";
property.Value = "/org.mycomp.mypackage/Settings";
Should be "/org.mycomp.mypackage.Settings/URLs".
The full component name is composed as <package>.<component-name>. And
you forgot the extra 'URLs' level you introduce in your schema.
properties[0] = property;
XInterface xViewRoot =
(XInterface)xConfigProvider.createInstanceWithArguments(
"com.sun.star.configuration.ConfigurationAccess",
properties);
XPropertySet xPropertySet =
(XPropertySet)UnoRuntime.queryInterface(
XPropertySet.class, xViewRoot );
dataPath = (String)xPropertySet.getPropertyValue("dataPath");
HTH
- Joerg
--
Joerg Barfurth Sun Microsystems - Desktop - Hamburg
>>>>>>>>>>>>>>>>>> using std::disclaimer <<<<<<<<<<<<<<<<<<<<<<<
Software Engineer [EMAIL PROTECTED]
Thin Client Software
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]