Liquid XML Data Binder 2019
Java fromXmlElement - XmlObjectInterface
Liquid XML Data Binder (C++, Java, VB6) > Reference > Java > Reference > com.liquid_technologies.ltxmllib17 > Attribute > Java fromXmlElement - XmlObjectInterface
public void fromXmlElement(com.liquid_technologies.ltxmllib17.dom.XmlElement elm)
  Property Description  
    Method Name FromXmlElement  
    Argument - elm The XmlElement to read the data from  
    Argument - context The SerializationContext object controls the way in which XML is serialized/de-serialized. Its main role is to control the way in which validation is performed and which namespaces are output.
If this is not specified, the a default (SerializationContext.Default global static) instance of the class is used. If you are using several libraries generated from different schemas, or you want to change the way validation is performed for during the lifetime of the application or you are writing multithreaded code, then you should consider creating your own instance(s) of the SerializationContext.
If you are writing a multithreaded app it is highly recommended that you use a different instance of this class on each thread, as access to the static instance is not synchronized. Although read only operations to the static instance (SerializationContext::Default) of the class are thread safe, if the global instance SerializationContext::Default is modified, then this could potentially cause threading problems.
    Description Reads XML from the XmlElement into the current object  

This method will only load XML that complies with the XSD schema.
It will raise an exception if the XML is invalid.

The root element in the XML held within lpszXMLIn must correspond to the class which this method is being called on. So you have a simple schema.

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs=""
  <xs:element name="Person">
        <xs:element name="name" type="xs:string"/>
        <xs:element name="Address">
              <xs:element name="HouseNumber" type="xs:string"/>
              <xs:element name="PostCode" type="xs:string"/>

This would cause 2 classes to be generated Person & Address.
So if you had the XML Data.

<?xml version="1.0" encoding="UTF-8"?>
  <name>Joe Blogs</name>
    <PostCode>LS5 9PQ</PostCode>

You would call FromXml on a Person object ie

This method allows you to re-use XML documents that have already been parsed using another parser (e.g. xerces).

// parsed previously in users code.
org.w3c.dom.Element docElm = ...;

ltxmllib17.dom.XmlDocument ltXmlDoc = new ltxmllib17.dom.XmlDocument();


Person person = new Person();
// cls is now loaded with data from docElm.

Character encoding.
The default underlying parser supports the following character encodings

  • UTF-8
  • UTF-16

Also See Multi-Language Support