How use xml with namespaces
I have the following xml which is output from Oracle Bpel.
<OglRapportPerAdresnrResponse xmlns="http://www.itude.com/technology/Ogl/RapportPerAdresnrResponse">
<AdresGegevens>
<Adresnr>54321</Adresnr>
<Straatkode>12345</Straatkode>
</AdresGegevens>
</OglRapportPerAdresnrResponse>
If i remove the namespace info everything works fine but with the namespace info the output is empty if i insert e.g. <Adresnr> into a template. The field browser shows everything fine and also the value but when rendering a PDF it disappears. I read in the user guide that i need to declare the namspace in a form field like <?namespace:namespace name= namespace url?> but how do i do that with the above namespace notation where the namespace name is empty ?
Regards,
Andre
Hi Tim,
I found part of the solution but i am still stuck when i need to use <?for-each?> tags. When i use the following XML:
<OglRapportPerAdresnrResponse xmlns="http://www.itude.com/technology/Ogl/RapportPerAdresnrResponse">
<AdresGegevens>
<Adresnr>8391</Adresnr>
<Straatkode>11070</Straatkode>
</AdresGegevens>
<Basisgegevens>
<paramPResult xmlns="urn:generated.ws.kgb.itude.com">
<paramAdresnr>8391</paramAdresnr>
<paramGegevenstype>GEBRUIK</paramGegevenstype>
</paramPResult>
<paramPResult xmlns="urn:generated.ws.kgb.itude.com">
<paramAdresnr>8391</paramAdresnr>
<paramGegevenstype>STADSDEEL</paramGegevenstype>
</paramPResult>
</Basisgegevens>
</OglRapportPerAdresnrResponse>
I read the xml file in Word. I then have access to the fields but when i select AdresGegevens/Adresnr the output is not rendered. The namespace is a default namespace for that element. I found out that if i define a namespace like <?xmlns:bpel=http://www.itude.com/technology/Ogl/RapportPerAdresnrResponse?> and then access the AdresGegevens/Adresnr through <?bpel:Adresnr?> it works!
I then defined a second namespace <?xmlns:bpel2=urn:generated.ws.kgb.itude.com?> and tried to render the paramPResult tags with:
<?for-each:paramPResult?>
<?bpel2:paramAdresnr?>
<?bpel2:paramGegevenstype?>
<?end for-each?>
But the above does not work. Any ideas?
Regards,
Andre Jochems
Similar Messages
-
Hi,
I have following XML document stored as XMLType column,
<ocaStatus xmlns="http://xmlbeans.apache.org/ocastatus"><status><statusCode>934</statusCode><statusDate>Wed Apr 07 16:05:53 GMT+05:30 2010</statusDate><userId>u0121845</userId><comment>Sent to LTC</comment></status><status><statusCode>934</statusCode><statusDate>Wed Apr 07 15:58:25 GMT+05:30 2010</statusDate><userId>u0121845</userId><comment>Sent to LTC</comment></status><status><statusCode>934</statusCode><statusDate>Wed Apr 07 15:54:02 GMT+05:30 2010</statusDate><userId>u0121845</userId><comment>Sent to LTC</comment></status><status><statusCode>750</statusCode><statusDate>2010-03-31 12:39:41.580 GMT+05:30</statusDate><userId>u0121845</userId><comment>Document Metadata is correct.</comment></status><status><statusCode>934</statusCode><statusDate>2010-03-31 12:39:41.580 GMT+05:30</statusDate><userId>u0121845</userId><comment>Sent to LTC</comment></status><status><statusCode>932</statusCode><statusDate>2010-03-31 12:39:41.580 GMT+05:30</statusDate><userId>u0121845</userId><comment>Loaded to Novus</comment></status><status><statusCode>700</statusCode><statusDate>2010-03-31 12:39:41.580 GMT+05:30</statusDate><userId>u0121845</userId><comment>Document is deleted from OCA.</comment></status></ocaStatus>
This XML row contains namespace in it. Also there are some XML that does not have any namespace in it.
I am running following XMLQuery() to get statusCode,
select docfamily_uuid,
XMLQuery(
'for $i in /ocaStatus/status
where $i/statusCode = 934
return <statusDate>{$i /statusDate}</statusDate>'
passing document_status_bean RETURNING CONTENT)
from document_status_xml;
Interestingly the query returns null for XML with namespace and statusCode value for rest of the XMLs without any namespace.
Please help me to get this resolved.
Thanks in advanced.
Edited by: user6117359 on Apr 8, 2010 12:17 AMuser6117359 wrote:
I have some XPath queries too which are using extract(). I am facing the similar problem with them.Hi,
Extract() accepts a list of namespaces as its third parameter.
Ex. : based on your sample, to extract the first "status" element :
SELECT extract(document_status_bean, 'ocaStatus/status[1]', 'xmlns="http://xmlbeans.apache.org/ocastatus"')
FROM document_status_xml -
Problem while using XML with Oracle
I have a problem using XML with oracle applications
The process I am following
1. Making a XML string.
2. Parsing it to get a document
3. Free the parser using xmlparser.freeparser
4. Traversing through nodes .
5. Freeing the document.
The whole Process is executed in batch mode.
The problem occurs after executing the procedure for 5000 records and I get the error
ORA-04031: unable to allocate 4176 bytes of shared memory ("shared pool","unknown object","sga
heap","library cache")
Can you please help me out to overcome this problem
It's urgent
I have
Oracle version 8.1.7.0.0
XML version 1.2
OS Windows NT
To resolve the problem I have increase shared memory size and java initialization parameters ,which seems OK
Looking forward for your answer.Hello, Reena
Your process flow seems to be correct in term of getting/freeing memory.
Following error
The problem occurs after executing the procedure for 5000 records and I get the error
ORA-04031: unable to allocate 4176 bytes of shared memory ("shared pool","unknown object","sga
heap","library cache")may be caused by memory leaks in xdk or memory fragmentation(due to get/free memory cycle)
To find out if this is an memory leak issue you could try to monitor V$SGASTAT from one session while running your batch process in another session.
To prevent (or lower its impact) fragmentation issues try to PIN objects, and adjust java_pool_size and shared_pool_reserved_size.
Anyway, counsult your Oracle DBA.
Oracle version 8.1.7.0.0I think, you should apply database patch first of all. The latest one (8.1.7.4.x) could be accured from Metalink. -
How use multithead with socket
How use multithead with socket
I need do a client and server program that accept multitherad issue
Thanks who can help meyou'd have to do something like this:
(this is all assuming you want to read Strings from the socket. setSoTimeout works for any read() call to the InputStream associated with the Socket)
ServerSocket ss = new ServerSocket(myPort);
Socket s = ss.accept();
s.setSoTimeout(5*60*1000); // 5 mins * 60 secs * 1000ms
BufferedReader in = new BufferedReader(new InputStreamReader(s.getInputStream()));
boolean running = true;
while(running)
try
String readIn = in.readLine();
// do whatever you want with the data read
catch(SocketTimeoutException)
running = false;
Now. That's what I think needs to be done. I don't have Java on the machine I'm currently on, so I can't test/verify it, but it goes something like that.
Good luck,
Radish21 -
How to extract XML with namespace?
Hi all,
Below is the XML i have :
<?xml version="1.0" encoding="UTF-8" ?>
- <Transaction xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.test.com/Support/Services/test1/2012" xsi:schemaLocation="http://schemas.test.com/Support/Services/test1/2012 Support.test1.v1.xsd">
- <Request>
<Memid>10</Memid>
<Actid>32</Actid>
<Pax>3</Pax>
<Flt>2012-DEC-10</Flt>
<Username>WebUserNameTest</Username>
</Request>
<Request>
<Memid>1</Memid>
<Actid>3</Actid>
<Pax>2</Pax>
<Flt>2012-DEC-12</Flt>
<Username>WebUserNameTest</Username>
</Request>
</Transaction>
I want to extract the element values :
The below code will help me when i have no namespace , what must be done in order to work with namespace and etract element value
v_string_xml :=
' //Request[' || TO_CHAR (counter_xml) || ']/Memid/text()';
v_ssp_table (v_ssp_table.COUNT).memid :=
p_xml_in.EXTRACT (v_string_xml).getnumberval ();
v_string_xml :=
'//Request[' || TO_CHAR (counter_xml) || ']/Actid/text()';
v_ssp_table (v_ssp_table.COUNT).actid :=
p_xml_in.EXTRACT (v_string_xml).getnumberval ();
v_string_xml :=
'//Request['
|| TO_CHAR (counter_xml)
|| ']/Pax/text()';
v_ssp_table (v_ssp_table.COUNT).pax :=
p_xml_in.EXTRACT (v_string_xml).getnumberval ();
v_string_xml :=
'//Request[' || TO_CHAR (counter_xml) || ']/Flt/text()';
v_ssp_table (v_ssp_table.COUNT).flt :=
p_xml_in.EXTRACT (v_string_xml).getstringval ();
v_string_xml :=
'//Request['
|| TO_CHAR (counter_xml)
|| ']/Username/text()';
v_ssp_table (v_ssp_table.COUNT).username :=
p_xml_in.EXTRACT (v_string_xml).getstringval ();declare
v_xml xmltype := xmltype( '<?xml version="1.0" encoding="UTF-8" ?>
<Transaction xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.test.com/Support/Services/test1/2012" xsi:schemaLocation="http://schemas.test.com/Support/Services/test1/2012 Support.test1.v1.xsd">
<Request>
<Memid>10</Memid>
<Actid>32</Actid>
<Pax>3</Pax>
<Flt>2012-DEC-10</Flt>
<Username>WebUserNameTest</Username>
</Request>
<Request>
<Memid>1</Memid>
<Actid>3</Actid>
<Pax>2</Pax>
<Flt>2012-DEC-12</Flt>
<Username>WebUserNameTest</Username>
</Request>
</Transaction>' );
begin
for r_xml in ( select *
from xmltable( xmlnamespaces( default 'http://schemas.test.com/Support/Services/test1/2012' )
, '/Transaction/Request'
passing v_xml
columns memid number path 'Memid'
, actid number path 'Actid'
, pax number path 'Pax'
, flt varchar2(100) path 'Flt'
, username varchar2(100) path 'Username'
loop
dbms_output.put_line( r_xml.memid );
dbms_output.put_line( r_xml.actid );
dbms_output.put_line( r_xml.pax );
dbms_output.put_line( r_xml.flt );
dbms_output.put_line( r_xml.username );
end loop;
end; -
Using selectSingleNode with namespace prefixes like "xmlsns:xsi"???
I'm having a little trouble manipulating a document with the xmlparserv2 library. The XMLNode.selectSingleNode method does not seem to work when the attribute in question is part of a namespace. For example, I have a document that has a schema declaration like so:
****CUT****
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="..\XMLStressTestCase.xsl"?>
<XMLTestCase xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../XmlStressTestCase.xsd" Name="Engenious (Switch) Eligible Test" MaxTime="30000">
****CUT****
If I create an XMLDocument (myDoc) from the file in question and try to execute the following line of code
Node n = myDoc.selectSingleNode("@xmlns:xsi");
I get the following error
" Namespace prefix 'xmlns' used but not declared."
In google I found a thread (http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&threadm=ugJD7hJ3BHA.2236%40tkmsftngp02&rnum=2&prev=/groups%3Fhl%3Den%26lr%3D%26ie%3DUTF-8%26oe%3DUTF-8%26q%3Dxmlns%2B%252B%2BselectSingleNode%26sa%3DN%26tab%3Dwg)that points to setProperty/selectionNamespaces
as qa possible way to resolve the problem in the MSXML implementation. It looks like the oracle XDK has the same method, but I can't seem to find any documentation on the values that are supported for that method (http://otn.oracle.com/docs/tech/xml/xdk_java/doc_library/Production9i/doc/java/javadoc/oracle/xml/parser/v2/XMLNode.html#setProperty(java.lang.String, java.lang.Object))
Any help? Should I be declaring the namespace in my XML someplace?In fact it used to be possible to set a NamespacePrefixMapper that controls the namespace prefixes in the JAXB 2.0 from Glasfish like this:
marshaller.setProperty("com.sun.xml.bind.namespacePrefixMapper", new MyNamespacePrefixMapper());
When using the Java 6 implementation of JAXB this coded will throw an exception. Has anyone got a clue how to control the namespace prefix in Java 6?
Thanks,
Ager -
Using XML with websphere jdbc adapter 2.6 on 11.2.0.2
Hi,
while upgrading a DB from 10g to 11R2, the developers encountered problems with the websphere adapter for JDBC while using XML.
the adapter is working with the oracle XML libraries such as xmltype_lib and the adapter fails to run the package procedures (specifically xmltype.createxml).
to my understanding, it works with 11R1 (the dev team tested it), and my guess is that the implementation of the xmltype_lib library changed in 11R2.
any idea how to approach this issue? is there any known overall changes to xmltype_lib in 11R2 ? if my assumption is correct there should be no problem fixing this issue by compiling older libraries or some sort of similar approach.If you ask this question in a Java forum you are looking for someone that has run into this before and found a solution - what you need is someone experienced with Websphere, so you really should ask in a Websphere forum (which you can find on the IBM website).
But this part of your question:
is there any known overall changes to xmltype_lib in 11R2 ?relates to the Oracle DBMS which takes it out of the realm of Java altogether. If you want an answer to that, again, ask in the right forum. I'm guessing this one:
XML DB -
Using XML with special characters - not rendering
Hello,
I am using xml to populate the content of a Flash file, but
we have localized content for different global regions. So, when
the content contains special characters like "é" they do not
show up at all in the flash. I tried using é but that
just renders the actual code...
Is there a workaround for this?
ThanksHi Rothrock, thanks for your reply...
Flash Version: 8, but the swf was published to be 7+
compatible.
The font is Meta Normal, it is embedded, and it does include
the character.
I am retrieving the xml by using this script in the html
page:
<script type="text/javascript">
// <![CDATA[
var fo = new FlashObject("/templates/flash/index.swf" +
cKiller, "ad-flash", "710", "351", "7", "#FFFFFF");
fo.addVariable("xmlURL", "/flash_content/products.xml");
fo.write("ad");
// ]]>
</script>
I am creating the XML using Macromedia Homesite, with the
encoding declaration <?xml version="1.0" encoding="UTF-8" ?>
The XML is being read fine, only the special characters don't
show up... so it will cut off the word, or just have an empty space
where the character should be.
I am not sure how to specifiy Extended Latin charset in the
document... could you tell me how to do that?
Thanks -
ORA-31020 when using XML with external DTD or entities
I'd like to parse XML documents against a modular DTD that references other DTDs. This works fine with Oracle 9i. But after upgrading to 11g, the parsing of XML-instances fails and DBMS_XMLPARSER.parseClob produces ORA-31020.
The same error occurs even if I simply try to store XML with a reference to an external DTD as xmltype:
SQL> select xmltype('<?xml version="1.0" encoding="iso-8859-1"?><!DOCTYPE ewl-artikel SYSTEM "http://www.foo.com/example.dtd"><test>123</test>') from dual;
ERROR:
ORA-31020: Der Vorgang ist nicht zulässig, Ursache: For security reasons, ftp
and http access over XDB repository is not allowed on server side
ORA-06512: in "SYS.XMLTYPE", Zeile 310
ORA-06512: in Zeile 1
How can I use external DTDs on remote servers in order to parse XML in an 11g database??? Any ideas for a workaround? Thanks in advance!This is my PL/SQL validation procedure:
procedure validatexml (v_id in number default 0) is
PARSER DBMS_XMLPARSER.parser;
DTD_SOURCE clob;
DTD_DOCUMENT xmldom.DOMDocumentType;
XML_INSTANCE xmltype;
BEGIN
-- load DTD from XDB repository
SELECT httpuritype('http://example.foo.de/app1/DTD1.dtd').getclob() into DTD_SOURCE from dual;
-- load XML instance
select co_xml into XML_INSTANCE from tb_xmltab where co_id=v_id;
-- parse XML instance
PARSER := DBMS_XMLPARSER.newParser;
xmlparser.setValidationMode( PARSER , false);
xmlparser.parseDTDClob( PARSER , DTD_SOURCE , 'myfirstnode' );
DTD_DOCUMENT := xmlparser.getDoctype( PARSER );
xmlparser.setValidationMode( PARSER , true );
xmlparser.setDoctype( PARSER , DTD_DOCUMENT );
DBMS_XMLPARSER.parseClob( PARSER , v_xml );
DBMS_XMLPARSER.freeParser(PARSER);
htp.print('<P>XML instance succesfully validated!<P>');
end validatexml; -
Namespace not found error when creating data server for xml with namespace
Hi
I tried creating XML data server in ODI with namespace in xml file. I followed the below steps but could not success in creating the dataserver. however when I remove the namespace in xml file I am able to reverse engineer the xml file.
1) Create xml data server
2) select xml driver - com.sunopsis.jdbc.driver.xml.SnpsXmlDriver
3) Provide the jdbc url - jdbc:snps:xml?f=D:/xmlnew/sample_namespace.xml&s=xmlns&d=D:/xmlnew/sample_namespace.dtd
xml content
<f:root xmlns:f="http://www.w3.org/TR/html4/">
<table>
<name>African Coffee Table</name>
<width>80</width>
<length>120</length>
</table>
</f:root>
DTD content
<!ELEMENT f:root ( table ) >
<!ELEMENT length ( #PCDATA ) >
<!ELEMENT name ( #PCDATA ) >
<!ELEMENT table ( name, width, length ) >
<!ELEMENT width ( #PCDATA ) >
when I test connection it shows the following error.
java.sql.SQLException: The model generated by the model mapper was not accepted by a validator: Model not accepted: Namespace not found:
at oracle.odi.jdbc.datasource.LoginTimeoutDatasourceAdapter.doGetConnection(LoginTimeoutDatasourceAdapter.java:133)
at oracle.odi.jdbc.datasource.LoginTimeoutDatasourceAdapter.getConnection(LoginTimeoutDatasourceAdapter.java:62)
at com.sunopsis.sql.SnpsConnection.testConnection(SnpsConnection.java:1100)
at com.sunopsis.graphical.dialog.SnpsDialogTestConnet.getLocalConnect(SnpsDialogTestConnet.java:371)
at com.sunopsis.graphical.dialog.SnpsDialogTestConnet.localConnect(SnpsDialogTestConnet.java:794)
at com.sunopsis.graphical.dialog.SnpsDialogTestConnet.jButtonTest_ActionPerformed(SnpsDialogTestConnet.java:754)
at com.sunopsis.graphical.dialog.SnpsDialogTestConnet.connEtoC1(SnpsDialogTestConnet.java:137)
at com.sunopsis.graphical.dialog.SnpsDialogTestConnet.access$1(SnpsDialogTestConnet.java:133)
at com.sunopsis.graphical.dialog.SnpsDialogTestConnet$IvjEventHandler.actionPerformed(SnpsDialogTestConnet.java:87)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:272)
at java.awt.Component.processMouseEvent(Component.java:6289)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
at java.awt.Component.processEvent(Component.java:6054)
at java.awt.Container.processEvent(Container.java:2041)
at java.awt.Component.dispatchEventImpl(Component.java:4652)
at java.awt.Container.dispatchEventImpl(Container.java:2099)
at java.awt.Component.dispatchEvent(Component.java:4482)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4577)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
at java.awt.Container.dispatchEventImpl(Container.java:2085)
at java.awt.Window.dispatchEventImpl(Window.java:2478)
at java.awt.Component.dispatchEvent(Component.java:4482)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:644)
at java.awt.EventQueue.access$000(EventQueue.java:85)
at java.awt.EventQueue$1.run(EventQueue.java:603)
at java.awt.EventQueue$1.run(EventQueue.java:601)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:98)
at java.awt.EventQueue$2.run(EventQueue.java:617)
at java.awt.EventQueue$2.run(EventQueue.java:615)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:614)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Caused by: java.sql.SQLException: The model generated by the model mapper was not accepted by a validator: Model not accepted: Namespace not found:
at com.sunopsis.jdbc.driver.xml.SnpsXmlDTD.initialize(SnpsXmlDTD.java:389)
at com.sunopsis.jdbc.driver.xml.SnpsXmlDTD.initialize(SnpsXmlDTD.java:421)
at com.sunopsis.jdbc.driver.xml.SnpsXmlDTD.<init>(SnpsXmlDTD.java:150)
at com.sunopsis.jdbc.driver.xml.SnpsXmlSchema.<init>(SnpsXmlSchema.java:478)
at com.sunopsis.jdbc.driver.xml.SnpsXmlSchemaManager.createNewSchema(SnpsXmlSchemaManager.java:292)
at com.sunopsis.jdbc.driver.xml.SnpsXmlSchemaManager.getSchemaFromProperties(SnpsXmlSchemaManager.java:270)
at com.sunopsis.jdbc.driver.xml.SnpsXmlDriver.connect(SnpsXmlDriver.java:114)
at oracle.odi.jdbc.datasource.DriverManagerUtils$DriverProxy.connect(DriverManagerUtils.java:23)
at oracle.odi.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriverManager(DriverManagerDataSource.java:368)
at oracle.odi.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriverManager(DriverManagerDataSource.java:352)
at oracle.odi.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriverManager(DriverManagerDataSource.java:316)
at oracle.odi.jdbc.datasource.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:275)
at oracle.odi.jdbc.datasource.LoginTimeoutDatasourceAdapter.doGetConnection(LoginTimeoutDatasourceAdapter.java:99)
at oracle.odi.jdbc.datasource.LoginTimeoutDatasourceAdapter.getConnection(LoginTimeoutDatasourceAdapter.java:62)
at oracle.odi.jdbc.datasource.LoginTimeoutDatasourceAdapter$ConnectionProcessor.run(LoginTimeoutDatasourceAdapter.java:217)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)Hi,
Thans for your reply.
This is the DTD for my xmldoc.
<!ELEMENT Data (Department+)>
<!ELEMENT EmployeeID (#PCDATA)>
<!ATTLIST EmployeeID col (EMPID) #IMPLIED>
<!ELEMENT Education (EmployeeID, Sequence, Dgree)>
<!ATTLIST Education table NMTOKEN #IMPLIED>
<!ELEMENT Employee (EmployeeName, EmployeeID, DepartmentID, Education*)>
<!ATTLIST Employee table NMTOKEN #IMPLIED>
<!ELEMENT EmployeeName (#PCDATA)>
<!ATTLIST EmployeeName col NMTOKEN #IMPLIED>
<!ELEMENT DepartName (#PCDATA)>
<!ATTLIST DepartName col NMTOKEN #IMPLIED>
<!ELEMENT Table (Column+)>
<!ATTLIST Table importType NMTOKEN #IMPLIED>
<!ATTLIST Table parentTable NMTOKEN #IMPLIED>
<!ATTLIST Table tag NMTOKEN #IMPLIED>
<!ATTLIST Table columns NMTOKEN #IMPLIED>
<!ATTLIST Table name NMTOKEN #IMPLIED>
<!ELEMENT DepartID (#PCDATA)>
<!ATTLIST DepartID col NMTOKEN #IMPLIED>
<!ELEMENT MetaData (Table+)>
<!ELEMENT Sequence (#PCDATA)>
<!ATTLIST Sequence col NMTOKEN #IMPLIED>
<!ELEMENT Dgree (#PCDATA)>
<!ATTLIST Dgree col NMTOKEN #IMPLIED>
<!ELEMENT Export (MetaData, Data)>
<!ELEMENT DepartmentID (#PCDATA)>
<!ATTLIST DepartmentID col NMTOKEN #IMPLIED>
<!ELEMENT Column (#PCDATA)>
<!ATTLIST Column deleteKey NMTOKEN #IMPLIED>
<!ATTLIST Column isKey NMTOKEN #IMPLIED>
<!ELEMENT Department (DepartName, DepartID, Employee+)>
<!ATTLIST Department table NMTOKEN #IMPLIED>
Thanks again!
Yan -
How use jdbc with swing ? i am new in this concept.
hi
freinds,
i am new in java can any one give the example which explain the how to use jdbc with swing.
thanks in advace.
satish
thanks.See here > http://support.apple.com/kb/HT4236
More info in the User Guides for your Devices... -
Can anybody suggest me as how to use Tomcat with MySQL server.
Thanks in advance.
Khiz_engadd the classpath to the JDBC-driver to the tomcat-
environment (I did it in tomcat.sh)
Then put your code accessing MySQL into a servlet....
You can put the user-ID and the password into a session-
object or read them in as parameters.
The book 'core Servlets and Java Server Pages' from
Marty Hall gave me a lot information.
Regards
Fredy -
How to use XPath with Namespaces in the xml ?
Hi all,
I need to reference a certain Node in a Document using XPath notation.
The problem is the the XML Document contains Namespaces inside it
f.e.
<xn:SubNetwork id="JRANM">
<xn:VsDataContainer id="1">
<xn:vsDataType>vsDataAreas</xn:vsDataType>
</xn:VsDataContainer>
</xn:SubNetwork >Using DOMXPath (from weblogic.xml.xpath)
DOMXPath xPath = new DOMXPath("xn:SubNetwork/*");
Set nodeset = xPath.evaluateAsNodeset(this.xmlRootElement);When I Iterate through the Set I can see it's empty.
(On the other hand without namespaces everything is fine.)
So how can I reference a Node that contains a namespace in it ?
Thanks a lot
FrancescoWe use the following class to perform XPath Queries on our XmlBean objects.
Hope this helps,
Craig
import java.util.Set;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.apache.xmlbeans.XmlException;
import org.w3c.dom.Document;
import weblogic.xml.util.StringInputStream;
import weblogic.xml.xpath.DOMXPath;
* Class to encapsulate API specific (i.e. weblogic) XML functions
public class XmlUtil {
* Returns a set containing objects of type reflected in the query.<br/>
* e.g.<br/>
* /saur:tree/saur:treeNode[@label='My Reports']<br/>
* Returns a Set of TreeNode objects<br/>
* Sample Code: <br/>
* <code>
* Set set = XmlUtil.executeXPathQuery( myQuery, tree.xmlText());
* for( Iterator iter = set.iterator(); iter.hasNext();) {
* TreeNode node = TreeNode.Factory.parse((Node)iter.next());
* // Do whatever...
* </code>
* @param query
* @param xml
* @return
public static Set executeXPathSetQuery( String query, String xml) throws XmlException {
try {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
DocumentBuilder builder = factory.newDocumentBuilder();
StringInputStream in = new StringInputStream(xml);
Document doc = builder.parse(in);
DOMXPath xQuery = new DOMXPath(query);
return xQuery.evaluateAsNodeset(doc);
catch(Exception x) {
throw new XmlException("Error running XPath query", x);
} -
How to use XML with SQLServer2000 without IIS?
I don't want to use IIS
so,is there any WEBServer that can take the place of IIS?select * from sysobjects where name='sysobjects' for xml auto
-
Hi
I have to parse a xml file with 2 namespaces.
The file looks like as follows
<AA xmlns="http://XX.com/provider/C/D/E/F/2010/">
<BB xmlns="">
<Id>262</Id>
<Time>2011-03-10T13:55:00.000-06:00</Time>
<Indicator>true</Indicator>
</BB>
</AA>
i tried following 3 methods to parse this xml file but failed
PROCEDURE LOAD_XML
IS
l_clob := ' <<Above XML Content Here >>';
lv_root CONSTANT VARCHAR2(1000) := '/AA/BB'; /* Tried lv_root CONSTANT VARCHAR2(1000) := 'AA/BB' with all the three methods */
/* Method 1 */ lv_namespace constant varchar2(1000) := 'xmlns="http://XX.com/provider/C/D/E/F/2010/"';
/* Method 2 */ lv_namespace constant varchar2(1000) := 'xmlns="http://XX.com/provider/C/D/E/F/2010/" xmlns=""';
/*Method 3 */ lv_namespace constant varchar2(1000) := 'xmlns="http://XX.com/provider/C/D/E/F/2010/"/xmlns=""';
BEGIN
l_parser := dbms_xmlparser.newParser;
BEGIN
dbms_xmlparser.parseClob(l_parser, l_clob);
END;
l_doc := dbms_xmlparser.getDocument(l_parser);
-- Free resources associated with the CLOB and Parser now they are no longer needed.
dbms_xmlparser.freeParser(l_parser);
l_nl := dbms_xslprocessor.selectNodes(dbms_xmldom.makeNode(l_doc),lv_root,lv_namespaces );
FOR cur_rec IN 0 .. dbms_xmldom.getLength(l_nl) - 1 LOOP
l_n := dbms_xmldom.item(l_nl, cur_rec);
lv_rows_inserted_cnt := lv_rows_inserted_cnt + 1;
dbms_output.put_line('I am Here');
lv_rows_processed_cnt := lv_rows_inserted_cnt;
dbms_xmldom.freeDocument(l_doc);
l_clob := null;
dbms_output.put_line(lv_rows_processed_cnt||' Rows Parsed ');
END LOAD_XML ;
Every time zero rows are being parsed and it's not going into the for loop at all.
How to parse these kind of multiple namespaces (Especially default and unassigned namespaces ) ?
Thanks
PramodAs Anton showed, you don't need namespace if you directly access target node with the descendant axis.
However, I guess it's a simplified example so if you need it in a more complex case, this will do it :
DECLARE
l_clob clob := '<AA xmlns="http://XX.com/provider/C/D/E/F/2010/">
<BB xmlns="">
<Id>262</Id>
<Time>2011-03-10T13:55:00.000-06:00</Time>
<Indicator>true</Indicator>
</BB>
</AA>';
lv_root CONSTANT VARCHAR2(1000) := '/ns1:AA/BB/*';
lv_namespaces CONSTANT VARCHAR2(1000) := 'xmlns:ns1="http://XX.com/provider/C/D/E/F/2010/"';
l_parser dbms_xmlparser.Parser := dbms_xmlparser.newParser;
l_doc dbms_xmldom.DOMDocument;
l_nl dbms_xmldom.DOMNodeList;
l_n dbms_xmldom.DOMNode;
lv_rows_inserted_cnt NUMBER := 0;
lv_rows_processed_cnt NUMBER;
BEGIN
dbms_xmlparser.parseClob(l_parser, l_clob);
l_doc := dbms_xmlparser.getDocument(l_parser);
dbms_xmlparser.freeParser(l_parser);
l_nl := dbms_xslprocessor.selectNodes(dbms_xmldom.makeNode(l_doc), lv_root, lv_namespaces);
FOR cur_rec IN 0 .. dbms_xmldom.getLength(l_nl) - 1
LOOP
l_n := dbms_xmldom.item(l_nl, cur_rec);
lv_rows_inserted_cnt := lv_rows_inserted_cnt + 1;
dbms_output.put_line(dbms_xmldom.getNodeValue(dbms_xmldom.getFirstChild(l_n)));
END LOOP;
lv_rows_processed_cnt := lv_rows_inserted_cnt;
dbms_xmldom.freeDocument(l_doc);
dbms_output.put_line(lv_rows_processed_cnt||' Rows Parsed ');
END;
/If you're on version 10.2 (or +), maybe you'll find easier to use XMLTable instead :
SQL> select *
2 from xmltable(
3 xmlnamespaces('http://XX.com/provider/C/D/E/F/2010/' as "ns1"),
4 '/ns1:AA/BB'
5 passing xmltype('<AA xmlns="http://XX.com/provider/C/D/E/F/2010/">
6 <BB xmlns="">
7 <Id>262</Id>
8 <Time>2011-03-10T13:55:00.000-06:00</Time>
9 <Indicator>true</Indicator>
10 </BB>
11 </AA>')
12 columns id number path 'Id',
13 time timestamp with time zone path 'Time',
14 indicator varchar2(10) path 'Indicator'
15 )
16 ;
ID TIME INDICATOR
262 10/03/11 13:55:00,000000 -06:00 true
Maybe you are looking for
-
Status de notas aprovadas na J1BNFE com log de erro
Pessoal, bom dia. Estamos com um problema na J1BNFE. Estamos emitindo em paralelo. e as notas saem do R/3, vão para o GRC e são aprovadas pela SEFAZ (homologação). No GRC o status delas está OK mas no R/3 o status de algumas delas está com a bandeira
-
Photos not loading correctly, distorted colors, lines, etc.
So, my wife's Macbook is having a problem... it will not load pictures correctly in iPhoto or from the Finder. to give you an idea of what the pictures look like, see here: http://photos-h.ak.fbcdn.net/photos-ak-snc1/v1949/149/17/633596272/n633596272
-
Online Meet-up 6. How does RFID infrastructure figure as a part of ESA ?
ESA is a technology similar to RFID as a technology. For Ex: If a company does not have an SAP system at this moment. We have to work with their legacy system. Then we need to use the ESA. With the ESA, it will be easier to work with any system.ESA i
-
So I got CF10 installed on my server next to xampp, when I launch the installer and get to this screen: http://puu.sh/1uAB4 Then when I click "ADD" and go to xampp conf folder etc. I get this message: http://puu.sh/1uADv And then click OK, I get the
-
Hi Gurus One of my Colleague developed a query and wrote a formula in that query and the table is s903, where can i drill down to see this formula he wrote in sq01..sq04 so that i can tampered it with some changes Thanks in advanced regards PI