[opencms-dev] Question about OpenCms Programming

Anatol opencms at recordcaster.de
Thu Nov 17 10:32:53 CET 2005


Hi All!

I've a question about the OpenCms Programming concerning creating and 
manipulating a XmlContentDocument. Meenwhile I can _create_ an empty 
XmlContentDocument:  
CmsObject.createResource(<path/filename>,<ContentID>) works fine ;-)

But now I 've only the raw structure! How can I change the "values" with 
some Java-Functions? for example: How can I change from

<...>
    <name></name>
    <email></email>
<....>

to

<...>
    <name>hans</name>
    <email>hans at somewhere.org</email>
<....>

I a need a way like:

CmsFile cmsfile = CmsObject.readFile("path/to/test.html");
XmlContentFile xmlfile = new XmlContentFile(cmsfile);
xmlfile.setValue("name","hans");
xmlfile.setValue("email","hans at somewhere.org");
(by the way for all the other newbees: this code did NOT work!!!)

Is this possible? And how did it works? I've read the JavaDoc and there 
are some classes for XmlContent manipulating. But I cant find any 
methode like a "setValue" methode and I dont understand the 
relationships between all the Xml Classes :(

Have someone any idea and could help?
Anatol










More information about the opencms-dev mailing list