[Yanel-dev] Editing XML files

Michael Wechner michael.wechner at wyona.com
Wed Apr 8 10:47:09 EDT 2015


Hi Simon

Am 08.04.15 um 14:41 schrieb simon:
> Hi Michael
>
> Am 03.04.2015 um 14:33 schrieb Michael Wechner:
>> Hi Simon
>>
>> Do you intend to use and improve jquery.xmleditor?
> Not sure yet.
>>
>> I would be happy to help improve it. At the moment I am struggling a bit
>> to set the editPath, because the matcher-extension property is not
>> really documented and I get the following WARNING
>>
>> 97162 2015-04-03 14:26:35,187 +0200 [http-bio-8443-exec-1] WARN
>> com.litwan.yanel.impl.resources.jqueryxmleditor.JqueryXmleditorResource.init():85
>>
>> [] {id=127.0.0.1_9E3C} - Could not get Resource Configuration Property
>> 'matcher-extension'. Fallback to previous version ...
>>
>> Can you give me an example of a matcher-extension?
> It is the same mechanism as in yanels tinymce resource.

ok
>>
>> Shall I do  a pull request with my changes or could you give me write
>> access to the source of this resource?
> Not sure yet. Do you have something to check in?

yes, please see the diff below

diff --git a/resource-types/jquery.xmleditor/resource.xml
b/resource-types/jquery.xmleditor/resource.xml
index 4b1a0f9..9913b36 100644
--- a/resource-types/jquery.xmleditor/resource.xml
+++ b/resource-types/jquery.xmleditor/resource.xml
@@ -9,9 +9,9 @@
 jquery.xmleditor integration to edit xml files
 </description>
 
+<!-- INFO: Please set a write usecase policy for the XML you want to
edit and is specified by edith-path -->
+
 <rtd>
-<!--
-  <property name="foo" default-value="bar"/>
--->
+  <property name="matcher-extension"/> <!-- INFO: When not property
'matcher-extension' configured, then the request parameter 'edit-path'
is used -->
 </rtd>
 </resource>
diff --git
a/resource-types/jquery.xmleditor/src/java/com/litwan/yanel/impl/resources/jqueryxmleditor/JqueryXmleditorResource.java
b/resource-types/jquery.
index 5ed2346..6482a26 100644
---
a/resource-types/jquery.xmleditor/src/java/com/litwan/yanel/impl/resources/jqueryxmleditor/JqueryXmleditorResource.java
+++
b/resource-types/jquery.xmleditor/src/java/com/litwan/yanel/impl/resources/jqueryxmleditor/JqueryXmleditorResource.java
@@ -23,7 +23,9 @@ import javax.servlet.http.HttpServletRequest;
 import javax.xml.transform.Source;
 import javax.xml.transform.stream.StreamSource;
 
-import org.apache.log4j.Logger;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
+
 import org.w3c.dom.Document;
 //import org.w3c.tidy.Tidy;
 import org.wyona.yanel.core.Environment;
@@ -55,7 +57,7 @@ import org.apache.xml.resolver.tools.CatalogResolver;
  */
 public class JqueryXmleditorResource extends ExecutableUsecaseResource {
    
-    private static Logger log =
Logger.getLogger(JqueryXmleditorResource.class);
+    private static Logger log =
LogManager.getLogger(JqueryXmleditorResource.class);
    
     private static final String PARAMETER_EDIT_PATH = "edit-path";
     private static final String PARAMETER_CONTINUE_PATH = "continue-path";
@@ -80,7 +82,7 @@ public class JqueryXmleditorResource extends
ExecutableUsecaseResource {
             if (matcherExtension != null && matcherExtension.length() >
0) {
                 editPath = getPath().substring(0, getPath().length() -
matcherExtension.length());
             } else {
-                log.warn("Could not get Resource Configuration Property
'matcher-extension'. Fallback to previous version ...");
+                log.warn("Could not get Resource Configuration Property
'" + CONFIG_PROPERTY_MATCHER_EXTENSION + "'. Fallback to request
parameter '" + PA
                 editPath = getParameterAsString(PARAMETER_EDIT_PATH);
             }
         } catch(Exception e) {


Thanks

Michael
>
> Cheers
> Simon
>>
>> Thanks
>>
>> Michael
>>
>> Am 03.04.15 um 12:05 schrieb simon:
>>> Hi Michael
>>>
>>> Sorry Michael you just found one of the resource-types which is more a
>>> sketch. don't think this resource-type is working. i just started it.
>>> I'm certainly glad if you work on it.
>>> Some of the resource-types in my repo are more developed and some not.
>>>
>>> I'm really looking forward to find a solution for the missing link
>>> between GUI and java. I'm really happy with Jaxb. But i hate to make
>>> forms and usecases to make a CRUD GUI. The jquery.xmleditor was one of
>>> the more promising tools which could help to avoid implementing form
>>> based usecased.
>>>
>>> There is also a textedit resource-type based on
>>> https://codemirror.net/ which you can configure to edit XML. But it is
>>> more a texteditor with highlighting but it's able to autocomplete XML
>>> see: https://codemirror.net/demo/xmlcomplete.html
>>> But one probably needs to update the codemirror version. i did this
>>> when version 0.91 was current and now it's 5.1
>>>
>>> About the check in of the binary, this was accidental.
>>>
>>> Cheers
>>> Simon
>>>> Hi Simon
>>>>
>>>> I have just added the jquery.xmleditor to Yanel and built the resource
>>>> and after doing so realized that your git already contains the
>>>> binaries
>>>>
>>>>       modified:
>>>> build/classes/com/litwan/yanel/impl/resources/jqueryxmleditor/JqueryXmleditorResource.class
>>>>
>>>>
>>>>       modified:
>>>> build/lib/yanel-resource-jquery.xmleditor-0.0.1-dev-rXXX.jar
>>>>
>>>> I am not sure whether you intended to do so, but it might be better to
>>>> remove the build directory from git, unless
>>>> you want to provide the resource as package, such that one does not
>>>> have
>>>> to build it.
>>>>
>>>> I will try to use now your resource :-)
>>>>
>>>> Thanks
>>>>
>>>> Michael
>>>>
>>>> Am 03.04.15 um 00:01 schrieb Michael Wechner:
>>>>> Hi Simon
>>>>>
>>>>> IIUC the following resource allows to edit XML files
>>>>>
>>>>> https://github.com/teil3/3k3-yanel-contributions/tree/master/resource-types/jquery.xmleditor
>>>>>
>>>>>
>>>>>
>>>>> right?
>>>>>
>>>>> Or would you suggest some other resource to edit XML files?
>>>>>
>>>>> Thanks
>>>>>
>>>>> Michael
>>>
>
>



More information about the Yanel-development mailing list