replacement of xml child
I have trouble replacing child xml inside the XML document (below). In order to change the value of the xml node, do I really need to replace the child or there is a way to change the value of the xml node?
It seems that you try actually just to change the attribute of a node. If so, you can simply get the reference of the attribute and its value, as shown in the attached example.
Tags: NI Software
Similar Questions
-
Duplicate content XML child nodes
Hi all
I received below XML Developer example data and they need to load the data in table in the Oracle (10g) database.
< table >
< lines >
< row >
< CellCount > 3 < / CellCount >
cells <>
Tom John < cell > < / cell >
< cell > [email protected] < / cell >
< cell > 2013 - 08 - 30 12:20:37.0 < / cell >
< / cells >
< / row >
< row >
< CellCount > 3 < / CellCount >
cells <>
< cell > Micky Mouse < / cell >
< cell > [email protected] < / cell >
< cell > 2013 - 08 - 30 12:20:37.0 < / cell >
< / cells >
< / row >
< / rows >
< /table >
But I had the problem because child node which is duplicated name and developer use a tool to generate only and cannot change the tag before sending to me.
How can I do for this case?
Thanks in advance.
Hiko
SELECT name, email, sign_date FROM XMLTable('/Table/Rows/Row/Cells' -- hard-coded XML as unsure where your data comes from PASSING XMLTYPE('
3 John Tom | [email protected] | 2013-08-30 12:20:37.0 | 3 Micky Mouse | [email protected] | 2013-08-30 12:20:37.0 | That should help you get started. XMLTable was part of 10.2.0.1. Are there opportunities to spend at least 10.2.0.5 just to pick up corrections of bugs/new features?
-
XML: contents.replace () destroyed XML elements inside
Hello
I wrote a script XML rule where all the < ul > < li > is mapped to a paragraph style that uses bulleted lists. It is possible that returns occur inside the < li > elements. Before you go through the items and by applying styles with a script rule, I tried to change the return (\r) of returns (\n) cycling through all the < li > with this code:
_node.contents = _node.contents.replace(/\r/g, '\n'); //change all returns inside <usp><li> to newline
But I realized that, when there are other XML elements (for example < em > or < strong >) inside the < li >, these elements have been killed by my call of. replace().
So my question: How can I reach evolution \r's to \n's and keep inside XML structure?
Thanks in advance
Tobias
I did it with this chiseled script - function grep with emphasis on the XML element - executed after that all XML was processed and placed in the document:
// change \r to \n in usp's li's app.findGrepPreferences = NothingEnum.NOTHING; app.changeGrepPreferences = NothingEnum.NOTHING; var _root = _dok.xmlElements[0]; var _nodeList = _root.evaluateXPathExpression("//li"); app.findGrepPreferences.findWhat = "\\r"; app.changeGrepPreferences.changeTo = "\\n"; for ( i = 0; i < _nodeList.length; i++ ) { var _node = _nodeList[i]; if ( _node.contents != "" ) { _node.changeGrep(); } } app.findGrepPreferences = NothingEnum.NOTHING; app.changeGrepPreferences = NothingEnum.NOTHING;
It works perfectly. Any other suggestions?
Thank you
Tobias
-
Dear Indesign scripting,
This script is made of all the tags XML ParagraphStyles.
But he refuses to take the child to the elements. What do I have to use the XPath expression? And how?
function main() { var xes, n, doc, ps, xe; if ( !app.documents.length ) return; doc = app.activeDocument; xes = doc.xmlElements[0].xmlElements; n = xes.length; while ( n-- ) { xe = xes[n]; st = doc.paragraphStyles.itemByName (xe.markupTag.name ); !st.isValid && doc.paragraphStyles.add({name:xe.markupTag.name}); } } main();
The XML code
<Workbook> <Element_A_01> <Element_A_01></Element_A_01> </Element_A_01> <Element_B_02> <Element_B_02></Element_B_02> </Element_B_02> </Workbook>
Greetings from Holland
The code creates two paragraph styles namely Element_A_01 and Element_B_02. These two are created for the immediate child nodes of the workbook node. Now, it seems you are trying to create pstyles for all nodes in the XML document, which in your case would be even these two as Element_A_01 has a child node that is also named Element_A_01 and what is the case for Element_B_02.
If I get your straight stitch then you need to create 4 pstyles if all nodes have different names, but who doesn't. For that you recursively through each node that you receive from the fixed code [n].
The code to be something like this
- main() {} function
- fixed var n, doc, ps, xe;
- If (! app.documents.length) return;
- doc = app.activeDocument;
- fixed = doc.xmlElements [0] .xmlElements; This gives the immediate children nodes of the workbook node, where the length in the next statement 2
- n = xes.length;
- While (n)-{}
- XE = set [n]; Here you need to recursively through the xe node
- The number of child elements of the xe can be obtained as xe.xmlElements.length
- First element can be obtained by xe.xmlElements [0]
- }
- }
- main();
Hope this fixes the problem
-
How can I find and replace the xml tags?
Hi, I am using xml in my workflow and want to be able to remove some tags if they contained particular text.
Here is an example of the xml struct...
< Entry >
< name > DEFAULT < / name >
< such > default < / such >
DEFAULT < address > < / address >
< / Entry >
I use this initial structure to define paragraph styles to follow when you import the xml data.
This leaves DEFAULT in place everywhere where an entry is not any content of this field.
I want to be able to import my XML and then run a script that deletes tags that include by DEFAULT, - I need to the xml tag to remove not only the text, if I do a normal find and replace will remove only the text not the tags that is causing problems with style. I also want to remove the end of para/return (^ p) that I placed at the end of the line. So it would be the same opening editor mode and removing content, tags + hard back in there, but I want to automate the process...
So I think that's what I'm looking for in each case
"< name > DEFAULT < / name > ^ p.
and I want to replace it with nothing.
Is this possible in a script (ideally javascript)?
I have a little knowledge of javascript, but don't know how to search for and target this kind of string in indesign...
using indesign cs5
Thank you very much
Hello
Script should do it in two steps:
1 find all occurrences of that is ' > by DEFAULT.<>
2 delete the whole paragraph which is a found_text container.
For example, in this way - JS - (a textFrame filled your text must be selected):
var mStory = app.selection[0].parentStory; app.findTextPreferences = null; app.findTextPreferences.findWhat = ">DEFAULT<"; var myF = mStory.findText(); var count = myF.length; while (count--) myF[count].paragraphs[0].remove();
Rgds
-
Need to replace a XML tag request in OSB
I have my proxy in OSB service connected to MQ as the supplier of inputs. Now, I want to take a couple of namespaces and copy them into the body and remove the labels.
Here is the entrance to MQ...
-------------------------------------------------------------------------------------------------------------------------------------
< soapenv:Envelope xmlns:soapenv = 'http://schemas.xmlsoap.org/soap/envelope/' xmlns: v = "http://www.w3.org/1999/XSL/Transform" >
< soapenv:Header / >
< soapenv:Body >
< v: createAccount >
< partId > Mnhtd_21 < / partId >
< / v: createAccount >
< / soapenv:Body >
< / soapenv:Envelope >
-------------------------------------------------------------------------------------------------------------------------------------
I want this xml request to be converted in the following xml code before it can be routed to business...
-------------------------------------------------------------------------------------------------------------------------------------
< v: createAccount xmlns: v = "http://www.w3.org/1999/XSL/Transform" >
< partId > Mnhtd_21 < / partId >
< / v: createAccount >
-------------------------------------------------------------------------------------------------------------------------------------
How can I convert in the stream of messages of the Proxy Service?
Help, please.
Thanks in advance!
Published by: 994962 on March 20, 2013 12:10 AMHello
Have you managed to make it work?
Kind regards
Fabio Douek -
the analysis for the XML child nodes
Hello
I have the following XML
' < AllocSimulation >
elements <>
< > 76 ItemNo < / ItemNo >
< DisplayCodes >
< DisplayCode > 1 < / DisplayCode >
< DisplayCode > 2 < / DisplayCode >
< / DisplayCodes >
< / object >
elements <>
< > 767 ItemNo < / ItemNo >
< DisplayCodes >
< DisplayCode > 3 < / DisplayCode >
< DisplayCode > 5 < / DisplayCode >
< / DisplayCodes >
< / object >
< / AllocSimulation > '
How can I extract elements such as
No display item code
76 1.2
767 3.5
I ran the following query
resultSelect * From xmltable('AllocSimulation/items' passing xmltype('<AllocSimulation> <items> <ItemNo>76</ItemNo> <DisplayCodes> <DisplayCode> 1 </DisplayCode> <DisplayCode>2 </DisplayCode> </DisplayCodes> </items> <items> <ItemNo>767</ItemNo> <DisplayCodes> <DisplayCode> 3 </DisplayCode> <DisplayCode>5 </DisplayCode> </DisplayCodes> </items> </AllocSimulation>') columns Item Varchar2(10) Path 'ItemNo', display xmltype path '//DisplayCode');
76 < DisplayCode > 1 < / DisplayCode > < DisplayCode > 2 < / DisplayCode >
767 < DisplayCode > 3 < / DisplayCode > < DisplayCode > 5 < / DisplayCode >Manjusha Muraleedas wrote:
It is one of the solutions... any solution straight forwatd for this?That's the one that I would have suggested too.
Another possibility would be to expand the collection in a subquery using the MULTISET operator, but I prefer the first approach.
To summarize (assuming that the document is stored in the TMP_XML table):
SELECT x.itemno , cast( multiset( select code, min, max from XMLTable('DisplayCodes/DisplayCode' passing x.display columns code varchar2(100) path 'code' , Min number(10) path 'Min' , Max number(10) path 'Max' ) ) as displaycodes_vtt ) as display_collection FROM tmp_xml t , XMLTable('/purchase/items' passing t.object_value columns ItemNo varchar2(30) path 'ItemNo' , display xmltype path 'DisplayCodes' ) x ;
or,
SELECT d.itemno , cast(collect(displaycode(p.code, p.Min, p.Max)) as displaycodes_vtt) as display_collection FROM tmp_xml t , XMLTable('/purchase/items' passing t.object_value columns ItemNo varchar2(30) path 'ItemNo' , display xmltype path 'DisplayCodes' ) d , XMLTable('DisplayCodes/DisplayCode' passing d.display columns code varchar2(100) path 'code' , Min number(10) path 'Min' , Max number(10) path 'Max' ) p GROUP BY d.itemno ;
-
Replace the XML data using AS3
I have a file called temp.xml saved on the localhost (I'm under wamp to test), and it has this in it:
<?xml version="1.0" encoding="utf-8"?> <1> <SAVEDATA pos="1"/> </1>
The idea is, you get to control pos points = "" could be updated. " I can't understand how to actually change it. SAVEDATA is located in < 1 > it is because I wanted to also give somehow a unique ID to each player (there is a system of connection), and when you connect, it checks your ID and continues the game where you left off.
If you use the XML, as I've shown, you can use the following to load and change the attribute of retail:
Load it
var urlLoader:URLLoader = new URLLoader();
urlLoader.addEventListener (Event.COMPLETE, f);
urlLoader.load (new URLRequest ("test2.xml"));
var xml;
function f(e:Event):void {}
XML = XML (e.target.data);
}
editing xml: (for example to change player with id = '3' for pos = '7', use editXMLF (3.7);)
you don't need to change any code above or below except the parameters you pass when you call editXMLF
function editXMLF(playerID:int,_newPOS:int):void {}
XML. Player. (@id == playerID.toString ()). SaveData.@POS = newPOS;
}
-
How to search and replace only tag values XML and tag not the columns?
Hello
I'm new to xml db, and I have a scenario where I need to find and replace the xml content. The search is based on a clear text and not on any column.
I have a table as follows:
ID VARCHAR2 (32 BYTE),
MESSAGE_TYPE, VARCHAR2 (64 BYTE),
XMLTYPE OF the MESSAGE_CONTENT,
REJECTED_REASON VARCHAR2 (256 BYTE)
And XML in the form of the sample:
<? XML version = "1.0" encoding = "US-ASCII"? >
< MessageEnvelope >
< header >
Renault < partner > < / partners >
< MessageType > release < / MessageType >
S74 < PartnerMessageType > < / PartnerMessageType >
< MessageTime > 2001-12-17T 09: 30:47.0Z < / MessageTime >
String of < LinkToRawMessage > < / LinkToRawMessage >
< / header >
< body >
< version >
< address >
< DealerDestAddr > ABCD < / DealerDestAddr >
< DestAddr > ABCD < / DestAddr >
< NextDestAddr / >
< StartAddr / >
< / book >
< assignment / >
< ClientStatus / >
< dates / >
< HoldInfo >
< HoldCode > HoldTest < / HoldCode >
< / HoldInfo >
< message / >
< partner >
< OrderGiverCode > CMR00BCV < / OrderGiverCode >
< / partners >
< ToDo / >
< transport / >
< vehicle >
W0LGDM9A_Ran11115 < WINE > < / WINE >
< / vehicle >
< / Statement >
< / body >
< / MessageEnvelope >
I'm running the query of foll:
UPDATE t_xml D SET D.MESSAGE_CONTENT = replace (D.MESSAGE_CONTENT, "ABCD", "Chennai")
(WHERE d.MESSAGE_CONTENT.existsNode('//*[*="ABCD"]') = 1;
This works very well and replaces the two ABCD < DealerDestAddr > < / DealerDestAddr > and < DestAddr > ABCD < / DestAddr > tag values in Chennai. But the problem I encounter is if there is that a node with the name of the < ABCD > tag is also changed to < Chennai >. Please help me to fix this problem.
Kind regards
SprighteeWhat happens if I need to select and update a node that has the value null. Who doesn't have any value to it.
You can test if the partner has a child text() node:
existsNode( d.message_content , '/MessageEnvelope/Header[not(Partner/text())]' , 'xmlns="http://www.groupecat.com/CLV2/MessageEnvelope/20120501"' ) = 1
-
Just starting to learn more about XML.
I have a simple XML I created which is
Ambient panel1 panel2 panel3 Using the XML property - child results node table of nodes in a table of 9 elements:
#text Probe #text Probe #text Probe #text Probe #text
My question is what are all the #text that are there? Should the child nodes be not just the probes?
It seems to me you may be heading down a dark path. Instead of using the "table of nodes child" and fighting through the unnecessary complications and text nodes, let me suggest you look at XPath and using "get all matched Nodes.vi ' or 'Get first match Node.vi' to get the items. XPath allows parsing XML child's play.
For example:
Of course, I hope that you use XP does not mean you use LV8.6 or earlier since the XPath screws are new to LV9.
If you use LV8.6 or earlier, I suggest looking in the .NET functions to implement XPath. Once you get the hang of it, it still beats the attempt to parse XML the old-fashioned way.
As for the editor, I generate very few XML files by hand, for the most part I bring other programs and analyse them in LV again, XPath adjusts the rough edges.
-
Replace the current XML node with another node in XML fragments
Hello
Please help, trying to replace an XML node with other fragments XML using XML DB, updateXML/deleteXML functions don't receive the desired result, on the front of the image below, this is what I have, and the transom is the replacement with new values XML fragment, I expect to see, there is a list of records from the XML that I need to open and do the replacement of the < broker-retail > according to the number of records to be inserted.
Before the photo:
< Broker-benefits-link >
< hpp-rule > 0 < / hpp-rule >
LISP < in.-CVCA-benefits-type > < / po-CVCA-benefits-type >
< commit / >
<broker-retail >
< broker-entity-not > 1000947836 < / broker-entity-not >
< broker-pct > 100 < / broker-pct >
Y < principal > < / main >
< / broker-retail >
< / Broker-benefits-link >
After photo (expected result):< Broker-benefits-link >
< hpp-rule > 0 < / hpp-rule >
LISP < in.-CVCA-benefits-type > < / po-CVCA-benefits-type >
< commit / >
<broker-retail >
< broker-entity-not > 65656524 < / broker-entity-not >
< broker-pct > 25 < / broker-pct >
N < principal > < / main >
< / broker-retail >
<broker-retail >
< broker-entity-not > 122224444 < / broker-entity-not >
< > 75 broker-pct < / broker-pct >
Y < principal > < / main >
< / broker-retail >
< / Broker-benefits-link >
Kind regards
Qwestion
You can use DELETEXML and INSERTCHILDXML
SQL> set long 10000 SQL> column xmldata_new format a100 SQL> set linesize 150 SQL> SQL> with t 2 as 3 ( 4 select 5 xmltype('
6 ') xmldata from dual 15 ) 16 select xmlserialize 17 ( 18 document 19 insertchildxml 20 ( 21 deletexml 22 ( 23 xmldata 24 , '/broker-benefit-link/broker-detail' 25 ) 26 , '/broker-benefit-link' 27 , 'broker-detail' 28 , xmltype 29 ( 30 '0 7LISP 89 10 141000947836 11100 12Y 1331 ').extract('/broker-master/broker-detail') 42 ) 43 as clob indent size = 2 44 ) xmldata_new 45 from t; XMLDATA_NEW ----------------------------------------------------------------------------------------32 3665656524 3325 34N 3537 41122224444 3875 39Y 400 LISP 65656524 25 N 122224444 75 Y -
Mechanism for Parent LVOOP VI to prevent child Override VI execution
I am working with LVOOP and I my 'controller' represented as an object. The parent class contains the data private to State "under tension" and with a 'process' VI. The 'Process' VI can be replaced by the child object and is required to call the implementation of the parent. So what I would do is check the status "under tension" in the implementation of the 'Process' parent and if the controller is not powered, do not continue execution of implementation of the child.
I want to do in the implementation of the parent so that I do not need to re - write this feature in each child object 'process '.
So, is there a mechanism to dynamically prevent implementation of the child of the 'process' to run without code required on the child of "process"?
The two approaches that come to mind are:
(1) define an error in the parent VI and make sure that the child is not running if there is an error on the wire in error.
(2) that the parent call another dynamic dispatch method that does the actual work, if the power is on. If you do this, there is probably no reason for the external VI (the one who performs the audit power) for dynamic distribution. So you must always only one child VI, it should just be called from a different place. Unfortunately I do not know how you would ensure that it is only called in the parent.
There is no way for the parent to say "immediately returned without executing the following code" - which is essentially what you ask for.
-
IMAQdx attributes listed in the xml file not found in labview
Hello
Some attributes of my camera our watch camera (DALSA CamExpert) software but are not displayed in MAX.
When I opened the xml file, I don't see a difference between the attributes shown and hidden.
Why LabView displays all possible attributes?
The sml file has specific requirements?
Any ideas?
Hello Eric,
I solved the problem yesterday!
I use a DALSA camera. Dalsa software downloads the XML file and saves it in a directory 'dalsa"on my local disk.
National instruments software (MAX) downloaded XML file and saves it in another directory. The 2 files were not equal. I replaced the XML file OR the XML of Dalsa file and now I'm able to get all attributes.
But thanks for your response!
Kind regards
Kim
-
XML file works only with XmlDataModel
Hi all
I'm developing a simple picture viewer using the online service www.imgur.com. It's going to be free and without advertising that allows using the normal API pretty easy. I followed the tutorials on the dev site to send an http request and receive the response. I managed to do all that finding, but I'm stumped trying to apply the http response in my ListView.
The response is an XML file, but with child elements rather than attributes for more information. I tried to get my response working with the tutorial here:
Networking Dev BlackBerry tutorial
more specifically, this part of the code
// Create the data model using the contents of the file. The // location of the file is relative to the assets directory. XmlDataModel *dataModel = new XmlDataModel(); dataModel->setSource(QUrl("file://" + QDir::homePath() + "/model.xml")); // Set the new data model on the list and stop the activity indicator mListView->setDataModel(dataModel);
But I can't work. I read from different people (but not confirmed what whether doc) that the XmlDataModel cannot be used with child element type XML files? If so, can someone point me in the direction of the conversion of an XML attribute type?
The DataSource object can manage lists XML child element, and it manages the query part of network too. It is however quite limited in its ability to manage structures complex multi-level, so it may or may not be suitable for your use. Without an example XML file, I can't say for sure if DataSource would deal with it, but it's probably something worth investigating.
-
When you write an object XML in the file is possible to include the XML? statement
I tried the toXMLString() function, and that doesn't seem to work, I get the contents of the XML file fine but no statement.
So I tried adding it as a literal string (the book object is simple a XML object that contains all the content of the book):
var xmlFile = File(chapterFolder+app.activeDocument.name.replace(".indd","")+".xml"); xmlFile.open('w'); xmlFile.encoding = 'UTF-8'; xmlFile.write("""<?xml version="1.0" encoding="UTF-8"?>"""+"\r"+book.toXMLString()); xmlFile.close();
Is there a property I'm missing that would allow me to have the declaration included automatically?
See you soon,.
Kurtis
Hi Kurtis,
What is an ExtendScript XML object? I am able to do it in one of my scripts and get the statement:
var settingsXML =
; saveSettingsFile (settingsXML); function saveSettingsFile (settingsXML) { var settingsFile = File ($.fileName.replace (/\.jsx(?:bin)?$/i , ".xml")); settingsFile.open ("w"); settingsFile.write ("\r" + settingsXML); settingsFile.close (); }Element text This script give me this result:
Element text -Rick
Maybe you are looking for
-
NB100 no usb not power - how to reset
The NB 100 has 2 usb ports on the right side. I tried plugging in an external cd drive and got a box with red indicator of the background task bar indicating something on the device of drawing too much power and that the supply would be stopped.Since
-
help on history cats and employer with transcripts
OK, so I have a colleague in trouble with his employer on the content of IM Skype chat between 2 employees. However, they all have two been deleted and their chat history, but the employer says that they have a copy of all conversations. 1. I thought
-
fsclm.dll report appears in crashing, the cause of new version
All of a sudden a lot of firefox crashes. Go to the homepage (google) once come search and new sites to explore, someone who may cause the crash. Most firefox must begin new session.
-
My Qosmio stops automatically after some time
Hello. My computer already has in the support center.Since he returned, I have a huge problem.When I play games it stops automatically after a certain time.After some time, I found out why. The temperature of the gpu goes above 90 degrees.* First - I
-
Why can't I see the characters to enter to clear the spam problem
you want type me the character that I see, but their there's not some points going in circles