Removing xml node
Hello,
i am using a scroll panel component with an instance name of
photoScroll on the stage. This scroll panel is linked to an xml
page which contains the names of the thumbnails and the jpgs.
When you click on the thumbnail it loads the corresponding
jpg beside the scroll panel. Also on the stage, there is a button
which moves the timeline along and also removes the scroll panel.
The problem is that the jpg which was loaded remains on the stage.
I can't figure out how to get rid of it. I really need help, i've
been on this for days!
Here is my code (the jpgs are found in the <data> node
of the xml page). "hor" is the button that must remove the scroll
panel and the lingering jpg.
thanks!
stop();
import flash.events.MouseEvent;
import com.afcomponents.scrollpanel.ScrollPanelEvent;
import flash.display.Loader;
import flash.display.LoaderInfo;
import flash.net.URLRequest;
import flash.net.navigateToURL;
photoScroll.addEventListener(ScrollPanelEvent.XML_LOAD_COMPLETE,
loadComplete);
function loadComplete(event:ScrollPanelEvent){
photoScroll.addGenericItemEventListener(MouseEvent.CLICK,
playOnClick);
function playOnClick(event:MouseEvent) {
var imageLoader:Loader = new Loader();
var myRequest:URLRequest = new
URLRequest(event.target.data);
imageLoader.load(myRequest);
addChild(imageLoader);
imageLoader.y = 117;
imageLoader.x = 435;
hor.buttonMode = true;
hor.addEventListener (MouseEvent.CLICK,funchor);
hor.addEventListener (MouseEvent.CLICK,removeScroll);
function funchor (e:MouseEvent):void
gotoAndPlay(currentFrame+1);
addFrameScript (currentFrame+5, skipFrame);
function skipFrame ()
gotoAndPlay (29);
function removeScroll(event:MouseEvent) {
removeChild(photoScroll);
}
Hi,
Actually i have to process multiple purchase orders which is coming from IDOC and when i didn't use the parent node i am getting all the purchase orders and then purchase order header followed with details,
But i need the detials records and purchase order header corresponding to the purchase order, so for that i have define parent node, but at the output i dont require this parent node..
i mean the output shuld look like below by removing parent node.
mt_receiver
HeaderNode
--Field1
--Field2
PurchaseOrder
--Field1
--Field2
PurchaseHeader
--Field1
--Field2
Details
--Field1
--Field2
--Field3
PurchaseOrder
--Field1
--Field2
PurchaseHeader
--Field1
--Field2
Details
--Field1
--Field2
--Field3
i think you understand now..
regards,
sai
Similar Messages
-
Hello,
I'm using J Developer/SOA Suite 11.1.1.6.0 and BPEL 2.0
I am trying to remove datetime nodes from xml, where the datetime value equals a certain value. So far I have the following BPEL code:
<assign name="RemoveEmptyDates">
<extensionAssignOperation>
<bpelx:remove>
<bpelx:target>$GetNewHires_GetWrittenOffersReadyForUpload_OutputVariable.parameters//*[ . instance of xsd:dateTime and xsd:dateTime(.) = xsd:dateTime('0001-01-01T00:00:00')]</bpelx:target>
</bpelx:remove>
</extensionAssignOperation>
</assign>
I have tried multiple variations of the predicate, but I can't seem to figure it out. Right now I am getting an error in J Developer that specifies it is expecting an "]" right after the "//*[." portion of the predicate. Any ideas on this would be greatly appreciated.
ThanksYou can't use spaces.
you have wrong this part of your text:
[ . instance of xsd:dateTime and xsd:dateTime(.) = xsd:dateTime('0001-01-01T00:00:00')]
check it. -
Remove xml node based on value
Hi,
we have to remove elements bases on the value.
for example consider below xml
<htl:room>
<htl:ratePlan>
<htl:freeNights>12</htl:freeNights>
<htl:promoSavings>undefined</htl:promoSavings>
<htl:tax>undefined</htl:tax>
</htl:ratePlan>
<htl:guestAllocation>1,2</htl:guestAllocation>
</htl:room>
We have to remove elements with value undefined and should construct a new xml as below
<htl:room>
<htl:ratePlan>
<htl:freeNights>12</htl:freeNights>
</htl:ratePlan>
<htl:guestAllocation>1,2</htl:guestAllocation>
</htl:room>
please help.
Thanksi assume that loc always corresponds to name. So to find the rows to remain is just a simple group by
with data as(
select 'aaa' name,'a1' loc,10 count from dual union all
select 'aaa','a1',0 from dual union all
select 'bbb','b1',0 from dual union all
select 'ccc','c1',0 from dual union all
select 'dcc','d1',11 from dual union all
select 'dcc','d1',0 from dual )
select
name
, loc
, max(count) cnt
from data
group by
name
, loc
order by
name
, loc
NAME LOC CNT
aaa a1 10
bbb b1 0
ccc c1 0
dcc d1 11to find the other is just a minus
with data as(
select 'aaa' name,'a1' loc,10 count from dual union all
select 'aaa','a1',0 from dual union all
select 'bbb','b1',0 from dual union all
select 'ccc','c1',0 from dual union all
select 'dcc','d1',11 from dual union all
select 'dcc','d1',0 from dual )
select name,loc,count from data
minus
select
name
, loc
, max(count) cnt
from data
group by
name
, loc
order by
name
, loc
NAME LOC COUNT
aaa a1 0
dcc d1 0so a delete would be
delete from data
where
(name,loc,count)
in
(select name,loc,count from data
minus ..regards -
Xml in JTree: how to not collpase JTree node, when renaming XML Node.
Hi.
I'm writing some kind of XML editor. I want to view my XML document in JTree and make user able to edit contents of XML. I made my own TreeModel for JTree, which straight accesses XML DOM, produced by Xerces. Using DOM Events, I made good-looking JTree updates without collapsing JTree on inserting or removing XML nodes.
But there is a problem. I need to produce to user some method of renaming nodes. As I know, there is no way to rename node in w3c DOM. So I create new one with new name and copy all children and attributes to it. But in this way I got a new object of XML Node instead of renamed one. And I need to initiate rebuilding (treeStructureChanged event) of JTree structure. Renamed node collapses. If I use treeNodesChanged event (no rebuilding, just changes string view of JTree node), then when I try to operate with renamed node again, exception will be throwed.
Is there some way to rename nodes in my program without collpasing JTree?
I'am new to Java. Maybe there is a method in Xerces DOM implementation to rename nodes without recreating?
Thanks in advance.I assume that "rename" means to change the element name? Anyway your question seems to be "When I add a node to a JTree, how do I make sure it is expanded?" This is completely concerned with Swing, so it might have been better to post it in the Swing forum, but if it were me I would do this:
1. Copy the XML document into a JTree.
2. Allow the user to edit the document. Don't attempt to keep an XML document or DOM synchronized with the contents of the JTree.
3. On request of the user, copy the JTree back to a new XML document.
This way you can "rename" things to the user's heart's content without having the problem you described. -
How to remove a node from a target xml payload in reciever file channel
i have a scenario where i have to remove a node from my target xml file in receiver file channel and want xml as the output file. I don't want a fixed length file. How to do that in receiver channel? Do we need to use file content conversion for that?
that will result in giving you a fixed file or a separator defined file.
it will not give you an XML file.
In case you want a XML file, instead of using variable substitution, use Dynamic configuration and adapter specific properties.
Some ref:
/people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14
http://help.sap.com/saphelp_nw04/helpdata/en/43/03612cdecc6e76e10000000a422035/frameset.htm -
How to remove a node from a xml
Hi All,
I want to remove a node from my xml output. Can anyone suggest me how to get that? I want to implement this by using the ASSIGN activity.
My sample output is
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsa="http://www.w3.org/2005/08/addressing">
<env:Header>
<wsa:MessageID>urn:4EF1A350677C11E1BFA7794ED76B03EF</wsa:MessageID>
<wsa:ReplyTo>
<wsa:Address>http://www.w3.org/2005/08/addressing/anonymous</wsa:Address>
</wsa:ReplyTo>
</env:Header>
<env:Body>
<SiebelOrderQueryByExample_Output xmlns="http://siebel.com/asi/">
<ListOfOrderInterface xmlns="http://www.siebel.com/xml/Siebel%20Order">
<Orders>
<Id>1-15IXJ</Id>
<AccountId>1-2EE</AccountId>
<OrderNumber>1012-1234</OrderNumber>
<ListOfLineItems>
<LineItems>
<Id>1-15IYN</Id>
<LineNumber>303</LineNumber>
<OrderNumber>1012-1234</OrderNumber>
<OrderHeaderId>1-15IXJ</OrderHeaderId>
</LineItems>
</ListOfLineItems>
</Orders>
</ListOfOrderInterface>
</SiebelOrderQueryByExample_Output>
</env:Body>
</env:Envelope>
I want to delete the <ListOfLineItems>node from the xml above so that my resultant would be,
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsa="http://www.w3.org/2005/08/addressing">
<env:Header>
<wsa:MessageID>urn:4EF1A350677C11E1BFA7794ED76B03EF</wsa:MessageID>
<wsa:ReplyTo>
<wsa:Address>http://www.w3.org/2005/08/addressing/anonymous</wsa:Address>
</wsa:ReplyTo>
</env:Header>
<env:Body>
<SiebelOrderQueryByExample_Output xmlns="http://siebel.com/asi/">
<ListOfOrderInterface xmlns="http://www.siebel.com/xml/Siebel%20Order">
<Orders>
<Id>1-15IXJ</Id>
<AccountId>1-2EE</AccountId>
<OrderNumber>1012-1234</OrderNumber>
</Orders>
</ListOfOrderInterface>
</SiebelOrderQueryByExample_Output>
</env:Body>
</env:Envelope>
Please suggest something Its urgent.
Thanks in Advance.It goes something like this, taken from the above blog entry:
Removing a node from node-list
With the bpelx: extensions in BPEL you are able to insert and update nodes in a node list. A node-list is an XML message that contains a set of records. In this article I use the following example:
<BookList xmlns="http://message.vijfhuizen.com">
<Book>
<title>The Lord Of The Rings</title>
<author>J.R.R. Tolkien</author>
</Book>
<Book>
<title>Harry Potter</title>
<author>J.R.R. Tolkien</author>
</Book>
<Book>
<title>The Hobbit</title>
<author>J.R.R. Tolkien</author>
</Book>
<Book>
<title>Storm; Chronicals of Pandarve</title>
<author>Don Lawrence</author>
</Book>
</BookList>
For creating and updating node lists the bpelx: functions are enough to handle this. But when you want to remove a particular node, you can use the bpelx:remove function. But this function can only remove a node from a particular position. For example removing the second node you code:
<bpel:assign>
<bpelx:remove>
<bpelx:target variable="VarBookList" query="/Booklist/Book[2]" />
</bpelx:append>
</bpel:assign>
It is hard to code the bpelx:remove to create a xpath to dynamicly remove node. You would like to remove the second node based on the xpath:
/Booklist/Book[title="Harry Potter" and author="J.R.R. Tolkien"]
You can add the above xpath in the bpelx:remove, but you are not able to make this dynamically.
There is a solution. The trick is to create a stylesheet that copies the data into a new message, but removing that particular records. Create a stylesheet that does the normal copy of the XML message. Then add a <choose> element in the stylsheet to filter that particular record.
<xsl:template match="/">
<BookList>
<xsl:for-each select="/BookList/Book">
<xsl:choose>
<xsl:when test="title='Harry Potter' and author='J.R.R. Tolkien'"/>
<xsl:otherwise>
<Book>
<title>
<xsl:value-of select="title"/>
</title>
<author>
<xsl:value-of select="author"/>
</author>
</Book>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</BookList>
Now we have a XSL stylesheet that removes a particular record, but this is not variable. This can be done via XSLT parameters.
<xsl:param name="pTitle"/>
<xsl:param name="pAuthor"/>
<xsl:template match="/">
<BookList>
<xsl:for-each select="/BookList/Book">
<xsl:choose>
<xsl:when test="title=$pTitle and author=$pAuthor"/>
<xsl:otherwise>
<Book>
<title>
<xsl:value-of select="title"/>
</title>
<author>
<xsl:value-of select="author"/>
</author>
</Book>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</BookList>
</xsl:template>
Now we are able to use this stylesheet in BPEL. In general BPEL create the following code:
<assign name="Transform">
<bpelx:annotation>
<bpelx:pattern>transformation</bpelx:pattern>
</bpelx:annotation>
<copy>
<from expression="ora:processXSLT('RemoveNode.xsl'
, bpws:getVariableData('Variable_BookList','payload')" />
<to variable="Variable_BookListTemp" part="payload"/>
</copy>
</assign>
But this code does not pass parameters to the stylesheet. The ora:processXSLT() can do this it has an additional parameter in this function:
<assign name="Transform">
<bpelx:annotation>
<bpelx:pattern>transformation</bpelx:pattern>
</bpelx:annotation>
<copy>
<from expression="ora:processXSLT('RemoveNode.xsl'
, bpws:getVariableData('Variable_BookList','payload')" />
, bpws:getVariableData('BPELxslparameters'))"/>
<to variable="Variable_BookListTemp" part="payload"/>
</copy>
</assign>
Now only you have to create the BPELxslparameters variable and assign it with the correct name/value pairs. The structure of the this variable is as follows:
<?xml version="1.0" encoding="windows-1252" ?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="http://schemas.oracle.com/service/bpel/common"
targetNamespace="http://schemas.oracle.com/service/bpel/common"
elementFormDefault="qualified">
<xsd:element name="parameters">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="item" minOccurs="1" maxOccurs="unbounded">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="name" type="xsd:string"/>
<xsd:element name="value" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
Create in BPEL the variable BPELxslparameters and let it point to this strucure:
<process ....
xmlns:common="http://schemas.oracle.com/service/bpel/common"
.../>
<variable name="BPELparameters" element="common:parameters"/>
Now we can in BPEL create an empty XML message, based on this strcuture and assign the values to these parameters and then call the processXSLT function.
<bpelx:assign name="Assign_GenerateEmptyParameterSet">
<copy>
<from>
<parameters xmlns="http://schemas.oracle.com/service/bpel/common">
<item>
<name>pTitle</name>
<value/>
</item>
<item>
<name>pAutor</name>
<value/>
</item>
</parameters>
</from>
<to variable="BPELparameters" query="/common:parameters"/>
</copy>
</bpelx:assign>
<assign name="Assign_setXSLTParameters">
<copy>
<from expression="'Harry Potter'"/>
<to variable="BPELparameters" query="/common:parameters/common:item[1]/common:value"/>
</copy>
<copy>
<from expression="'J.R.R. Tolkien'"/>
<to variable="BPELparameters" query="/common:parameters/common:item[1]/common:value"/>
</copy>
</assign>
Posted by Marc Kelderman SOA Blog at 1/16/2008 09:20:00 PM -
Removing header node in xml file
Hi Experts,
Actually i want to remove the parentnode tag from the resultant output, do we have any java code to remove such xml nodes.
mt_receiver
HeaderNode
--Field1
--Field2
ParentNode
PurchaseOrder
--Field1
--Field2
PurchaseHeader
--Field1
--Field2
Details
--Field1
--Field2
--Field3
ParentNode
PurchaseOrder
--Field1
--Field2
PurchaseHeader
--Field1
--Field2
Details
--Field1
--Field2
--Field3
regards,
saiHi,
Actually i have to process multiple purchase orders which is coming from IDOC and when i didn't use the parent node i am getting all the purchase orders and then purchase order header followed with details,
But i need the detials records and purchase order header corresponding to the purchase order, so for that i have define parent node, but at the output i dont require this parent node..
i mean the output shuld look like below by removing parent node.
mt_receiver
HeaderNode
--Field1
--Field2
PurchaseOrder
--Field1
--Field2
PurchaseHeader
--Field1
--Field2
Details
--Field1
--Field2
--Field3
PurchaseOrder
--Field1
--Field2
PurchaseHeader
--Field1
--Field2
Details
--Field1
--Field2
--Field3
i think you understand now..
regards,
sai -
How to binding incoming xml node list to the tree control as dataProvider
Recently, I faced into one issue: I want to binding incoming xml node (it's not avaliable at start) list to the tree control as a dataProvider.
Since the incoming xml node list is not avaliable at beginning but I needs to bind it to the tree, so I create one virtual one in the xml, and prepare to remove it before the tree is shown. (ready for the actual node adding). But It did not work.
Please see the presudo-code here:
1. Model layer(CsModel.as)
public class CsModel
[Bindable]
public var treeXML:XML=<nodes><car label="virtualOne" id="1">
</car></nodes>;
(Here, I want to build binding relationship on the <car/> node,
one 'virtual/stub' node is set here with lable="virtualOne".
But this node will be deleted after IdTree
control is created completely.)
[Bindable]
public var treeData:XMLList =new XMLListCollection(treeXML.car);
2. view layer(treePage.mxml)
private var _model:CsModel = new CsModel();
private function addNode():void
var newNode:XML=<car/>;
newNode.@label="newOne";
newNode.@id=1;
_model.treeXML.appendChild(newNode);
private function cleanData():void
delete _model.treeXML.car;
<mx:VBox height="100%" width="100%">
<mx:Button label="AddNode" click="addNode()" />
<mx:Tree id="IdTree" labelField="@label"
creationComplete="cleanData()"
dataProvider="{_model}"/>
</mx:VBox>
3. Top view layer (App.Mxml)
<mx:application>
<treePage />
</mx:application>
For method: cleanData(),It's expected that when the treePage is shown, we first delete the virutalOne to provide one 'clear' tree since we don't want show virtualOne to the user. The virutalOne node just for building the relationship between treeData and treeXML at beginning. But the side effect of this method, I found, is that the relationship between treeXML and treeData was cut off. And this leads to that when I added new node (by click the 'addNode' button) to the xmlXML, the xmlData was not affected at all !
So Is there any other way to solve this issue or bind the incoming xml node list to the xmlListCollection which will be used as Tree control's dataProvider ?If u want to display the name : value then u can do like this
<xsl:eval>this.selectSingleNode("name").nodeName</xsl:eval> : <xsl:value-of select="name" /> -
Getting Error 'Root XML Node nqw not found in island!'
I have upgraded my setup from OBIEE 11.1.1.5.0 to 11.1.1.5.1 and then uploaded a catalog created in older version, 11g itself.
I'm able to run the dashboards and see all reports. They run absolutely fine, show all correct data.
However if I try to edit report or try to open them in Answers module .... from anywhere (Catalog Link/ Edit option below reports in Dashboard) it gives me this error.
" Root XML Node nqw not found in island! "
It's strange. I tried following:
1. doing a Upgrade of catalog by setting up parameter in instanceconfig.xml file
<Catalog>
<UpgradeAndExit>true</UpgradeAndExit>
</Catalog>
and then reverting back to false.
2. Also tried the GUID upgarde by setting parameters in instanceconfig.xml file and NQSConfig.ini file
none helped.
Any help?Hi Naresh,
I hope you have resolved the issue by this time.
In my case, it was related to an invalid filter on the report.
I have removed the filter by updating the report .xml file from Catalog Manager.
Hope this helps other with similar issue.
Thanks,
Ravi -
How to remove target node if source field value is empty SAP PI Mapping
Hello,
how to remove target node if source field value is empty in graphical Mapping.
Like if
MIddle name in source filed is empty, I would like to eliminate target field from out put XML.
Thank you
JohnHi Jhon,
If you want to remove all empty tags and you dont to complicate your message mapping, you can use a XSL, after the message mapping, to remove all the empty tags:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="*[not(@*|*|comment()|processing-instruction())
and normalize-space()='' ]"/>
</xsl:stylesheet>
Regards -
OBIEE Error 'Root XML Node nqw not found in island!'
Hello,
After I altered my Hyperion Essbase structure, my OBIEE Reports don't open.
I increase one generation in my accounts hierachy, and now when I try open my OBIEE reports, I get the follow error:
"Root XML Node nqw not found in island"
Any help?
Thanks,Hi Naresh,
I hope you have resolved the issue by this time.
In my case, it was related to an invalid filter on the report.
I have removed the filter by updating the report .xml file from Catalog Manager.
Hope this helps other with similar issue.
Thanks,
Ravi -
Convertion of XML node to string using Xquery transformation in OSB
How to convert XML node to string using a built in function using Xquery transformation in OSB? In BPEL we have the Xpath extension function ora:getContentAsString() to do the same.
fn:bea-serialize() function converts xml node to string. but it assigns namespace prefix in every xml node during the conversion. So is there any function to remove the namespace prefix from XML node using Xquery built in function?
-
Xsl for removing specific nodes and modifying one node.
Hello,
i have the urgent need to remove specific nodes
and modify one node in my XML.
the xml as input :
<?xml version="1.0" encoding="utf-8"?>
<PLOT>
<REQUEST>
<GET_LAYOUT>
<PROPERTIES>
<MAPNAME name="xxxx" />
</PROPERTIES>
<DATAFRAME id="MAIN">
<LAYERLIST>
<LAYERDEF id="0" visible="false" query="" />
<LAYERDEF id="1" visible="false" query="" />
<LAYERDEF id="2" visible="false" query="" />
<LAYERDEF id="3" visible="false" query="" />
<LAYERDEF id="4" visible="false" query="" />
<LAYERDEF id="5" visible="false" query="" />
<LAYERDEF id="6" visible="false" query="" />
<LAYERDEF id="7" visible="false" query="" />
<LAYERDEF id="8" visible="false" query="" />
<LAYERDEF id="9" visible="false" query="" />
<LAYERDEF id="10" visible="false" query="" />
</LAYERLIST>
<MAPSERVICELIST>
<MAPSERVICEDEF service="BASEMAP" >
<LAYERLIST>
<LAYERDEF id="2" visible="True" query="" />
<LAYERDEF id="1" visible="False" query="" />
</LAYERLIST>
</MAPSERVICEDEF>
<MAPSERVICEDEF service="MAP1">
<LAYERLIST>
<LAYERDEF id="4" visible="True" query="" />
<LAYERDEF id="3" visible="True" query="" />
<LAYERDEF id="2" visible="True" query="" />
<LAYERDEF id="1" visible="False" query="" />
</LAYERLIST>
</MAPSERVICEDEF>
</MAPSERVICELIST>
</DATAFRAME>
</GET_LAYOUT>
</REQUEST>
</PLOT>
what i want to have is:
<?xml version="1.0" encoding="utf-8"?>
<PLOT>
<REQUEST>
<GET_LAYOUT>
<PROPERTIES>
<MAPNAME name="xxxx" />
</PROPERTIES>
<DATAFRAME id="MAIN">
<LAYERLIST>
<LAYERDEF id="6" visible="True" query="" />
<LAYERDEF id="5" visible="True" query="" />
<LAYERDEF id="4" visible="True" query="" />
<LAYERDEF id="3" visible="False" query="" />
<LAYERDEF id="2" visible="True" query="" />
<LAYERDEF id="1" visible="False" query="" />
</LAYERLIST>
<MAPSERVICELIST/>
</DATAFRAME>
</GET_LAYOUT>
</REQUEST>
</PLOT>
as you see, <MAPSERVICELIST/> is empty and <LAYERLIST> contains all <LAYERDEF> of <MAPSERVICEDEF>/<LAYERLIST>
The ones of BASEMAP are kept unchanged but the ones of MAP1 are having a new attribute value for id.
Thanks four your help.
Regards.You can implement very straightforward map in BizTalk like below:
If you are interested in XSLT of this map, I copied below which visual studio gave me when i validated the map:
<?xml version="1.0" encoding="UTF-16"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:var="http://schemas.microsoft.com/BizTalk/2003/var" exclude-result-prefixes="msxsl var" version="1.0">
<xsl:output omit-xml-declaration="yes" method="xml" version="1.0" />
<xsl:template match="/">
<xsl:apply-templates select="/PLOT" />
</xsl:template>
<xsl:template match="/PLOT">
<PLOT>
<REQUEST>
<GET_LAYOUT>
<PROPERTIES>
<MAPNAME>
<xsl:if test="REQUEST/GET_LAYOUT/PROPERTIES/MAPNAME/@name">
<xsl:attribute name="name">
<xsl:value-of select="REQUEST/GET_LAYOUT/PROPERTIES/MAPNAME/@name" />
</xsl:attribute>
</xsl:if>
<xsl:value-of select="REQUEST/GET_LAYOUT/PROPERTIES/MAPNAME/text()" />
</MAPNAME>
<xsl:value-of select="REQUEST/GET_LAYOUT/PROPERTIES/text()" />
</PROPERTIES>
<DATAFRAME>
<xsl:if test="REQUEST/GET_LAYOUT/DATAFRAME/@id">
<xsl:attribute name="id">
<xsl:value-of select="REQUEST/GET_LAYOUT/DATAFRAME/@id" />
</xsl:attribute>
</xsl:if>
<LAYERLIST>
<xsl:for-each select="REQUEST/GET_LAYOUT/DATAFRAME/MAPSERVICELIST/MAPSERVICEDEF">
<xsl:for-each select="LAYERLIST/LAYERDEF">
<LAYERDEF>
<xsl:if test="../../../../LAYERLIST/LAYERDEF/@id">
<xsl:attribute name="id">
<xsl:value-of select="../../../../LAYERLIST/LAYERDEF/@id" />
</xsl:attribute>
</xsl:if>
<xsl:if test="@id">
<xsl:attribute name="id">
<xsl:value-of select="@id" />
</xsl:attribute>
</xsl:if>
<xsl:if test="../../../../LAYERLIST/LAYERDEF/@visible">
<xsl:attribute name="visible">
<xsl:value-of select="../../../../LAYERLIST/LAYERDEF/@visible" />
</xsl:attribute>
</xsl:if>
<xsl:if test="@visible">
<xsl:attribute name="visible">
<xsl:value-of select="@visible" />
</xsl:attribute>
</xsl:if>
<xsl:if test="../../../../LAYERLIST/LAYERDEF/@query">
<xsl:attribute name="query">
<xsl:value-of select="../../../../LAYERLIST/LAYERDEF/@query" />
</xsl:attribute>
</xsl:if>
<xsl:if test="@query">
<xsl:attribute name="query">
<xsl:value-of select="@query" />
</xsl:attribute>
</xsl:if>
</LAYERDEF>
</xsl:for-each>
</xsl:for-each>
<xsl:value-of select="REQUEST/GET_LAYOUT/DATAFRAME/LAYERLIST/text()" />
</LAYERLIST>
<MAPSERVICELIST>
<xsl:text> </xsl:text>
</MAPSERVICELIST>
<xsl:value-of select="REQUEST/GET_LAYOUT/DATAFRAME/text()" />
</DATAFRAME>
<xsl:value-of select="REQUEST/GET_LAYOUT/text()" />
</GET_LAYOUT>
<xsl:value-of select="REQUEST/text()" />
</REQUEST>
</PLOT>
</xsl:template>
</xsl:stylesheet>
You can highlight the issue if you have any specific one.
Please mark it as Answer if this answers your question
Thanks.
Mo
The contents I write here is my personal views, not the view of my employer and anyone else. -
Hi all!
I have a problem about an xml. I have to eliminate redundancy
So from this xml:
<xml1>
<Property>
<Parameters1>
<Param>
<name>A</name>
<prop></prop> <!--this doesn't matter-->
</Param>
<Param>
<name>B</name>
<prop></prop> <!--this doesn't matter-->
</Param>
<Param>
<name>C</name>
<prop></prop> <!--this doesn't matter-->
</Param>
</Parameters1>
<Parameters2>
<Param>
<name>A</name>
<prop></prop> <!--this doesn't matter-->
</Param>
<Param>
<name>C</name>
<prop></prop> <!--this doesn't matter-->
</Param>
<Param>
<name>D</name>
<prop></prop> <!--this doesn't matter-->
</Param>
</Parameters2>
</Property>
</xml1>
I want to obtain this xml:
<xml2>
<Property>
<Parameters1>
<Param>
<name>A</name>
<prop></prop> <!--this doesn't matter-->
</Param>
<Param>
<name>B</name>
<prop></prop> <!--this doesn't matter-->
</Param>
<Param>
<name>C</name>
<prop></prop> <!--this doesn't matter-->
</Param>
</Parameters1>
<Parameters2>
<!--Parameters A and C are missing-->
<Param>
<name>D</name>
<prop></prop> <!--this doesn't matter-->
</Param>
</Parameters2>
</Property>
</xml2>
There are just parameters without repeting.
My code until now is:
private String numeParam;
private Vector elParam = new Vector();
for (int i=0;i<rootlist2.getLength();i++)
Element element2 = (Element)rootlist2.item(i); // rootlist is my doc xml
if (element2.getLocalName()==Property)
NodeList childrenName2 = element2.getChildNodes();
for (j=0;j<childrenName2.getLength();j++)
Element elemm = (Element)childrenName2.item(j);
if ((elemm.getLocalName() == "Parameters1")||(elemm.getLocalName() == "Parameters2"))
NodeList param = elemm.getChildNodes();
for(int y=0;y<param.getLength();y++)
bn=true;
bas=true;
Element childInProperty2 = (Element)param.item(m2); // acesta e de sters
if (childInProperty2.getLocalName() == Param)
NodeList tlist =childInProperty2.getChildNodes();
for (int y = 0;y<tlist.length();y++)
Element childInPUParam2 = (Element)tlist.item(y);
if (childInPUParam2.getLocalName()== "name")
numeParam = childInPUParam2.getTextContent();
bas=false;
if (bas==false)
if (!elParam.contains(numeParam))
elParam.addElement(numeParam);
if (elParam.contains(numeParam))
bn=false;
break;
} end if
} // end for
if (bn==false)
ba = false;
if (bn==false)
System.out.println("C");
ba = false;
elParam.clear();
this is working I a kind of way, but this remove some elements that is not god. I wonder... Is like elParam contains some strings but, after me is imposible.
Thanks allWhy don't you use XPath? Anyway.
-> Get a List of the documents Node
-> Get a List of all children
You have to check each Node:
-> if the node is not null
-> if the node's name is not null
-> if the node's content is not null
-> if the node's name is equals (<name>)
If the Node-Element is found, store it in a Collection (the reference of the node object).
Later you could iterate the collection and remove all Nodes from the Document.
Afterwards you can transfer the document to a xml file.
btw: if you use XPath you have to be sure to use at least Java 1.5
Regards,
Florian -
Im using this line of code
var selectedNode:XML = XML(MyTree.selectedItem);
and i want to remove the selectedNode from the tree... The
only way that I have found to remove the node is to use these lines
of code which seems ridiculous just to remove the node
var parentChildren:XMLList =
XMLList(selectedNode.parent().children());
for (var i:int = 0; i < parentChildren.length(); i++) {
if (parentChildren
.@label == selectedNode.@label) {
delete parentChildren;
The only thing that I have found is to use the XMLNode object
because it has removeNode method... Except I can't use that either
because I get a warning when I try to cast the selectedItem into a
XMLNode.
Does anyone know how to simplify a deletion of a node.First, XMLNode is an object belonging to the old flash xml
style xml stuff,
and is not part of the new e4x XML class. Neither is
XMLDocument. In the new
XML, yo only have XML and XMLList to work with.
As far as delete, it is a bit of a PITA. I am amazed that we
have to use the
top-level object delete, but that is the case.
Now you should be able to just do:
delete selectedNode;
Try that first..However, looking back at my own code I
didn't do this.
Instead, I use this function:
//deletes the currently selected node
private function deleteSelectedNode():void
var nodeToDelete:XML = XML(treeData.selectedItem);
//reference to the
node to delete
var xlcParent:XMLListCollection = new
XMLListCollection(nodeToDelete.parent().children());
//collection of nodes
containing the node to delete
var iIndex:int = xlcParent.getItemIndex(nodeToDelete);
//index of node to
delete in collection
xlcParent.removeItemAt(iIndex); //remove the node
//treeData.invalidateList(); //refresh the tree
}//deleteSelectedNode
Maybe that technique will work for you.
Tracy
Maybe you are looking for
-
Screen refresh problem with Windows 7
Hello all, I've recently begun testing Oracle with Windows 7 on a new HP 2540p notebook computer. I've encountered a very strange issue so far. After logging into Oracle, and Windows switches to Windows Basic theme, I should be taken to the main Navi
-
How do i get to display the lyrics on my iPad i have IOS 6.0.1
Please help is really urgent for me to display the lyrics on the ipad and i cant do it. I have the 6.0.1 IOS
-
help!! i accidentally changed the language setting from english to something unrecognizable. how do i get to language settings again to change it back???
-
How do i go from windows 64b to 32b that is idiot proof?
New here....can anyone help?
-
How do i set what opens when I click on the "+" tab and open a new tab?
I installed some sw for a camcorder and it changed something in FF. Now everytime I open a new tab, I get sent to this page; http://www.somoto.com/441/%7B9149BBF6-F330-44B5-8E1C-F9F70DD50517%7D?s_src=newtab How do I set it to not go anywhere when I o