IXML - Checking if a specific node exists in XML data
Hi,
I´m reading XML data by using iXML classes. One XML file I´m reading contains header and
item data.
Right now I´m starting with reading the header attributes and then read all nested nodes and their attribute data. That works all fine, but now I had the error, that the XML file wrongly didn´t contain the items.
My XML reading method then ended up in a dump because the node was null:
l_node = l_iterator->get_next( ).
Can anybody give me an advice, how to check at the beginning of reading my xml data, if a specific node (in my case the node for items) exists in the XML data? If not, I want to stop with an error message. I want to check that at the beginning, before reading all element data, to keep my method structured.
Thank you very much!
Hi,
You can create a filter and set that filter to the iterator. If this is done the iterator returns you only the node with a specific node name or node ID.
You can also check the parsing in the following WIKI code gallery
https://wiki.sdn.sap.com/wiki/x/JoDmAQ
Subroutines create_set_filter_attribute and parse_xml_file would be helpful.
Similar Messages
-
How to check if a specific file exist and which exit code to use ?
Hi, First I'm not a scripting guy and I know almost nothing about VB scripting.
I have a deployment of 6 tasks and I want to make sure that step # 2 will not be process if it failed in step #1, and so on for the 6 task.
To do this, i have to run a vb script before installation or uninstalltion on each steps
I'm trying to use a script (not from me) that i have modified for pre-uninstallation of software and also post-installation of the software.
Pre-uninstallation: The script will look if the specified "exe" exist on the server and if so, than it will run the msiuninstall "application_name".
If the uninstallation is successful, the post-installation script will check if the "exe" file exist again on the server, and it shouldn't find it (because it was deleted from the uninstallation), than it will return an exit code of successful
to run the next process.
Here an example:
Step 1: Uninstall "Software#1" with msiuninstall Software#1.exe command
Step 2: Uninstall "Software#2" with msiuninstall Software#2.exe command
Step 3: Install "Software #3"with an .exe extension
Step 4: Re install "Software #2" with an .msi extension
Step 5: Re install "Software #1" with a .msi extension.
Step 6: Send email to confirm the deployment is successful
So i need to validate that step #2 will not process step #3 if it failled on # 2. It need to validate if the file exist before and after.
At the end, Step 6 should send an email to confirm that the 6 steps of the deployment was completed without errors.
Any idea how to do it ?
Many many thanks for all the help !
A desperate guy :)
This is what i have
'This script will look if an .exe file exist for a specific application.
'=============================================================================================
path = WScript.Arguments.Item(0)
set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists(C:\Inetpub\wwwroot\Enterprise\EnterpriseWS\web.config) = true then
exitCode = 0
else
exitCode = 1
End If
Wscript.Quit exitCodeSince you are not a scripting guy here is a very good place to start:
http://technet.microsoft.com/en-us/scriptcenter/dd793612.aspx
¯\_(ツ)_/¯ -
Checking List of Specific Files exists in Folder
Hi all,
Please help and advice
business promises that they drop 10 Different Files with TimeStamp.
1. QHP_Group_Association_Benefit_Periods_20140117104957
2. QHP_Out_Of_Pocket_Limit_20140117110805
10.QHP_Strategy_20140117110230
I have a requirement where I have to start SSIS process Only if all 10 files are available. If any file is missing Dont start any process.
Please help me How to check all files needed are available in a Folder using SSIS?
Thanks
KodiI would perform this task by using a Script Task the System.IO classes. The task would have access to an SSIS variable that was the directory path. The task would get a listing of the files in the directory. Another Boolean package variable would be set
to True if all ten file where present. A conditional expression on the workflow using this Boolean variable would control whether execution continued or not. -
Check whether there is nodes inside a xml node
I am trying a few different way, but i can't get the point,
hope some expert can help me on this.
eg:
<product>
<item>
</item>
</product>
<cfscript>
<!--- after xml parse to xmlElement --->
if (xmlElement.product.item neq ""){
writeOutput(xmlElement.product.item[1]);
But this wont work for me, anyone know how to check whether a
xml node contains child nodes or not?xmlSearch()?
Adam -
How to transform node name in XML data source for SSIS
I have the following xml file; I want to change the node name of Emp.location to Emp_location, Edu.location to Edu_location, Addr.location to Addr_location as it was not supported by SSIS. I have multiple files like that. I am thinking to use SSIS XML
task with XLST file to transform it. Can anybody help it?
Thank you
<?xml version="1.0" encoding="utf-8"?>
<Resumes>
<Resume>
<Name>
<Name.Prefix />
<Name.First>Shai</Name.First>
<Name.Middle />
<Name.Last>Bassli</Name.Last>
<Name.Suffix />
</Name>
<Skills>
I am an experienced and versatile machinist who can operate a range of machinery personally
as well as supervise the work of other machinists. I specialize in diagnostics and precision inspection, have expertise in reading blueprints, and am able to call on strong interpersonal and communication skills to guide the work of other production machinists
whose work I am called upon to inspect.
My degree in mechanical engineering affords me a better theoretical understanding and mathematical
background than many other candidates in the machinist trade.
</Skills>
<Employment>
<Emp.StartDate>2000-06-01Z</Emp.StartDate>
<Emp.EndDate>2002-09-30Z</Emp.EndDate>
<Emp.OrgName>Wingtip Toys</Emp.OrgName>
<Emp.JobTitle>Lead Machinist</Emp.JobTitle>
<Emp.Responsibility>
Supervised work of staff of four machinists. Coordinated all complex assembly and tooling
activities, including production of tricycles and wagons.
Developed parts fabrication from sample parts, drawings and verbal orders.Worked with
ISO9000 implementation.
</Emp.Responsibility>
<Emp.FunctionCategory>Production</Emp.FunctionCategory>
<Emp.IndustryCategory>Manufacturing</Emp.IndustryCategory>
<Emp.Location>
<Location>
<Loc.CountryRegion>US </Loc.CountryRegion>
<Loc.State>MI </Loc.State>
<Loc.City>Saginaw</Loc.City>
</Location>
</Emp.Location>
</Employment>
<Employment>
<Emp.StartDate>1996-11-15Z</Emp.StartDate>
<Emp.EndDate>2000-05-01Z</Emp.EndDate>
<Emp.OrgName>Blue Yonder Airlines</Emp.OrgName>
<Emp.JobTitle>Machinist</Emp.JobTitle>
<Emp.Responsibility>
Repaired and maintained a variety of production and fabrication machine tools.
Set up and operated machines to close tolerances. Used and wrote CNC machine programs.
Trained extensively in computer-aided manufacturing.
</Emp.Responsibility>
<Emp.FunctionCategory>Production</Emp.FunctionCategory>
<Emp.IndustryCategory>Manufacturing</Emp.IndustryCategory>
<Emp.Location>
<Location>
<Loc.CountryRegion>US </Loc.CountryRegion>
<Loc.State>IL </Loc.State>
<Loc.City>Chicago</Loc.City>
</Location>
</Emp.Location>
</Employment>
<Employment>
<Emp.StartDate>1994-06-10Z</Emp.StartDate>
<Emp.EndDate>1996-07-22Z</Emp.EndDate>
<Emp.OrgName>City Power and Light</Emp.OrgName>
<Emp.JobTitle>Assistant Machinist</Emp.JobTitle>
<Emp.Responsibility>
Performed centerless grinding. Received training in manual mill and lathe machines,
as well as micrometers and calipers.
Owned complete toolset.Worked extensive overtime on request.
</Emp.Responsibility>
<Emp.FunctionCategory>Production</Emp.FunctionCategory>
<Emp.IndustryCategory>Manufacturing</Emp.IndustryCategory>
<Emp.Location>
<Location>
<Loc.CountryRegion>US </Loc.CountryRegion>
<Loc.State>IA </Loc.State>
<Loc.City>Des Moines</Loc.City>
</Location>
</Emp.Location>
</Employment>
<Education>
<Edu.Level>Bachelor</Edu.Level>
<Edu.StartDate>1990-09-15Z</Edu.StartDate>
<Edu.EndDate>1994-05-10Z</Edu.EndDate>
<Edu.Degree>Bachelor of Science</Edu.Degree>
<Edu.Major>Mechanical Engineering</Edu.Major>
<Edu.Minor />
<Edu.GPA>3.2</Edu.GPA>
<Edu.GPAScale>4</Edu.GPAScale>
<Edu.School>Midwest State University</Edu.School>
<Edu.Location>
<Location>
<Loc.CountryRegion>US </Loc.CountryRegion>
<Loc.State>IA </Loc.State>
<Loc.City>Ames</Loc.City>
</Location>
</Edu.Location>
</Education>
<Address>
<Addr.Type>Home</Addr.Type>
<Addr.Street>567 3rd Ave</Addr.Street>
<Addr.Location>
<Location>
<Loc.CountryRegion>US </Loc.CountryRegion>
<Loc.State>MI </Loc.State>
<Loc.City>Saginaw</Loc.City>
</Location>
</Addr.Location>
<Addr.PostalCode>53900</Addr.PostalCode>
<Addr.Telephone>
<Telephone>
<Tel.Type>Voice</Tel.Type>
<Tel.IntlCode>1</Tel.IntlCode>
<Tel.AreaCode>276</Tel.AreaCode>
<Tel.Number>555-0114</Tel.Number>
</Telephone>
<Telephone>
<Tel.Type>Fax</Tel.Type>
<Tel.IntlCode>1</Tel.IntlCode>
<Tel.AreaCode>276</Tel.AreaCode>
<Tel.Number>555-0132</Tel.Number>
</Telephone>
</Addr.Telephone>
</Address>
<EMail>[email protected]</EMail>
<WebSite />
</Resume>
</Resumes>See if these posts help: http://blogs.msdn.com/b/mattm/archive/2007/12/15/xml-source-making-things-easier-with-xslt.aspx
http://simonlv.blogspot.ca/2012/08/ssis-step-by-step-6-use-xslt-to.html
Arthur My Blog -
How to check whether a node exist in a Particular Level. (xmltype)
hi,
please help me to check whether a particular node exists in one level.
for eg
I have the following xml
<map>
<entry>
<key>
heading1
</key>
<map>
<entry>
<key> sub1 heading1</key>
<value> sub1 heading1 value </value>
</entry>
<entry>
<key> sub2 heading1 </key>
<value> sub2 heading1 value </value>
</entry>
</map>
</entry>
<entry>
<key>
heading2
</key>
<map>
<entry>
<key> sub1 heading2</key>
<value> sub1 heading2 value </value>
</entry>
<entry>
<key> sub2 heading2 </key>
<value> sub2 heading2 value </value>
</entry>
</map>
</entry>
</map>i need to check how many heading exists in this xml.
I am checking like
i:=1;
l_section := ip_xml.extract('//map/entry');
WHILE l_section.existsnode('entry[' || i|| ']') = 1 LOOP
// extract the key name within entry tag
// print the key name.
i:=i+1;
end loop;but iam getting all the key name like
heading1
sub1 heading1
sub2 heading1
heading2
sub1 heading2
sub2 heading2
I need only heading1 and heading2. how can I check whether a particular node exist in particular level.
first level , second level etc. Please helpbut iam getting all the key nameThat's because you're using a descendant axis : //map/entry
SQL> DECLARE
2
3 ip_xml xmltype := xmltype('<map>
4 <entry>
5 <key>
6 heading1
7 </key>
8 <map>
9 <entry>
10 <key> sub1 heading1</key>
11 <value> sub1 heading1 value </value>
12 </entry>
13 <entry>
14 <key> sub2 heading1 </key>
15 <value> sub2 heading1 value </value>
16 </entry>
17 </map>
18 </entry>
19 <entry>
20 <key>
21 heading2
22 </key>
23 <map>
24 <entry>
25 <key> sub1 heading2</key>
26 <value> sub1 heading2 value </value>
27 </entry>
28 <entry>
29 <key> sub2 heading2 </key>
30 <value> sub2 heading2 value </value>
31 </entry>
32 </map>
33 </entry>
34 </map>');
35
36 BEGIN
37
38 for r in (
39 select heading, headno
40 from xmltable( '/map/entry/key'
41 passing ip_xml
42 columns heading varchar2(30) path '.'
43 , headno for ordinality )
44 )
45 loop
46 dbms_output.put_line('Heading '||r.headno||' = '||r.heading);
47 end loop
48 ;
49
50 END;
51 /
Heading 1 =
heading1
Heading 2 =
heading2
PL/SQL procedure successfully completed -
Call subtemplate if the corresponding node exists in the XML
Hi,
I have a requirement to call the sub template if the corresponding exists in the XML file. For example if the invoice node and the corresponding details are present in the XML file then i have to call the invoice sub template. Can any one suggest me how to check if the node exists or not in the XML file. Is there any specific command for this.
ThanksHi,
Thanks a lot..it is working now as per ur suggestions..but am facing another problem here. Am calling the sub template from a main template. Headers and footers for both main and sub templates are different. So for calling the sub template i did section break (Insert -->Break , In section break-->New page) so that the header and footer of the main template wll not be repeated in the sub template. So in the new page am checking if the node exists or not the XML. If so then call the XML. If the node exists then sub template is called successfully. But if the node does not exists then a blank page is displayed for this since the call stmt is in the new page.
So can you please suggest me how to suppress the blank page if the node does not exist.
Thanks. -
Xml search for specific node/attribute
Hi,
I load an xml in as3 and need to find and output (as an
XMLList) a specific node with a specific attribute (example:
<xs:element name="abcd"> ), or at least find out its path
(after, I would know what to do to get the XMLList). I looked at
the XPath classes for Actionscript but the documentation is very
poor and I did not see any method doing this. Could someone help me
please? If no method exists, how can I loop through all the xml and
test each node to see if it is the proper node I am looking for?
thanks so much in advance for your help
PierrotYou could do it this way, using the descendant accessor:
var xml:XML =
<data xmlns:xs="
http://www.w3.org/2001/XMLSchema">
<xs:element name="abcd">
<tagA>hjfhsldf</tagA>
<tagB>dummy stuff</tagB>
</xs:element>
<xs:sequence>
<xs:element name="dd">
<tagA>words</tagA>
<tagB>dummy stuff too</tagB>
</xs:element>
</xs:sequence>
</data>;
var xs:Namespace = xml.namespaceDeclarations()[0];
var nodelist:XMLList = xml..xs::element.(@name=="dd");
trace(nodelist)
If you need generic code that accounts for no namespaces, you
can use
something like this:
var xs:Namespace = xml.namespaceDeclarations()[0];
var nodelist:XMLList =
(xs == null || xs == undefined)
? xml..element.(@name=="dd");
: xml..xs::element.(@name=="dd");
trace(nodelist) -
Node exist in a schema in orchestration
How to check in orchestration that a particular node exist in schema or not ?
My orchestration is as follows:
In decide shape,I have to check whether incoming message contains a particular node.
If yes then send to it a error send port otherwise send it to a simple port.
How it can be possible?
PrakashDifferent options, if your field is a promoted property you can use the 'exists' function:
MyPropertySchema.MyProperty exists myMessage
If it's not a promoted property and just a field or distinguished field you can use following:
value = xpath(Message, "string(//*[local-name()='ElementName'])");
You can then do a System.String.IsNullOrEmpty(value) to check if the value is present or not...
Glenn Colpaert - Microsoft Integration MVP - Blog : http://blog.codit.eu -
Is it possible to execute a scheduled job to run on a specific node.
BEGIN
SYS.DBMS_SCHEDULER.CREATE_JOB_CLASS
job_class_name => 'TEST'
,resource_consumer_group => 'DEFAULT_CONSUMER_GROUP'
,service => 'ORCL'
,log_history => 30
,comments => NULL
END;
/ ORCL must exists:
SELECT NAME FROM DBA_SERVICES:
NAME
SYS$BACKGROUND
SYS$USERS
ORCLXDB
ORCL
BEGIN
SYS.DBMS_SCHEDULER.CREATE_JOB
job_name => 'SYS.TEST_JOB'
,start_date => TO_TIMESTAMP_TZ('sysdate','yyyy/mm/dd hh24:mi:ss.ff tzr')
,repeat_interval => NULL
,end_date => NULL
,job_class => 'TEST'
,job_type => 'PLSQL_BLOCK'
,job_action => 'begin null; end;'
,comments => NULL
/ -
Search if a layersets with a specific name exist and execute a function if it is the case
Hello,
How can i write a script that search if a layersets with a specific name exist and execute a function if it is the case?
Some examples?
Many thanks.
Regards.
SebastienThis would check for a LayerSet if a name with DOM code – so it’s fairly slow.
var check = checkForLayersetNamed(app.activeDocument, false, "thisName");
alert (check);
////// function collect all layers //////
function checkForLayersetNamed (theParent, theCheck, theName) {
/* if (!allLayers) {var allLayers = new Array}
else {};*/
for (var m = theParent.layers.length - 1; m >= 0;m--) {
var theLayer = theParent.layers[m];
// apply the function to layersets;
if (theLayer.typename == "ArtLayer") {
// allLayers.push(theLayer)
else {
if (theLayer.name == theName) {theCheck = true};
theCheck = (checkForLayersetNamed(theLayer, theCheck, theName))
// allLayers.push(theLayer);
return theCheck
Below is AM code Paul Riggott posted some time ago in connection with linking Layer Masks.
Re: Automatically re-link layer masks
You could add a check for whether the Layer is a LayerSet, but if the name is the sole distinguishing feature this might work as a basis for your operations.
app.bringToFront();
main();
function main(){
if(!documents.length) return;
linkLayers();
function linkLayers(){
var ref = new ActionReference();
ref.putEnumerated( charIDToTypeID('Dcmn'), charIDToTypeID('Ordn'), charIDToTypeID('Trgt') );
var count = executeActionGet(ref).getInteger(charIDToTypeID('NmbL')) +1;
var Names=[];
try{
activeDocument.backgroundLayer;
var i = 0; }catch(e){ var i = 1; };
for(i;i<count;i++){
if(i == 0) continue;
ref = new ActionReference();
ref.putIndex( charIDToTypeID( 'Lyr ' ), i );
var desc = executeActionGet(ref);
var layerName = desc.getString(charIDToTypeID( 'Nm ' ));
var Id = desc.getInteger(stringIDToTypeID( 'layerID' ));
if(layerName.match(/^<\/Layer group/) ) continue;
/* you could insert your operations in an if clause here */ -
In which transport request an specific object exist.
I know that a way (trx) exists to find in which transport request an specific object exist.
Howewer I forgot which
Could you help meHi Tina,
May be this method can be followed.
1. Go to Tcode SE03
2. SEARCH FOR OBJECTS IN REQUESTS/TASKS and F8
3. Depending on the Object if its a Pgm name or a Function grp or a table etc etc you can inoput the value in the screen
4. Specify if it s Released or in modifiable state.
5. Check outthe lsit of TR's.
Hope this info Helps.
Award points if problem is solved.
Br,
Sri -
How to blick tree view few specific nodes
here i got a code which show how to blink tree view node but i am confuse that how to blink few node.
Answered by:
Avatar of Tamer Oz
20,185
Points
Top 0.5
Tamer Oz
Partner Joined Sep 2009
2
8
17
Tamer Oz's threads
Show activity
Treeview control - How to make a node blink?
Visual Studio Languages
.NET Framework
>
Visual C#
Question
Alert me
Question
Vote as helpful
0
Vote
Hi,
Is there a "elegant" way to make blink a treeview node?
I am thinking to use a timer with the collection of nodes that I want to make the blink effect, and update the icon ...
Friday, November 06, 2009 6:19 PM
Reply
|
Quote
|
Report as abuse
Avatar of Kikeman
Kikeman
R. BOSCH
105 Points
All replies
Question
Vote as helpful
0
Vote
Hi,
You can develop your custom control for this purpose. The logic you mentioned was correct. Here is a sample control that I developed by the logic you mentioned.
public class BlinkingTreeView : TreeView
private Timer t = new Timer();
private List<TreeNode> blinkingNodes = new List<TreeNode>();
public BlinkingTreeView()
t.Interval = 1000;
t.Tick += new EventHandler(t_Tick);
bool isNodeBlinked = false;
void t_Tick(object sender, EventArgs e)
foreach (TreeNode tn in blinkingNodes)
if (isNodeBlinked)
//update Icon
tn.Text = tn.Text.Substring(0, tn.Text.Length - 1);//to test
isNodeBlinked = false;
else
//update Icon
tn.Text = tn.Text + "*";//to test
isNodeBlinked = true;
public void AddBlinkNode(TreeNode n)
blinkingNodes.Add(n);
public void RemoveBlinkNode(TreeNode n)
blinkingNodes.Remove(n);
public void ClearBlinkNodes()
blinkingNodes.Clear();
public List<TreeNode> BlinkingNodes
get { return blinkingNodes; }
public int BlinkInterval
get { return t.Interval; }
set { t.Interval = value; }
public void StartBlinking()
isNodeBlinked = false;
t.Enabled = true;
public void StopBlinking()
t.Enabled = false;
just show me how to use BlinkingTreeView class. i will have tree view which will have few node and few nodes may have few child nodes. now how to achieve by this class BlinkingTreeView and show me how to blink few specific node not all. thanksbetter to come with code. first populate tree view with some dummy node this way
Root
Child1
Child1-sub1
Child1-sub2
Child2
Child2-sub1
Child2-sub2
now blink Child1-sub2 & Child2-sub1. please come with code. thanks -
How to expand a tree at a specific node/item?
Hi,
we have a tree and the nodes/items were binded to context with this code
lo_nd_nvccmp = wd_context->get_child_node( name = wd_this->wdctx_nvccmp ).
lo_nd_tree = lo_nd_nvccmp->get_child_node( name = wd_this->wdctx_tree ).
lo_el_tree = lo_nd_tree->bind_structure( new_item = ls_tree set_initial_elements = abap_false ).
We want that the tree is expanded at a specific node/item?
The structure has the field is_expanded of type WDY_BOOLEAN. I think that if the field of the right structure is 'X' then the tree should expanded. How can we find the right structure in the context and change this field to 'X'?
Code is appreciated.
Thanks, regards
SusanneOh, apparently if you try that call right after you create
the Tree, it will throw a null reference exception. That might
count as a bug in the flex api...
If you create a Tree, and give it's dataProvider some xml
data, and then add it to the stage (addChild), and then you call
expandItem or expandChildrenOf() right after, you will get a null
object exception. You have to wait... for something. I don't know
what.
I even tried calling _tree.invalidateList() before the
expandItem, but it will still throw the error...
I wonder what the Tree needs to wait for? Is this a bug for
Adobe to fix? -
Error when creating a user - IAM-3010183 : An error occurred while checking if a user already exists with the Common Name generated.
in OIM 11g R2
Message was edited by: 2b3c0737-074f-48d0-a760-e24e3ed9a37c
Maybe you are looking for
-
Hi Everyone In the block diagram of the posted VI, thru serial comm, byte #2 is either 00 or 01 (Hex). This byte should dictate which case to execute. If Hex value = 00 executes case #1, If Hex value = 01 executes case #2. If neither, nothing should
-
Do I Need To Install Lenovo Drivers After A Fresh Install Of Windows 7 Pro
I've just installed Windows 7 Pro (with SP1) on a Lenovo ThinkPad Edge and after running the Lenovo System Update utiltiy it doesn't list any drivers that need installing. When I had a look at the Drivers & Downloads section of this website it lists
-
Poor rendering quality of Motion import
I have some simple Motion moves - pans scans and zooms across hi-res (3600x2400px) still images. When these are taken into FCP (v5.0.4), either as an import or as an export from Motion (v2.0.1), I encounter a problem with image quality. This is most
-
I have no sound coming from my iPad unless I plug in external speakers. How can I get sound again. Thanks
-
Good day! I have an error every time I validate the business rules in essbase. This is the error when I validate the Business rules : Unable to run or validate this rule (VSHI1_CopyData) against the following location: Essbase/vincentp.misnet.com.ph/