Parse nested XML

Hi
I wanted to parse and find XML node having specific value. For e.g. in below xml document I wanted to find the UIObject node havign Id= 'UIEnterpirseIDEdit'
Xml structure is fixed but UIObject level might differ. ie. it might be  under node UIobject having id 'UIEnterpirseIDEdit'
how to get element this xml element in C#
Thanks
Varsha
<?xml version="1.0"?>
<UITest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Name="" Id="b267ee5a-a190-4e90-aa2a-ffd0207de69b" AssemblyVersion="11.0.61030.0" Version="1.0" xmlns="http://schemas.microsoft.com/VisualStudio/TeamTest/UITest/2010">
<Configuration>
<Group Name="IE">
<Setting Name="Version" Value="9.11.9600.17501" WarningLevel="1" />
<Setting Name="InformationBar" WarningLevel="1" />
<Setting Name="AutoCompletePassword" WarningLevel="1" />
<Setting Name="AutoCompleteForm" Value="no" WarningLevel="1" />
<Setting Name="DefaultBrowser" Value="IEXPLORE.EXE" WarningLevel="1" />
<Setting Name="PopupBlocker" Value="0" WarningLevel="1" />
<Setting Name="TabbedBrowsing" WarningLevel="2" />
<Setting Name="InternetZoneSecurity" Value="0" WarningLevel="2" />
<Setting Name="IntranetZoneSecurity" Value="69632" WarningLevel="2" />
<Setting Name="TrustedZoneSecurity" Value="70912" WarningLevel="2" />
<Setting Name="RestrictedZoneSecurity" Value="73728" WarningLevel="2" />
<Setting Name="PhishingFilter" WarningLevel="1" />
<Setting Name="EnhancedSecurityConfiguration" Value="0" WarningLevel="1" />
</Group>
<Group Name="OS">
<Setting Name="Name" Value="Microsoft Windows Server 2008 R2 Enterprise " WarningLevel="2" />
<Setting Name="Version" Value="Microsoft Windows NT 6.1.7601 Service Pack 1" WarningLevel="2" />
<Setting Name="IsUserAdmin" Value="True" WarningLevel="2" />
<Setting Name="Is64BitOperatingSystem" Value="True" WarningLevel="2" />
<Setting Name="IsTerminalServerSession" Value="True" WarningLevel="2" />
<Setting Name="OSLanguage" Value="1033" WarningLevel="1" />
<Setting Name="UserLocale" Value="1033" WarningLevel="1" />
<Setting Name="DragFullWindows" Value="False" WarningLevel="2" />
<Setting Name="ScreenResolutionWidth" Value="1280" WarningLevel="2" />
<Setting Name="ScreenResolutionHeight" Value="1024" WarningLevel="2" />
<Setting Name="SystemDPIX" Value="96" WarningLevel="2" />
<Setting Name="SystemDPIY" Value="96" WarningLevel="2" />
<Setting Name="Aero" Value="1" WarningLevel="1" />
<Setting Name="UACEnabled" Value="0" WarningLevel="2" />
<Setting Name="UACPromptEnabled" Value="0" WarningLevel="1" />
</Group>
<Group Name="TechnologyManagers" />
</Configuration>
<InitializeActions />
<CleanupActions />
<OnErrorActions />
<Maps>
<UIMap Id="UIMap">
<TopLevelWindows>
<TopLevelWindow ControlType="Window" Id="UIAUGConnectInternetExWindow" FriendlyName="AUG Connect... - Internet Explorer" SpecialControlType="BrowserWindow" SessionId="853230">
<TechnologyName>MSAA</TechnologyName>
<WindowTitles>
<WindowTitle>AUG Connect...</WindowTitle>
</WindowTitles>
<SearchConfigurations>
<SearchConfiguration>VisibleOnly</SearchConfiguration>
</SearchConfigurations>
<AndCondition Id="SearchCondition">
<PropertyCondition Name="Name">AUG Connect...</PropertyCondition>
<PropertyCondition Name="ClassName">IEFrame</PropertyCondition>
<PropertyCondition Name="ControlType">Window</PropertyCondition>
</AndCondition>
<SupportLevel>0</SupportLevel>
<Descendants>
<UIObject ControlType="Document" Id="UIAUGConnectDocument" FriendlyName="AUG Connect..." SpecialControlType="None">
<TechnologyName>Web</TechnologyName>
<WindowTitles>
<WindowTitle>AUG Connect...</WindowTitle>
</WindowTitles>
<AndCondition Id="SearchCondition">
<AndCondition Id="Primary">
<PropertyCondition Name="ControlType">Document</PropertyCondition>
<PropertyCondition Name="TagName">BODY</PropertyCondition>
<PropertyCondition Name="Id" />
<PropertyCondition Name="RedirectingPage">False</PropertyCondition>
<PropertyCondition Name="FrameDocument">False</PropertyCondition>
</AndCondition>
<FilterCondition Id="Secondary">
<PropertyCondition Name="Title">AUG Connect...</PropertyCondition>
<PropertyCondition Name="AbsolutePath">/aug/</PropertyCondition>
<PropertyCondition Name="PageUrl"></PropertyCondition>
</FilterCondition>
</AndCondition>
<SupportLevel>0</SupportLevel>
<Descendants>
<UIObject ControlType="Edit" Id="UIEnterpriseIdEdit" FriendlyName="Enterprise Id :" SpecialControlType="None">
<TechnologyName>Web</TechnologyName>
<WindowTitles>
<WindowTitle>AUG Connect...</WindowTitle>
</WindowTitles>
<AndCondition Id="SearchCondition">
<AndCondition Id="Primary">
<PropertyCondition Name="ControlType">Edit</PropertyCondition>
<PropertyCondition Name="TagName">INPUT</PropertyCondition>
<PropertyCondition Name="Id">ContentPlaceHolder1_LoginAUG_UserName</PropertyCondition>
<PropertyCondition Name="Name">ctl00$ContentPlaceHolder1$LoginAUG$UserName</PropertyCondition>
</AndCondition>
<FilterCondition Id="Secondary">
<PropertyCondition Name="LabeledBy">Enterprise Id :</PropertyCondition>
<PropertyCondition Name="Type">SINGLELINE</PropertyCondition>
<PropertyCondition Name="Title" />
<PropertyCondition Name="Class" />
<PropertyCondition Name="ControlDefinition">name="ctl00$ContentPlaceHolder1$LoginAUG</PropertyCondition>
<PropertyCondition Name="TagInstance">3</PropertyCondition>
</FilterCondition>
</AndCondition>
<SupportLevel>0</SupportLevel>
<Descendants />
</UIObject>
<UIObject ControlType="Edit" Id="UIPasswordEdit" FriendlyName="Password :" SpecialControlType="None">
<TechnologyName>Web</TechnologyName>
<WindowTitles>
<WindowTitle>AUG Connect...</WindowTitle>
</WindowTitles>
<AndCondition Id="SearchCondition">
<AndCondition Id="Primary">
<PropertyCondition Name="ControlType">Edit</PropertyCondition>
<PropertyCondition Name="TagName">INPUT</PropertyCondition>
<PropertyCondition Name="Id">ContentPlaceHolder1_LoginAUG_Password</PropertyCondition>
<PropertyCondition Name="Name">ctl00$ContentPlaceHolder1$LoginAUG$Password</PropertyCondition>
</AndCondition>
<FilterCondition Id="Secondary">
<PropertyCondition Name="LabeledBy">Password :</PropertyCondition>
<PropertyCondition Name="Type">PASSWORD</PropertyCondition>
<PropertyCondition Name="Title" />
<PropertyCondition Name="Class" />
<PropertyCondition Name="ControlDefinition">name="ctl00$ContentPlaceHolder1$LoginAUG</PropertyCondition>
<PropertyCondition Name="TagInstance">4</PropertyCondition>
</FilterCondition>
</AndCondition>
<SupportLevel>0</SupportLevel>
<Descendants />
</UIObject>
<UIObject ControlType="Button" Id="UICtl00ContentPlaceHolButton" FriendlyName="ctl00$ContentPlaceHolder1$LoginAUG$LoginImageButto..." SpecialControlType="None">
<TechnologyName>Web</TechnologyName>
<WindowTitles>
<WindowTitle>AUG Connect...</WindowTitle>
</WindowTitles>
<AndCondition Id="SearchCondition">
<AndCondition Id="Primary">
<PropertyCondition Name="ControlType">Button</PropertyCondition>
<PropertyCondition Name="TagName">INPUT</PropertyCondition>
<PropertyCondition Name="Id">ContentPlaceHolder1_LoginAUG_LoginImageButton</PropertyCondition>
<PropertyCondition Name="Name">ctl00$ContentPlaceHolder1$LoginAUG$LoginImageButton</PropertyCondition>
</AndCondition>
<FilterCondition Id="Secondary">
<PropertyCondition Name="DisplayText" />
<PropertyCondition Name="Type">image</PropertyCondition>
<PropertyCondition Name="Src"></PropertyCondition>
<PropertyCondition Name="Title" />
<PropertyCondition Name="Class" />
<PropertyCondition Name="ControlDefinition">name="ctl00$ContentPlaceHolder1$LoginAUG</PropertyCondition>
<PropertyCondition Name="TagInstance">5</PropertyCondition>
</FilterCondition>
</AndCondition>
<SupportLevel>0</SupportLevel>
<Descendants />
</UIObject>
</Descendants>
</UIObject>
</Descendants>
</TopLevelWindow>
</TopLevelWindows>
</UIMap>
</Maps>
<ValueMap>
<ParameterList />
</ValueMap>
</UITest>

XmlDocument and XPath should work.
XPath doesn't handle an anonymous namespace, so you'll have to give the namespace a name using a NamespaceManager for this namespace:
xmlns="http://schemas.microsoft.com/VisualStudio/TeamTest/UITest/2010"
lets say you choose the name 'x' for this namespace.  (Any name will do.)
Then use some xpath like this: Beware your typo!
//x:UIObject[@Id='UIEnterpirseIDEdit']
(The typo above is your own -- I cut and pasted it. Also, ID vs Id is case sensitive)
The whole thing might look like this:
(This time I've fixed the typo so that it finds an actual node in your example xml)
XmlDocument doc = new XmlDocument();
doc.Load( "XmlFile1.xml" ); // or however you want to load your XML.
XmlNamespaceManager nsmgr = new XmlNamespaceManager( doc.NameTable );
nsmgr.AddNamespace( "x", "http://schemas.microsoft.com/VisualStudio/TeamTest/UITest/2010" );
XmlNode node = doc.SelectSingleNode( @"//x:UIObject[@Id='UIEnterpriseIdEdit']", nsmgr );
Console.WriteLine( node.OuterXml ); // Example to demonstrate that it works.
Again, be aware that the example node Id you wanted to find has a typo in it.

Similar Messages

  • How to parse nested xml file using dom

    i want to parse nested xml file
    please tell me how to parse nested xml
    for eg.
    <xml>
    <row>
    <name>Rahul<name>
    <row><newXml>
    <newXML>
    <Row>
    <code>12</code>
    </Row>
    <newXML>
    <XML>
    please tell how to parse this file

    Normally if you have no idea about X, the first thing you should do is google "X tutorial". You will find plenty of them out there. And the advantage is, they are better written than whatever we spend two minutes throwing together here. Not to mention that it saves us the two minutes.
    But if you have specific questions with your SAX parser when you get it going, then ask them here. Actually, ask them in the XML forum here, not this one.

  • Which is the best way to parse nested XML

    Hello, I am just getting back into using ColdFusion and I am
    working on a project that needs to parse some XML.
    The XML is generated by a third party document.
    I figured out how to grab individual values and such, but I'm
    not sure what is the best way to grab a value in relation to where
    it is in the XML.
    Following is a rather simplified example of the XML
    I need to grab the value of 'Rich Text' in relation to the
    'ID name' value.
    &lt;project&gt;
    &lt;CT text&gt;
    &lt;Group&gt;
    &lt;id name = text1&gt;
    &lt;Rich Text&gt;some sample text&lt;/Rich
    Text&gt;
    &lt;/id&gt;
    &lt;/Group&gt;
    &lt;/CT Text&gt;
    &lt;CT text&gt;
    &lt;Group&gt;
    &lt;Group&gt;
    &lt;id name = text1&gt;
    &lt;Rich Text&gt;some sample text&lt;/Rich
    Text&gt;
    &lt;/id&gt;
    &lt;/Group&gt;
    &lt;/Group&gt;
    &lt;/CT Text&gt;
    &lt;CT text&gt;
    &lt;id name = text2&gt;
    &lt;Rich Text&gt;some more sample text&lt;/Rich
    Text&gt;
    &lt;/id&gt;
    &lt;/CT Text&gt;
    &lt;/project&gt;
    Once parsed, the info I need to output on the page would look
    like
    text 1
    some sample text
    text 2
    some more sample text
    The part that makes this difficult for me is that there may
    be 0 'Group' values or there might be a number of them. As such, I
    can't just grab the value by listing the tree out, since it changes
    depending on the document (there are thousands of these documents
    that I need to parse).
    From what I have seen in some XML examples, there are a
    number of ways to go about doing this, but before I put a lot of
    time into any of them, I was wondering what the 'best' way to do
    this is.
    XSLT? XMLSearch? Structures? Some combination of those or
    other functions?
    P.S. what little I know of using ColdFusion with XML all
    comes from the doc written by Nate Weiss.
    I was a bit let down that after spending well over $1,000 for
    ColdFusion, Adobe left out the only two books that were worth
    printing (the CFML reference guide and the Advanced book). It
    wouldn't have bothered me as much if there was something on the
    product page listing the manuals that said 'we only actually give
    you 2 of the ones listed'.
    Best regards
    Kevin R.

    Hello,
    Could someone do me a huge favor and provide some sample code
    that would parse/output the above xml so that the output would look
    something like the following. . .
    text 1 = some sample text
    text 2 = some more sample text
    The problem I am having is displaying the xmltext for the
    RICH TEXT element in relation to the ID element.
    The code below will return the value of the RICHTEXT
    (incorrectly named in the original XML examples) easily enough, but
    I need to have it show which text number it is.
    Best regards,
    Kevin R.

  • How to construct the where clause for a nested xml target file

    Post Author: jlpete72
    CA Forum: Data Integration
    I'm having some problems getting the desired results creating a multi-level nested xml file.  Specifically, it does not seem that the where clause in the child schemas respects values from parent schemas.  I'm sure I'm constructing something incorrectly, but am running out of ideas. 
    I am working with the classic company/order/line hierarchy and there are three levels of output schemas in my target xml file, one for company, order header and order line information.
    For testing, I have hardcoded a restriction at the order header line to deal with only one order.  But unless I hardcode values into the where clause at the order line level of the schema, all values are returned for orders belonging to the company defined in the company level.
    I'm trying a where clause at the order line level similar to:
    order_line.customer = order_header.customer and order_line.order_num = order_header.order_num
    If the customer has more than one order in the data file, then all orders for that customer are placed in the detail for the order header.  Only if I hard code the order number in the where clause do I get only the lines for the order specified in the header section.  Not very practical. 
    What am I missing?

    An External Parsed Entity could be used to reference a schema.
    In your DTD:
    <!ENTITY datamodules SYSTEM "file:///c:/Datamodules/Datamodules.xsd">
    Refer the external entity in xml document:
    <datamodules>&datamodules;</datamodules>

  • Parsing a XML using Jdom --- Problem pls help

    Hi all,
    I am reposting it as I was told to format the code and send it again.
    I am trying to parse a xml file using a jdom java code.This code works fine if I remove xmlns attribute in the root element. (I get the expected result) .If the "xmlns" attribute is put in the xml as it should be then the parsing and retrieving returns null. Please tell me how to fix this issue.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Xml
    <process name="CreateKBEntryService" targetNamespace="http://serena.com/CreateKBEntryService" suppressJoinFailure="yes" xmlns:tns="http://serena.com/CreateKBEntryService" xmlns="http://schemas.xmlsoap.org/ws/2003/03/business-process/" xmlns:bpelx="http://schemas.oracle.com/bpel/extension" xmlns:ora="http://schemas.oracle.com/xpath/extension" xmlns:nsxml0="http://localhost:8080/axis/services/CreateKBEntryService" xmlns:nsxml1="http://DefaultNamespace" xmlns:bpws="http://schemas.xmlsoap.org/ws/2003/03/business-process/">
    <partnerLinks>
    <partnerLink name="client" partnerLinkType="tns:CreateKBEntryService" myRole="CreateKBEntryServiceProvider"/>
    <partnerLink name="CreateKBEntryPartnerLink" partnerLinkType="nsxml0:CreateKBEntryLink" partnerRole="CreateKBEntryProvider"/>
    </partnerLinks>
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`
    Java:
    import java.io.*;
    import java.util.*;
    import org.jdom.Document;
    import org.jdom.Element;
    import org.jdom.input.SAXBuilder;
    public class sample1 {
    public static void main(String[] args) throws Exception {
    // create a XML parser and read the XML file
    SAXBuilder oBuilder = new SAXBuilder();
    Document oDoc = oBuilder.build(new File("**xml file location**"));
    Element root = oDoc.getRootElement();
    System.out.println(root.getName());
    String tgtns= root.getAttributeValue("targetNamespace");
    System.out.println("tgt ns "+ tgtns);
    List list= root.getChildren("partnerLinks");
    Iterator it1= list.iterator();
    System.out.println("Iterator 1 - "+list.size());
    while(it1.hasNext()){
    Element partnerlinks = (Element)it1.next();
    List list2= partnerlinks.getChildren("partnerLink");
    System.out.println("iterator 2 - "+list2.size());
    }~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Result:
    Without Xmlns in xml file(Expected and correct output)
    process
    tgt ns http://serena.com/CreateKBEntryService
    Iterator 1 - 1//expected and correct result that comes when I remove xmlns attribute from xml
    iterator 2 - 2
    Result with xmlns:
    process
    tgt ns http://serena.com/CreateKBEntryService
    Iterator 1 - 0 //instead of 0 should return 1

    One suggestion to try:
    Change your code to the following
    Element root = oDoc.getRootElement();
    System.out.println(root.getName());
    String tgtns= root.getAttributeValue("targetNamespace");
    System.out.println("tgt ns "+ tgtns);
    Namespace ns = Namespace.getNamespace(
      "http://schemas.xmlsoap.org/ws/2003/03/business-process/" );
    List list= root.getChildren("partnerLinks", ns );
    Iterator it1= list.iterator();
    System.out.println("Iterator 1 - "+list.size());The JavaDoc says for the one-arg getChildren()
    If this target element has no nested elements with the given name outside a namespace, an empty List is returned.
    Your elements have a namespace (the default one) so it should be worth a try.
    Dave Patterson

  • Problem parsing a xml using Jdom

    Hi all,
    I am reposting it as I was told to format the code and send it again.
    I am trying to parse a xml file using a jdom java code.This code works fine if I remove xmlns attribute in the root element. (I get the expected result) .If the "xmlns" attribute is put in the xml as it should be then the parsing and retrieving returns null. Please tell me how to fix this issue.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Xml
    <process name="CreateKBEntryService" targetNamespace="http://serena.com/CreateKBEntryService" suppressJoinFailure="yes" xmlns:tns="http://serena.com/CreateKBEntryService" xmlns="http://schemas.xmlsoap.org/ws/2003/03/business-process/" xmlns:bpelx="http://schemas.oracle.com/bpel/extension" xmlns:ora="http://schemas.oracle.com/xpath/extension" xmlns:nsxml0="http://localhost:8080/axis/services/CreateKBEntryService" xmlns:nsxml1="http://DefaultNamespace" xmlns:bpws="http://schemas.xmlsoap.org/ws/2003/03/business-process/">
    <partnerLinks>
    <partnerLink name="client" partnerLinkType="tns:CreateKBEntryService" myRole="CreateKBEntryServiceProvider"/>
    <partnerLink name="CreateKBEntryPartnerLink" partnerLinkType="nsxml0:CreateKBEntryLink" partnerRole="CreateKBEntryProvider"/>
    </partnerLinks>
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`
    Java:
    import java.io.*;
    import java.util.*;
    import org.jdom.Document;
    import org.jdom.Element;
    import org.jdom.input.SAXBuilder;
    public class sample1 {
    public static void main(String[] args) throws Exception {
    // create a XML parser and read the XML file
    SAXBuilder oBuilder = new SAXBuilder();
    Document oDoc = oBuilder.build(new File("**xml file location**"));
    Element root = oDoc.getRootElement();
    System.out.println(root.getName());
    String tgtns= root.getAttributeValue("targetNamespace");
    System.out.println("tgt ns "+ tgtns);
    List list= root.getChildren("partnerLinks");
    Iterator it1= list.iterator();
    System.out.println("Iterator 1 - "+list.size());
    while(it1.hasNext()){
    Element partnerlinks = (Element)it1.next();
    List list2= partnerlinks.getChildren("partnerLink");
    System.out.println("iterator 2 - "+list2.size());
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Result:
    Without Xmlns in xml file(Expected and correct output)
    process
    tgt ns http://serena.com/CreateKBEntryService
    Iterator 1 - 1//expected and correct result that comes when I remove xmlns attribute from xml
    iterator 2 - 2
    Result with xmlns:
    process
    tgt ns http://serena.com/CreateKBEntryService
    Iterator 1 - 0 //instead of 0 should return 1

    One suggestion to try:
    Change your code to the following
    Element root = oDoc.getRootElement();
    System.out.println(root.getName());
    String tgtns= root.getAttributeValue("targetNamespace");
    System.out.println("tgt ns "+ tgtns);
    Namespace ns = Namespace.getNamespace(
      "http://schemas.xmlsoap.org/ws/2003/03/business-process/" );
    List list= root.getChildren("partnerLinks", ns );
    Iterator it1= list.iterator();
    System.out.println("Iterator 1 - "+list.size());The JavaDoc says for the one-arg getChildren()
    If this target element has no nested elements with the given name outside a namespace, an empty List is returned.
    Your elements have a namespace (the default one) so it should be worth a try.
    Dave Patterson

  • UTFDataFormatException when parsing incoming XML

    Hi,
    I am constantly seeing this message bellow when upgrade OCEP from 11.1.1.2 to 11.1.1.3 when parsing the XML from inbound JMSAdapter . Anyone knows the problem and how to fix it?
    patcherException: java.rmi.UnmarshalException: failed to unmarshal response; nested exception is:
    java.io.UTFDataFormatException
    weblogic.jms.common.JMSException: weblogic.messaging.dispatcher.DispatcherException: java.rmi.UnmarshalException: failed
    to unmarshal response; nested exception is:
    java.io.UTFDataFormatException
    at weblogic.jms.dispatcher.DispatcherAdapter.convertToJMSExceptionAndThrow(DispatcherAdapter.java:116)
    at weblogic.jms.dispatcher.DispatcherAdapter.dispatchSyncNoTran(DispatcherAdapter.java:61)
    at weblogic.jms.client.JMSSession.receiveMessage(JMSSession.java:894)
    at weblogic.jms.client.JMSConsumer.receiveInternal(JMSConsumer.java:647)
    at weblogic.jms.client.JMSConsumer.receive(JMSConsumer.java:526)
    at weblogic.jms.client.WLConsumerImpl.receive(WLConsumerImpl.java:184)
    at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveMessage(AbstractPollingMessag
    eListenerContainer.java:405)
    at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingM
    essageListenerContainer.java:309)
    at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMes
    sageListenerContainer.java:261)
    at com.bea.core.asyncbeans.internal.DefaultMessageListenerContainer.receiveAndExecute(DefaultMessageListenerCont
    ainer.java:59)
    at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(D
    efaultMessageListenerContainer.java:983)
    at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLo
    op(DefaultMessageListenerContainer.java:974)
    at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessa
    geListenerContainer.java:876)
    at com.bea.core.asyncbeans.internal.WorkManagerTaskExecutor$1.run(WorkManagerTaskExecutor.java:39)
    at weblogic.work.commonj.CommonjWorkManagerImpl$WorkWithListener.run(CommonjWorkManagerImpl.java:196)
    at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:528)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
    Thanks,
    Brandon

    I also got the same exception:
    I am trying to access the JMS queue from CEP application and the JMS queue are configured and populated by the OBS server.
    OSB server Version : 11g R1
    Weblogic version : 10.3.3
    CEP server Version : 11.1.1.3
    Also I disable the DMS option in both CEP and OSB server.
    In CEP Server:
    I disable DMS option in ‘startwlevs.cmd’ file in CEP domain folder as shown below.
    "%JAVA_HOME%\bin\java" %JVM_ARGS% %DGC% %DEBUG% -Doracle.dms.context=OFF
    -Dwlevs.home="%USER_INSTALL_DIR%" -Dbea.home="%BEA_HOME%" -jar
    "%USER_INSTALL_DIR%\bin\wlevs.jar" %1 %2 %3 %4 %5 %6
    :finish
    In OSB Server:
    OSB11g WLS Path : C:\Oracle11g\user_projects\domains\base_domain\bin
    File Name : startWebLogic.cmd
    if "%WLS_REDIRECT_LOG%"=="" (
    echo Starting WLS with line:
    echo %JAVA_HOME%\bin\java %JAVA_VM% %MEM_ARGS% -Doracle.dms.context=OFF -Dweblogic.Name=%SERVER_NAME% -Djava.security.policy=%WL_HOME%\server\lib\weblogic.policy %JAVA_OPTIONS% %PROXY_SETTINGS% %SERVER_CLASS%
    %JAVA_HOME%\bin\java %JAVA_VM% %MEM_ARGS% -Dweblogic.Name=%SERVER_NAME% -Djava.security.policy=%WL_HOME%\server\lib\weblogic.policy %JAVA_OPTIONS% %PROXY_SETTINGS% %SERVER_CLASS%
    ) else (
    echo Redirecting output from WLS window to %WLS_REDIRECT_LOG%
    %JAVA_HOME%\bin\java %JAVA_VM% %MEM_ARGS% -Doracle.dms.context=OFF -Dweblogic.Name=%SERVER_NAME% -Djava.security.policy=%WL_HOME%\server\lib\weblogic.policy %JAVA_OPTIONS% %PROXY_SETTINGS% %SERVER_CLASS% >"%WLS_REDIRECT_LOG%" 2>&1
    Please share your suggestion

  • Creating a PLSQL script to parse structured XML with repeated tags

    Hi, I'm trying to parse an xml feed but the way it's structured makes it difficult to pull out the values. (see example) Would anyone be able to recommend a solution or some ideas as to how to get around this?
    SAMPLE XML:<env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>
         <env:Header>
         </env:Header>
         <env:Body>
              <ns3:commandResponse xmlns:ns2="http://test.com/2011/Generic/schema" xmlns:ns3="http://test.com/2011/Generic">
                   <return>
                   <ns2:return>success</ns2:return>
                   <ns2:Command>issues</ns2:Command>
                        <ns2:WorkItems>
                             <ns2:Id>216141</ns2:Id>
                             <ns2:ModelType>Issue</ns2:ModelType>
                             <ns2:DisplayId>216141</ns2:DisplayId>
                             <ns2:Field>
                                  <ns2:Name>Type</ns2:Name>
                                  <ns2:Value>
                                       <ns2:Item>
                                            <ns2:Id>Dev Task</ns2:Id>
                                            <ns2:ModelType>Type</ns2:ModelType>
                                            <ns2:DisplayId>Dev Task</ns2:DisplayId>
                                       </ns2:Item>
                                  </ns2:Value>
                             </ns2:Field>
                             <ns2:Field>
                                  <ns2:Name>ID</ns2:Name>
                                  <ns2:Value>
                                       <ns2:int>216141</ns2:int>
                                  </ns2:Value>
                             </ns2:Field>
                             <ns2:Field>
                                  <ns2:Name>Reason</ns2:Name>
                                  <ns2:Value>
                                       <ns2:string>Integrating</ns2:string>
                                  </ns2:Value>
                             </ns2:Field>
                             <ns2:Field>
                                  <ns2:Name>Dev Task Component</ns2:Name>
                                  <ns2:Value>
                                       <ns2:string>Java Tools</ns2:string>
                                  </ns2:Value>
                             </ns2:Field>
                             <ns2:Field>
                                  <ns2:Name>Created Date</ns2:Name>
                                  <ns2:Value>
                                       <ns2:datetime>2009-08-10T15:52:39.000-04:00</ns2:datetime>
                                  </ns2:Value>
                             </ns2:Field>
                             <ns2:Field>
                                  <ns2:Name>Date Closed</ns2:Name>
                                  <ns2:Value/>
                             </ns2:Field>
                             <ns2:Field>
                                  <ns2:Name>Modified Date</ns2:Name>
                                  <ns2:Value>
                                       <ns2:datetime>2011-03-04T12:57:05.000-05:00</ns2:datetime>
                                  </ns2:Value>
                             </ns2:Field>
                        </ns2:WorkItems>
                   </return>
              </ns3:commandResponse>
         </env:Body>
    </env:Envelope>This is just a sample with just one WorkItem, but there would be much more, N number of items with 9 fields per item. (Not all of the fields were put in the sample, and some can have null values)
    I only need to pull the content from /ns2:WorkItems/ns2:Field/ns2:Value/ns2:Item/ns2:Id for the first field and the /ns2:value/* tag of all the other fields. Then put this in a table where each row is a workitem and the fields are the columns (create table workitems (Type,ID,Reason,Dev Task Component,Created Date, Date Closed, Modified Date) --all the fields should be varchar2 except the dates)
    What I've been trying so far seems rather brute force by running a nested loop to go through every item and field and then an IF case for each field 1,2,...9 which would insert the value into a table.
    At the moment I'm using something like below to pull a single value
    path1 = '//ns2:WorkItems[1]/ns2:Field[1]/ns2:Value[1]/ns2:Item[1]/ns2:Id[1]';
    nameserve = 'xmlns:ns2="http://test.com/2011/Generic/schema"';
    extractvalue(xmltype(src_clob),path1,nameserve);I'm not entirely sure if I would be able to substitute the [1]'s with [' || nitem || '] where nitem is loop number to do something like:
    for nitem in 1..itemcount
    loop
        FOR nfield in 1..9
        loop
            if nfield=1 then
                path1 := '//ns2:WorkItems[' || nitem || ']/ns2:Field[' || nfield || ']/ns2:Value[1]/ns2:Item[1]/ns2:Id';
                fieldvalue := extractvalue(xmltype(src_clob),path1,nameserve);';
            else
                path2 := '//ns2:WorkItems[' || nitem || ']/ns2:Field[' || nfield || ']/ns2:Value[1]/*[1]';
                fieldvalue := extractvalue(xmltype(src_clob),path2,nameserve);';
            end if;
        end loop;
    end loop;The problem with the above script is how do I insert this fieldvalue into different columns on a table without using an IF case for each field.
    I was wondering if there is simpler way to put each field into a different column and loop through every workitem. I looked into dynamically naming variables but I don't think plsql supports that.
    Any help/advice is appreciated,
    Thanks!
    Edited by: 843508 on Mar 10, 2011 1:56 PM
    Edited by: 843508 on Mar 10, 2011 1:57 PM
    Edited by: 843508 on Mar 10, 2011 2:01 PM

    If it were me, I wouldn't use PL/SQL to try and process XML, but would use SQL's XMLTABLE functionality e.g.
    SQL> ed
    Wrote file afiedt.buf
      1  WITH t as (select XMLTYPE('
      2  <RECSET xmlns:aa="http://www.w3.org">
      3    <aa:REC>
      4      <aa:COUNTRY>1</aa:COUNTRY>
      5      <aa:POINT>1800</aa:POINT>
      6      <aa:USER_INFO>
      7        <aa:USER_ID>1</aa:USER_ID>
      8        <aa:TARGET>28</aa:TARGET>
      9        <aa:STATE>6</aa:STATE>
    10        <aa:TASK>12</aa:TASK>
    11      </aa:USER_INFO>
    12      <aa:USER_INFO>
    13        <aa:USER_ID>5</aa:USER_ID>
    14        <aa:TARGET>19</aa:TARGET>
    15        <aa:STATE>1</aa:STATE>
    16        <aa:TASK>90</aa:TASK>
    17      </aa:USER_INFO>
    18    </aa:REC>
    19    <aa:REC>
    20      <aa:COUNTRY>2</aa:COUNTRY>
    21      <aa:POINT>2400</aa:POINT>
    22      <aa:USER_INFO>
    23        <aa:USER_ID>3</aa:USER_ID>
    24        <aa:TARGET>14</aa:TARGET>
    25        <aa:STATE>7</aa:STATE>
    26        <aa:TASK>5</aa:TASK>
    27      </aa:USER_INFO>
    28    </aa:REC>
    29  </RECSET>') as xml from dual)
    30  -- END OF TEST DATA
    31  select x.country, x.point, y.user_id, y.target, y.state, y.task
    32  from t
    33      ,XMLTABLE(XMLNAMESPACES('http://www.w3.org' as "aa"),
    34                '/RECSET/aa:REC'
    35                PASSING t.xml
    36                COLUMNS country NUMBER PATH '/aa:REC/aa:COUNTRY'
    37                       ,point   NUMBER PATH '/aa:REC/aa:POINT'
    38                       ,user_info XMLTYPE PATH '/aa:REC/*'
    39               ) x
    40      ,XMLTABLE(XMLNAMESPACES('http://www.w3.org' as "aa"),
    41                '/aa:USER_INFO'
    42                PASSING x.user_info
    43                COLUMNS user_id NUMBER PATH '/aa:USER_INFO/aa:USER_ID'
    44                       ,target  NUMBER PATH '/aa:USER_INFO/aa:TARGET'
    45                       ,state   NUMBER PATH '/aa:USER_INFO/aa:STATE'
    46                       ,task    NUMBER PATH '/aa:USER_INFO/aa:TASK'
    47*              ) y
    SQL> /
       COUNTRY      POINT    USER_ID     TARGET      STATE       TASK
             1       1800          1         28          6         12
             1       1800          5         19          1         90
             2       2400          3         14          7          5p.s. XML questions are better suited in the XML DB forum:
    XML DB FAQ

  • Parse complex XML in PL/SQL

    have complex XML with depth level 10. I need to parse and store data into tables from XML. I am able to parse simple XML but not complex. Could any body suggest me the required steps to parse complex XML in PL/SQL?

    Based on response from mdrake on this thread:
    Re: XML file processing into oracle
    Reading XML using a schema...
    declare
      SCHEMAURL VARCHAR2(256) := 'http://xmlns.example.org/xsd/testcase.xsd';
      XMLSCHEMA VARCHAR2(4000) := '<?xml version="1.0" encoding="UTF-8"?>
         <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb" xdb:storeVarrayAsTable="true">
            <xs:element name="cust_order" type="cust_orderType" xdb:defaultTable="CUST_ORDER_TBL"/>
            <xs:complexType name="groupType" xdb:maintainDOM="false">
                    <xs:sequence>
                            <xs:element name="item" type="itemType" maxOccurs="unbounded"/>
                    </xs:sequence>
                    <xs:attribute name="id" type="xs:byte" use="required"/>
            </xs:complexType>
            <xs:complexType name="itemType" xdb:maintainDOM="false">
                    <xs:simpleContent>
                            <xs:extension base="xs:string">
                                    <xs:attribute name="id" type="xs:short" use="required"/>
                                    <xs:attribute name="name" type="xs:string" use="required"/>
                            </xs:extension>
                    </xs:simpleContent>
            </xs:complexType>
            <xs:complexType name="cust_orderType" xdb:maintainDOM="false">
                    <xs:sequence>
                            <xs:element name="group" type="groupType" maxOccurs="unbounded"/>
                    </xs:sequence>
                    <xs:attribute name="cust_id" type="xs:short" use="required"/>
            </xs:complexType>
         </xs:schema>';
      INSTANCE  CLOB :=
    '<cust_order cust_id="12345">
      <group id="1">
        <item id="1" name="Standard Mouse">100</item>
        <item id="2" name="Keyboard">100</item>
        <item id="3" name="Memory Module 2Gb">200</item>
        <item id="4" name="Processor 3Ghz">25</item>
        <item id="5" name="Processor 2.4Ghz">75</item>
      </group>
      <group id="2">
        <item id="1" name="Graphics Tablet">15</item>
        <item id="2" name="Keyboard">15</item>
        <item id="3" name="Memory Module 4Gb">15</item>
        <item id="4" name="Processor Quad Core 2.8Ghz">15</item>
      </group>
      <group id="3">
        <item id="1" name="Optical Mouse">5</item>
        <item id="2" name="Ergo Keyboard">5</item>
        <item id="3" name="Memory Module 2Gb">10</item>
        <item id="4" name="Processor Dual Core 2.4Ghz">5</item>
        <item id="5" name="Dual Output Graphics Card">5</item>
        <item id="6" name="28inch LED Monitor">10</item>
        <item id="7" name="Webcam">5</item>
        <item id="8" name="A3 1200dpi Laser Printer">2</item>
      </group>
    </cust_order>';                
    begin
      dbms_xmlschema.registerSchema
         schemaurl       => SCHEMAURL
        ,schemadoc       => XMLSCHEMA
        ,local           => TRUE
        ,genTypes        => TRUE
        ,genBean         => FALSE
        ,genTables       => TRUE
        ,ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
      execute immediate 'insert into CUST_ORDER_TBL values (XMLTYPE(:INSTANCE))' using INSTANCE;
    end;
    desc CUST_ORDER_TBL
    --SQL> desc CUST_ORDER_TBL
    -- Name                                                                                                                                    Null?    Type
    -- TABLE of SYS.XMLTYPE(XMLSchema "http://xmlns.example.org/xsd/testcase.xsd" Element "cust_order") STORAGE Object-relational TYPE "cust_orderType222_T"
    set autotrace on explain
    set pages 60 lines 164 heading on
    col cust_id format a8
    select extract(object_value,'/cust_order/@cust_id') as cust_id
          ,grp.id as group_id, itm.id as item_id, itm.inm as item_name, itm.qty as item_qty
    from   CUST_ORDER_TBL
          ,XMLTABLE('/cust_order/group'
                    passing object_value
                    columns id   number       path '@id'
                           ,item xmltype      path 'item'
                   ) grp
          ,XMLTABLE('/item'
                    passing grp.item
                    columns id   number       path '@id'
                           ,inm  varchar2(30) path '@name'
                           ,qty  number       path '.'
                   ) itm
    CUST_ID    GROUP_ID    ITEM_ID ITEM_NAME                        ITEM_QTY
    12345             1          1 Standard Mouse                        100
    12345             1          2 Keyboard                              100
    12345             1          3 Memory Module 2Gb                     200
    12345             1          4 Processor 3Ghz                         25
    12345             1          5 Processor 2.4Ghz                       75
    12345             2          1 Graphics Tablet                        15
    12345             2          2 Keyboard                               15
    12345             2          3 Memory Module 4Gb                      15
    12345             2          4 Processor Quad Core 2.8Ghz             15
    12345             3          1 Optical Mouse                           5
    12345             3          2 Ergo Keyboard                           5
    12345             3          3 Memory Module 2Gb                      10
    12345             3          4 Processor Dual Core 2.4Ghz              5
    12345             3          5 Dual Output Graphics Card               5
    12345             3          6 28inch LED Monitor                     10
    12345             3          7 Webcam                                  5
    12345             3          8 A3 1200dpi Laser Printer                2
    17 rows selected.Need at least 10.2.0.3 for performance i.e. to avoid COLLECTION ITERATOR PICKLER FETCH in execution plan...
    On 10.2.0.1:
    Execution Plan
    Plan hash value: 3741473841
    | Id  | Operation                          | Name                   | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT                   |                        | 24504 |    89M|   873   (1)| 00:00:11 |
    |   1 |  NESTED LOOPS                      |                        | 24504 |    89M|   873   (1)| 00:00:11 |
    |   2 |   NESTED LOOPS                     |                        |     3 | 11460 |   805   (1)| 00:00:10 |
    |   3 |    TABLE ACCESS FULL               | CUST_ORDER_TBL         |     1 |  3777 |     3   (0)| 00:00:01 |
    |*  4 |    INDEX RANGE SCAN                | SYS_IOT_TOP_774117     |     3 |   129 |     1   (0)| 00:00:01 |
    |   5 |   COLLECTION ITERATOR PICKLER FETCH| XMLSEQUENCEFROMXMLTYPE |       |       |            |       |
    Predicate Information (identified by operation id):
       4 - access("NESTED_TABLE_ID"="CUST_ORDER_TBL"."SYS_NC0000900010$")
           filter("SYS_NC_TYPEID$" IS NOT NULL)
    Note
       - dynamic sampling used for this statementOn 10.2.0.3:
    Execution Plan
    Plan hash value: 1048233240
    | Id  | Operation               | Name              | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT        |                   |    17 |   132K|   839   (0)| 00:00:11 |
    |   1 |  NESTED LOOPS           |                   |    17 |   132K|   839   (0)| 00:00:11 |
    |   2 |   MERGE JOIN CARTESIAN  |                   |    17 |   131K|   805   (0)| 00:00:10 |
    |   3 |    TABLE ACCESS FULL    | CUST_ORDER_TBL    |     1 |  3781 |     3   (0)| 00:00:01 |
    |   4 |    BUFFER SORT          |                   |    17 | 70839 |   802   (0)| 00:00:10 |
    |*  5 |     INDEX FAST FULL SCAN| SYS_IOT_TOP_56154 |    17 | 70839 |   802   (0)| 00:00:10 |
    |*  6 |   INDEX UNIQUE SCAN     | SYS_IOT_TOP_56152 |     1 |    43 |     2   (0)| 00:00:01 |
    |*  7 |    INDEX RANGE SCAN     | SYS_C006701       |     1 |       |     0   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       5 - filter("SYS_NC_TYPEID$" IS NOT NULL)
       6 - access("SYS_NTpzENS1H/RwSSC7TVzvlqmQ=="."NESTED_TABLE_ID"="SYS_NTnN5b8Q+8Txi9V
                  w5Ysl6x9w=="."SYS_NC0000600007$")
           filter("SYS_NC_TYPEID$" IS NOT NULL AND
                  "NESTED_TABLE_ID"="CUST_ORDER_TBL"."SYS_NC0000900010$")
       7 - access("SYS_NTpzENS1H/RwSSC7TVzvlqmQ=="."NESTED_TABLE_ID"="SYS_NTnN5b8Q+8Txi9V
                  w5Ysl6x9w=="."SYS_NC0000600007$")
    Note
       - dynamic sampling used for this statement-----
    -- CLEAN UP
    DROP TABLE CUST_ORDER_TBL purge;
    exec dbms_xmlschema.deleteschema('http://xmlns.example.org/xsd/testcase.xsd');

  • Spry Menu Using Nested XML Dataset (Spry 1.6)

    I have a vertical menu with a few items. One of which is
    labeled Products which has submenus. I want to have that submenu
    read from a Nested XML dataset. Using a single dataset for one
    level in a menu is easy enough, but the subenu will have submenus.
    Example Menu:
    Home
    Company
    Products
    |-- Product 1
    |-- Item 1
    |-- Item 2
    |-- Item 3
    |-- Product 2
    |-- Item 1
    |-- Item 2
    |-- Product 3
    |-- Item 1
    |-- Item 2
    |-- Item 3
    |-- Item 4
    |-- Product 4
    |-- Item 1
    |-- Item 2
    |-- Product 5
    I have been looking for an easy way to use the Spry Nested
    XML Dataset to create the Product/Item menu. The number of Products
    may vary as well as the number of Items in each Product submenu
    (also, some Products may not have Items).
    I already have an ASP page that creates the XML data from a
    database.
    Schema follows (XSD ):
    <?xml version="1.0" encoding="utf-8"?>
    <xsd:schema xmlns:xsd="
    http://www.w3.org/2001/XMLSchema">
    <xsd:element name="products">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element name="product_type"
    maxOccurs="unbounded">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element name="type_name" maxOccurs="1"
    type="xsd:string"/>
    <xsd:element name="type_url" maxOccurs="1"
    type="xsd:anyURI"/>
    <xsd:element name="product_name"
    maxOccurs="unbounded">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element name="item_name" maxOccurs="1"
    type="xsd:string"/>
    <xsd:element name="item_url" maxOccurs="1"
    type="xsd:anyURI"/>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    </xsd:schema>
    I have been programming for 17 years but am new to Spry. If
    this cannot be done easily with the Spry framework, I'll probably
    wind up splitting the XML data into 2 files (Products and Items)
    then writing a nested loop and call each by row, but then I have to
    find out how Spry Datasets reference XML data. Figuring out how to
    call rows from the XML data shouldn't be so bad, but this method
    just seems like such a hassle for something that should be easy.
    Pseudocode follows:
    j=1
    i=1 to TotalNumberProducts
    display Product i from Products
    ItemsExist=true
    While ItemsExist
    if j > TotalNumberItems | Item j is not for Product then
    ItemsExist=false
    else
    display Item j from Items
    j++
    Wend
    Next
    Thanks in advance for any help or direction!

    That's exactly what I'm trying to do. However, I implemented
    that code and the submenus won't appear. I suspect the submenus
    aren't finding the field names from the Nested XML Dataset. The
    first level of Product menus work great (this is a submenu of the
    overall menu) and correctly identify products that do not have
    submenus, so I know it's picking up the number of records in the
    Nested Dataset correctly - it just won't display the data in the
    next level of menu.
    variable and script declarations:
    <script src="SpryAssets/SpryMenuBar.js"
    type="text/javascript"></script>
    <script src="SpryAssets/xpath.js"
    type="text/javascript"></script>
    <script src="SpryAssets/SpryData.js"
    type="text/javascript"></script>
    <script src="SpryAssets/SpryNestedXMLDataSet.js"
    type="text/javascript"></script>
    <link href="SpryAssets/SpryMenuBarVertical.css"
    rel="stylesheet" type="text/css">
    <script type="text/javascript">
    <!--
    var productMenuData = new
    Spry.Data.XMLDataSet("products.asp", "products/product_type");
    var productMenuDataItems = new
    Spry.Data.NestedXMLDataSet(productMenuData, "product_name");
    //-->
    </script>
    Code for menus:
    <ul id="NavMenu" class="MenuBarVertical">
    <li><a
    href="index.html">Home</a></li>
    <li><a
    href="company.html">Company</a></li>
    <li><a href="franco_giberti.html">Franco
    Giberti</a></li>
    <li><a class="MenuBarItemSubmenu"
    href="products.asp">Products</a>
    <ul spry:region="productMenuData
    productMenuDataItems">
    <li spry:repeat="productMenuData"><a
    class="MenuBarItemSubmenu" href="{type_url}"
    spry:if="{productMenuDataItems::ds_RowCount} !=
    0">{type_name}</a> <a href="{type_url}"
    spry:if="{productMenuDataItems::ds_RowCount} ==
    0">{type_name}</a>
    <ul spry:if="{productMenuDataItems::ds_RowCount} !=
    0">
    <li spry:repeat="productMenuDataItems"><a
    href="{productMenuDataItems::item_url}">{productMenuDataItems::item_name}</a></li>
    </ul>
    </li>
    </ul>
    </li>
    <li><a href="contact.html">Contact Us</a>
    <!-- end #sidebar1 -->
    </li>
    </ul>
    XML:
    <products
    xsi:noNameSpaceSchemaLocation="products.xsd">

    <product_type>
    <type_name>Pasta Sauce</type_name>
    <type_url>pt_2.asp</type_url>

    <product_name>
    <item_name>Putenesca</item_name>
    <item_url>pn_3.asp</item_url>
    </product_name>

    <product_name>
    <item_name>Arrabiata</item_name>
    <item_url>pn_4.asp</item_url>
    </product_name>

    <product_name>
    <item_name>Pesto</item_name>
    <item_url>pn_5.asp</item_url>
    </product_name>

    <product_name>
    <item_name>Basil and Tomato</item_name>
    <item_url>pn_6.asp</item_url>
    </product_name>

    <product_name>
    <item_name>Bolognese</item_name>
    <item_url>pn_7.asp</item_url>
    </product_name>

    <product_name>
    <item_name>Carboniera</item_name>
    <item_url>pn_8.asp</item_url>
    </product_name>
    </product_type>
    +
    <product_type>
    <type_name>Organic Olive Oil</type_name>
    <type_url>pt_3.asp</type_url>

    <product_name>
    <item_name>Original</item_name>
    <item_url>pn_9.asp</item_url>
    </product_name>

    <product_name>
    <item_name>Basil</item_name>
    <item_url>pn_10.asp</item_url>
    </product_name>

    <product_name>
    <item_name>Herbs</item_name>
    <item_url>pn_11.asp</item_url>
    </product_name>

    <product_name>
    <item_name>Sun Dried Tomato</item_name>
    <item_url>pn_12.asp</item_url>
    </product_name>
    </product_type>
    +
    <product_type>
    <type_name>Organic Spreads</type_name>
    <type_url>pt_4.asp</type_url>

    <product_name>
    <item_name>Putenesca</item_name>
    <item_url>pn_13.asp</item_url>
    </product_name>

    <product_name>
    <item_name>Arrabiata</item_name>
    <item_url>pn_14.asp</item_url>
    </product_name>

    <product_name>
    <item_name>Pesto</item_name>
    <item_url>pn_15.asp</item_url>
    </product_name>

    <product_name>
    <item_name>Basil and Tomato</item_name>
    <item_url>pn_16.asp</item_url>
    </product_name>

    <product_name>
    <item_name>Bolognese</item_name>
    <item_url>pn_17.asp</item_url>
    </product_name>

    <product_name>
    <item_name>Carboniera</item_name>
    <item_url>pn_18.asp</item_url>
    </product_name>
    </product_type>
    +
    <product_type>
    <type_name>Organic Grilled Vegetables</type_name>
    <type_url>pt_5.asp</type_url>

    <product_name>
    <item_name>Putenesca</item_name>
    <item_url>pn_19.asp</item_url>
    </product_name>

    <product_name>
    <item_name>Arrabiata</item_name>
    <item_url>pn_20.asp</item_url>
    </product_name>

    <product_name>
    <item_name>Pesto</item_name>
    <item_url>pn_21.asp</item_url>
    </product_name>

    <product_name>
    <item_name>Basil and Tomato</item_name>
    <item_url>pn_22.asp</item_url>
    </product_name>

    <product_name>
    <item_name>Bolognese</item_name>
    <item_url>pn_23.asp</item_url>
    </product_name>

    <product_name>
    <item_name>Carboniera</item_name>
    <item_url>pn_24.asp</item_url>
    </product_name>
    </product_type>

    <product_type>
    <type_name>Truffle Products</type_name>
    <type_url>pt_6.asp</type_url>
    </product_type>
    </products>
    Any further guidance would be very much appreciated!

  • Parsing an xml output of a ws-client using JDOM

    how do i use jdom to parse an output from a web service client,
    ive been using JDev. 10g, was able to create a web service client to consume and return the output in the form of an xml.
    i want to be able to parse the xml doc into variables such that i can insert them into the database.
    is it possible to parse without saving it?
    cheers,
    Shivek Sachdev

    how do i use jdom to parse an output from a web service client,
    ive been using JDev. 10g, was able to create a web service client to consume and return the output in the form of an xml.
    i want to be able to parse the xml doc into variables such that i can insert them into the database.
    is it possible to parse without saving it?
    cheers,
    Shivek Sachdev

  • "Error while parsing SOAP XML payload: no element found" received when invoking Web Service

    Running PB 12.1 Build 7000.  Using Easysoap.  Error ""Error while parsing SOAP XML payload: no element found" received when invoking Web Service".  This error does not appear to be coming from the application code.  Noticed that there were some erroneous characters showing up within the header portion of the XML ("&Quot;").  Not sure where these are coming from.  When I do a find within the PB code for ""&quot;" it gets located within two objects, whereas they both reference a "temp_xml_letter".  Not sure where or what temp_xml_letter resides???   The developer of this is no longer with us and my exposure to WSDL and Web Services is rather limited.  Need to get this resolved...please.
    This is the result of the search.  Notice the extraneous characters ("&quot;"):
    dar1main.pbl(d_as400_mq_xml)
    darlettr.pbl(d_email_xml)
    ---------- Search: Searching Target darwin for 'temp_xml'    (9:52:41 AM)
    ---------- 2 Matches Found On "temp_xml":
    dar1main.pbl(d_as400_mq_xml).d_as400_mq_xml:  export.xml(usetemplate="temp_xml_letter" headgroups="1" includewhitespace="0" metadatatype=0 savemetadata=0  template=(comment="" encoding="UTF-8" name="temp_xml_letter" xml="<?xml version=~"1.0~" encoding=~"UTF-16LE~" standalone=~"yes~"?><EmailServiceTransaction xmlns=~"http://xml.xxnamespace.com/Utility/Email/EmailService" ~" xmlns:imc=~"http://xml.xxnamespace.com/IMC~" xmlns:xsi=~"http://www.w3.org/2001/XMLSchema-instance~" xmlns:root=~"http://xml.xxnamespace.com/RootTypes~" xmlns:email=~"http://xml.xxnamespace.com/Utility/Email~" xsi:schemaLocation=~"http://xml.xxnamespace.com/Utility/Email/EmailService http://dev.xxnamespace.com/Utility/Email/EmailService/V10-TRX-EmailService.xsd~"><EmailServiceInformation><EmailServiceDetail __pbband=~"detail~"><ApplicationIdentifier> applicationidentifier </ApplicationIdentifier><AddresseeInformation><AddresseeDetail><Number> number </Number></AddresseeDetail></AddresseeInformation><EmailMessageInformation><Ema
    darlettr.pbl(d_email_xml).d_email_xml:  export.xml(usetemplate="temp_xml_letter" headgroups="1" includewhitespace="0" metadatatype=0 savemetadata=0  template=(comment="" encoding="UTF-8" name="temp_xml_letter" xml="<?xml version=~"1.0~" encoding=~"UTF-16LE~" standalone=~"yes~"?><EmailServiceTransaction xmlns=~"http://xml.xxnamespace.com/Utility/Email/EmailService" ~" xmlns:imc=~"http://xml.xxnamespace.com/IMC~" xmlns:xsi=~"http://www.w3.org/2001/XMLSchema-instance~" xmlns:root=~"http://xml.xxnamespace.com/RootTypes~" xmlns:email=~"http://xml.xxnamespace.com/Utility/Email~" xsi:schemaLocation=~"http://xml.xxnamespace.com/Utility/Email/EmailService http://dev.xxnamespace.com/Utility/Email/EmailService/V10-TRX-EmailService.xsd~"><EmailServiceInformation><EmailServiceDetail __pbband=~"detail~"><ApplicationIdentifier> applicationidentifier </ApplicationIdentifier><AddresseeInformation><AddresseeDetail><Number> imcnumber </Number></AddresseeDetail></AddresseeInformation><EmailMessageInformation><Ema
    ---------- Done 2 Matches Found On "temp_xml":
    ---------- Finished Searching Target darwin for 'temp_xml'    (9:52:41 AM)

    Maybe "extraneous" is an incorrect term.  Apparantly, based upon the writeup within Wiki, the parser I am using does not interpret the "&quot;"?  How do I find which parser is being utilized and how to control it?
    <<<
    If the document is read by an XML parser that does not or cannot read external entities, then only the five built-in XML character entities (see above) can safely be used, although other entities may be used if they are declared in the internal DTD subset.
    If the document is read by an XML parser that does read external entities, then the five built-in XML character entities can safely be used. The other 248 HTML character entities can be used as long as the XHTML DTD is accessible to the parser at the time the document is read. Other entities may also be used if they are declared in the internal DTD subset.
    >>>

  • Unable to display tree view; Error when parsing an XML document (Premature end of file.)

    Hi folks,
    I am using a cascaded mapping in my OM. I have a graphical mapping followed by the Java mapping. It is a flat file to IDOC mapping. Everything works fine in Dev but when I transport the same objects to QA, the Operation mapping though it doesn't fail in ESR testing tool, gives the following message and there is no output generated for the same payload which is successfully tested in DEV. Please advise on what could be the possible reasons.
    Unable to display tree view; Error when parsing an XML document (Premature end of file.)

    kalyan,
    There seems to be an invalid xml payload which causes this error in ESR not generating the tree view. Please find the similar error screenshot and rectify the payload.
    Mutti

  • Parsing an xml document inside a Thread

    Hi Friends
    I have to do some processing in my application for which i need to use multithreading.
    Inside every new thread created i have to parse an xml document using s parsing tool like castor or jibx.
    My question is that is it possible to parse a xml document inside a new thread everytime it gets created.
    is it a good coding practice as it involves java code to do it.
    Thanks
    Vikeng

    vikeng wrote:
    Hi
    Thanks for the reply.
    Well i need to do some kind of a batch processing in my application.
    I need to parse an xml document and upload the data i get after parsing into columns in the database.
    Since its a batch what i was asking was is it possible to do it for every request as batch needs to handle hundreds of records during the daily or nightly sync.
    Is it a good practice to do parsing for every record in a batch
    Thanks
    VikengI don't get it. One batch is one document, and that document contains e.g. 100 records? What's one request? A request for one batch? I would execute one batch in one thread.
    Kaj

  • Parseing an XML Document as a String

    Hi all,
    i am trying to parse an XML document to a parser. I get the file as a request parameter, which is filled in to at String variable.
    But for some reason i get an SAXException, does anyone se the problem?
    Thank you for your help...
    Below is the code
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.util.*;
    import java.text.*;
    import java.net.*;
    import java.net.URL;
    import java.sql.*;
    import org.w3c.dom.Document;
    import org.w3c.dom.NamedNodeMap;
    import org.w3c.dom.Node;
    import org.w3c.dom.NodeList;
    import org.xml.sax.SAXException;
    import org.xml.sax.SAXParseException;
    import javax.xml.parsers.*;
    import javax.xml.transform.stream.StreamSource;
    public class StartServlet extends HttpServlet
    private boolean debug = true;
    private final static String CONTENT = "content";
    private final static String COOKIES = "cookies";
    String resp = new String();
    private static String NODE_TYPES[] = new String[] {
         "ELEMENT",
         "ATTRIBUTE",
         "TEXT",
         "CDATA_SECTION",
         "ENTITY_REFERENCE",
         "ENTITY",
         "PROCESSING_INSTRUCTION",
         "COMMENT",
         "DOCUMENT",
         "DOCUMENT_TYPE",
         "DOCUMENT_FRAGMENT",
         "NOTATION" };
    public static void println(String s, int indent) {
         for(int i = 0 ; i < indent; i++) {
                   System.out.println(" ");
         System.out.println(s);
    public static void println(String s) {
         System.out.println(s);
    public static void print(Node node){
         printImpl(node, 0);
    public static void printImpl(Node node, int indent){
         if(node == null) {
              return;
         String nodeType = NODE_TYPES[node.getNodeType()];
         String nodeName = node.getNodeName();
         String nodeValue = node.getNodeValue();
         if(nodeValue != null) {
              nodeValue = nodeValue.trim();
         if(nodeType.equals("TEXT") && nodeValue.equals("")) {
              ; //Ignore emty node
         else {
              println(nodeType + " - " + nodeName + " - " + nodeValue, indent);
         NamedNodeMap attributes = node.getAttributes();
         if (attributes != null) {
              for(int i = 0; i < attributes.getLength(); i++) {
                   printImpl(attributes.item(i), indent + 1);
         NodeList children = node.getChildNodes();
         if(children != null) {
              for(int i = 0; i < children.getLength(); i++){
                   printImpl(children.item(i), indent + 1);
    public static DocumentBuilder newBuilder(boolean validation)
                        throws ParserConfigurationException {
         DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance();
         domFactory.setValidating(validation);
         domFactory.setNamespaceAware(true);
         DocumentBuilder domBuilder = domFactory.newDocumentBuilder();
         //domBuilder.setErrorHandler(new PrintErrorHandler());
         return domBuilder;
    public static Document newDocument()
                        throws ParserConfigurationException{
         DocumentBuilder domBuilder = newBuilder(false);
         Document document = domBuilder.newDocument();
         return document;
    public static Document parse( String xml, boolean validation)
                        throws ParserConfigurationException, IOException, SAXException {
              DocumentBuilder domBuilder = newBuilder(validation);
              Document document = domBuilder.parse(xml);
              return document;
    public void init() {
    public void service( javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res) {
              String[] cookies = null;
              try{
                   Hashtable document = getDocument("http://.../first.xml", cookies);
                   resp = (String) document.get(CONTENT);
                   debug(resp);
                   print(parse(resp, false));
              catch (SAXParseException e){
                   System.out.println("Saxfejl");
                   //System.exit(1);
              catch (Exception e){
                   e.printStackTrace();
                   System.exit(1);
    public void debug(String msg) {
         if(debug) {
              System.out.println(msg);
    public void performTask(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) {
         try
              // Insert user code from here.
         catch(Throwable theException)
              // uncomment the following line when unexpected exceptions
              // are occuring to aid in debugging the problem.
              //theException.printStackTrace();
    public void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, java.io.IOException {
         performTask(request, response);
    public void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, java.io.IOException {
         performTask(request, response);
    private Hashtable getDocument(String urlCode, String[] oldCookies) {
         Hashtable document = new Hashtable();
         HttpURLConnection http = null;
         try {
              URL httpURL = new URL(urlCode);
              // If HTTP Protocol, then open connection using the Request method indicated
              URLConnection conn = httpURL.openConnection();
              http = (HttpURLConnection) conn;
              //http.setRequestMethod("GET");
              http.setDoInput(true);
              http.setDoOutput(true);
              http.setUseCaches(false);
              http.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
              if (oldCookies != null) {
                   for (int j = 0; j < oldCookies.length; j++) {
                        String cookie = oldCookies[j];
                        http.setRequestProperty("Cookie", cookie);
              http.connect();
              http.getContent();
              StringBuffer tsb = new StringBuffer("");
              if (http.getResponseCode() == 200) {
                   InputStream cis = http.getInputStream();
                   byte[] a = new byte[1024];
                   int n = cis.read(a);
                   while (n >= 0) {
                        tsb.append(new String(a, 0, n));
                        n = cis.read(a);
                   cis.close();
                   document.put(CONTENT, tsb.toString());
              String[] cookies = null;
              if (cookies == null) {
                   int headerFieldIndex = 0;
                   String headerFieldValue = http.getHeaderField(headerFieldIndex);
                   Vector cookieValues = new Vector();
                   while (headerFieldValue != null) {
                        String headerFieldName = http.getHeaderFieldKey(headerFieldIndex);
                        if ((headerFieldName != null) && headerFieldName.toLowerCase().equals("set-cookie")) {
                             int index = headerFieldValue.indexOf(";");
                             if (index > -1) {
                                  headerFieldValue = headerFieldValue.substring(0, index);
                             cookieValues.addElement(headerFieldValue);
                        headerFieldValue = http.getHeaderField(++headerFieldIndex);
                   cookies = new String[cookieValues.size()];
                   cookieValues.copyInto(cookies);
              document.put(COOKIES, cookies);
         catch (Exception e) {
              debug("url problem" + e);
         finally {
              if (http != null) {
                   http.disconnect();
         return document;
    }

    Hi,
    Use this code it will helpful to you.
    resultXMLDocument=(XmlDocument)documentDoc;
    StringWriter sw = new StringWriter();
    resultXMLDocument.write((Writer) sw);
    xmlString=sw.toString();
    thnaks,
    suneel

Maybe you are looking for

  • Itunes library is on a mac formatted external hdd: can windows recognize it

    subject pretty much says it all. can windows recognize my mac formatted external hdd? i know when i had my ipod formatted to windows, the mac recognized it, but will the mac formatted drive allow windows to see it, play the music, and possibly move i

  • Sql exception occurred during pl/sql upload error in custom integrator

    Hi, I have modified custom integrator which was working fine. I have added one column in template and the lov is working fine. Issue is that when i upload the file to oracle it showing error as ''sql exception occurred during pl/sql upload". I have t

  • Problems with Action menu in 3.1.2.00.02

    Hi, I wonder if any one has encountered a similar problem am having with the action menu of Interactive reports in version 3.1.2.00.02. The action items of the action menu do not work for a conditional report. If I have the Interactive Report set to

  • Xerox Phaser 6300N / OS 10.8 compatibility

    This happened last upgrade (to 10.6). Xerox has a new driver for OS 10.8 on their site, but when installed, the Mac and the Xerox are not cooperating. The  printer goes to Pause and, when Resume is chosen, it reverts right back to Pause. I spent abou

  • Photos preview and browsing without importing

    Is it possible to preview or browse the photos without importing all the phots into the Mac? Sometimes I just want to preview the photos and select the best ones to import into the Mac for further editting and delete the rest of them. But now I must