I want to change the "value" and "defaultValue" of the "drop" that contains "a33"
<?xml version='1.0' encoding='UTF-8' standalone='yes' ?>
<settings version="-1">
<setting id="1" name="a1" value="VAL555" drop="a12" defaultValue="VAL555" default="false" tag="null" />
<setting id="2" name="a2" value="VAL555" drop="a22" defaultValue="VAL555" default="false" tag="null" />
<setting id="3" name="a3" value="VAL555 <== I WANT TO CHANGE THIS" drop="a33" defaultValue="VAL555 <== I WANT TO CHANGE THIS" default="false" tag="null" />
<setting id="4" name="a4" value="VAL555" drop="a44" defaultValue="VAL555" default="false" tag="null" />
<setting id="5" name="a5" value="VAL555" drop="a55" defaultValue="VAL555" default="false" tag="null" />
</settings>
I want to do this for an app in Android Java
Currently, I can't go anywhere.
I have no idea where to start from, or where to look for.
Related
I have a following xml file:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xml>
<Abc version="3" xmlns="urn:Abc-v3">
<Ele1>
<SubElement name ="name" description="DO">
<Node version="C" siteURL="https://example.com" />
<Client>
<ClientId>1</ClientId>
<ClientSecret>Yes</ClientSecret>
</Client>
</SubElement>
<SubElement name ="SharePointOLDev1" description="DEV1">
<Node version="C" siteURL="https://example.com" />
<Local>
<LocalId>id</LocalId>
<Password>password</Password>
</Local>
</SubElement>
<SubElement name="AS" description="wow">
<DB connection="connection" />
</SubElement>
</Ele1>
<Ele2>
<Content ID="A" co="LD">
<Description>Simple Docs</Description>
<Serve
Lib1="TEST"
Lib2="yes"
Lib3="yes"
Lib4="no"
Lib5="no"
Lib6="name">
<Hole enabled="false" count="200" />
<Fol enabled="false" count="100" />
<Role enabled="No" validate="false" />
<FetchFilenameAttribute connection="SAP-AS" delay="3" />
</Serve>
</Content>
<Content ID="B" co="OL">
<Description>Simple Docs </Description>
<Serve
Lib1="TEST"
Lib2="yes"
Lib3="yes"
Lib4="no"
Lib5="no"
Lib6="name"">
<Hole enabled="false" count="200" />
<Fol enabled="false" count="100" />
<Role enabled="No" validate="false" />
</Serve>
</Content>
</Ele2>
<Ele3>
<CNode attr="hai" attr1="bye" />
</Ele3>
</Abc>
I need to parse this XML file and assign values to its corresponding class objects.Which is the best option to parse such an xml file.
JAXB sounds good to me but the POJOs were already written by someone and now i will have to rewrite and deploy them.ALso teh xml file has some errors while running xjc command.
DOM approach seems to be very cumbersome n error prone.
Please suggest.
PS:Kindly excuse my beginner level knowledge.
the JDK project comes with SAX(Simple API for XML) accessible by importing org.xml.sax.*.
You may take a look at this https://www.tutorialspoint.com/java_xml/java_sax_parse_document.htm for an introduction to the subject.
I have developed Odata service for a system entity which generates a metadata but however I cant figure out how to add Annotations element to it. Sample Metadata generated is as follows :-
<?xml version="1.0" encoding="utf-8"?>
<edmx:Edmx xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx" xmlns:sap="http://www.sap.com/Protocols/SAPData" Version="1.0">
<edmx:DataServices xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
m:DataServiceVersion="1.0">
<Schema xmlns="http://schemas.microsoft.com/ado/2008/09/edm" Namespace="myNamespace" sap:schema-version="1">
<EntityType Name="System">
<Key>
<PropertyRef Name="Id" />
</Key>
<Property Name="Id" Type="Edm.Int32" Nullable="false" />
<Property Name="name" Type="Edm.String" sap:label="System Name" sap:creatable="false"
sap:updatable="false" sap:sortable="false" sap:required-in-filter="true"/>
<Property Name="description" Type="Edm.String" />
<Property Name="status" Type="Edm.String" />
<Property Name="type" Type="Edm.String" />
</EntityType>
<EntityContainer Name="ODataEntityContainer" m:IsDefaultEntityContainer="true">
<EntitySet Name="Systems" EntityType="myNamespace.System" />
<FunctionImport Name="NumberOfSystems" ReturnType="Collection(myNamespace.System)"
m:HttpMethod="GET" />
</EntityContainer>
</Schema>
</edmx:DataServices>
</edmx:Edmx>
I need to add following elements to above metatada
<Annotations Target="myNamespace.System"
xmlns="http://docs.oasis-open.org/odata/ns/edm">
<Annotation Term="com.sap.vocabularies.UI.v1.LineItem">
<Collection>
<Record Type="com.sap.vocabularies.UI.v1.DataField">
<PropertyValue Property="Value" Path="name" />
</Record>
<Record Type="com.sap.vocabularies.UI.v1.DataField">
<PropertyValue Property="Value" Path="description"/>
</Record>
<Record Type="com.sap.vocabularies.UI.v1.DataField">
<PropertyValue Property="Value" Path="status" />
</Record>
</Collection>
</Annotation>
</Annotations>
I came across the org.apache.olingo.commons.api.edm.provider.annotation package but cant find any suitable API. Please let me know how should I proceed.
Thanks in advance.
The annotations you would like to use have been introduced with OData V3 which is why they are not directly supported with the Olingo V2 library.
You can use the EdmProvider AnnotationElement and AnnotationAttribute classes to mimic this behaviour though. For example You can create a AnnotationElement with the name "Annotations" this element will then have the "AnnotationAttribute" Target=SomeString. Since an "AnnotationElement" can have child elements you can put your Collection element there. Namespaces are also handled with "AnnotationAttributes".
You can only attach the annotation to Edm elements which are derived from the EdmAnnotatable interface. So this is a difference to V3.
This is currently the only way to get this behaviour with Olingo V2.
Using mybatis generator for classes of db tables, I found that sometimes it introduces newlines into function signatures in the .java files generated, *Example.java and *Mapper.java.
Can this be avoided someway, as it makes very difficult sometimes to check svn modifications?
I used the following configuration:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE generatorConfiguration PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN" "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd" >
<generatorConfiguration >
<classPathEntry location="myFolder/myDriver.jar"/>
<context id="MyDB" targetRuntime="MyBatis3">
<commentGenerator>
<property name="suppressDate" value="true" />
</commentGenerator>
<jdbcConnection driverClass="myDriver" connectionURL="myUrl" userId="myUserID" password="myPwd" />
<javaModelGenerator targetPackage="myPackage" targetProject="myProject" >
<property name="enableSubPackages" value="false" />
</javaModelGenerator>
<sqlMapGenerator targetPackage="myMapper" targetProject="myProject">
<property name="enableSubPackages" value="false" />
</sqlMapGenerator>
<javaClientGenerator targetPackage="myMapper" targetProject="myProject" type="XMLMAPPER">
<property name="enableSubPackages" value="false" />
</javaClientGenerator>
<table schema="MY_SCHEMA" tableName="TABLE_TO_GENERATE">
</table>
</context>
</generatorConfiguration>
I want to populate payload mediator with the response from a first service and this payload is going to be sent to another service. I used context expression and everything seems correct. But payload mediator is not getting populated. When the message built to send to the second service, payload remains blank. I used ctx path expression shown below to populate.
Here is the proxy service configuration,
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="CreditProxy"
transports="https,http"
statistics="disable"
trace="disable"
startOnLoad="true">
<target>
<inSequence>
<log level="full">
<property name="sequence" value="inSequence - request for CreditProxy"/>
</log>
<property xmlns:sam="http://samples.esb.wso2.org"
name="ORG_ID"
expression="//sam:credit/sam:id"/>
<property xmlns:sam="http://samples.esb.wso2.org"
name="ORG_AMOUNT"
expression="//sam:credit/sam:amount"/>
<enrich>
<source type="inline" clone="true">
<sam:get xmlns:sam="http://samples.esb.wso2.org">
<sam:id>?</sam:id>
</sam:get>
</source>
<target type="body"/>
</enrich>
<enrich>
<source type="property" clone="true" property="ORG_ID"/>
<target xmlns:sam="http://samples.esb.wso2.org" xpath="//sam:get/sam:id"/>
</enrich>
<log level="full">
<property name="sequence" value="inSequence - request for PersonInfoService"/>
</log>
<property name="STATE" value="PERSON_INFO_REQUEST"/>
<send>
<endpoint>
<address uri="http://127.0.0.1:9764/services/PersonInfoService/"/>
</endpoint>
</send>
</inSequence>
<outSequence>
<log level="full"/>
<property xmlns:ns="http://samples.esb.wso2.org"
xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"
xmlns:ax23="http://samples.esb.wso2.org/xsd"
name="address"
expression="/soapenv:Envelope/soapenv:Body/ns:getResponse/ns:return/ax23:address"
scope="default"
type="STRING"/>
<property xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"
xmlns:ns="http://samples.esb.wso2.org"
xmlns:ax23="http://samples.esb.wso2.org/xsd"
name="id"
expression="/soapenv:Envelope/soapenv:Body/ns:getResponse/ns:return/ax23:id"
scope="default"
type="STRING"/>
<property xmlns:ns="http://samples.esb.wso2.org"
xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"
xmlns:ax23="http://samples.esb.wso2.org/xsd"
name="name"
expression="/soapenv:Envelope/soapenv:Body/ns:getResponse/ns:return/ax23:name"
scope="default"
type="STRING"/>
<payloadFactory media-type="xml">
<format>
<p:credit xmlns:p="http://samples.esb.wso2.org"><!--0 to 1 occurrence--><ax25:info xmlns:ax25="http://samples.esb.wso2.org"><!--0 to 1 occurrence--><xs:amount xmlns:xs="http://samples.esb.wso2.org/xsd">?</xs:amount>
<!--0 to 1 occurrence--><ax25:personInfo xmlns:ax25="http://samples.esb.wso2.org/xsd"><!--0 to 1 occurrence--><xs:address xmlns:xs="http://samples.esb.wso2.org/xsd">$1</xs:address>
<!--0 to 1 occurrence--><xs:id xmlns:xs="http://samples.esb.wso2.org/xsd">$2</xs:id>
<!--0 to 1 occurrence--><xs:name xmlns:xs="http://samples.esb.wso2.org/xsd">$3</xs:name>
</ax25:personInfo>
</ax25:info>
</p:credit>
</format>
<args>
<arg evaluator="xml" expression="$ctx:address"/>
<arg evaluator="xml" expression="$ctx:id"/>
<arg evaluator="xml" expression="$ctx:name"/>
</args>
</payloadFactory>
<send buildmessage="true">
<endpoint>
<address uri="http://127.0.0.1:9764/services/CreditService/"/>
</endpoint>
</send>
</outSequence>
<endpoint>
<address uri="http://127.0.0.1:9764/services/PersonInfoService/"/>
</endpoint>
</target>
<publishWSDL uri="file:./repository/samples/resources/proxy/CreditProxy.wsdl"/>
<description/>
</proxy>
What can be the reason for this?
a simpliest situation: I have a drools flow.
Very simple,like
"<?xml version="1.0" encoding="UTF-8"?>
<process xmlns="http://drools.org/drools-5.0/process"
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
xs:schemaLocation="http://drools.org/drools-5.0/process drools-processes-5.0.xsd"
type="RuleFlow" name="ruleflow" id="com.sample.ruleflow" package-name="com.sample" >
<header>
</header>
<nodes>
<start id="1" name="Start" x="16" y="16" width="48" height="48" />
<actionNode id="2" name="Hello" x="96" y="16" width="80" height="48" >
<action type="expression" dialect="mvel" >System.out.println("Hello World");</action>
</actionNode>
<end id="3" name="End" x="208" y="16" width="48" height="48" />
</nodes>
<connections>
<connection from="1" to="2" />
<connection from="2" to="3" />
</connections>
</process>"
How can I change it programmatically , not with loading the flow file to XML Parsers etc, but to add the nodes and connection through the code?
Thanks in advance
I don't think any Drools API will be there for modifying the rules