Using XPath to create nodes
Hi,
Obviously the main use of XPath is to query the state of an XML document... the equivalent to a "select" statement in SQL.
DOM4J has methods that allow you to use XPath as the equivalent to "insert" statements in SQL. You can specify an XPath like "/Hello/World/Value = 3" and apply this XPath to an XML document so that it creates something like this for you:
<Hello>
<World>
<Value>3</Value>
</World>
</Hello>
This is actually very useful for an investment banking application that I'm working on.
The problem with DOM4J is that it doesn't handle attributes or conditionals well. If you specify
/Hello[@name=2]/World = 3
I would expect
<Hello name=2>
<World>3</World>
</Hello>
to be produced. Instead, it produces
<Hello[@name=2]>
<World>3</World>
</Hello>
These are all simple examples. What I'm doing in real life is using XPath to insert nodes into a complicated XML document that already has a lot of structure. I'm only adding one or two elements to big documents.
Is there anything at all like this available in the JDK 1.5 release. I've had a good look, and XPath looks like it's only for queries. Is this correct?
I think this might do what you need...
// Create a dummy XML document
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
InputStream bais = new ByteArrayInputStream("<test><e1/></test>".getBytes());
Document doc = db.parse(bais);
// Define the XPath expression to "select" the parent element in the document
XPath xpath = XPathFactory.newInstance().newXPath();
XPathExpression xpathExpression = xpath.compile("/test/e1");
// Select the parent node (should probably chuck an ex if not present)
Node node = (Node) xpathExpression.evaluate(doc, XPathConstants.NODE);
// Create and append the child element
node.appendChild(doc.createElement("newElement"));
// Convert the Document into a string
ByteArrayOutputStream baos = new ByteArrayOutputStream();
DOMSource source = new DOMSource(doc);
StreamResult result = new StreamResult(baos);
TransformerFactory transformerFactory = TransformerFactory.newInstance();
Transformer transformer = transformerFactory.newTransformer();
transformer.transform(source, result);
// <?xml version="1.0" encoding="UTF-8"?><test><e1><newElement/></e1></test>
System.out.println(baos.toString());
Similar Messages
-
Using XPath to create Document node
Hi, could anyone suggest how to create Document nodes using xpaths with the help of some api (dom4j, JAXP, etc)?
For example:
With xpath="//A/B", I need to produce:
<A>
<B>.. </B>
</A>
XPath is usually used for querying XML document, but now I need to do the reverse.
Thanks.DrClap, thanks for your reply.
Yes, the topic title is a bit misleading. I shouldn't call it "Document" node.
"And you have an XPath expression of a very restricted form which is supposed to describe the structure of that document."
Not really, what I have is a bunch of xpath expressions, each of them describe a element in a xml.
With these xpath expressions, in the end of the day I need to create a xml document with these elements.
For example, if I have
//A/B
//A/C
//A/D
I need to create a xml like this:
<A>
<B> ...</B>
<C>....</C>
<D>.....</D>
</A>
While I could do this in a manual way (creating each element from the root and adding children one by one....), I'm sure dom4j (or other packages) can do this but I couldn't find how. -
Xslt copy-of creates a xml which returns empty while trying to access elements using XPATH
Hi
I am trying to do a copy-of function using the XSLT in jdev. This is what I do
<xsl:param name="appdataDO"/>
<xsl:template match="/">
<ns1:applicationData>
<ns1:applicationId>
<xsl:value-of select="$appdataDO/ns1:applicationData/ns1:applicationId"/>
</ns1:applicationId>
<xsl:copy-of select="/fslo:ExternalapplicationData/fslo:ApplicationsHDRAddInfo">
</xsl:copy-of>
</ns1:applicationData>
</xsl:template>
</xsl:stylesheet>
After this I can see the document created in the process flow as this :
<ns1:applicationData>
<ns1:applicationId>MMMM</ns1:applicationId>
<ns2:ApplicationsHDRAddInfo>
<ns3:genericFromBasePrimitive>iuoui</ns3:genericFromBasePrimitive>
<ns4:EstimatedMarketValue>77</ns4:EstimatedMarketValue>
<ns4:PropertyInsuranceFee>jih</ns4:PropertyInsuranceFee>
<ns4:LoanOriginationFee>hjh</ns4:LoanOriginationFee>
<ns4:RegistrarFee>kkkkk</ns4:RegistrarFee>
<ns4:LoanCashInFee>hjh</ns4:LoanCashInFee>
<ns4:LoanPaidInCashFlag>cddffgd</ns4:LoanPaidInCashFlag>
</ns2:ApplicationsHDRAddInfo>
</ns1:applicationData>
But whenever I am trying to extract any of the output nodes I am getting an empty result. I can copy the whole dataset into similar kind of variable.
But I am unable to get individual elements using XPATH.
I tried using exslt function for node set and xslt 2.0 without avail.
The namespaces might be the culprit here . The test method in the jdev is able to output a result but at runtime the xpath returns empty .
I have created another transform where I try to copy data from the precious dataobject to a simple string in another data object .
This is the test sample source xml for the transform created by jdev while testing with all namespaces, where I try to copy the data in a simple string in another data object.
<applicationData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.oracle.com/bpmpa/fs/ulo/types file:/C:/JDeveloper/NewAPP/Xfrm/xsd/ApplicationData.xsd" xmlns="http://xmlns.oracle.com/bpmpa/fs/ulo/types">
<applicationId>applicationId289</applicationId>
<ApplicationsHDRAddInfo>
<genericFromBasePrimitive xmlns="http://xmlns.oracle.com/bpm/pa/extn/types/BasePrimitive">genericFromBasePrimitive290</genericFromBasePrimitive>
<EstimatedMarketValue xmlns="http://xmlns.oracle.com/bpm/pa/extn/headerCategories/">291</EstimatedMarketValue>
<PropertyInsuranceFee xmlns="http://xmlns.oracle.com/bpm/pa/extn/headerCategories/">PropertyInsuranceFee292</PropertyInsuranceFee>
<LoanOriginationFee xmlns="http://xmlns.oracle.com/bpm/pa/extn/headerCategories/">LoanOriginationFee293</LoanOriginationFee>
<RegistrarFee xmlns="http://xmlns.oracle.com/bpm/pa/extn/headerCategories/">RegistrarFee294</RegistrarFee>
<LoanCashInFee xmlns="http://xmlns.oracle.com/bpm/pa/extn/headerCategories/">LoanCashInFee295</LoanCashInFee>
<LoanPaidInCashFlag xmlns="http://xmlns.oracle.com/bpm/pa/extn/headerCategories/">LoanPaidInCashFlag296</LoanPaidInCashFlag>
</ApplicationsHDRAddInfo>
</applicationData>
And the xslt
<xsl:template match="/">
<ns1:DefaultOutput>
<ns1:attribute1>
<xsl:value-of select="/fslo:applicationData/fslo:ApplicationsHDRAddInfo/custom:LoanOriginationFee"/>
</ns1:attribute1>
</ns1:DefaultOutput>
</xsl:template>
This results in a empty attribute1. Any help will be appreciated .Please delete attributeFormDefault="qualified" elementFormDefault="qualified" from your XSD
Please check the next link:
http://www.oraclefromguatemala.com.gt/?p=34 -
Count multiple nodes in XML using xPath
Hi',
How to count the CUSTSERIAL node in the below XML using xPath.
<missingICCRec>
<MissingField xmlns="http://www.Google.com/MissingFields/v1.0">
<CUSTSERIAL xmlns="http://Google.com/InboundService">23809002RN</CUSTSERIAL>
<CUSTSERIAL xmlns="http://Google.com/InboundService">23809003RN</CUSTSERIAL>
<CUSTSERIAL xmlns="http://Google.com/InboundService">23809004RN</CUSTSERIAL>
</MissingField>
</missingICCRec>
Thanks
YatanYatan,
I created a simple BPEL with assign to count the node. Using ora:countNodes() function is throwing exception but when i tried with count() it works.
XSD seems to be valid. Only you need to have the function as below.
count(bpws:getVariableData('inputVariable','payload','/client:process/client:missingICCRec/client:MissingField/client:CUSTSERIAL'))
XSD Used:
<?xml version="1.0" encoding="UTF-8"?>
<schema attributeFormDefault="unqualified" elementFormDefault="qualified"
targetNamespace="http://xmlns.oracle.com/PIMtoRPASAmendment/BPLENodeCount/BPLENodeCount"
xmlns="http://www.w3.org/2001/XMLSchema">
<element name="process">
<complexType>
<sequence>
<element name="missingICCRec">
<complexType>
<sequence>
<element name="MissingField">
<complexType>
<sequence>
<element name="CUSTSERIAL" maxOccurs="unbounded" type="string"/>
</sequence>
</complexType>
</element>
</sequence>
</complexType>
</element>
</sequence>
</complexType>
</element>
<element name="processResponse">
<complexType>
<sequence>
<element name="result" type="string"/>
</sequence>
</complexType>
</element>
</schema>
This works !!!
Please let me know if this helps.
Thanks,
Vijay -
Hi all,
I am learning XPATH and XQUERY from the Book "Pro T-SQL 2008 Programmer's Guide" written by Michael Coles, (published by apress). I copied the Code Listing 12-8 FOR XML PATH Using XPath Node Tests (listed below) and executed it in my
SQL Server 2012 Management Studio:
--Coles12_8.sql // saved in C:/Documemnts/SQL Server Management Studio
-- Coles Listing 12-8 FOR XML PATH Using XPATH Node Tests
-- Retrieving Name and E-mail Addresses with FOR XML PATH in AdvantureWorks
-- 16 March 2015 0935 AM
USE AdventureWorks;
GO
SELECT
p.NameStyle AS "processing-instruction(nameStyle)",
p.BusinessEntityID AS "Person/@ID",
p.ModifiedDate AS "comment()",
pp.PhoneNumber AS "test()",
FirstName AS "Person/Name/First",
MiddleName AS "Person/Name/Middle",
LastName AS "Person/Name/Last",
EmailAddress AS "Person/Email"
FROM Person.Person p
INNER JOIN Person.EmailAddress e
ON p.BusinessEntityID = e.BusinessEntityID
INNER JOIN Person.PersonPhone pp
ON p.BusinessEntityID = pp.BusinessEntityID
FOR XML PATH;
I got the following error message:
Msg 6850, Level 16, State 1, Line 2
Column name 'test()' contains an invalid XML identifier as required by FOR XML; '('(0x0028) is the first character at fault.
I have no ideas why I got this error message. Please kindly help and advise me how to resolve this error.
Thanks in advance, Scott ChangHi Michelle, Thanks for your nice response.
I corrected the mistake and executed the revised code. It worked nicely.
I just have one question to ask you about the appearance of the xml output of my Co;les12_8.sql:
<row>
<?nameStyle 0?>
<Person ID="1" />
<!--2003-02-08T00:00:00-->697-555-0142<Person><Name><First>Ken</First><Middle>J</Middle><Last>Sánchez</Last></Name><Email>[email protected]</Email></Person></row>
<row>
<?nameStyle 0?>
<Person ID="2" />
<!--2002-02-24T00:00:00-->819-555-0175<Person><Name><First>Terri</First><Middle>Lee</Middle><Last>Duffy</Last></Name><Email>[email protected]</Email></Person></row>
<row>
<?nameStyle 0?>
<Person ID="3" />
<!--2001-12-05T00:00:00-->212-555-0187<Person><Name><First>Roberto</First><Last>Tamburello</Last></Name><Email>[email protected]</Email></Person></row>
<row>
<?nameStyle 0?>
<Person ID="4" />
<!--2001-12-29T00:00:00-->612-555-0100<Person><Name><First>Rob</First><Last>Walters</Last></Name><Email>[email protected]</Email></Person></row>
<row>
<?nameStyle 0?>
<Person ID="5" />
<!--2002-01-30T00:00:00-->849-555-0139<Person><Name><First>Gail</First><Middle>A</Middle><Last>Erickson</Last></Name><Email>[email protected]</Email></Person></row>
<row>
<?nameStyle 0?>
<Person ID="6" />
<!--2002-02-17T00:00:00-->122-555-0189<Person><Name><First>Jossef</First><Middle>H</Middle><Last>Goldberg</Last></Name><Email>[email protected]</Email></Person></row>
<row>
<?nameStyle 0?>
<Person ID="7" />
<!--2003-03-05T00:00:00-->181-555-0156<Person><Name><First>Dylan</First><Middle>A</Middle><Last>Miller</Last></Name><Email>[email protected]</Email></Person></row>
<row>
<?nameStyle 0?>
<Person ID="8" />
<!--2003-01-23T00:00:00-->815-555-0138<Person><Name><First>Diane</First><Middle>L</Middle><Last>Margheim</Last></Name><Email>[email protected]</Email></Person></row>
<row>
<?nameStyle 0?>
<Person ID="9" />
<!--2003-02-10T00:00:00-->185-555-0186<Person><Name><First>Gigi</First><Middle>N</Middle><Last>Matthew</Last></Name><Email>[email protected]</Email></Person></row>
<row>
<?nameStyle 0?>
<Person ID="10" />
<!--2003-05-28T00:00:00-->330-555-2568<Person><Name><First>Michael</First><Last>Raheem</Last></Name><Email>[email protected]</Email></Person></row>
<row>
<?nameStyle 0?>
<Person ID="11" />
<!--2004-12-29T00:00:00-->719-555-0181<Person><Name><First>Ovidiu</First><Middle>V</Middle><Last>Cracium</Last></Name><Email>[email protected]</Email></Person></row>
<row>
I feel this xml output is not like the regular xml output. Do you know why it is diffrent from the regular xml xml output? Please comment on this matter.
Thanks,
Scott Chang
What do you mean by regular xml document? Are you referring to fact that its missing a root element? if yes it can be added as below
USE AdventureWorks;
GO
SELECT
p.NameStyle AS "processing-instruction(nameStyle)",
p.BusinessEntityID AS "Person/@ID",
p.ModifiedDate AS "comment()",
pp.PhoneNumber AS "text()",
FirstName AS "Person/Name/First",
MiddleName AS "Person/Name/Middle",
LastName AS "Person/Name/Last",
EmailAddress AS "Person/Email"
FROM Person.Person p
INNER JOIN Person.EmailAddress e
ON p.BusinessEntityID = e.BusinessEntityID
INNER JOIN Person.PersonPhone pp
ON p.BusinessEntityID = pp.BusinessEntityID
FOR XML PATH('ElementName'),ROOT('RootName');
replace ElementName and RootName with whatever name you need to set for element as well as the root element
Please Mark This As Answer if it solved your issue
Please Vote This As Helpful if it helps to solve your issue
Visakh
My Wiki User Page
My MSDN Page
My Personal Blog
My Facebook Page -
How to extract node value by using xpath in orchestration shape
i want extract the node value by using xpath in expression shape in orch, then assign to variable.
then decide shape in if branch im using check condition based nodevalue .
str = xpath(Message_3, ("string(/*[local-name()='Root' and namespace-uri()='http://BizTalk_Server_ProjectRNd2.Schema3']/*[local-name()='no' and namespace-uri()=''])"));
but i got below error:
xlang/s engine event log entry: Uncaught exception (see the 'inner exception' below) has suspended an instance of service 'BizTalk_Server_ProjectRNd2.BizTalk_Orchestration1(f3c581d3-049f-8a8a-9316-fc1235b03f99)'.
The service instance will remain suspended until administratively resumed or terminated.
If resumed the instance will continue from its last persisted state and may re-throw the same unexpected exception.
InstanceId: 020779be-713d-408c-9ff4-fd1462c2e52c
Shape name: Expression_1
ShapeId: b865a3e1-7ebe-410d-9f60-8ad2139ad234
Exception thrown from: segment 1, progress 10
Inner exception: There is an error in the XML document.
Exception type: InvalidOperationException
Source: System.Xml
Target Site: System.Object Deserialize(System.Xml.XmlReader, System.String, System.Xml.Serialization.XmlDeserializationEvents)
The following is a stack trace that identifies the location where the exception occured
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
at Microsoft.XLANGs.Core.Part.XPathLoad(Part sourcePart, String xpath, Type dstType)
at BizTalk_Server_ProjectRNd2.BizTalk_Orchestration1.segment1(StopConditions stopOn)
at Microsoft.XLANGs.Core.SegmentScheduler.RunASegment(Segment s, StopConditions stopCond, Exception& exp)
Additional error information:
<no xmlns=''> was not expected.
Exception type: InvalidOperationException
Source: System.Xml
Target Site: System.Object Read_string()
The following is a stack trace that identifies the location where the exception occured
at System.Xml.Serialization.XmlSerializationPrimitiveReader.Read_string()
at System.Xml.Serialization.XmlSerializer.DeserializePrimitive(XmlReader xmlReader, XmlDeserializationEvents events)
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)Hi,
as per your code i got below error
Uncaught exception (see the 'inner exception' below) has suspended an instance of service 'BizTalk_Server_ProjectRNd2.BizTalk_Orchestration1(f3c581d3-049f-8a8a-9316-fc1235b03f99)'.
The service instance will remain suspended until administratively resumed or terminated.
If resumed the instance will continue from its last persisted state and may re-throw the same unexpected exception.
InstanceId: f5fffb05-e6d6-4765-83da-4e6c9696dd8a
Shape name: Expression_1
ShapeId: b865a3e1-7ebe-410d-9f60-8ad2139ad234
Exception thrown from: segment 1, progress 10
Inner exception: There is an error in the XML document.
Exception type: InvalidOperationException
Source: System.Xml
Target Site: System.Object Deserialize(System.Xml.XmlReader, System.String, System.Xml.Serialization.XmlDeserializationEvents)
The following is a stack trace that identifies the location where the exception occured
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializat
this is my schema:
<?xml version="1.0" encoding="utf-16"
?>
<xs:schema xmlns="http://BizTalk_Server_ProjectRNd2.Schema3" xmlns:b="http://schemas.microsoft.com/BizTalk/2003"
xmlns:ns0="https://BizTalk_Server_ProjectRNd2.PropertySchema" targetNamespace="http://BizTalk_Server_ProjectRNd2.Schema3" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:annotation>
<xs:appinfo>
<b:imports>
<b:namespace
prefix="ns0" uri="https://BizTalk_Server_ProjectRNd2.PropertySchema" location=".\PropertySchema.xsd"
/>
</b:imports>
</xs:appinfo>
</xs:annotation>
<xs:element name="Root">
<xs:annotation>
<xs:appinfo>
<b:properties>
<b:property
name="ns0:no" xpath="/*[local-name()='Root' and namespace-uri()='http://BizTalk_Server_ProjectRNd2.Schema3']/*[local-name()='no' and namespace-uri()='']"
/>
</b:properties>
</xs:appinfo>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element
name="no" type="xs:string" />
<xs:element
name="name" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema> -
Extract Node Values using XPATH
This may be a repeat question.
No offence meant
I am using XPATH to extract values from the nodes.
I need to extract the value of i:RequestedBy Node using XPATH
<?xml version="1.0" encoding="UTF-8"?>
<i:Interest>
<i:Status>0</i:Status>
<i:Generation>2</i:Generation>
<i:Details xsi:type="i:vanilla.details.stock">
<i:RequestedBy>AA.MM</i:RequestedBy>
The above XML is of type Document
Document msgDoc;
XPath xpath = XPathFactory.newInstance().newXPath();
XPathExpression expr;
Object result=null;
try {
expr = xpath.compile("i:Interest/i:Details/i:RequestedBy/text()");
result = expr.evaluate(msgDoc, XPathConstants.NODESET);
NodeList nodes = (NodeList) result;
for (int i = 0; i < nodes.getLength(); i++) {
System.out.println(nodes.item(i).getNodeValue());
} catch (XPathExpressionException e1) {
e1.printStackTrace();
I am getting null/
Is my XPATH correct?I don't know if your XPath is correct or not. Your XML is not well-formed because the namespace declarations are missing. And I don't see where you set the namespace context for your XPath object; that is quite likely why it doesn't do what you want.
-
Can i use DLL file created by Fortran with the call libary function node
Can i use a DLL created by Fortran (Compaq Visual Fortran) with the call library function node in labview. If yes how do i create the DLL file if i have the Fortran code.
ThanksYes! Maybe these old post will help:
http://forums.ni.com/ni/board/message?board.id=170&message.id=88786
http://forums.ni.com/ni/board/message?board.id=170&message.id=109150
Good luck!
Message Edited by altenbach on 03-21-2006 02:35 PM
LabVIEW Champion . Do more with less code and in less time . -
Need to Set Node Attribute using XPath
Hi,
I have an XMLType coloum, I Need to Set/Update/Remove Root Node Attribute using XPath query.
Regards,
RajeshHere you go:
Node nameNode =
(Node) XPathFactory.newInstance().newXPath().evaluate(
"/root/name", doc, XPathConstants.NODE);
nameNode.setTextContent("bob"); -
Hi,
I wanted to know if an XML Document created in the Database using xPaths. I mean, I don't want to creat any XML file on the OS in the first place. I want to create an XML using a table containing xPaths. Can this be done in XDB ?
Thanks in Advance,
PiyushHi Piyush
I don't see how you can create a XML document via xpath!?!? xpath it's only used to reference data in an XML document...
Chris -
Hello,
I want to creat XML document using Dom and XPath, as per my knowledge goes I can't create it using XPath {I may b wrong, if I am then pls tell me know :-) }.
If there doesn't exists any thing like this I am thinkin of wrapping a class {say its XPathProcesserDom} which takes the XPath querry and internaly creates XML Document and returns on request. Is this a good idea :-)
waiting for comments :-)....
thanks and regards,
MaheshPujariHi Piyush
I don't see how you can create a XML document via xpath!?!? xpath it's only used to reference data in an XML document...
Chris -
Using RMAN to create single instance standby from 2 node rac
Any advice on the RMAN command to take a non catalog full rman backup from a two node 11gr2 rac node and use it to create the STANDBY single instance.
The RAC two node instance is in ASM (Linux)
The Physical Standby is Normal File System (Linux)
The command that I get from Metalink suggests:
rman target sys/passwd@primary catalog RMAN/RMAN@RMAN auxiliary sys/passwd
RMAN> run {
allocate auxiliary channel C1 device type disk;
duplicate target database for standby;
When I took the rman backup I did not use catalog. Please suggest how to accomplish the same task without catalog. ThanksListener.ora
SID_LIST_STANDBY_LSNR =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = KEMETRAC.respecti.com)
(SID_NAME = STANDBY)
(ORACLE_HOME = /u02/standby/11.2.0.3/STANDBY)
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /u02/standby/11.2.0.3/STANDBY)
(PROGRAM = extproc)
ADR_BASE_STANDBY = /u02/standby/11.2.0.3
TRACE_LEVEL_STANDBY = OFF
STANDBY_LSNR =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = standby.respecti.com)(PORT = 2012))
LOGGING_STANDBY = OFF
...... Tnsnames.ora
STANDBY.RESPECTI.COM,STANDBY =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = standby.respecti.com)(PORT = 2012))
(CONNECT_DATA =
(SERVICE_NAME = STANDBY.respecti.com)
KEMETRAC1.respecti.com, KEMETRAC1 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = rac1-vip.respecti.com)(PORT = 2012))
(CONNECT_DATA =
(SERVICE_NAME = kemetrac1.respecti.com)
KEMETRAC2.respecti.com, KEMETRAC2 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = rac2-vip.respecti.com)(PORT = 2012))
(CONNECT_DATA =
(SERVICE_NAME = kemetrac2.respecti.com)
# TAF 2 Node RAC
KEMETRAC.respecti.com, KEMETRAC =
(DESCRIPTION =
(ADDRESS_LIST =
(FAILOVER = ON)
(LOAD_BALANCE = ON)
(ADDRESS = (PROTOCOL = TCP)(HOST = rac1-vip.respecti.com)(PORT = 2012))
(ADDRESS = (PROTOCOL = TCP)(HOST = rac2-vip.respecti.com)(PORT = 2012))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = kemetrac.respecti.com)
(FAILOVER_MODE =
(TYPE = SELECT)
(METHOD = BASIC)
(RETRIES = 180)
(DELAY = 5)
The Standby has been started up with nomount.
standby> rman target sys/[email protected] auxiliary sys/pw
Recovery Manager: Release 11.2.0.3.0 - Production on Wed Jan 18 18:16:46 2012
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: KEMETRAC (DBID=1448030790)
connected to auxiliary database: KEMETRAC (not mounted)
RMAN>
RMAN> run {
2> duplicate target database for standby from active database dorecover nofilenamecheck;}
Starting Duplicate Db at 18-JAN-12
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 01/18/2012 18:23:06
RMAN-05501: aborting duplication of target database
RMAN-06217: not connected to auxiliary database with a net service name
RMAN> -
Use XPath to select one of the node??
Can I use xpath to draw <param-value>/mnt/VISL/stats/stats/clarent2</param-value>
only?
I have tried to use ApplyXPath sample, but
I don't know what xpath value I should use?
I tried /doc/servlet/init-param/param-value
but it certainly draw other tag with the same name
Pls help!!!
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<servlet>
<servlet-name>
gen_daily
</servlet-name>
<servlet-class>
gen_daily
</servlet-class>
<init-param>
<param-name>clarent_init_dir</param-name>
<param-value>/mnt/VISL/stats/stats/clarent2</param-value>
</init-param>
<init-param>
<param-name>linefeed_mode</param-name>
<param-value>2</param-value>
</init-param>
</servlet>
<servlet>
<servlet-name>
RequestParamExample
</servlet-name>
<servlet-class>
RequestParamExample
</servlet-class>
</servlet>
<servlet>
<servlet-name>
RequestParamExample2
</servlet-name>
<servlet-class>
RequestParamExample2
</servlet-class>
</servlet>
<!-- Define example application events listeners -->
<!-- Define servlets that are included in the example application -->
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<taglib>
<taglib-uri>
http://java.apache.org/tomcat/examples-taglib
</taglib-uri>
<taglib-location>
/WEB-INF/jsp/example-taglib.tld
</taglib-location>
</taglib>
<resource-ref>
<res-ref-name>mail/session</res-ref-name>
<res-type>javax.mail.Session</res-type>
<res-auth>Container</res-auth>
</resource-ref>
<security-constraint>
<display-name>Example Security Constraint</display-name>
<web-resource-collection>
<web-resource-name>Protected Area</web-resource-name>
<!-- Define the context-relative URL(s) to be protected -->
<url-pattern>/jsp/security/protected/*</url-pattern>
<!-- If you list http methods, only those methods are protected -->
<http-method>DELETE</http-method>
<http-method>GET</http-method>
<http-method>POST</http-method>
<http-method>PUT</http-method>
</web-resource-collection>
<auth-constraint>
<!-- Anyone with one of the listed roles may access this area -->
<role-name>tomcat</role-name>
<role-name>role1</role-name>
</auth-constraint>
</security-constraint>
</web-app>You have to start at the root and go down the XML tree.
Try:
/web-app/servlet/init-param/param-value
Are you trying to use this in xsl?
Kind regards,
Hans. -
How to use Xpath to query elements loaded from different xml docs?
I have a big DBLP XML doc (95mb), to load into the container, i splitted the doc into many small xml docs by the publication types, such as articles, books, inproceedings, etc.
I tried to use xpath query such as
query 'collection()/dblp[article/author]/book[title]'
I got empty answers.
but if i use XQuery such as
query 'let $r:=collection()/dblp,$a :=$r/inproceedings/author
for $l2 in $r/book
where $a and $l2/title
return <result> {$l2}{$a}</result>'
i got answers. However, if i remove {$a} from the return clause, i still got empty answers.
is there any problem with my Xpath query and flwor Xquery?
regards,
xiaoyingHi John,
Following is the procedure i have used to load the xml docs (after the indexes have been created):
private static void loadXmlFiles(File path2DbEnv,String theContainer, File file) throws Throwable {
//Open a container in the db environment
XmlManager theMgr = null;
XmlContainer openedContainer = null;
myDbEnv env;
try {
env = new myDbEnv(path2DbEnv);
theMgr = new XmlManager(env.getEnvironment(), new XmlManagerConfig());
//use node container
theMgr.setDefaultContainerType(XmlContainer.NodeContainer);
try{
openedContainer = theMgr.createContainer(theContainer);
}catch (XmlException e){
//if the container alreay exist, then open it;
openedContainer = theMgr.openContainer(theContainer);
//Get an update context.
XmlUpdateContext updateContext = theMgr.createUpdateContext();
String theFile = file.toString();
String docName=file.getName();
//Get the input stream.
XmlInputStream theStream = theMgr.createLocalFileInputStream(theFile);
System.out.println("Adding " + theFile + " to container " +
theContainer);
// Do the actual put
openedContainer.putDocument(docName, // The document's name
theStream, // The actual document.
updateContext, // The update context
// (required).
null); // XmlDocumentConfig object
System.out.println("done.");
//XmlException extends DatabaseException, which in turn extends Exception.
// Catching Exception catches them all.
} catch (XmlException e){
System.err.println("Error loading files into container " + theContainer);
System.err.println(" Message: " + e.getMessage());
//In the event of an error, we abort the operation
// The database is left in the same state as it was in before
// we started this operation.
throw e;
finally {
cleanup(theMgr, openedContainer);
Unfortunately, i waited for around 20 hours 148mb doc was not loaded; so i gave up.
Could you please give me some suggestions on how to load the large doc efficiently ? thanks.
regards,
xiaoying -
Hey Folks, have a scenario where i need to link my data, i.e one node points to another node, e.g
<data>
<liability id="1">
<value> 10000 </value>
</liability>
<asset id = "2">
<value> 20000 </value>
</asset>
</data>
so take the case above, i have a house which is an asset and i have a mortgage(liability) on that house, now i want to show that in my asset that there is a liability on this asset, so i need to come up with a way to link my asset to a liability, now easiest way in my thinking is just point to the XPath of the liability!! Now problem is this, at the data level that im working at, i know what data node im working on but i dont know its absolute path, in my case the above XML is just a snippet of what im dealing with, there is more hierarchical levels in my document!! Maybe im blind but i couldnt see from the API how to get the XPath of a node?? is there existing API which does this or will i have to go ahead and write something to come up with the XPath!! or does anyone have any other suggestions as to how i would do my link??
The way i see my XML when finished is something like this
<data>
<liability id="1">
<value> 10000 </value>
</liability>
<asset id = "2">
<value> 20000 </value>
<liability> /data/liability[@id='1'] </liability>
</asset>
</data>
any thoughts are welcome,
cheers,
LLA better design would be to make your "id" attribute the key... looking back at your post, it seems that you have done that already. So your XML should just look something like this:<data>
<liability id="1">
<value> 10000 </value>
</liability>
<asset id = "2" liabilityid="1">
<value> 20000 </value>
</asset>
</data>Then when your code needs to match the liability to the asset, you can easily build the XPath to find it. (Of course if there can be more than one liability per asset, you shouldn't use a liabilityid attribute as I did in the example.)
PC²
Maybe you are looking for
-
Error while Filling Up setup table
Hi All, When i try to Fill the Setup table i am getting error message as below Error determining rate: foreign curr. local curr. INR date 25.03.2008 (doc. 11990) Help us, Regards, Hari
-
Indesign CC 64-Bit UI is not displaying correctly
I have just installed Indesign CC 64-bit and I am having trouble getting the UI to display at the correct resolution. It is fuzzy and unclear I have added a screenshot of a comparrison between the proper resolution from the 32-bit version side by si
-
Problem with accordion behaviours
Hi, with the new update, my accordions are not behaving as I set them up initially and I cannot use the new settings to effect any changes. I am aware that they have been updated, etc. I have them all closed initially and even though "Overlap items b
-
I get an error trying to download movie
I got transformers 3 for Xmas. I redeemed the code, but the download fails saying I dont have the "access priveledges to download this movie." I updated itunes, I dont have parental controls that wont let me download movie set, I am on the internet..
-
HI EXPERTS I AM NEW IN FI /CO I AM HAVING SOME DOUBTS IN PREPARATION OF RECCURING DOCUMENT. AND ALSO WICH PURPOSE USING THIS DOCUMENT IN REAL TIME. Edited by: chakri55 on Nov 18, 2011 9:06 AM