You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@plc4x.apache.org by GitBox <gi...@apache.org> on 2020/12/17 21:57:49 UTC

[GitHub] [plc4x] splatch opened a new pull request #213: PLC4X-265 Support for hex mapping of byte/byte[] values in XML test

splatch opened a new pull request #213:
URL: https://github.com/apache/plc4x/pull/213


   There are small updates in EIP stuff which shouldn't break anything.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [plc4x] chrisdutz commented on pull request #213: PLC4X-265 Support for hex mapping of byte/byte[] values in XML test

Posted by GitBox <gi...@apache.org>.
chrisdutz commented on pull request #213:
URL: https://github.com/apache/plc4x/pull/213#issuecomment-752657971


   Hmm ok ... so you extended the API model classes with explicit serialization code ... would it be possible to have this sort of outside of the API classes? If included in the API, I would prefer the default Java XML DOM instead of Dom4j ... I Like the DOM4J api more than the default, but I wouldn't want to force that on the users.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [plc4x] chrisdutz commented on a change in pull request #213: PLC4X-265 Support for hex mapping of byte/byte[] values in XML test

Posted by GitBox <gi...@apache.org>.
chrisdutz commented on a change in pull request #213:
URL: https://github.com/apache/plc4x/pull/213#discussion_r550339759



##########
File path: plc4j/drivers/eip/src/main/java/org/apache/plc4x/java/eip/readwrite/field/EipField.java
##########
@@ -135,4 +138,27 @@ public String getPlcDataType() {
                 return Object.class;
         }
     }
+
+    @Override
+    public void xmlSerialize(Element parent) {
+        Document doc = parent.getOwnerDocument();
+        Element messageElement = doc.createElement(getClass().getSimpleName());
+        parent.appendChild(messageElement);
+
+        Element blockNumberElement = doc.createElement("node");
+        blockNumberElement.appendChild(doc.createTextNode(tag));
+        messageElement.appendChild(blockNumberElement);
+
+        Element indexElement = doc.createElement("type");
+        indexElement.appendChild(doc.createTextNode(type == null ? "" : type.name()));
+        messageElement.appendChild(indexElement);
+
+        Element subIndexElement = doc.createElement("elementNb");
+        subIndexElement.appendChild(doc.createTextNode(Integer.toString(elementNb)));
+        messageElement.appendChild(subIndexElement);
+
+        Element dataType = doc.createElement("defaultJavaType");
+        dataType.appendChild(doc.createTextNode((type == null ? Object.class : getDefaultJavaType()).getName()));
+        messageElement.appendChild(dataType);
+    }

Review comment:
       I mean this stuff ..
   




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [plc4x] splatch commented on pull request #213: PLC4X-265 Support for hex mapping of byte/byte[] values in XML test

Posted by GitBox <gi...@apache.org>.
splatch commented on pull request #213:
URL: https://github.com/apache/plc4x/pull/213#issuecomment-752759973


   > I would prefer the default Java XML DOM instead of Dom4j
   
   Which place do you mean - plc field implementation or test framework?


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [plc4x] splatch commented on a change in pull request #213: PLC4X-265 Support for hex mapping of byte/byte[] values in XML test

Posted by GitBox <gi...@apache.org>.
splatch commented on a change in pull request #213:
URL: https://github.com/apache/plc4x/pull/213#discussion_r550367392



##########
File path: plc4j/drivers/eip/src/main/java/org/apache/plc4x/java/eip/readwrite/field/EipField.java
##########
@@ -135,4 +138,27 @@ public String getPlcDataType() {
                 return Object.class;
         }
     }
+
+    @Override
+    public void xmlSerialize(Element parent) {
+        Document doc = parent.getOwnerDocument();
+        Element messageElement = doc.createElement(getClass().getSimpleName());
+        parent.appendChild(messageElement);
+
+        Element blockNumberElement = doc.createElement("node");
+        blockNumberElement.appendChild(doc.createTextNode(tag));
+        messageElement.appendChild(blockNumberElement);
+
+        Element indexElement = doc.createElement("type");
+        indexElement.appendChild(doc.createTextNode(type == null ? "" : type.name()));
+        messageElement.appendChild(indexElement);
+
+        Element subIndexElement = doc.createElement("elementNb");
+        subIndexElement.appendChild(doc.createTextNode(Integer.toString(elementNb)));
+        messageElement.appendChild(subIndexElement);
+
+        Element dataType = doc.createElement("defaultJavaType");
+        dataType.appendChild(doc.createTextNode((type == null ? Object.class : getDefaultJavaType()).getName()));
+        messageElement.appendChild(dataType);
+    }

Review comment:
       This is regular implementation of `XmlSerializable` interface from plc4x spi.utils package. It is based on regular dom api just like other places.
   
   Overall issue is how to make this mapping automatic in xstream, am I right?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [plc4x] splatch merged pull request #213: PLC4X-265 Support for hex mapping of byte/byte[] values in XML test

Posted by GitBox <gi...@apache.org>.
splatch merged pull request #213:
URL: https://github.com/apache/plc4x/pull/213


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org