Xml bean with other Xml Bean
Is there a way to make two set's of generated java classes from the same schema
to work together?
I generated two sets of java classes using scomp. one set with xsdConfig and the
other without.
I got two sets of java classes that are mapped to the same schema.
when I am trying to pass the same string of the first Document class as an argument
and to the second Document parser I am getting a class cast exception on the second
one.
// example
RootDoc1 doc1 = RootDoc1.Factory.parse("a valid xml string");
RootDoc2 doc2 = RootDoc2.Factory.parse("same xml string here"); <= couse a class
cast exception because it returns a RoodDoc1 type.
why nobody helping me
pls help me
i am stucked with type mapping error?
Similar Messages
-
XML gateway with multiple XML structures??
Hi,
I have a requirement to import data using XML gateway with different XML structures. Third party system sometimes will not provide certain tags itself if there is no data for the tag like contacts in below sample xmls. In that case we need to ignore those tags (CONTACTS in below sample). As per my understanding, we must have tag in XML though it may not have any value.
We have 2 XMLs
XML1 for supplier with contacts
<SUPPLIER>
<NAMES>
<NAME1>XYZ </NAME1>
<NAME2>ABC</NAME2>
</NAMES>
<SITE>
<SITE1>XYZ </SITE1>
<SITE2>ABC</SITE2>
</SITE>
<CONTACT>
<CONTACT1>XYZ </CONTACT1>
<CONTACT2>ABC</CONTACT2>
</CONTACT>
</SUPPLIER>
XML2 for supplier without contacts
XML1
<SUPPLIER>
<NAMES>
<NAME1>XYZ1 </NAME1>
<NAME2>ABC1</NAME2>
</NAMES>
<SITE>
<SITE1>XYZ1 </SITE1>
<SITE2>ABC1</SITE2>
</SITE>
</SUPPLIER>
Can we upload data in both these xmls using only one generic dtd and xgm using XML gateway which will skip any missing tag.
Thanks
RishiHi, you can FOR XML PATH for a finer degree of control over your XML. Use the @ symbol to create attributes. Here's a simple example:
DECLARE @t TABLE ( rowId INT IDENTITY PRIMARY KEY, [address] VARCHAR(50), city VARCHAR(30), floor INT, suite INT, doorType VARCHAR(20) )
INSERT INTO @t VALUES
( '123 Fake St', 'Springfield', 10, 512, 'Metal' )
SELECT
[address] AS "Address",
city AS City,
[floor] AS "Location/@Floor",
suite AS "Location/@Suite",
doorType AS "Location/@DoorType"
FROM @t
FOR XML PATH ('Company'), ROOT ('Companies'), ELEMENTS; -
Session bean with 2 entity bean
i have a phonebook manager (session bean) taht controls the category of contacts such as group a , group b, group c and group d. where group a b c and d are all entity beans.
may i know how to control a session bean so that it can diferent which entity beans to invoke ?Group might be a table in a database,
GroupEJB referes to Entity Bean.
with the following fields. Group Id , Group disciption. where group ID is primary Key.
Use a session bean and create your group A B C D.( EJB create method).
Simple i guess.
Enjoy
Zoha. -
Having a xml output with custom xml tags
Hi All,
I have a requirement where we need to generate an xml output with a custom set of tags as given below.
<templates>
<list>
<List_no></list_no>
<List_name> </List_name>
</List>
</templates>
I am not sure how to get the list part as tags within tags.
I am able to get the output if the tag level is just one level like ,
<templates>
<List_no></list_no>
<List_name> </List_name>
</List>
</templates>
Does anybody know how I could get the multi-level tags. Any help would be much appreciated. Thank you all.
-VinHi, you can FOR XML PATH for a finer degree of control over your XML. Use the @ symbol to create attributes. Here's a simple example:
DECLARE @t TABLE ( rowId INT IDENTITY PRIMARY KEY, [address] VARCHAR(50), city VARCHAR(30), floor INT, suite INT, doorType VARCHAR(20) )
INSERT INTO @t VALUES
( '123 Fake St', 'Springfield', 10, 512, 'Metal' )
SELECT
[address] AS "Address",
city AS City,
[floor] AS "Location/@Floor",
suite AS "Location/@Suite",
doorType AS "Location/@DoorType"
FROM @t
FOR XML PATH ('Company'), ROOT ('Companies'), ELEMENTS; -
Writing generated XML into a file after comparing with other XML
Hi,
I have completed the comparison of two XML now I have a requirement to concat these two xml but also need to append the XML with a status node that if after comparing the two XML output is Y or N so if it is Y then a node with
<status>Y</status>
<from table>t1</from table>
then completing those task I need to write it in a file
declare
p_emp_info CLOB;
l_emp_tab xmlsequencetype := xmlsequencetype();
BEGIN
FOR i IN (SELECT id from emp WHERE emp_name='ABC') LOOP
l_emp_tab.extend;
SELECT XMLELEMENT("ABCD",
XMLELEMENT("id",i.id))
INTO l_emp_tab(i)
FROM dual;
END LOOP;
SELECT XMLELEMENT("EMP"
,XMLAGG(t.column_value))
INTO p_emp_info
FROM TABLE(l_emp_tab) t;
--Dbms_Output.put_line(getclobval(1,2));
EXCEPTION
WHEN OTHERS THEN
Dbms_Output.put_line(SQLCODE||sqlerrm);
END ;
I am using this query but it is giving me an error that expression is of wrong type at this line { INTO l_emp_tab(I) }
I am unable to find out the error that what I am missing here !!You've changed the datatype of i from the example that Odie gave you in
repeating nodes using FOR loop but when concating XML string then concating only last iteration of FOr loop ??
In his example, i was a number. In your above code, i is now the rowset for a cursor.
You could rewrite your version to look like
declare
p_emp_info XMLTYPE;
l_emp_tab xmlsequencetype := xmlsequencetype();
l_pos PLS_INTEGER;
CURSOR c_info IS
SELECT id
from emp
WHERE emp_name='ABC';
BEGIN
FOR r_info IN c_info LOOP
l_emp_tab.extend;
l_pos := c_info%ROWCOUNT;
SELECT XMLELEMENT("ABCD",
XMLELEMENT("id",r_info.id))
INTO l_emp_tab(l_pos)
FROM dual;
END LOOP;
SELECT XMLELEMENT("EMP"
,XMLAGG(t.column_value))
INTO p_emp_info
FROM TABLE(l_emp_tab) t;
--Dbms_Output.put_line(p_emp_info.getclobval());
END ;
You can't use the c_info%ROWCOUNT in the INTO clause, hence the need for l_pos.
Or you could rewrite it to be
declare
p_emp_info XMLTYPE;
l_clob CLOB;
BEGIN
SELECT XMLElement("EMP",
XMLAgg(XMLElement("ABCD",
XMLElement("id",e.id))))
INTO p_emp_info
FROM emp e
WHERE emp_name = 'ABC';
SELECT XMLSERIALIZE(DOCUMENT p_emp_info AS CLOB)
INTO l_clob
FROM DUAL;
Dbms_Output.put_line(l_clob);
END;
Both produce the same XML. -
How to count number of xml nodes , with JSTL XML api?
I am trying to count the number of nodes in the parsed xml by doing this:
<x:out select="count($doc/Items/Item)"/>
There are about 50 item nodes in the source xml, but I get the output as 0
Is this syntax correct?
I searched every where but couldn't find the xpath syntax to be used inside jstl xml tags, I was assuming that it's the same as the syntax used in xsltThank you for your reply, sorry I wasnt very clear with my question.
I want to count the number of nodes inside the jsp file , not inside the xslt file.
My xml file is something like this for example:
<?xml version="1.0" encoding="UTF-8"?>
<DocumentRootNode>
<Products>
<Item>1</Item>
<Item>2</Item>
<Item>3</Item>
<Products>
</DocumentRootNode>
I want the count of number of Item nodes , in the JSP file.
I'm doing something like this in the JSP but it gives 0 instead of 3:
<c:import url="source.xml" var="xml" charEncoding="UTF-8"/>
<x:parse doc="${xml}" var="xml_doc"/>
<x:out select="count($xml_doc/Products/Item)"/>
null -
Is it possible to disable SafeHTML in Outlook Web App on Exchange 2010?
We have users that receive messages with attachments that are generated by a 3rd party.
They are XML files saved with a XLS extension.
When opening via Outlook, Excel prompts that the content does not match the content type and asks the user if they want to open the file anyway, when opened the file does contain the data.
When opening the file via OWA, the contents are stripped out and replaced with the text: This attachment was removed because it contains data that could pose a security risk.
The problem is that some users exclusively use OWA and they need to be able to open these attachments.
Thank You.Hi,
You can disable the OWA SafeHTML filtering by changing changing the
BypassOwaHTMLAttachmentFiltering option to true, for more details, please refer to the following article.
All HTML content in attachment files of messages is run through an HTML filter when you open or save the attachment by using Outlook Web Access (OWA)
http://support.microsoft.com/kb/958881
Best regards,
Belinda Ma
TechNet Community Support -
Matching JS XML object with Indd XML elements
Hello Scripters,
I need help ...
I have some XML from a file read into a Javascript XML object.
The object has the name "myXml", and contains:
<book id="bk101">
<author>Gambardella, Matthew</author>
<title>XML Developer's Guide</title>
<genre>Computer</genre>
<imagecontainer href="C:\33415677.JPG"></imagecontainer>
<price>44.95</price>
<publish_date>2000-10-01</publish_date>
<description><test>Sublevel</test>An in-depth look at creating applications with XML.</description>
</book>
... and several other books
I also have some XML in Indesign, wich in my JS is known as "myTplXmlRoot".
myTplXmlRoot is defined as myTplXmlRoot = mySelection.associatedXMLElement;
What would be the best approach for matching elements of the same name in the two xml structures, and where there is a match* replace the Indesign content**, with that from the object "myXml"?
*) Match if same name, dont worry about place in hirachy
**) content might be an imageI've figured out the solution to my problem. For anyone
interested, see me code below (the xml element names are different,
but the concept is the same). -
hi Friends,
Please help me in below error , I am using XML data source with below encoding
<?xml version="1.0" encoding="iso-8859-1"?>
While generating xsd, i am getting below error.
'.', hexadecimal value 0x00, is an invalid character. Line 2, position 1.
the xml is parsing correctly as i am using XML spy to check the xml.
Any help is appritiated.
Thanks in advance,
PariI think XMLSpy does something to swallow the null char.
I'd inspect this file in a professional editor to determine whether (likely) a hex 0x00 is in the file.
Arthur
MyBlog
Twitter -
How to get & use xml data with jstl libraries? (URGENT PLZ)
I am using jstl to get and use xml data
I needs to perform operations on the parsed xml document with other libraries of jstl. How can i do that.
I used Dom variable to parse my document as:
<x:parse varDom="test"> <c:import url="project.xml"/> </x:parse>
where my project.xml is:
<?xml version="1.0" encoding="iso-8859-1"?>
<project> <projectName>myProject</projectName> </project>
I can dislay this value in html by
<x:out select="$test/project/projectName"/>
But I need a string value sotred in variable such as <c:set var="pname" value="???">
HOW CAN I SET THIS VALUE IN CORE VARIABLE THAT IS, USING <c:set...> SO THAT IT CAN BE USED ANYWHERE IN JSP PAGE TO CONCATE RETURNED STRING IN OTHER STRING VARIABLES DEFINED BY CORE LIB?
Jessy
Message was edited by:
jessy
Message was edited by:
jessyI believe that <c:set> should do that but i am facing problem in it. Look into this jsp scriptlet:
1-<x:parse varDom="test"> <c:import url="project.xml"/> </x:parse>
2-<x:set var="ds" select="$test/project/projectName"/>
3-<x:out select="$ds"/> <br>
4-<c:set var="tt" value="${ds}" />
5-<c:out value="${tt}" />
In line 3 variable ds returns: myProject
In line 5 variable tt returns: [[projectName: null]]
perhaps on line 4 ds is storing some array to tt and i am not calling correct array element. I tried many options but still could not find solution. Plz Plz do something urgent for me. Thanks
Jessy
Message was edited by:
jessy -
First time with Oracle XML database
Hi!
I'm a beginner with XML and with Oracle XML database so i need same help. I've read the documentation (example for XML Oracle).
What do i need to write XML files from an oracle database and the other way to read XML files into the database?
Or does anyone know how i can get information about this?
Thank's for help!
With best regards
NicoleNicole,
One quick way to get xml out of the database is to use the dbms_xmlgen.getXML package.
i.e. in sqlplus
set long 4000
select dbms_xmlgen.getxml('select * from emp') from dual;
or
set long 4000
select dbms_xmlgen.getxml('select column_name from owner.tablename') from dual;
HTH -
Error deploying Bean with EJB QL statement in ejb-jar.xml
Hi,
I'm using Oracle iAS 9i Rev:9.03.
I've tried to deploy a Entity Bean with the following EJB QL Query:
</cmp-field>
<query>
<query-method>
<method-name>findByProcessStep</method-name>
<method-params>
<method-param>java.lang.Integer</method-param>
<method-param>java.lang.Integer</method-param>
</method-params>
</query-method>
<ejb-ql>SELECT OBJECT(p) FROM Processparameter AS p WHERE p.stepid=?1 AND p.stepversion=?2</ejb-ql>
</query>
</entity>
Without the query statement everything works fine. As soon as I include it I get the following Error message from dcmctl:
ADMN-300075
Nested exception
Base Exception:
java.rmi.RemoteException:Failure to initialize EJBQL descriptors: java.lang.RuntimeException: No method found for XML query element: Ambiguous or invalid <query-method>
Is this an Oracle iAS error or is there an error in my query?
Thanks in advance
Jenstry :
p.stepid and p.stepversion are correct insert into <cmp-field> ?
and Processparameter is the correct name of <abstract-schema-name>?
is your <ejb-ql> insert in the right <entity> ?
findByProcessStep(Integer, Integer) is the unique name in your ejb-jar? and in the (LocalHome ||RemoteHome) -
What are the necessary elements in ejb-jar.xml with CMP entity bean
What are the necessary elements in ejb-jar.xml with CMP entity bean
Actually i am using webligic 8.1 and while deployment getting the error that
some elements r missing
Thanks
Anand PritamAccording to the ejb-jar.xml dtd ejb-name, ejb-class, persistence-type, prim-key-class, reentrant are the required elements for an entity bean.
<!ELEMENT entity (description?, display-name?, small-icon?,
large-icon?, ejb-name, home?, remote?, local-home?,
local?, ejb-class, persistence-type, prim-key-class,
reentrant, cmp-version?, abstract-schema-name?,
cmp-field*, primkey-field?, env-entry*, ejb-ref*,
ejb-local-ref*, security-role-ref*, security-identity?,
resource-ref*, resource-env-ref*, query*)> -
"Could not locate the bean with the ejb-name XYZ in weblogic-ejb-jar.xml
Hi,
Please someone help me on this...
I'm trying to deploy an application on WLS 8.1 SP4
on HPUX IA64 arch. From the ear file WLS is able to
deploy 3 jars but for the last two jars it's throwing
the below error:
Could not locate the bean with the ejb-name xyz in weblogic-ejb-jar.xml
But ejb with name xyz is defined in the the weblogic-ejb-jar.xml file and it's also present in the
META-INF/ejb-jar.xml file.
I have no clue what's going wrong.
Any help is appreciated.
Thanks
Moulioops! Pls ignore my previous mail. It was for a different problem.
FOr the original problem of "couldn ot locate the bean with the ejb-name XZY in weblogic-ejb-jar.xml":
This happens if you don't have the below files defined
for a JAR/EAR file:
weblogic-ejb-jar.xml and weblogic-cmp-rdbms-jar.xml (needed if you have any Datasource mapped)
These two are basic files required for any JAR/EAR file.
If you dont' have it already you can generate them using
$WLS_HOME/bin/startWLBuilder.sh GUI tool bundled along
with WLS (I used 8.1 SP4) to generate these files ! This tool is really helpful.
- Mouli -
How to get an XML string from a Java Bean without wrting to a file first ?
I know we can save a Java Bean to an XML file with XMLEncoder and then read it back with XMLDecoder.
But how can I get an XML string of a Java Bean without writing to a file first ?
For instance :
My_Class A_Class = new My_Class("a",1,2,"Z", ...);
String XML_String_Of_The_Class = an XML representation of A_Class ?
Of course I can save it to a file with XMLEncoder, and read it in using XMLDecoder, then delete the file, I wonder if it is possible to skip all that and get the XML string directly ?
FrankI think so too, but I am trying to send the object to a servlet as shown below, since I don't know how to send an object to a servlet, I can only turn it into a string and reconstruct it back to an object on the server side after receiving it :
import java.io.*;
import java.net.*;
import java.util.*;
class Servlet_Message // Send a message to an HTTP servlet. The protocol is a GET or POST request with a URLEncoded string holding the arguments sent as name=value pairs.
public static int GET=0;
public static int POST=1;
private URL servlet;
// the URL of the servlet to send messages to
public Servlet_Message(URL servlet) { this.servlet=servlet; }
public String sendMessage(Properties args) throws IOException { return sendMessage(args,POST); }
// Send the request. Return the input stream with the response if the request succeeds.
// @param args the arguments to send to the servlet
// @param method GET or POST
// @exception IOException if error sending request
// @return the response from the servlet to this message
public String sendMessage(Properties args,int method) throws IOException
String Input_Line;
StringBuffer Result_Buf=new StringBuffer();
// Set this up any way you want -- POST can be used for all calls, but request headers
// cannot be set in JDK 1.0.2 so the query string still must be used to pass arguments.
if (method==GET)
URL url=new URL(servlet.toExternalForm()+"?"+toEncodedString(args));
BufferedReader in=new BufferedReader(new InputStreamReader(url.openStream()));
while ((Input_Line=in.readLine()) != null) Result_Buf.append(Input_Line+"\n");
else
URLConnection conn=servlet.openConnection();
conn.setDoInput(true);
conn.setDoOutput(true);
conn.setUseCaches(false);
// Work around a Netscape bug
conn.setRequestProperty("Content-Type","application/x-www-form-urlencoded");
// POST the request data (html form encoded)
DataOutputStream out=new DataOutputStream(conn.getOutputStream());
if (args!=null && args.size()>0)
out.writeBytes(toEncodedString(args));
// System.out.println("ServletMessage args: "+args);
// System.out.println("ServletMessage toEncString args: "+toEncodedString(args));
BufferedReader in=new BufferedReader(new InputStreamReader(conn.getInputStream()));
while ((Input_Line=in.readLine()) != null) Result_Buf.append(Input_Line+"\n");
out.flush();
out.close(); // ESSENTIAL for this to work!
return Result_Buf.toString(); // Read the POST response data
// Encode the arguments in the property set as a URL-encoded string. Multiple name=value pairs are separated by ampersands.
// @return the URLEncoded string with name=value pairs
public String toEncodedString(Properties args)
StringBuffer sb=new StringBuffer();
if (args!=null)
String sep="";
Enumeration names=args.propertyNames();
while (names.hasMoreElements())
String name=(String)names.nextElement();
try { sb.append(sep+URLEncoder.encode(name,"UTF-8")+"="+URLEncoder.encode(args.getProperty(name),"UTF-8")); }
// try { sb.append(sep+URLEncoder.encode(name,"UTF-16")+"="+URLEncoder.encode(args.getProperty(name),"UTF-16")); }
catch (UnsupportedEncodingException e) { System.out.println(e); }
sep="&";
return sb.toString();
}As shown above the servlet need to encode a string.
Now my question becomes :
<1> Is it possible to send an object to a servlet, if so how ? And at the receiving end how to get it back to an object ?
<2> If it can't be done, how can I be sure to encode the string in the right format to send it over to the servlet ?
Frank
Maybe you are looking for
-
Open I phone 4 after upgrading to ios 5
i upgraded my iphone 4 to ios 5 but its closed and cant be opened , i bought it from USA blocked and opened it in Israel , any solutions to open it again or downgrade to my old software virion 4 ????
-
Record to internal or external drive ?
Hello, I've been recording directly to my external HD, a Glyph, since I started with Logic Express. Last night I was recording a live performance and afterwards a gentleman, with a lot of recording experience, said my recording path was wrong. He sai
-
Is it possible to join both the us and uk itunes store?
is it possible to join up in both the us and uk?
-
Redownload apps..?
I bought creative cloud today and downloaded some apps. In the apps section on the creative cloud window it says that InDesign, Photoshop and Illustrator are all up to date. However I can only find InDesign on my computer and am unable to download Ph
-
Query to find the top ranked student in each class ?? table given
i/p table: studentid classid marks 1 1 400 2 1 500 3 2 600 4 2 700 5 3 800 6 3 900 o/p table : studentid classid marks 2 1 500 4 2 700 6 3 900