Accessing multiple xml elements with same name
I am having trouble with an xsl stylesheet. This is what one of the rows of my output xml document looks like
<Row>
<Num>1</Num>
<Valuation>Val</Valuation>
<COMBCHARFLAG>Y</COMBCHARFLAG>
<CCCOUNT>2</CCCOUNT>
<CCDESC>CHARDESC1</CCDESC>
<CCDESC>CHARDESC2</CCDESC>
</Row>
Does anyone know how I can access the 2nd CCDESC ("CHARDESC2") . When i run this in the workbench I can only ever access the first CCDESC, it acts like the 2nd isn't there. However I was also using a 3rd party xsl editor called "XMLSpy" to look for other possible solutions and when i render it with XMLSpy, everything is displaying correctly. Is this some sort of limitation of the workbench? Any help would be much appreciated. Thanks
This is the template i am calling in my xsl.......
<xsl:template name="for.loop">
<xsl:param name="i" />
<xsl:param name="count" />
<!--begin_: Line_by_Line_Output -->
<xsl:if test="$i <= $count">
<tr>
<td align="center"><xsl:value-of select="CCDESC[position()=$i]"/>
</td>
<td align="center">
<input style="width:110px;" class="Mfieldv-M" name="txtValuation"></input>
</td>
</tr>
</xsl:if>
<!begin_: RepeatTheLoopUntilFinished>
<xsl:if test="$i <= $count">
<xsl:call-template name="for.loop">
<xsl:with-param name="i">
<xsl:value-of select="$i + 1"/>
</xsl:with-param>
<xsl:with-param name="count">
<xsl:value-of select="$count"/>
</xsl:with-param>
</xsl:call-template>
</xsl:if>
I than call the template as follows from within my <xsl:for-each select="Row"> statement
<xsl:call-template name="for.loop">
<xsl:with-param name="i">1</xsl:with-param>
<xsl:with-param name="count"><xsl:value-of select="CCCOUNT"/></xsl:with-param>
</xsl:call-template>
Muzammil,
Thanks for the response. I may have explained my situation a little poorly. I am not trying to access the 2nd CCDESC within the workbench via a repeater or such. It is after the XSL renders the page that I don't see the second CCDESC. When the XSL renders the page through Internet explorer i get something that looks like the following......
Res # 1
CHARDESC1
When I render it in the application XMLSpy it shows both CCDESC's like follows.
Res # 1
CHARDESC1
CHARDESC2
In XMLSpy if i change the line of xsl code from <td align="center"><xsl:value-of select="CCDESC[position()=$i]"/> to <td align="center"><xsl:value-of select="CCDESC[2]"/> the page is rendered in XMLSpy with both labels the same as follows.
Res # 1
CHARDESC2
CHARDESC2
If i do that same change in the workbench and render the page through IE I get no label results....
Res # 1
Thanks
Similar Messages
-
Can i have xml elements with same name but one is having attrbt..?
Hi all,
I am suppose to take input from one system into BPEL.That system is auto gererating xml file. But that file is strange. It has two xml element with
same name but with completely different sequence. First one is having two comlexTypes while second is having 5 simple types.
Now the difference is First element is having attribute while second is not.
So is that file is correct.?
thanks a lot.
/mishitcan you post the file? or load the file into JDeveloper and check the syntax or use XMLSpy for validation of the XML.
-
JMS Queue XML: Elements with same name
Hi
I notice that ODI does not do a good job of reverse-engineering JMS queue models where an element name is referenced in different parts of the schema.
For example:
root
..body
...consignment
....load
.....event
....unload
.....event
etc
In the above, ODI will reverse-engineer the 'event' element under 'load', but not the one under 'unload'.
I don't have control over the xsd models and was therefore wondering if there is some sort of workaround I can perform in this scenario?
CheersActually, I just found the following Oracle note sums this up: 757642.1
Is it possible to use the SAME ELEMENT as a SUB-ELEMENT in multiple DIFFERENT Elements of an XML File?
If so, what is the impact of this approach on the reverse engineered Model and Datastores and how can Integration Interfaces be set up to map these identical ELEMENT for which the content is semantically different and as a result to be used differently in different Oracle Data Integrator (ODI) Integration Interfaces.
The following XML is a simple example in which the ITEM Element is logically set as a sub-element to three other XML Elements:
•Shoppinglist
•GroceryStore
•HardwareStore
<Shoppinglist>
<Item>ShoppingList</Item>
<GroceryStore>
<Item>Eggs</Item>
<Item>Milk</Item>
<Item>Bread</Item>
</GroceryStore>
<HardwareStore>
<Item>Screwdriver</Item>
<Item>Hammer</Item>
<Item>Nails</Item>
</HardwareStore>
</Shoppinglist>Solution
Such an approach must be avoided. This is a strict limitation of the ODI XML Driver.
See Bug:8563428 DUPLICATE SUBELEMENTS WITH DIFFERETNT TYPES ARE NOT SUPPORTED BY XML DRIVER -
Append XML elements with same name in an XML document
Hi,
I am using Oracle9i XMLDB utilities to modify an XML document stored in the database. I have a sample XML document like this in the database:
<Person>
<Address ID="1"> </Address>
</Person>
My task is to include a second <Address> element with a different attribute so that my XML document will become
<Person>
<Address ID="1"> </Address>
<Address ID="2"> </Address>
</Person>
After creating the second element, I am using the function xmldom.appendChild() or xmldom.insertBefore() but they remove the first <Address> element and replace it with the second one. This is not what I want since I want both <Address> elements to be present.
Could anyone please advise.
Thanks.
A. DennisPlease post your question [url http://forums.oracle.com/forums/forum.jsp?forum=154]here for quick response.
thank you.
Regards,
Anupama
[url http://otn.oracle.com/sample_code/]OTN Sample Code -
Writing schema for multiple elements with same name with diff. content
following is the XML file,
<?xml version="1.0" encoding="utf-8"?>
<e-abstract xmlns="http://www.citicorp.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="Deed.xsd">
<deed>
<deed_type>
<deedtyp name="Quit Claim" value="Q" />
<deedtyp name="sheriff's deed" value="Sheriff" />
<deedtyp name="Warranty" value="W" />
</deed_type>
<deed>
</e-abstract>
--- end----
in this I have 3 elements of deedtyp , how i can write them in .xsd file as these elements have same name?Please help, if u have idea about this...
i have written .xsd up to deed_type,
----Deed.xsd----
<? xml version="1.0" encoding="UTF-8" ?>
<xs:schema xmlns:xs="http://www.citicorp/2001/XMLSchema"
targetNamespace="http://www.citicorp.com"
xmlns="http://www.citicorp.com"
elementFormDefault="qualified">
<xs:element name="deed_type" type="string" use="required"/>
<xs:simpleType name="string">
<xs:restriction base="xs:string">
</xs:restriction>
</xs:simpleType>
</xs:schema>I don't know the exact and complete specification of your intended schema...
anyway, from what I can see in your post, I assume that
<deed>
<deed_type>
<name>Quit Claim</name>
<value>Sheriff</name>
</deed_type>
<deed_type>
<name>sheriff's deed</name>
<value>Sheriff</value>
</deed_type>
<deed_type>
<name>Warranty</name>
<value>W</name>
</deed_type>
</deed>would be the "proper" way to go...
which makes your "deed_type" a complexType, including a sequence of two kinds of xs:string elements : "name" and "value" -
Passing multiple URL parameters with same name
Hi,
I have a question which is not entirely related to Java. But although its related HTTP calls, so I thought I might get some ideas here.
Background:
I am making HTTP URL call from SAP ABAP code. Its pretty much similar to Java (creating URL connection, setting HTTP headers, connecting, receiving response and everything)
For example,
http://service_server:8080/a7/extension.services.SearchRequirements.a7x?RequestStatus=CR&RequestStatus=RR
Now, this service_server runs a query to database where it uses both these values of "RequestStatus" to form 'OR' condition for a field.
Issue:
When I run this URL from browser, it shows XML response containing results for both values. In short, this is the ideal response.
(I am using getParameterValues(string) at service_server to read multiple values for same parameter)
But when I see response in SAP system, I see that it is returning data for only one value of 'RequestStatus'.
I checked the logs of service_server, and I see that it has received only one parameter, not two.
Question:
It seems like SAP systems web server is truncating both parameters with same name and passing just one of them to outside server(??)
Is there any configuration at Web Server side or any HTTP headers to be set so as to avoid this?
Can anybody suggest something on this?I managed to resolve this issue by using HTTP 'Post' method to send the data.
CALL METHOD CL_HTTP_CLIENT=>CREATE_BY_URL
EXPORTING
URL = L_URL
IMPORTING
CLIENT = L_HTTP_CLIENT
EXCEPTIONS
ARGUMENT_NOT_FOUND = 1
PLUGIN_NOT_ACTIVE = 2
INTERNAL_ERROR = 3
OTHERS = 4 .
"STEP-2 : AUTHENTICATE HTTP CLIENT
CALL METHOD L_HTTP_CLIENT->AUTHENTICATE
EXPORTING
USERNAME = 'name'
PASSWORD = 'password'.
"STEP-3 : SET HTTP HEADERS
CALL METHOD L_HTTP_CLIENT->REQUEST->SET_HEADER_FIELD
EXPORTING NAME = 'Accept'
VALUE = 'text/xml'.
CALL METHOD L_HTTP_CLIENT->REQUEST->SET_HEADER_FIELD
EXPORTING NAME = '~request_method'
VALUE = 'POST' .
CALL METHOD L_HTTP_CLIENT->REQUEST->SET_CONTENT_TYPE
EXPORTING CONTENT_TYPE = 'application/x-www-form-urlencoded' .
"SETTING REQUEST DATA FOR 'POST' METHOD
IF L_PARAMS_STRING IS NOT INITIAL.
CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
EXPORTING
TEXT = L_PARAMS_STRING
IMPORTING
BUFFER = L_PARAMS_XSTRING
EXCEPTIONS
FAILED = 1
OTHERS = 2.
CALL METHOD L_HTTP_CLIENT->REQUEST->SET_DATA
EXPORTING DATA = L_PARAMS_XSTRING .
ENDIF.
"STEP-4 : SEND HTTP REQUEST
CALL METHOD L_HTTP_CLIENT->SEND
EXCEPTIONS
HTTP_COMMUNICATION_FAILURE = 1
HTTP_INVALID_STATE = 2.
"STEP-5 : GET HTTP RESPONSE
CALL METHOD L_HTTP_CLIENT->RECEIVE
EXCEPTIONS
HTTP_COMMUNICATION_FAILURE = 1
HTTP_INVALID_STATE = 2
HTTP_PROCESSING_FAILED = 3.
"STEP-6 : READ RESPONSE DATA
CALL METHOD L_HTTP_CLIENT->RESPONSE->GET_CDATA
RECEIVING DATA = L_RESULT .
"STEP-7 : CLOSE CONNECTION
CALL METHOD L_HTTP_CLIENT->CLOSE
EXCEPTIONS
HTTP_INVALID_STATE = 1
OTHERS = 2 .
{code} -
Getting multiple XML elements with UCCX 4
I am trying to pick up multiple elements with identical tags from an XML file.
(Example)
<NAME1>
<PHONE>123-1234-3456</PHONE>
<PHONE>506-245-5566</PHONE>
</NAME1>
I am able to pick up the first PHONE, but when using a second Get XML step I get the same again. How do we traverse the file without actually numbering the tags?
(Thought I did this before, but maybe not...)
regards
JohnnyHi Johnny,
Did you ever find a solution? I'm running into the same scenario.
Thanks!
Mike -
Concatenate elements with same name in sequence
version 9.2
I have a clob column containing xml - unregistered
Some of the old xml has multiple <notes> elements and the new xml has one <notes> element. I have made a view that successfully extracts the xml from the column and it works great, but when I have multiple <notes> elements the view fails since I am using extractvalue(). I need to select the <notes> tags concatenated into one column in sequence when I have multiples. I am guessing the sequence should be as they appear in the xml document from top to bottom since there is no sequence attribute. I know how to use xmlsequence and xmltable to get the individual <notes> tags but they are not concatenated. Is there a magic xmlsequence/concatenation function that will do what I want here?
-- old xml
<Accident>
<Case>
<TRACS_Case_Number Value="7777777"/>
<Notes>V-1 AND V-2 N/B TRANSIT RD (ST 78\) SLOWING TO MERGE INTO TRAFFIC. V-3 N/B TRANSIT RD. </Notes>
<Notes>STRIKES V-2 IN REAR AND PUSHES V-2 INTO V-1 STRIKING V-1 IN REAR WITH FRONT OF V-2 . </Notes>
<Notes>NO INJURIES.</Notes>
</Case>
</Accident>-- new xml
<Accident>
<Case>
<TRACS_Case_Number Value="7777777"/>
<Notes>V-1 AND V-2 N/B TRANSIT RD (ST 78) SLOWING TO MERGE INTO TRAFFIC. V-3 N/B TRANSIT RD. STRIKES V-2 IN REAR AND PUSHES V-2 INTO V-1 STRIKING V-1 IN REAR WITH FRONT OF V-2 . NO INJURIES.</Notes>
</Case>
</Accident>I am also trying to register this xml to improve performance. However, when I see things like this in the xml I wonder what will happen when I try to register this xml. The DTD, I have no XSD, currently only supports one <notes> tag. Do I have to clean up all the xml in column to match the current DTD before registering? I could also use a good, EASY, example of how to register a schema.
Thanks...You can use the string aggregation technique to concatenate the Notes element.
sql> WITH xmltable AS
2 (SELECT xmltype('<Accident>
3 <Case>
4 <TRACS_Case_Number Value="7777777"/>
5 <Notes>V-1 AND V-2 N/B TRANSIT RD (ST 78\) SLOWING TO MERGE INTO TRAFFIC. V-3 N/B TRANSIT RD. </Notes>
6 <Notes>STRIKES V-2 IN REAR AND PUSHES V-2 INTO V-1 STRIKING V-1 IN REAR WITH FRONT OF V-2 . </Notes>
7 <Notes>NO INJURIES.</Notes>
8 </Case>
9 </Accident>') xmlcol
10 FROM dual)
11 SELECT SUBSTR(replace(MAX(sys_connect_by_path(notes, ':')),':',' '), 2) Notes
12 FROM
13 (SELECT extractvalue(t.column_value, '/Notes/text()') notes,
14 rownum rn
15 FROM xmltable xt,
16 TABLE(xmlsequence(EXTRACT(xmlcol, 'Accident/Case/Notes'))) t)
17 CONNECT BY PRIOR rn = rn -1 START WITH rn = 1;
NOTES
V-1 AND V-2 N/B TRANSIT RD (ST 78\) SLOWING TO MERGE INTO TRAFFIC. V-3 N/B TRANSIT RD. STRIKES V-2 IN REAR AND PUSHES
G V-1 IN REAR WITH FRONT OF V-2 . NO INJURIES. -
Collecting values from multiple check boxes with same name
Hi,
I have a jsp-page with one form with several check boxes sharing the same
name (but with different values).
Can I collect the values in an array/list or something?
/jsp-beginner and google ain't my friend in this casethis answer not good enough for you?
-
How to get the second element in XML Response with same name
Hi All,
I am struck at this point, I have written a sample HTTP client which sends a request to the HTTP Server. In response to the request made the HTTP Server gives response in the XML format. eg: -
<?xml version="1.0"?>
<parent>
<node1> Value1 </node1>
<node1> Value2 </node1>
<node2> Value3 </node2>
</parent>
In the HTTP Client I am getting the value of node1 using the following statement: -
if (node instanceof Element && "node1".equals(((Element)node).getName()) )
String node1 = node.getStringValue();
System.out.println("Product Code:"+node1);
This is always returning the first node1 value i.e. <node1> Value1 </node1>.
The requirement is, I also need to get the <node1> Value2 </node1> value also. So can anyone tell me hw can I get the <node1> Value2 </node1> value. please tell me the piece of code that I should add to get the <node1> Value2 </node1>.
My Mode is something like this: -
try
Document document = (Document)DocumentHelper.parseText(response);
List<Node> transactionNodeList = document.selectNodes( "//parent" );
for(Node singleNode:transactionNodeList)
for(int i=0,j=0;i< ((Element)singleNode).nodeCount();i++ )
Node node = ((Element)singleNode).node(i);
if (node instanceof Element && "node1".equals(((Element)node).getName()) )
node1= node.getStringValue();
System.out.println("Air Way Bill Number:"+node1);
if (node instanceof Element && "node1".equals(((Element)node).getName()) )
node1= node.getStringValue();
System.out.println("Product Code:"+node1);
Thanks in AdvanceDocumentBuilderFactory factory=DocumentBuilderFactory.newInstance();
DocumentBuilder db=factory.newDocumentBuilder();
Document doc=db.parse(new File(ur xml file"));
Element root=doc.getDocumentElement();
System.out.println("root "+root.getNodeName()); -
Reading the next element with sam name
Hi,
i have xml file which looks like
<Response>
<params>
<param>
<value><array><data><value><string>ok</string></value>
<value><string>41408241257406373</string></value>
</data></array></value>
</param>
</params>
</Response>
I need the value of element string which i am reading now using
<string>ok</string>
using
xmldom.getfirstchild
But problem is how to read the next one as its tag name is also the same?
<string>41408241257406373</string>
thanks,
7Zsorry if I was not clear.
I call soap request and get a XML response
<Response>
<params>
<param>
<value><array><data><value>
<string>ok</string>
</value>
<value>
<string>41408241257406373</string>
</value>
</data></array></value>
</param>
</params>
</Response>
I have already funtion by using dom that read the first tag and work fine.
But for this XML
<string>ok</string> ----string tag
<string>41408241257406373</string> -----string
it is
function gettvalue(p_node dbms_xmldom.domdocument, p_tag in varchar2)
return varchar2
is
t_node dbms_xmldom.domnode;
t_child_node dbms_xmldom.domnode;
begin
t_node := xmldom.item (xmldom.getelementsbytagname(p_node, p_tag), 0);
if xmldom.isnull(t_node)
then
return null;
end if;
t_child_node := xmldom.getfirstchild (t_node);
if xmldom.isnull(t_child_node)
then
return null;
else
return xmldom.getnodevalue(t_child_node);
end if;
end;
it is not reading the second element.
thanks for help.
odie_63 -
Accessing Multiple rows of the same name.
If I have an XML Document which looks like this:
<content nr="1">
<text> Text of the first Content item </text>
<othertext> blahblah </othertext>
<attribute1 foo="bar"/>
</content>
<content nr="2">
<text> Text of the second Content item </text>
<othertext> blahblah </othertext>
<attribute1 foo="bar"/>
</content>
<content nr="3">
<text> Text of the third Content item </text>
<othertext> blahblah </othertext>
<attribute1 foo="bar"/>
</content>
And I want to create a website that automatically displays the contents of <text></text> of all the <content> items, how do I do that? (I dont want to do it manually because it should work independent of how many content items there are)
If I bind
var testData= new Spry.Data.XMLDataSet("testing.xml", "content/text");
and then use
<div spry:region="testData">{testData::text}</div>
I just get the Content of the first item. ("Text of the first Content item").
It seems to be pretty easy to do it right, but I just dont get it.
EDIT: What I forgot: merely using something such as "spry:repeat" wont be enough, because I need to access only a number of these content items (I plan on displaying them over several pages, so I'l just display a few, save the others for the next page)IMHO, the easiest way is to differentiate the records by adding an identifyer to the record e.g.
<content nr="1">
<text> Text of the first Content item </text>
<page>1</page>
<othertext> blahblah </othertext>
<attribute1 foo="bar"/>
</content>
<content nr="2">
<text> Text of the second Content item </text>
<page>1</page>
<othertext> blahblah </othertext>
<attribute1 foo="bar"/>
</content>
<content nr="3">
<text> Text of the third Content item </text>
<page>2</page>
<othertext> blahblah </othertext>
<attribute1 foo="bar"/>
</content>
Then use Spry:repeat with a Spry:test to obtain the records that you want to use.
Another way is to Spry:test the required content numbers
I hope this helps.
Ben -
Multiple Local Users With Same Name
Hi guys, this is the screen saver after i upgraded to Yosemite. I knew wifi have problem, but i'm still okay with it. Another problem that i'm facing now is this!
I don't really understand what's the number meaning behind my username which is the number (7), i've never seen this before. Sometime it will turn to 2, 3, 4, or maybe 5. This problem force me to quit some software because it said i'm using same license with multiple user, but i'm the only one who using this username!
I don't understand what happen with this, i've try to read and change almost everything in the preferences. I've try to google everything too, can anyone help me? I really don't want to format my macbook. I've never register same username even i'm in a office.
Really appreciate if anyone can guide me and tell me what should i do! Thanks!Send Apple feedback. They won't answer, but at least will know there is a problem. If enough people send feedback, it may get the problem solved sooner.
Feedback
I've gotten some relief by renaming it in System Preferences/Sharing and then clicking Edit tab to make sure it is correct there. May not hold. -
"Open with" shows multiple app's with same name; 2 at most are valid
I use Preview as my default JPEG viewer application; when I want to edit I used another application and use "Open With". I have a backup drive mounted and the app's backed up show... that's a nuisance, but acceptable.
However, there are 5 listings for some applications, yet only 2 possible copies (as verified by Spotlight). How can I clean-up the list? Is there a way to tell an app's source (in the menu)?A long shot perhaps, but at the bottom of the Open With submenu you will see "Other...". If you go in there there is a setting for either "All Applications" or a specific application folder to be selected. Have you assigned the latter and does it help?
-
While saving multiple attachments from mail, files with same name are added and not replaced
While saving Multiple Attachments from Mail, existing file with same name are not overwritted but new files are added in the folder.
Bjørn Larsen a écrit:
Hi all
Hope to get some help with Elements Organizer.
I have 12-15 years of digital photos that I now want to import into my newly aquirede Adobe Elements Organizer / Photoshop. Since my Nikon names the files with continous numbers from 0001 to 9999 I have multiple files with the same name although they are not alike at all. My previous software had no problems with that since I keep the photos in separate file folders based on import date. I generally import photos after each event and so name the folder with the date and some event info (e.g. 2014.12.24 - Christmas at grandparents).
That is a common situation, I have the same limitation for files not going over 9999 on my Canons...
Now - when I import my photos into Elements Organizer I get a lot of error messages with "same name exist .....) Hmmmmmmm
Please sate the exact wording of the error message, I have never seen a message stating 'same name exist...' or equivalent; only messages about files already in the catalog. Files already in the catalog mean that some files have the same 'date taken' and file size in Kb.
Any suggestions. I'm using a mac and tried to rename files based on date taken. The mac can do that but it takes ages to go into each folder and run the renaming script there.
I also use a similar folder creation scheme (such a date naming is the default for the downloader). That way I never get a message about duplicates for the same file names.
However - I can't be the first or only person with this problem so I figure that some workaround must be known out there. Maybe the import action can recognize date taken or - well. Thank you very much in advance if you can help me out here.
You can alsways set the downloader to rename the imported files with a unique new name, there are many options in the 'advanced' dialog of the downloader. I don't know about Macs, but I don't thing there is a difference.
Maybe you are looking for
-
Problem in Posting Excise Invoice
Hi, I am posting a Excise Invoice thru J1IEX_P, but while posting the document I am getting a Error as " Balance In Transaction Currency". This error is prevailing is there from long time. Can anybody please suggest some solution over this. Regards,
-
View All Background Jobs with Class A
Hi All, We have around 500 Background jobs scheduled on PRD system (CI and on the rest DI's), Our requirement is how to generate a list with All the backround jobs w.r.t their Job class (Any method /T-code navigation, function etc) so that I can ge
-
Auto-generating word documents from word templates
How would one go about generating a word document based off of a word template (.dot)? For example, I have a simple JSP form which has a field "Last Name". When submitted, the "Last Name" is plugged into a corresponding bookmark in a .dot file. Then
-
Dictionary shortcut doesn't work for me
I found out that we can look up vocabularies on Safari while pressing ControlCommandD. However, I'm unable to bring this feature out no matter how many times I pressed this shortcut.(I even pressed it for 20 sec and nothing happened.) Yes, I have wen
-
Change client in scenarios with SAP business system
Did you ever wonder how you can change the client of a Business System and it's related communication channels in scenarios that make use of SAP systems? One might think that changing the client in the communication channel (sender and/or receiver) i