Showing posts with label XML. Show all posts
Showing posts with label XML. Show all posts

JSON vs. XML

Comparison of JSON and XML syntax (from http://json.org/example)





As an Amazon Associate I earn from qualifying purchases.

JSON vs. XML

Comparison of JSON and XML syntax (from http://json.org/example)





As an Amazon Associate I earn from qualifying purchases.

Eclipse convert to lower or upper case

Let say you have XML and you want to change text case:


<color name="fault_list_history_item_even">#CcCcCc</color>

command+shift+x  -- UPPER CASE

  <color name="fault_list_history_item_even">#CCCCCC</color>

command+shift+y -- LOWER CASE

<color name="fault_list_history_item_even">#cccccc</color>





As an Amazon Associate I earn from qualifying purchases.

Eclipse convert to lower or upper case

Let say you have XML and you want to change text case:


<color name="fault_list_history_item_even">#CcCcCc</color>

command+shift+x  -- UPPER CASE

  <color name="fault_list_history_item_even">#CCCCCC</color>

command+shift+y -- LOWER CASE

<color name="fault_list_history_item_even">#cccccc</color>





As an Amazon Associate I earn from qualifying purchases.

XML file design and formatting

It is well know that XML files are larger and therefore slower that JSON, however with careful design they don't have to be so. Remember the rule:

1) it the tag repeats only once then it should be converted to an attribute, for example:
- name, latitude, longitude, etc.

2) shorten the tag names, but don't go to far so it is still human readable
3) compress (zip) XML files when transferring them over a network



Formatting:
1) put each attribute on separate line, white space does not cost when compressed
2) extend line length to at least 120 characters for readability, your window size most likely allows for more






As an Amazon Associate I earn from qualifying purchases.

XML file design and formatting

It is well know that XML files are larger and therefore slower that JSON, however with careful design they don't have to be so. Remember the rule:

1) it the tag repeats only once then it should be converted to an attribute, for example:
- name, latitude, longitude, etc.

2) shorten the tag names, but don't go to far so it is still human readable
3) compress (zip) XML files when transferring them over a network



Formatting:
1) put each attribute on separate line, white space does not cost when compressed
2) extend line length to at least 120 characters for readability, your window size most likely allows for more






As an Amazon Associate I earn from qualifying purchases.

Axis: building using ant



<!-- Generate WSDL -->
    <target name="generateAuthenticationWSDL" depends="compile">
      <axis-java2wsdl 
        classname="com.hmco.morse.authentication.service.RemoteAuthenticationService" 
        namespace="urn:AuthenticationWS
        location="${soap.service}/AuthenticationWS" 
        output="${project.config.dir}/AuthenticationWS.wsdl">
        <mapping namespace="urn:AuthenticationWSpackage="com.hmco.morse.authentication.service"/>
      </axis-java2wsdl>
    </target>

    <!-- Generate WSDL -->
    <target name="generateAuthenticationWrappedWSDL" depends="compile">
      <axis-java2wsdl 
        classname="com.hmco.morse.authentication.service.RemoteAuthenticationService" 
        namespace="urn:AuthenticationWS
        location="${soap.service}/AuthenticationWS" 
        output="${project.config.dir}/AuthenticationWS.wsdl"
        style="wrapped">
        <mapping namespace="urn:AuthenticationWSpackage="com.hmco.morse.authentication.service"/>
      </axis-java2wsdl>
    </target>

    <!-- Generate Client And Move Descriptors -->
    <target name="generateAuthenticationClient">
      <axis-wsdl2java 
        url="${project.config.dir}/AuthenticationWS.wsdl" 
        output="${java2wsdl.output.dir}" 
        deployscope="request" 
        serverSide="yes"
      verbose="true" 
      helpergen="false">
      <mapping namespace="urn:AuthenticationWSpackage="com.hmco.morse.authentication.service"/>
    </axis-wsdl2java>
    <antcall target="moveAxisDescriptors"/>
    </target>

  <target name="moveAxisDescriptors">
    <echo message="moving: ${java2wsdl.output.dir}/com/hmco/morse/authentication/service/deploy.wsdd"/>
    <move file="${java2wsdl.output.dir}/com/hmco/morse/authentication/service/deploy.wsdd" todir="${project.deploy.dir}" failonerror="false"/>
    <echo message="moving: ${java2wsdl.output.dir}/com/hmco/morse/authentication/service/undeploy.wsdd"/>
    <move file="${java2wsdl.output.dir}/com/hmco/morse/authentication/service/undeploy.wsdd" todir="${project.deploy.dir}" failonerror="false"/>
  </target>


As an Amazon Associate I earn from qualifying purchases.

apt quotation..