1/31/2011 4:57:22 AM
Title:
Filter the XML Data with Namespace
I have an urgent requirement of filtering the namespace based xml.
here is my xml
<DTS:Executable xmlns:DTS="www.microsoft.com/SqlServer/Dts" DTS:ExecutableType="MSDTS.Package.1">
<DTS:Property DTS:Name="InitExpression">0</DTS:Property>
<DTS:Property DTS:Name="EvalExpression">1</DTS:Property>
<DTS:Property DTS:Name="AssignExpression">1</DTS:Property>
<DTS:Property DTS:Name="MaxConcurrent">1</DTS:Property>
<DTS:Property DTS:Name="ForceExecValue">0</DTS:Property>
<DTS:Property DTS:Name="ExecValue" DTS:DataType="3">0</DTS:Property>
<DTS:Property DTS:Name="ForceExecutionResult">-1</DTS:Property>
<DTS:Property DTS:Name="Disabled">0</DTS:Property>
<DTS:Property DTS:Name="FailPackageOnFailure">0</DTS:Property>
<DTS:Property DTS:Name="FailParentOnFailure">0</DTS:Property>
<DTS:Property DTS:Name="MaxErrorCount">1</DTS:Property>
<DTS:Property DTS:Name="ISOLevel">1048576</DTS:Property>
<DTS:Property DTS:Name="LocaleID">-1</DTS:Property>
<DTS:Property DTS:Name="TransactionOption">1</DTS:Property>
<DTS:Property DTS:Name="DelayValidation">0</DTS:Property>
</DTS:Executable>
I am loading the xml file through URLLoader and keep the xml values in xmlData
like
xmlData=new XML(urlLoader.data);
after that i am adding the namespace for xmlData
xmlData.addNamespace("DTS");
var DTS:Namespace = xmlData.namespace("DTS");
Now I am able to fetch all child node of Executable element by using following code
trace("creating "+xmlData.children().@DTS::Property);
But my requirement is i need to fetch the data of some nodes,
eg, I need the value of <DTS:Property DTS:Name="MaxConcurrent">1</DTS:Property> by using @name="MaxConcurrent" property. But i don't know how to do filter like that.
If anyone worked one namespace xml file, please let me know how to make filter the namespace XML
FYI: I need similar output
http://www.java2s.com/Code/Flash-Flex-ActionScript/XML/AlistofemployeeswhoseIDnumberis238.htm
(but in this example, they used the xml without namespace)