Intellij is not respecting the java code import formatter - java

I have a java code formatter xml file:
<code_scheme name="zhc" version="17">
<option name="RIGHT_MARGIN" value="120" />
<option name="CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND" value="1000" />
<option name="NAMES_COUNT_TO_USE_IMPORT_ON_DEMAND" value="1000" />
<option name="IMPORT_LAYOUT_TABLE">
<value>
<package name="" withSubpackages="true" static="true" />
<emptyLine />
<package name="com" withSubpackages="true" static="false" />
<emptyLine />
<package name="java" withSubpackages="true" static="false" />
<package name="javax" withSubpackages="true" static="false" />
<emptyLine />
<package name="org" withSubpackages="true" static="false" />
<emptyLine />
<package name="" withSubpackages="true" static="false" />
</value>
</option>
</code_scheme>
But when I choose Code->Optimize Imports after I imorted this formatter file under Preference->Code Style->Java, It just doesn't work as the sequence written above.
Does anybody happen to know what's the problem here?

Related

Reflecting img.Xml into Java Objects Using JAXB

So I'm transitioning over from C# in Unity, where reflection in XML was quite easy. I wanted to apply the same process in Java to this to a slightly varied version of already existing XML of this type of format:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<imgdir name="0206.img">
<imgdir name="02060003">
<imgdir name="info">
<canvas name="icon" width="32" height="32">
<vector name="origin" x="0" y="32" />
</canvas>
<canvas name="iconRaw" width="32" height="31">
<vector name="origin" x="0" y="32" />
</canvas>
<int name="price" value="20" />
<int name="slotMax" value="1000" />
<int name="incPAD" value="4" />
</imgdir>
<imgdir name="bullet">
<canvas name="0" width="43" height="18">
<vector name="origin" x="23" y="10" />
<int name="z" value="0" />
</canvas>
<canvas name="1" width="41" height="9">
<vector name="origin" x="22" y="5" />
<int name="z" value="0" />
</canvas>
</imgdir>
</imgdir>
<imgdir name="02060005">
<imgdir name="info">
<canvas name="icon" width="26" height="25">
<vector name="origin" x="-3" y="25" />
<int name="z" value="0" />
</canvas>
<canvas name="iconRaw" width="20" height="18">
<vector name="origin" x="-6" y="25" />
<int name="z" value="0" />
</canvas>
<int name="slotMax" value="800" />
<int name="incPAD" value="10" />
<int name="reqLevel" value="10" />
<int name="tradeBlock" value="1" />
</imgdir>
<imgdir name="bullet">
<canvas name="0" width="36" height="19">
<vector name="origin" x="22" y="9" />
<int name="delay" value="150" />
</canvas>
<canvas name="1" width="40" height="22">
<vector name="origin" x="20" y="11" />
<int name="delay" value="150" />
</canvas>
<canvas name="2" width="43" height="21">
<vector name="origin" x="21" y="10" />
<int name="delay" value="150" />
</canvas>
<canvas name="3" width="46" height="23">
<vector name="origin" x="20" y="11" />
<int name="delay" value="150" />
</canvas>
</imgdir>
<imgdir name="hit">
<canvas name="0" width="55" height="38">
<vector name="origin" x="13" y="20" />
<int name="delay" value="90" />
</canvas>
<canvas name="1" width="43" height="55">
<vector name="origin" x="17" y="29" />
<int name="delay" value="100" />
</canvas>
<canvas name="2" width="51" height="65">
<vector name="origin" x="26" y="34" />
<int name="delay" value="100" />
</canvas>
<canvas name="3" width="62" height="87">
<vector name="origin" x="34" y="57" />
<int name="delay" value="100" />
</canvas>
</imgdir>
</imgdir>
The catch is that there are many of these XML files, and each one has different header names, such as 0206.img, 0207.img. Each one has a very similar structure to the previous one in that header category (leading digit determines what type of object it is unmarshaling).
I really only want to reflect properties such as price, slotMax, incPad, and ignore the rest if possible. I'm not sure how to go about this, since in all the unmarshal examples the XML is much simpler, such as
<Employees>
<Employee>
<id>1</id>
</Employee>
<Employee>
<id>2</id>
</Employee>
</Employees>
Where you'd probably define a class like Employees which contains List, and Employee can be unmarshalled into. To clarify, I know you have to set the RootElement to the name of the top element, such as in this case 0206.img, but how can this be dynamic for 0207?
As for code ... I mean the code base is pretty simple since it's just defining the structure for which to unmarshal into. Defining this structure in respect to the above XML I linked is harder for me atm.
If you're only interested in a few easy-to-detect elements, and not in the whole structure, JAXB may be a wrong tool. JAXB is good for the cases where you have an XML Schema, interested in (more or less) complete structure, unmarshalling as well as marshalling.
If you only need a few parts of XML there are easier ways to do this. In this particular case I would probably use STAX. Something along the lines:
private static final QName INT_ELEMENT_NAME = new QName("int");
// ...
XMLInputFactory factory = XMLInputFactory.newInstance();
XMLStreamReader reader = factory.createXMLStreamReader(is);
while (reader.hasNext()) {
if (XMLStreamConstants.START_ELEMENT == reader.next()) {
if (Objects.equals(INT_ELEMENT_NAME, reader.getName())) {
String name = reader.getAttributeValue(null, "name");
String value = reader.getAttributeValue(null, "value");
System.out.println(name + "=" + value);
}
}
}
Prints name/value paits from all the int elements. Can be easily extended to further cases. Very fast, does not have the JAXB overhead, would easily work with big XML files, no matter how huge.
There are other tools as well. There was one parser (I could not recall the name) where you define XPath-based rules and the parser returns data according to these rules. That would also be suitable, but I just don't recall the name. I think it was some Apache project.
Update: I've finally found it, I was talking about Digester. It allows configuring XPath-like binding rules and the creates objects for you. Still, I'd probably stay with the STAX solution unless you're sure you'll get more and more complex rules.

Source control intellij code style settings

We have a project being managed by more than 20 developers and most of them use intellij.
I was wondering if we can source an xml file somehow so that every developer doesn't have to import code style settings manually.
How to properly import Java code style settings with IntelliJ?
This thread suggests that we have to manually import the xml file and only then we will see those settings will come into effect. Is there a setting that can import the code styles automatically?
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectCodeStyleSettingsManager">
<option name="PER_PROJECT_SETTINGS">
<value>
<option name="CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND" value="99" />
<option name="NAMES_COUNT_TO_USE_IMPORT_ON_DEMAND" value="15" />
<option name="IMPORT_LAYOUT_TABLE">
<value>
<package name="" withSubpackages="true" static="true" />
<emptyLine />
<package name="java" withSubpackages="true" static="false" />
<emptyLine />
<package name="javax" withSubpackages="true" static="false" />
<emptyLine />
<package name="org" withSubpackages="true" static="false" />
<emptyLine />
<package name="com" withSubpackages="true" static="false" />
<emptyLine />
<package name="" withSubpackages="true" static="false" />
</value>
</option>
<codeStyleSettings language="JAVA">
<option name="KEEP_LINE_BREAKS" value="false" />
<option name="KEEP_FIRST_COLUMN_COMMENT" value="false" />
</codeStyleSettings>
</value>
</option>
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
</component>
</project>
The above settings in .idea/codestyleSettings.xml did the trick.

which datasource api supports both connection pooling and XA transactions?

In the below Mule flow, i have to implement both connection pooling and XA transaction for JDBC connectivity. which datasource API supports both connection pooling and XA distributed transaction and how to implement it using spring beans and configure it to jdbc component?
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:core="http://www.mulesoft.org/schema/mule/core"
xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core" xmlns:scripting="http://www.mulesoft.org/schema/mule/scripting"
xmlns:jbossts="http://www.mulesoft.org/schema/mule/jbossts" xmlns:vm="http://www.mulesoft.org/schema/mule/vm"
xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking"
xmlns:jdbc-ee="http://www.mulesoft.org/schema/mule/ee/jdbc" xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:spring="http://www.springframework.org/schema/beans" version="EE-3.4.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/vm http://www.mulesoft.org/schema/mule/vm/current/mule-vm.xsd
http://www.mulesoft.org/schema/mule/ee/jdbc http://www.mulesoft.org/schema/mule/ee/jdbc/current/mule-jdbc-ee.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/ee/tracking http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd
http://www.mulesoft.org/schema/mule/jbossts http://www.mulesoft.org/schema/mule/jbossts/current/mule-jbossts.xsd
http://www.mulesoft.org/schema/mule/scripting http://www.mulesoft.org/schema/mule/scripting/current/mule-scripting.xsd
http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd">
<!-- <jdbc-ee:mysql-data-source name="MySQL_REP_Data_Source" user="${rep.db.user}"
password="${rep.db.password}" url="${rep.db.url}" transactionIsolation="UNSPECIFIED"
doc:name="MySQL Data Source" /> -->
<spring:beans>
<spring:bean id="MySQL_Data_Source"
class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close"
name="Bean">
<spring:property name="driverClass" value="com.mysql.jdbc.Driver" />
<spring:property name="jdbcUrl" value="${rep.db.url}" />
<spring:property name="user" value="${rep.db.user}" />
<spring:property name="password" value="${rep.db.password}" />
<spring:property name="maxIdleTime" value="180" />
<spring:property name="minPoolSize" value="10" />
<spring:property name="acquireIncrement" value="-1" />
<spring:property name="maxPoolSize" value="100" />
</spring:bean>
</spring:beans>
<spring:beans>
<spring:bean id="MySQL_REP_Data_Source" name="MySQL_REP_Data_Source"
class="com.mysql.jdbc.jdbc2.optional.MysqlXADataSource">
<spring:property name="user" value="${rep.db.user}" />
<spring:property name="password" value="${rep.db.password}" />
<spring:property name="url" ref="${rep.db.url}" />
</spring:bean>
</spring:beans>
<jbossts:transaction-manager doc:name="Transaction Manager">
<property key="com.arjuna.ats.arjuna.coordinator.defaultTimeout"
value="${trans.default.timeout}" /> <!-- timeout in seconds -->
<property key="com.arjuna.ats.arjuna.coordinator.txReaperTimeout"
value="${trans.reaper.timeout}" /> <!-- timeout in milliseconds -->
</jbossts:transaction-manager>
<jdbc-ee:connector name="Reporting_Database"
dataSource-ref="MySQL_REP_Data_Source" validateConnections="true"
queryTimeout="-1" pollingFrequency="0" doc:name="Database">
<reconnect blocking="false" frequency="10000" count="3"></reconnect>
</jdbc-ee:connector>
<vm:connector name="VM_Connector" validateConnections="true"
doc:name="VM_Connector" createMultipleTransactedReceivers="true"
numberOfConcurrentTransactedReceivers="4">
</vm:connector>
<flow name="ApiKeyLoadImplFlow" doc:name="ApiKeyLoadImplFlow"
initialState="started">
<vm:inbound-endpoint exchange-pattern="request-response"
doc:name="Impl_ApiKeyLoad_Req" path="ImplApiKeyLoadReq"
connector-ref="VM_Connector" responseTimeout="${vm.response.timeout}">
<xa-transaction action="BEGIN_OR_JOIN" />
</vm:inbound-endpoint>
<logger message="Start of Api Key Load Implementation" level="DEBUG"
doc:name="ENTRY_LOG" />
<set-variable variableName="FlowData" value="#[payload]"
doc:name="FlowData" />
<set-variable variableName="#['UserId']" value="#[payload.getUserID()]"
doc:name="UserID" />
<choice doc:name="Choice">
<when expression="#[payload.getType().equalsIgnoreCase('incremental')]">
<choice doc:name="Choice">
<when expression="#[flowData.getAction().equalsIgnoreCase('update')]">
<flow-ref name="CheckApiKeyExistFlow" doc:name="CheckApiKeyExistsFlow" />
<choice doc:name="Choice">
<when expression="#[payload.size() == '0']">
<set-payload doc:name="FlowData" value="#[variable:FlowData]" />
<flow-ref name="InsertApiKeyFlow" doc:name="InsertApiKeyFlow" />
</when>
<when expression="#[payload.size() != '0']">
<set-payload doc:name="FlowData" value="#[variable:FlowData]" />
<flow-ref name="UpdateApiKeyFlow" doc:name="UpdateApiKeyFlow" />
</when>
<otherwise>
<set-payload value="#['Internal Server Error']"
doc:name="Internal_Server_Error" />
<logger message="Status for UserId #[flowVars.UserId] : #[payload]"
level="WARN" doc:name="Internal_Server_Status" />
</otherwise>
</choice>
</when>
<when expression="#[flowData.getAction().equalsIgnoreCase('delete')]">
<flow-ref name="CheckApiKeyExistFlow" doc:name="CheckApiKeyExistsFlow" />
<choice doc:name="Choice">
<when expression="#[payload.size() == '0']">
<set-payload value="#['DataNotFound']" doc:name="Data_Not_Found" />
<logger message="Status for UserId #[flowVars.UserId] : #[payload]"
level="WARN" doc:name="Data_Not_Found_Status" />
</when>
<when expression="#[payload.size() != '0']">
<set-payload doc:name="FlowData" value="#[variable:FlowData]" />
<flow-ref name="DeleteApiKeyFlow" doc:name="DeleteApiKeyFlow" />
</when>
<otherwise>
<set-payload value="#['Internal Server Error']"
doc:name="Internal_Server_Error" />
<logger message="Status for UserId #[flowVars.UserId] : #[payload]"
level="WARN" doc:name="Internal_Server_Status" />
</otherwise>
</choice>
</when>
<otherwise>
<set-payload value="#['InvalidAction']" doc:name="Invalid_Action" />
<logger message="Status for UserId #[flowVars.UserId] : #[payload]"
level="WARN" doc:name="Invalid_Action_Status" />
</otherwise>
</choice>
</when>
<when expression="#[payload.getType().equalsIgnoreCase('full')]">
<set-payload doc:name="FlowData" value="#[variable:FlowData]" />
<flow-ref name="InsertApiKeyFlow" doc:name="InsertApiKeyFlow" />
</when>
<otherwise>
<set-payload value="#['Internal Server Error']"
doc:name="Internal_Server_Error" />
<logger message="Status for UserId #[flowVars.UserId] : #[payload]"
level="WARN" doc:name="Internal_Server_Status" />
</otherwise>
</choice>
<logger message="End of Api Key Load Implementation" level="DEBUG"
doc:name="EXIT_LOG" />
<catch-exception-strategy doc:name="Catch Exception Strategy">
<logger level="WARN" doc:name="Exception_Log"
message="Exception in ApiKeyLoadImplFlow #[System.getProperty('line.separator')] Error Description = #[exception.getMessage()]" />
</catch-exception-strategy>
</flow>
<sub-flow name="CheckApiKeyExistFlow" doc:name="CheckApiKeyExistFlow">
<logger message="Start of Check Api Key Implementation" level="DEBUG"
doc:name="START_LOG" />
<jdbc-ee:outbound-endpoint exchange-pattern="request-response"
queryKey="checkdata" queryTimeout="-1" connector-ref="Reporting_Database"
doc:name="Check_Value_Exists">
<xa-transaction action="JOIN_IF_POSSIBLE" />
<jdbc-ee:query key="checkdata"
value="${ftp.db.t_bmrs_api_keys.checkdata.query}" />
</jdbc-ee:outbound-endpoint>
<logger message="End of Check Api Key Exists Implementation"
level="DEBUG" doc:name="EXIT_LOG" />
</sub-flow>
</mule>
You need to have a javax.sql.XADataSource that implements connection pooling. You will usually need a JDBC driver specific data source for this, because supporting XA (distributed transactions) requires close coordination with how the database system implements two-phase commit.
Note that contrary to what the name suggests, a javax.sql.ConnectionPoolDataSource should not provide connection pooling, it is a data source for a connection pool.

Multinesting Gradle Projects in IntelliJ Idea

I am using IntelliJ Idea 14.1.4 and Gradle, and I am trying to create sub projects and nested sub projects:
Project
|--Research
|--Development
|--Algorithms
The reason for this is that research algorithms are separate from the development implementation. They are written in different languages (Python vs. Java) and used by different programmers, however I still want to maintain one Gradle project, so eventually researchers would be able to use stable existing algorithms implementations when developing new ones.
My problem is that Idea doesn't recognize properly the Gradle structure of the second level Gradle sub project: Project is recognized well, Research and Development are recognized well, but the Algorithms sub project is not recognized:
The code inspection of the gradle.build file in Algorithms project is highlighted as a warning with a message that test cannot be applies to Groovy.lang.closure Note that below is the complete build.gradle:
test{
useTestNG()
testLogging.showStandardStreams = true
}
Also, when I try in Idea Run->Edit Configurations->Defaults->Gradle and trying to choose Gradle project, I see that in the pop-up menu Development and Research do appear as sub-projects of Project, but Algorithms appears as a stand alone project.
Making the project however does create all the binaries and manually running a test case also works well.
When I run Gradle for command line, it appears to be working well and recognizing all nested projects: All the code is being compiled and tests are being ran. So the question here is if there is an Idea issue here which is not working correctly with Gradle, or am I doing something wrong?
Code for build.gradle inside Project:
allprojects {
group 'com.project'
version 'v0.1'
repositories {
mavenCentral()
}
}
Code for settings.gradle inside Project
rootProject.name = 'Project'
include 'Development'
include 'Development:Algorithms'
include 'Research'
Code for build.gradle of Development sub-project:
subprojects {
apply plugin: 'java'
repositories {
jcenter()
}
dependencies{
testCompile 'org.testng:testng:6.9.4'
}
}
Other code samples that I might be writing wrong (most of them are auto generated by Idea:
Project.iml:
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id="Project" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="com.project" external.system.module.version="v0.1" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/build" />
<output-test url="file://$MODULE_DIR$/build" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
<excludeFolder url="file://$MODULE_DIR$/build" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
Development.iml
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id=":Development" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="com.project" external.system.module.version="v0.1" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/build" />
<output-test url="file://$MODULE_DIR$/build" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
<excludeFolder url="file://$MODULE_DIR$/build" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
Algorithms.iml
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id=":Development:Algorithms" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/../.." external.system.id="GRADLE" external.system.module.group="com.project" external.system.module.version="v0.1" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/build/classes/main" />
<output-test url="file://$MODULE_DIR$/build/classes/test" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
<excludeFolder url="file://$MODULE_DIR$/build" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module-library" scope="TEST">
<library>
<CLASSES>
<root url="jar://$APPLICATION_HOME_DIR$/plugins/testng/lib/testng.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
</component>
</module>
I would like to point the following:
All projects and sub-projects have the same group: com.project
In Algorithms.iml the original (auto generated) value of external.linked.project.id was :Algorithms. I have tried setting it to :Development:Algorithms to see if it will change anything. After each change I have ran rebuild.
In Algorithms.iml the original (auto generated) value of external.root.project.path was $MODULE_DIR$/... I have tried setting it to $MODULE_DIR$/../.. to see if it will change anything. After each change I have ran rebuild.
****************************Edit********************************
Further investigation shows an issue with the workspace.xml file:
There is a GradleLocalSettingsElement there that was automatically created, but appears to be wrong: There are two different entries: one for Development and Devlopment:Algorithms and onw for the rest, so I might have did something wrong when I created the project.
My question is if there is a reference for the structure of this file and specifically for the elements inserted by the Gradle plugin?
<map>
<entry>
<key>
<ExternalProjectPojo>
<option name="name" value="Development" />
<option name="path" value="$PROJECT_DIR$/Development" />
</ExternalProjectPojo>
</key>
<value>
<list>
<ExternalProjectPojo>
<option name="name" value="Development" />
<option name="path" value="$PROJECT_DIR$/Development" />
</ExternalProjectPojo>
<ExternalProjectPojo>
<option name="name" value=":Development:Algorithms" />
<option name="path" value="$PROJECT_DIR$/Development/Algorithms" />
</ExternalProjectPojo>
</list>
</value>
</entry>
<entry>
<key>
<ExternalProjectPojo>
<option name="name" value="Project" />
<option name="path" value="$PROJECT_DIR$" />
</ExternalProjectPojo>
</key>
<value>
<list>
<ExternalProjectPojo>
<option name="name" value="Project" />
<option name="path" value="$PROJECT_DIR$" />
</ExternalProjectPojo>
<ExternalProjectPojo>
<option name="name" value=":Development" />
<option name="path" value="$PROJECT_DIR$/Development" />
</ExternalProjectPojo>
<ExternalProjectPojo>
<option name="name" value=":Research" />
<option name="path" value="$PROJECT_DIR$/Research" />
</ExternalProjectPojo>
</list>
</value>
</entry>
</map>

Converting xml to grid format

I have got data from RSAQ_REMOTE_QUERY_CALL in xml data. I need to format that data in grid view. In that tag gives column value and tag gives Feild description respectively Below i have mentioned my xml data.
?xml version="1.0" encoding="UTF-8" ?>
TABLES>
FPAIRS>
item>
INDEX_A>0007</INDEX_A>
INDEX_U>0008 /INDEX_U>
TYPE>E/TYPE>
/item>
/FPAIRS>
LDATA>
item>
LINE>002:OR,004:0001,002:01,007:SCEM_02,000:, 002:PC;/</LINE>
/item>
/LDATA>
LISTDESC>
item>
FADD />
FDESC>Sales Organization</FDESC>
FNAME>VBAK-VKORG</FNAME>
FCOL>SOrg.</FCOL>
FNAMENEW>VBAK-VKORG</FNAMENEW>
FNAMEINT>VKORG</FNAMEINT>
FKEY />
FGTYP />
FNZERO />
FSUM />
FSONLY />
FSORT>00</FSORT>
FSODS />
FSUBT />
FLPOS>0002</FLPOS>
FNUMB>98</FNUMB>
FNUMBT />
FNOSUM />
FSONP />
/item>
item>
FADD />
FDESC>Distribution Channel</FDESC>
FNAME>VBAK-VTWEG</FNAME>
FCOL>DChl</FCOL>
FNAMENEW>VBAK-VTWEG</FNAMENEW>
FNAMEINT>VTWEG</FNAMEINT>
FKEY />
FGTYP />
FNZERO />
FSUM />
FSONLY />
FSORT>00</FSORT>
FSODS />
FSUBT />
FLPOS>0003</FLPOS>
FNUMB>98</FNUMB>
FNUMBT />
FNOSUM />
FSONP />
/item>
item>
FADD />
FDESC>Division</FDESC>
FNAME>VBAK-SPART</FNAME>
FCOL>Dv</FCOL>
FNAMENEW>VBAK-SPART</FNAMENEW>
FNAMEINT>SPART</FNAMEINT>
FKEY />
FGTYP />
FNZERO />
FSUM />
FSONLY />
FSORT>00</FSORT>
FSODS />
FSUBT />
FLPOS>0004</FLPOS>
FNUMB>98/FNUMB>
FNUMBT />
FNOSUM />
FSONP />
/item>
item>
FADD />
FDESC>Sold-to party/FDESC>
FNAME>VBAK-KUNNR/FNAME>
FCOL>Sold-to pt/FCOL>
FNAMENEW>VBAK-KUNNR/FNAMENEW>
FNAMEINT>KUNNR/FNAMEINT>
FKEY />
FGTYP />
FNZERO />
FSUM />
FSONLY />
FSORT>00</FSORT>
FSODS />
FSUBT />
FLPOS>0005</FLPOS>
FNUMB>98</FNUMB>
FNUMBT />
FNOSUM />
FSONP />
/item>
item>
FADD />
FDESC>Material Number Used by Customer/FDESC>
FNAME>VBAP-KDMAT/FNAME>
FCOL>Customer Material Number/FCOL>
FNAMENEW>VBAP-KDMAT/FNAMENEW>
FNAMEINT>KDMAT/FNAMEINT>
FKEY />
FGTYP />
FNZERO />
FSUM />
FSONLY />
FSORT>00</FSORT>
FSODS />
FSUBT />
FLPOS>0006</FLPOS>
FNUMB>98</FNUMB>
FNUMBT />
FNOSUM />
FSONP />
/item>
item>
FADD />
FDESC>Net Weight of the Item/FDESC>
FNAME>VBAP-NTGEW/FNAME>
FCOL>Net weight/FCOL>
FNAMENEW>VBAP-NTGEW/FNAMENEW>
FNAMEINT>NTGEW/FNAMEINT>
FKEY />
FGTYP />
FNZERO />
FSUM />
FSONLY />
FSORT>00</FSORT>
FSODS />
FSUBT />
FLPOS>0007</FLPOS>
FNUMB>98</FNUMB>
FNUMBT />
FNOSUM />
FSONP />
/item>
/LISTDESC>
SELECTION_TABLE />
/TABLES>
I need get output as like below format.
Output:
Sales Organization
Distribution Channel
Division
Sold-to party
Material Number Used by Customer
Net Weight of the Item
OR
0001
01
SCEM_02
null
PC
Please suggest me how to get this grid format from my xml data. Please reply as soon as possible.
Thanks in advance:)
Regards,
Joy
You didn't mention any language so i can't give you a concrete example, but basically every modern language has an XML parser, so just use the parser to get data from the xml and then you can put that data in wahtever format you like, including Grid format.
Update:
You need several things here:
If the xml's have a unified format (they all have the same
structure) you can get an XSD or write one (XSD Tutorials) and then
you can use a framework like XmlBeans to generate java objects from
the schema and work with them. That would be the easiest way.
The other option is to use the java DOM API. The API is a bit ugly
but once you get used to it it's not that hard. Problem is that you
need to take care of every xml structure manually.
what ever method you choose, once you parsed the XML you can access the data and do whatever you like with it.
Search for XML parser's, and you should be able to do the rest.
DOM should be able to do the trick for the above format

Categories