Mapping classes to XML nodes
Hi there,
I am not entirely sure, if this is the right section of this forum. If not, can any moderator please put it into the right section? Thank you.
So here's the problem:
Let's assume, we have a class Car which associates loads of Part classes. Example:
public class Car {
private List<Part> parts;
}The classes are Entities, and we are using Hibernate and JPA annotations to persist them.
Using Java-WS with Netbeans, that would result in a (simplified) XML structure like this:
<car>
<parts>
<part>
</part>
</parts>
</car>What I want to do now is to map the parts directly into the car node (skipping the <parts> node altogether), like this:
<car>
<part>
</part>
<part>
</part>
</car>I am aware that this is NOT good style. However, I have to stick to the non-standard requirements of the clients who use the SOAP interface later. Also I must not change the underlying database structure.
Is there a way to solve this with existing Annotations?
Thanks in advance!
JAXB will create classes from an XML schema, SAX is a parser library and JAXP is a library of XML a bunch of XML tools.
I don't care for JAXB too much. I would skip it and go right to the JAX-RPC spec (WebServices).
Similar Messages
-
XML to internal table conversion within ABAP mapping class
I am doing a ABAP mapping for file to Idoc. My requirement is to convert XML file into ABAP internal table (within ABAP mapping class). Is there any standard FM, method, transformation etc, which can be used here.
Thanks, DehraDehra,
Have you seen this weblogs which talks about this:
/people/r.eijpe/blog/2005/11/10/xml-dom-processing-in-abap-part-i--convert-an-abap-table-into-xml-file-using-sap-dom-approach
/people/r.eijpe/blog/2005/11/21/xml-dom-processing-in-abap-part-ii--convert-an-xml-file-into-an-abap-table-using-sap-dom-approach
/people/r.eijpe/blog/2006/02/19/xml-dom-processing-in-abap-part-iiia150-xml-dom-within-sap-xi-abap-mapping
/people/r.eijpe/blog/2006/02/20/xml-dom-processing-in-abap-part-iiib150-xml-dom-within-sap-xi-abap-mapping
Hope this helps you....
---Satish -
Mapping java classes to XML files
Hi Friends !!
Please I need your help.
Does somebody out there know any framework or API that helps me to map Java classes to XML files.
Something like:
public class Test {
public int x;
public int y;
public int sum(){}
}to something like:
<?xml version="1.0" encoding="UTF-8"?>
<class>
<className>Test</className>
bla
bla
bla
</class>
Any tips?
Thanks in advance
CleversonJAXB will create classes from an XML schema, SAX is a parser library and JAXP is a library of XML a bunch of XML tools.
I don't care for JAXB too much. I would skip it and go right to the JAX-RPC spec (WebServices). -
Map several records to different elements in the same xml node
Hi,
I am trying to map data from relational tables to elements as per my xml schema. One of my tables has several records that I need to map to different elements in the same xml node.
For example:
Customer_Id | Param_Id |Param_Name
212 | 1 |State
212 | 2 |Country
212 | 3 |ZipCode
I can not change the structure of this existing table and need to work with it.
How do I map the different params for a specific customer to my Customer node in the schema?
One option is to join on the parameters table several times, but there ought to be a better way!
PLEASE HELP!!!
Thanks,First I question the design that contains/allows 600 attributes on an element. They sound like they really should be elements in the XML.
Regardless, the following (NOT TESTED) should work for you (assuming you want to write one SQL with 600 columns)
CREATE OR REPLACE VIEW APPLICATION_XML
OF XMLTYPE
Element "LOAN_APPLICATION"
with object ID
substr(extractValue(object_value,'/LOAN_APPLICATION/APPLICATION_DATA/@CallID'),1,5)
AS
WITH parm_tb AS
SELECT MAX(DECODE(prv_valu, 1, prv_value)) BusinessType,
MAX(DECODE(param_id, 2, prv_value)) Product,
MAX(DECODE(param_id, 3, prv_value)) SomethingElse
FROM parameter_details
WHERE prv_pmh_header_id = 1
SELECT xmlElement
("APPLICATION_DATA",
xmlAttributes
p.prv_detail_id as "CallID",
p.PRV_PRM_PARAM_ID as "RandomID",
p.prv_value as AppInitDate
xmlElement
("PRODUCER_DATA",
xmlAttributes
parm_tb.BusinessType as "BusinessType" ,
parm_tb.Product as "Product"
FROM parameters_table p
WHERE p.PRV_PMH_HEADER_ID = 1 -
Error preverifying class javax.xml.soap.Node
Hi everybody,
I want to send SOAP messages from a mobile phone. So I use the J2ME Wireless Toolkit 2.2 and the packages saaj-api.jar and dom.jar. But when I build the project, I always have that error:
Error preverifying class javax.xml.soap.Node
java/lang/NoClassDefFoundError: org/w3c/dom/Node
Build failedI don't understand because the class Node is well included in the package dom.jar. Could everyone can help me please?
Thanks in advancehi ,I am also having the same problem.If u got the solution for that please tell me what can i do for those preverifying class error
-
Creating custom class instances for XML nodes
Hi guys,
I'm trying to load an external XML document in my application
and create an instance of a custom class for each node in the XML
based on the value of some of their elements. The instances created
will eventually end up in a DataGrid by the way. The problem I'm
having is there seems to be many ways of doing small parts of this
and I have no idea how to make them all gel. Initially I'm using
HTTPService to load the XML file but I've seen people just use an
XML object. Then, after that, I initially set the loaded XML to an
ArrayCollection but others have used XMLList or XMLListCollection.
I've no idea what's the best way to do this.
Eventually, when I've created all of these instances by
looping over the XML and creating them how will I make them
bindable to the data grid? I'm guessing I'll have to group them
somehow...
Any help would be greatly appreciated. ThanksHey Tracy,
That is exactly what I was talking about in a previous post
you replied to
http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?catid=585&threadid=1344350
Anyhow, Below is some code I created to do what your saying
somewhat dynamically. The idea being you can have many different
object types that you may want to populate with data from XML. In
my case I am using e4x as the result type from my web services. At
present I have about 6 different classes that call this function.
I'd love to get some opinions on the function. Good bad or
???? Any improvements etc????
package . . . .
import flash.utils.describeType;
import flash.utils.getDefinitionByName;
import flash.utils.getQualifiedClassName;
import mx.utils.ObjectUtil;
* Utility class to convert xml based Objects to class
instances.
* Takes a value object as the destination and an xmlList of
data
* Look through all the items in the value object. Note we
are using classInfo..accessor since
* our objects are bound all variables become getter /
setter's or accessors.
* Also note, we can handle custom objects, arrays and
arrayCollections.
* History
* 03.11.2008 - Steven Rieger : Created class
public final class XMLToInstance
public static function xmlToInstance( destinationObject :
Object, sourceXMLList : XMLList ) : void
// Get the class definition in XML, from the passed in
object ( introspection so to speak )
var classInfo : XML = describeType( destinationObject );
// Loop through each variable defined in the class.
for each ( var aVar : XML in classInfo..accessor )
// If this is String, Number, etc. . . Just copy the data
into the destination object.
if( isSimple( aVar.@type ) )
destinationObject[aVar.@name] = sourceXMLList[aVar.@name];
else
// Dynamically create a class of the appropriate type
var className : String = aVar.@type;
var ObjectClass : Class = getDefinitionByName( className )
as Class;
var newDestObject : Object = Object( new ObjectClass());
// If this is a custom type
if( isCustomType( className ) && ObjectClass != null
// Recursively call itself passing in the custom data type
and the data to store in it.
// I haven't tested nested objects more than one level. I
suppose it should work.
// Note to self. Check.
xmlToInstance( newDestObject, sourceXMLList[aVar.@name] );
else
// Must be some sort of Array, Array Collection . . .
if( ObjectClass != null )
var anXMLList : XMLList = new XMLList(
sourceXMLList[aVar.@name] );
for each( var anItem : XML in anXMLList )
// I'm sure there are more types, just not using any of them
yet.
if( newDestObject is Array )
newDestObject.push( anItem )
else
newDestObject.addItem( anItem );
// Add the data to the destination object. . . .
destinationObject[aVar.@name] = newDestObject;
} // end function objectToInstance
public static function isSimple( dataType : String ) :
Boolean
* This function is pretty self explanatory.
* Check to see if this is a simple data type. Did I miss
any?
* History
* 03.11.2008 - Steven Rieger : Created function
switch( dataType.toLowerCase() )
case "number":
case "string":
case "boolean":
return true;
return false;
} // end isSimple
public static function isCustomType( className : String ) :
Boolean
* This function is pretty self explanatory.
* Check to see if this is a custom data type. Add them here
as you need. . .
* History
* 03.11.2008 - Steven Rieger : Created function
var aClassName : String = className.replace( "::", "."
).toLowerCase();
aClassName = aClassName.substr( aClassName.lastIndexOf( "."
) + 1, aClassName.length - aClassName.lastIndexOf( "." ) );
switch( aClassName )
case "ndatetimevo":
case "expenselineitemvo":
return true;
return false;
} // end isCustomType
} // end class
} // end package -
Error in Java Mapping for Single XML conversion
We are working on ABAP Proxy --> SAP PI 7.1 --> SOAP (Synchronous Scenario).
(ECC -> PI -> Legacy CRM)
Client has provided a WSDL with Single Node of XML and asking us to pass the whole structure as an single string along with all the nodes of data structure. To perform mapping we are using Java Mapping.
Message which we are getting after Java Mapping:
Input
<?xml version="1.0" encoding="UTF-8"?>
<ns0:MT_SOReject_Sender xmlns:ns0="http://MTSINDIA/TC/SalesOrderReject">
<ITEM>
<sSlsOrderCode>1001</sSlsOrderCode>
<sDlrCode>A250</sDlrCode>
<sRejectReason>Z2</sRejectReason>
<nCircleCode>2</nCircleCode>
</ITEM>
</ns0:MT_SOReject_Sender>
Output
<?xml version="1.0" encoding="UTF-8"?><MT_Trg xmlns:ns="urn:Test_File_to_File"><stringinp><?xml version="1.0" encoding="UTF-8"?><ns0:MT_SOReject_Sender xmlns:ns0="http://MTSINDIA/TC/SalesOrderReject"><ITEM><sSlsOrderCode>1001</sSlsOrderCode><sDlrCode>A250</sDlrCode><sRejectReason>Insufficient Stock Balance</sRejectReason><nCircleCode>2</nCircleCode></ITEM></ns0:MT_SOReject_Sender></stringinp></MT_Trg>
Is ther any way from which we can convert > as u201C>u201D and < as u201C<u201D. Required result is as follows
Required Output
<?xml version="1.0" encoding="UTF-8"?><MT_Trg xmlns:ns="urn:Test_File_to_File"><stringinp><?xml version="1.0" encoding="UTF-8"?><ns0:MT_SOReject_Sender xmlns:ns0="http://MTSINDIA/TC/SalesOrderReject"><ITEM><sSlsOrderCode>1001</sSlsOrderCode><sDlrCode>A250</sDlrCode><sRejectReason>Insufficient Stock Balance</sRejectReason><nCircleCode>2</nCircleCode></ITEM></ns0:MT_SOReject_Sender></stringinp></MT_Trg>
We are using following Java Code for the same.
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.util.Map;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.w3c.dom.Element;
import org.w3c.dom.Document;
import org.w3c.dom.Text;
import com.sap.aii.mapping.api.*;
import com.sap.aii.mapping.api.StreamTransformation;
public class SingleStr implements StreamTransformation{
* @author user
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
public static void main(String args[]) throws Exception {
FileInputStream inFile =
new FileInputStream("C:/Documents and Settings/user.HR0102WILT00033/Desktop/Input.XML");
FileOutputStream outFile =
new FileOutputStream("C:/Documents and Settings/user.HR0102WILT00033/Desktop/Output.XML");
SingleStr xml = new SingleStr();
xml.execute(inFile, outFile);
System.out.println("Success");
public void setParameter(Map param) {
Map map = param;
public void execute(InputStream in, OutputStream out)
throws com.sap.aii.mapping.api.StreamTransformationException {
try {
//************************Code To Generate The XML Parsing Objects*****************************//
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
TransformerFactory tf = TransformerFactory.newInstance();
Transformer transform = tf.newTransformer();
//Document doc = db.parse(in);
Document docout = db.newDocument();
Element root = docout.createElement("MT_Trg");
root.setAttribute("xmlns:ns","urn:Test_File_to_File");
docout.appendChild(root);
Element stringinp = docout.createElement("stringinp");
root.appendChild(stringinp);
BufferedReader inpxml = new BufferedReader(new InputStreamReader(in));
StringBuffer buffer = new StringBuffer();
String line="";
while ((line = inpxml.readLine()) != null)
buffer.append(line);
String inptxml=buffer.toString();
Text srcxml = docout.createTextNode(inptxml);
stringinp.appendChild(srcxml);
DOMSource domS = new DOMSource(docout);
transform.transform((domS), new StreamResult(out));
} catch (Exception e) {
System.out.print("Problem parsing the file: " + e.getMessage());
e.printStackTrace();
Please help!!We are using following Java Code for the same.
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.util.Map;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.w3c.dom.Element;
import org.w3c.dom.Document;
import org.w3c.dom.Text;
import com.sap.aii.mapping.api.*;
import com.sap.aii.mapping.api.StreamTransformation;
public class SingleStr implements StreamTransformation{
public static void main(String args[]) throws Exception {
FileInputStream inFile =
new FileInputStream("C:/Documents and Settings/user.HR0102WILT00033/Desktop/Input.XML");
FileOutputStream outFile =
new FileOutputStream("C:/Documents and Settings/user.HR0102WILT00033/Desktop/Output.XML");
SingleStr xml = new SingleStr();
xml.execute(inFile, outFile);
System.out.println("Success");
public void setParameter(Map param) {
Map map = param;
public void execute(InputStream in, OutputStream out)
throws com.sap.aii.mapping.api.StreamTransformationException {
try {
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
TransformerFactory tf = TransformerFactory.newInstance();
Transformer transform = tf.newTransformer();
//Document doc = db.parse(in);
Document docout = db.newDocument();
Element root = docout.createElement("MT_Trg");
root.setAttribute("xmlns:ns","urn:Test_File_to_File");
docout.appendChild(root);
Element stringinp = docout.createElement("stringinp");
root.appendChild(stringinp);
BufferedReader inpxml = new BufferedReader(new InputStreamReader(in));
StringBuffer buffer = new StringBuffer();
String line="";
while ((line = inpxml.readLine()) != null)
buffer.append(line);
String inptxml=buffer.toString();
Text srcxml = docout.createTextNode(inptxml);
stringinp.appendChild(srcxml);
DOMSource domS = new DOMSource(docout);
transform.transform((domS), new StreamResult(out));
} catch (Exception e) {
System.out.print("Problem parsing the file: " + e.getMessage());
e.printStackTrace();
Please help!! -
Acces dynamic configuration variable (e.g. filename) in ABAP mapping class
Hi experts
I am searching for a possibility to acces a dynamic configuration variable (DCV) in an ABAP mapping class. Since I could not find a solution in SDN and other sources, I hope somebody in this forum can help me.
What I already found is the following code which can be used to set a DCV, but what I would be interested in is how to read a DCV.
Any help is appreciated.
Markus
METHOD if_mapping~execute.
DATA l_record type mpp_dynamic.
* copy payload
result = source.
* add an adapter specific attribute
l_record-namespace = 'http://sap.com/xi/XI/System/File'.
l_record-name = 'FileName'.
l_record-value = 'test.xml'.
dynamic_configuration->add_record( l_record ).
ENDMETHOD.Hi Markus,
you can find everything in my blogs
/people/michal.krawczyk2/blog/2007/04/26/xipi-throwing-generic-exceptions-from-any-type-of-mapping
Regards,
michal -
How to binding incoming xml node list to the tree control as dataProvider
Recently, I faced into one issue: I want to binding incoming xml node (it's not avaliable at start) list to the tree control as a dataProvider.
Since the incoming xml node list is not avaliable at beginning but I needs to bind it to the tree, so I create one virtual one in the xml, and prepare to remove it before the tree is shown. (ready for the actual node adding). But It did not work.
Please see the presudo-code here:
1. Model layer(CsModel.as)
public class CsModel
[Bindable]
public var treeXML:XML=<nodes><car label="virtualOne" id="1">
</car></nodes>;
(Here, I want to build binding relationship on the <car/> node,
one 'virtual/stub' node is set here with lable="virtualOne".
But this node will be deleted after IdTree
control is created completely.)
[Bindable]
public var treeData:XMLList =new XMLListCollection(treeXML.car);
2. view layer(treePage.mxml)
private var _model:CsModel = new CsModel();
private function addNode():void
var newNode:XML=<car/>;
newNode.@label="newOne";
newNode.@id=1;
_model.treeXML.appendChild(newNode);
private function cleanData():void
delete _model.treeXML.car;
<mx:VBox height="100%" width="100%">
<mx:Button label="AddNode" click="addNode()" />
<mx:Tree id="IdTree" labelField="@label"
creationComplete="cleanData()"
dataProvider="{_model}"/>
</mx:VBox>
3. Top view layer (App.Mxml)
<mx:application>
<treePage />
</mx:application>
For method: cleanData(),It's expected that when the treePage is shown, we first delete the virutalOne to provide one 'clear' tree since we don't want show virtualOne to the user. The virutalOne node just for building the relationship between treeData and treeXML at beginning. But the side effect of this method, I found, is that the relationship between treeXML and treeData was cut off. And this leads to that when I added new node (by click the 'addNode' button) to the xmlXML, the xmlData was not affected at all !
So Is there any other way to solve this issue or bind the incoming xml node list to the xmlListCollection which will be used as Tree control's dataProvider ?If u want to display the name : value then u can do like this
<xsl:eval>this.selectSingleNode("name").nodeName</xsl:eval> : <xsl:value-of select="name" /> -
SQL Server Agent Failed to decrypt protected XML node
I'm getting the below error when trying to run sql server agent to run an SSIS package. I've updated folder security to allow sql server agent access, but cannot get the package to execute within SQL Management Studio. The package runs find in SSIS.
11.0.2100.60 for 64-bit Copyright (C) Microsoft Corporation. All rights reserved. Started: 12:12:00 PM Error: 2014-11-30 12:12:02.65 Code: 0xC0016016 Source: LoadStgProspects Description:
Failed to decrypt protected XML node "DTS:Password" with error 0x8009000B "Key not valid for use in specified state.". You may not be authorized to access this information. This error occurs when there is a cryptographic error. Verify that
the correct key is available. End Error Error: 2014-11-30 12:12:03.88 Code: 0xC0016016 Source: LoadStgProspects Description: Failed to decrypt protected XML node "DTS:Password" with error
0x8009000B "Key not valid for use in specified state.". You may not be authorized to access this information. This error occurs when there is a cryptographic error. Verify that the correct key is available. End Error Error: 2014-11-30
12:12:04.74 Code: 0xC0209303 Source: LoadStgProspects Connection manager "Excel Connection Manager" Description: The requested OLE DB provider Microsoft.Jet.OLEDB.4.0 is not registered. If the 64-bit driver
is not installed<c/> run the package in 32-bit mode. Error code: 0x00000000. An OLE DB record is available. Source: "Microsoft OLE DB Service Components" Hresult: 0x80040154 Description: "Class not registered".
End Error Error: 2014-11-30 12:12:04.74 Code: 0xC020801C Source: Load prospect files Prospect xls [231] Description: SSIS Error Code DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER. The AcquireConnection
method call to the connection manager "Excel Connection Manager" failed with error code 0xC0209303. There may be error messages posted before this with more information on why the AcquireConnection method call failed. End Error Error:
2014-11-30 12:12:04.74 Code: 0xC0047017 Source: Load prospect files SSIS.Pipeline Description: Prospect xls failed validation and returned error code 0xC020801C. End Error Error: 2014-11-30 12:12:04.74
Code: 0xC004700C Source: Load prospect files SSIS.Pipeline Description: One or more component failed validation. End Error Error: 2014-11-30 12:12:04.74 Code: 0xC0024107 Source:
Load prospect files Description: There were errors during task validation. End Error Error: 2014-11-30 12:12:04.74 Code: 0xC00220DE Source: LoadStgProspects Description: Error
0xC0012050 while loading package file "C:\Users\Jim\Documents\Visual Studio 2010\Projects\SSISTraining\SSISTraining\LoadStgProspects.dtsx". Package failed validation from the ExecutePackage task. The package cannot run. . End Error DTExec:
The package execution returned DTSER_FAILURE (1). Started: 12:12:00 PM Finished: 12:12:04 PM Elapsed: 4.337 seconds. The package execution failed. The step failed.,00:00:04,0,0,,,,0Hi selfdestruct80,
According to your description, you created SSIS package and it works fine. But you got the error message when the SSIS package was called from a SQL Server Agent job.
According to my knowledge, the package may not run in the following scenarios:
The current user cannot decrypt secrets from the package.
A SQL Server connection that uses integrated security fails because the current user does not have the required permissions.
File access fails because the current user does not have the required permissions to write to the file share that the connection manager accesses.
A registry-based SSIS package configuration uses the HKEY_CURRENT_USER registry keys. The HKEY_CURRENT_USER registry keys are user-specific.
A task or a connection manager requires that the current user account has correct permissions.
According to the error message, the SSIS Package ProtectionLevel property to EncryptSensitiveWithPassword as ArthurZ mentioned. To solve the problem, you need to go to Command Line tab, manually specify the paassword in SQL Agent Job with the command like below:
/FILE "\"C:\Users\xxxx\Documents\SQL Server Management Studio\SSIS\Package.dtsx\"" /DECRYPT somepassword /CHECKPOINTING OFF /REPORTING E
If you have any more questions, please feel free to ask.
Thanks,
Wendy Fu
Wendy Fu
TechNet Community Support -
How to create xml nodes based on a value
Dear friends,
I've a question about graphical mapping in SAP PI...
How can I create XML nodes on the target side based on a value in a XML field on the source side.
For example:
This XML field on the source:
<NO_OF_LINES>4</NO_OF_LINES>
Must result on 4 Lines on the Target:
<LINE></LINES>
<LINE></LINES>
<LINE></LINES>
<LINE></LINES>
So it's actually the opposite of the Count function...
I appreciate your help,
Thank you in Advance,
Kind regards,
JohnHi ,
Try this
NO_OF_LINES---> count---> UDF---> LINE
example :
UDF Code :
for (int i=0;i<var1[0];i++)
result.addValue(""); -
Mime mapping in web.xml not working for csv/excel
I am using the weblogic 8.1 app server. I want to serve up some static content
from an "exploded" web application (dir structure instead of a war file). This
static content includes html files and csv files that cause the browser to give
an option to the user to open the file in excel or download to disk. I have inserted
the following mapping inside web.xml in the exploded directory structure...
<web-app>
<mime-mapping>
<extension>csv</extension>
<mime-type>application/vnd.ms-excel</mime-type>
</mime-mapping>
</web-app>
I redeployed the "web application". When I try to access a csv file, instead of
giving me the save/open dialog, the browser displays the ASCII contents of the
csv in the browser like an HTML file. Am I missing a step? Is the xml above not
for the functionality that I am trying to implement here?
Thanks.Hi All:
Thanks for all your help regarding the adfAuthentication success_url. Now I am able to configure to make this work. But now I am facing another issue i.e. I am getting 401 Not authorized message when the success_url is pointed to the jspx page.
Note: I am using custom login module similar to DBProcOraDataSourceLoginModule so my roles are stored in the custom Role class. So I am not sure how to pass this role info to the security in ADF in order to authorize the page to be viewed.
Could you please help and can you point me to any specific link.
Thanks & Regards
Sridhar Doki -
How to get Total Number of XML Nodes?
Hello All,
I have a Flash program I'm doing in Actionscript 3, using CS6.
I'm using the XMLSocket Class to read-in XML Data. I will write some sample XML Data that is being sent to the Flash
program below...
I know with this line here (below) I can access the 4th "element or node" of that XML Data.
Accessing XML Nodes/Elements:
// *I created an XML Variable called xml, and "e.data" contains ALL the XML Data
var xml:XML = XML(e.data);
// Accessing the 4th element of the data:
xml.MESSAGE[3].@VAR; ---> "loggedOutUsers"
xml.MESSAGE[3].@TEXT; ---> "15"
SAMPLE XML DATA:
<FRAME>
0 <MESSAGE VAR="screen2Display" TEXT="FRAME_1"/>
1 <MESSAGE VAR="numUsers" TEXT="27"/>
2 <MESSAGE VAR="loggedInUsers" TEXT="12"/>
3 <MESSAGE VAR="loggedOutUsers" TEXT="15"/>
4 <MESSAGE VAR="admins" TEXT="2"/>
</FRAME>
I'm new to Flash and Actionscript but I'm very familiar with other languages and how arrays work and such, and I know for
example, in a Shell Script to get the total number of elements in an array called "myArray" I would write something like
this --> ${#myArray[@]}. And since processing the XML Data looks an awful lot like an array I figured there was maybe
some way of accessing the total number of "elements/nodes" in the XML Data...?
Any thoughts would be much appreciated!
Thanks in Advance,
MattHey vamsibatu, thanks again for the quick reply!
Ohhh, ok I gotcha. That makes more sense.
So I just tried this loop below and I guess I could use this and just keep assigning an int variable to the output so
when it finishes I will be left with a variable containing the total number of elements:
for (var x:int in xml.MESSAGE)
trace("x == " + x);
*Which OUTPUTS the Following:
x == 0
x == 1
x == 2
x == 3
x == 4
So I guess I could do something like this and when the loop completes I will be left with the total number of elements/nodes...
var myTotal:int;
for (var x:int in xml.MESSAGE)
myTotal = x;
// add '1' to myTotal since the XML Data is zero-based:
myTotal += 1;
trace("myTotal == " + myTotal);
*Which Prints:
"myTotal == 5"
Thanks again for you suggestions, much appreciated!
I think that should be good enough for what I needed. Thanks...
Thanks Again,
Matt -
I get this exception at runtime, running TOPLink as persistence manager for my BMP WL7 beans. My sessions.xml validates according to the sessions_4_5.dtd file supplied with TOPLink, but yet I get this excpetion. Below is my complete sessions.xml, as well as teh header of the exception stack
Sessions.xml
<?xml version="1.0" encoding="US-ASCII"?>
<!DOCTYPE toplink-configuration PUBLIC "-//Oracle Corp.//DTD TopLink for JAVA 4.5//EN" "sessions_4_5.dtd">
<toplink-configuration>
<session>
<name>entitySession</name>
<project-class>za.co.discovery.legalentity.persistence.TOPLinkProject</project-class>
<session-type>
<server-session/>
</session-type>
<login>
<uses-external-connection-pool>true</uses-external-connection-pool>
<uses-external-transaction-controller>true</uses-external-transaction-controller>
</login>
<external-transaction-controller-class>oracle.toplink.jts.wls.WebLogicJTSExternalTransactionController</external-transaction-controller-class>
<enable-logging>true</enable-logging>
<logging-options>
<log-debug>false</log-debug>
<log-exceptions>true</log-exceptions>
<log-exception-stacktrace>true</log-exception-stacktrace>
<print-thread>false</print-thread>
<print-session>true</print-session>
<print-connection>true</print-connection>
<print-date>false</print-date>
</logging-options>
</session>
</toplink-configuration>
and the stack trace:
1) testAll(za.co.discovery.legalentity.ejb.test.ClassVersionTest)java.rmi.RemoteException: Exception in ejbFindByPrimaryKey; nested exception is:
EXCEPTION [TOPLINK-7094] (TopLink - 9.0.3 (Build 423)): oracle.toplink.exceptions.ValidationException
EXCEPTION DESCRIPTION: LOCAL EXCEPTION STACK:
EXCEPTION DESCRIPTION: Several [2] SessionLoaderExceptions were thrown:
EXCEPTION [TOPLINK-9002] (TopLink - 9.0.3 (Build 423)): oracle.toplink.exceptions.SessionLoaderException
EXCEPTION DESCRIPTION: Unable to load Project class [za.co.discovery.legalentity.persistence.TOPLinkProject].
INTERNAL EXCEPTION: java.lang.ExceptionInInitializerError
EXCEPTION [TOPLINK-9001] (TopLink - 9.0.3 (Build 423)): oracle.toplink.exceptions.SessionLoaderException
EXCEPTION DESCRIPTION: Unknown tag name: [session] in XML node: [toplink-configuration].
INTERNAL EXCEPTION: java.lang.reflect.InvocationTargetException
TARGET INVOCATION EXCEPTION: java.lang.NullPointerException
at oracle.toplink.exceptions.SessionLoaderException.finalException(Unknown Source)
at oracle.toplink.tools.sessionconfiguration.XMLLoader.load(Unknown Source)
at oracle.toplink.tools.sessionmanagement.SessionManager.getSession(Unknown Source)
at oracle.toplink.tools.sessionmanagement.SessionManager.getSession(Unknown Source)
at oracle.toplink.ejb.EJBDataStore.getSession(Unknown Source)
at oracle.toplink.ejb.EJBDataStore.getDescriptor(Unknown Source)
at oracle.toplink.ejb.EJBDataStore.getWrapperPolicy(Unknown Source)
at oracle.toplink.ejb.EJBDataStore.findByPrimaryKey(Unknown Source)
at oracle.toplink.ejb.bmp.BMPEntityBase.findByPrimaryKey(Unknown Source)
at za.co.discovery.legalentity.ejb.LegalEntityEJB.ejbFindByPrimaryKey(LegalEntityEJB.java:67)
all help appreciated!
thanks
Alwyn ([email protected])Hi Alwyn
I've seen this exact problem before when the sessions.xml file has been parsed by a different version of xerces from the one provided in TopLink. Is this a possibility?
JIM -
Order of servlet mapping in web.xml
Hello,
is the order of multiple <servlet-mapping> in web.xml important? Or it doesn't matter in which order they are declared?
For example, if i have two controllers, one is
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
and the second:
<servlet>
<servlet-name>FrontController</servlet-name>
<servlet-class>servlets.FrontController</servlet-class>
</servlet>
and the mapping are:
<servlet-mapping>
<servlet-name>FrontController</servlet-name>
<url-pattern>/jsf/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>where /jsf/ contains jsp pages containing jsf components.
is the order important?
And may second question is:
if i call the jsp page test.jsf in /jsf/test.jsp , which controller is responseble? Faces servlet or Frontcontroller?Here is what the 2.4 specification says on the matter (section SRV.11.1):
>
The path used for mapping to a servlet is the request URL from the request
object minus the context path and the path parameters. The URL path mapping rules below are used in order. The first successful match is used with no further matches attempted:
1. The container will try to find an exact match of the path of the request to the
path of the servlet. A successful match selects the servlet.
2. The container will recursively try to match the longest path-prefix. This is done by stepping down the path tree a directory at a time, using the �/� character as a path separator. The longest match determines the servlet selected.
3. If the last segment in the URL path contains an extension (e.g. .jsp), the servlet container will try to match a servlet that handles requests for the extension. An extension is defined as the part of the last segment after the last �.� character.
4. If neither of the previous three rules result in a servlet match, the container will attempt to serve content appropriate for the resource requested. If a "default" servlet is defined for the application, it will be used.
The container must use case-sensitive string comparisons for matching.
It also notes that in prior versions of the specification these were only a suggestion so if you are on servlet 2.3 or prior, you need to consult the documentation for your container.
So, to answer your questions, no, order in the descriptor is not important.
Also, based on the rules above, using your mappings, any URL starting with /jsf will be handled by FrontController including /jsf/test.jsp and /jsf/test.jsf.
Maybe you are looking for
-
Hi all, I have no idea to setup my LDAP servers for supporting failover. Is there any document mention abt it? I followed the admin guide to setup the database link, but seems doesn't work well. It's urgent, pls help. Cheers, Victor
-
Posting in wrong business area
Dear Gurus, We have made provision if my delivery charges are increased and if i changed it in MIRO manually and after posting accounting entries will b going in other transactional losses...it is posting correctly but it is taking different business
-
Hi I have windows 7 and reader x. I print everything else in color, but this PDF file it prints only in black? Specific file: producer "acrobat distiller" 9.4.6 (windows), version: 1.5 (acrobat 6.x). When I click print, then properties,under quick pr
-
Edge Animate 1.01 is now released, fixing issues with DPS
Hey All, If you've been using Edge Animate content in your DPS creations I come bearing good news! Edge Animate 1.01 is now available for download, providing a fix for a nasty iOS6 bug when deploying multiple Animate compositions in DPS. If you're us
-
hi all when i ask siri weather report says cant tell me as doesnt know my location and telling me to go to location settings ect but the location setting is on,also when i ask for neares take away ect its says as im in usa cant answer that question b