Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x

XML

20K

Solutions

13K

Contributors

Extensible Markup Language (XML) refers to the encoding of documents such that they can be read by both machines and humans. XML documents use tags to show the beginning and end of a set of data. XML is used extensively on websites to show volumes of data, and is the default for a number of office productivity suites. This topic includes discussions of XML-related technologies, such as XQuery (the XML Query language), XPath (the XML Path language), XSLT (eXtensible Stylesheet Language Transformations), XLink (the XML Linking language) and XPointer (the XML Pointer language).

Share tech news, updates, or what's on your mind.

Sign up to Post

Hi All

I am clearly missing something here. I am trying to send calls to an API for a product called ServiceDeskPlus.

The operation name "ADD_REQUEST"  should be sent as a "POST attribute" with key "OPERATION_NAME".

The technician key should be sent as a "POST attribute" with key "TECHNICIAN_KEY".

Input is an XML string sent as a "POST attribute" with key "INPUT_DATA".

The full documentation page is found here.

The code I am using to create the Post Attributes is:
public void CreateSupportDeskItem(ref SupportItem supportItem, string clientCode = "")
        {
            string destinationUrl = Properties.Settings.Default.ServiceDeskEndPoint;
            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(destinationUrl);

            string group = Properties.Settings.Default.ServiceDeskGroup;
            string status = Properties.Settings.Default.ServiceDeskStatus;
            string service = Properties.Settings.Default.ServiceDeskService;
            string technicianKey = Properties.Settings.Default.ServiceDeskAPIKey;

            string requestXml;

            if (string.IsNullOrEmpty(clientCode))
                requestXml = GenerateRequestXml(supportItem,
                                         group, status, service);
            else
                requestXml = GenerateRequestXml(supportItem, group, status, service, clientCode);

    

Open in new window

0
Receive 1:1 tech help
LVL 11
Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

I have following xml
<root>
	<Telephone>
		<ElementNumber>2</ElementNumber>
		<ElementNumber>1</ElementNumber>
		<TelephoneNumber>7865554433</TelephoneNumber>
	</Telephone>
	<Telephone>
	<TelephoneNumber>68021212111</TelephoneNumber>
	</Telephone>
</root>

Open in new window


and following xjs logic:
var nodeTravelerContact = domReq.Root.SelectSingle("Telephone[ElementNumber ='1']/TelephoneNumber | Telephone[not(ElementNumber)]/TelephoneNumber");

if ((!nodeTravelerContact || !nodeTravelerContact.NormalizedText))
	false;
else
	return true;

Open in new window

     
      
I want my function to return true because it found a Telephone where ElementNumber=1 , but my variable returns false because it does not find match (specifically, because it's searching for first position which in this case = 2). I've used .SelectNode, .Select and it never traverses through ALL ElementNumber to find match.

Please advise.
0
I need some help with a custom XML feed i need to work.

I need the feed below to only pull jobs which are tagged "careerbuilder". and then only show 120 of those posts.

At the moment, I have zero posts tagged with "careerbuilder" but it's still pulling 120 other posts.  How can i fix the code below, so that only posts tagged careerbuiler show up?.   the xml feed is found here

<?php
/**
 * Template Name: Custom CareerBuilder RSS Template - cretefeed
 */
 
$postCount = 120; // The number of posts to show in the feed
$posts = query_posts('showposts=' . $postCount, 'tag=careerbuilder');
header('Content-Type: '.feed_content_type('rss-http').'; charset='.get_option('blog_charset'), true);
echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>';
?>
<rss version="2.0"
        xmlns:content="http://purl.org/rss/1.0/modules/content/"
        xmlns:wfw="http://wellformedweb.org/CommentAPI/"
        xmlns:dc="http://purl.org/dc/elements/1.1/"
        xmlns:atom="http://www.w3.org/2005/Atom"
        xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
        xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
        <?php do_action('rss2_ns'); ?>>
<channel>
        <title><?php bloginfo_rss('name'); ?> - Feed</title>
        <atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
        <link><?php get_permalink(); ?></link>
        <description><?php 

Open in new window

0
I have to add an attribute to XML node with more than 10k records so whats the best way to transform XML document faster.

I have tried StAX parser which almost takes 4 min for adding an attribute and using SAX parser it should take 5 min.

Is there any other lib available to do it better or another way to do that please give your suggestions.

Sample Code :(Using STAX Parser)
XMLStreamReader r = factory.createXMLStreamReader(new FileInputStream(inputfile));

/*Start Writing document */

XMLOutputFactory xmlOutputFactory = XMLOutputFactory.newInstance();

XMLEventWriter xmlEventWriter = xmlOutputFactory.createXMLEventWriter(new FileOutputStream(outputfile), "UTF-8");

/*End Writing document */

int event = r.getEventType();

long startTime = System.currentTimeMillis();

        System.out.println("Started reading node from xml document....."+TimeUnit.MILLISECONDS.toSeconds(startTime));

int node1Cnt = 0,node2Cnt = 0,node3Cnt=0,node4Cnt = 0;

      while (true) {

      XMLEventFactory eventFactory = XMLEventFactory.newInstance();

            switch (event) {

            case XMLStreamConstants.START_DOCUMENT:

                 // System.out.println("Start Document.");

                  StartDocument startDocument = eventFactory.createStartDocument();

                  xmlEventWriter.add(startDocument);

                  break;

            case XMLStreamConstants.START_ELEMENT:

                              

                //Create Start node

          

Open in new window

0
Here is the xml file

<Crew>
    <CrewMembers>
      <CrewMember>
        <CrewName ID="35124">JOHN DOE</CrewName>
        <CrewRole ID="7">Not Applicable</CrewRole>
        <CrewLevel>EMT-Paramedic</CrewLevel>
        <CrewSequence>1</CrewSequence>
      </CrewMember>
    
    </CrewMembers>

Open in new window


Here is the query

DECLARE @PRID_S varchar(10) set @PRID_S='48967264'

DECLARE @FILENAME VARCHAR(30) SET @FILENAME='c:\pcr\archive\'+@PRID_S+'.XML'
Declare @CrewName1 varchar(30)
Declare @Crew1 varchar(10) set @crew1='35124'

IF OBJECT_ID('tempdb..#tempDATA4') IS NOT NULL DROP TABLE #tempDATA4
CREATE TABLE #tempDATA4 (  CrewName1 VARCHAR(20))

INSERT INTO #tempDATA4
exec(
'declare @xml xml 
set @xml=(
  SELECT *
  FROM OPENROWSET(BULK'+ ''''+@FILENAME+''''+', SINGLE_BLOB) AS data
)

select 

@xml.value(''(/PCRDATA/Crew/CrewMembers/CrewMember/CrewName/ID='+ ''''+@Crew1+''''+', ''nvarchar(max)'') as CrewName')

SELECT TOP 1 @CrewName1=CrewName1 FROM #tempDATA4
print(@CrewName1)

Open in new window


The error I am getting is Unclosed quotation mark after the character string ') as CrewName'.  

what am I doing wrong

Thanks
0
I have to write a program that will parse the following attached file from weather underground. I am not a xml programmer and was wondering if someone could provide a sample to parse this xml file. The schema can be found at https://www.wunderground.com/weather/api/d/docs?d=data/forecast10day&MR=1 

Thanks
wuExample.txt
0
Hi,

I have the following scripts :


<?

$xml="<whmcsapi>
<action>getinvoice</action>
<result>success</result>
<invoiceid>242347</invoiceid>
<invoicenum></invoicenum>
<userid>25209</userid>
<date>2017-12-21</date>
<duedate>2018-01-11</duedate>
<datepaid>0000-00-00 00:00:00</datepaid>
<lastcaptureattempt>0000-00-00 00:00:00</lastcaptureattempt>
<subtotal>50.00</subtotal>
<credit>0.00</credit>
<tax>3.00</tax>
<tax2>0.00</tax2>
<total>53.00</total>
<balance>53.00</balance>
<taxrate>6.00</taxrate>
<taxrate2>0.00</taxrate2>
<status>Unpaid</status>
<paymentmethod>banktransfer</paymentmethod>
<notes></notes>
<ccgateway></ccgateway>
     <items>
                   <item>
                                <id>304494</id>
                                <type>Domain</type>
                                <relid>52025</relid>
                                <description>Domain Renewal - xxx.com - 1 Year/s (11/01/2018 - 10/01/2019)</description>
                                <amount>50.00</amount>
                                <taxed>1</taxed>
                  </item>
     </items>
<transactions></transactions>
</whmcsapi>";


$content .= '<table border="1" cellpadding="5" style="border-collapse: collapse;border: 1px solid #cacaca">';

$content .= '<tr><th colspan="2" bgcolor="thistle">ITEMS '.print_r($xml).'</th></tr>';
foreach ($xml['items']['item'] as $key => $value) {

  $content .= '<tr><td><b>Description</b></td><td>'.$value['description'].'</td></tr>';
  $content .=

Open in new window

0
I am creating a post agent which has to receive two files, one pdf and one xml both with the same name, and it worked fine the first time I sent test post, after sending several test emails with the same xml file, I sent the error 4005 notes error, I feel that it is because I send several times the same file with the same name and they are all stored in a location inside the server. Somebody could help me ??

error.png
0
What's the simplest way to get the value of the first node from the attached XML using C#? I expect to get the value ZELNINO. I'm using Visual Studio 2015. I thin it uses C# version 6.

I've tried a bunch of stuff I see on the web but nothing works well.

Also, how would I get the value of the current address street name. The value that should be returned is SPROUL. In this case, there are multiple address elements, but I want the element that has the status element under the address element with a value of CURRENT.
CreditReportResponse.xml
0
Dear Experts,

I use google map to locate some of my customers.
I have below code, it works and list the data for the certain dates, but it does not work more than one month or different dates.
I checked the sql, it is fine.  Sql brings data but xml do not list it.

my date format is like this 2017-12-01

$mysqli->query("set names utf8mb4");

$sql = "SELECT * FROM mytable WHERE tarih >= '$birinci' AND tarih < date_add( '$ikinci' , interval 1 day) AND uid='$satisci' and lat is not Null";

$res = $mysqli->query($sql);

$xml = new XMLWriter();

$xml->openURI("php://output");
$xml->startDocument();
$xml->setIndent(true);

$xml->startElement('markers');

while ($row = mysqli_fetch_assoc($res)) {
  $xml->startElement("marker");

  $xml->writeAttribute('id', $row['id']);
  $xml->writeAttribute('name', $row['adi']);
  $xml->writeAttribute('address', $row['tarih']);
  $xml->writeAttribute('lat', $row['lat']);
  $xml->writeAttribute('lng', $row['lng']);
  $xml->writeAttribute('type', $row['bayikodu']);
  //$xml->writeRaw($row['lng']);

  $xml->endElement();
}

$xml->endElement();

header('Content-type: text/xml');
$xml->flush();

Open in new window

0
Free Tool: IP Lookup
LVL 11
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

I am using the code below in a MS sql stored procedure.  This works fine when the delimiters are constant ie. <Unit>"xxxxx"</Unit>.  The problem is the xml file has variable data encapsulated by the delimters ,  so for example <Unit ID="56">"Unit 56"<Unit ID>.  How would I modify this to accommodate the variations in ID=.  Thanks

[DECLARE @TEST varchar(20) = ''


DECLARE @FILENAME VARCHAR(30) SET @FILENAME='c:\pcr\archive\'+@PRID_S+'.XML'
DECLARE @SQL AS VARCHAR(MAX) = '';

IF OBJECT_ID('tempdb..#tempDATA') IS NOT NULL DROP TABLE #tempDATA
CREATE TABLE #tempDATA ( TEST VARCHAR(20) )

INSERT INTO #tempDATA
EXEC ( '
	SELECT 
		  Y.times.query(''Unit ID'').value(''.'', ''varchar(20)'')
		  
	FROM 
	( 
		SELECT CAST(y AS XML)
		FROM OPENROWSET(
		 BULK ' + '''' + @FILENAME + '''' + ' ,
		 SINGLE_BLOB) AS T(y)
	) AS T(y)
	CROSS APPLY y.nodes(''/PCRDATA/Header'') AS Y(Times) ' 
)

SELECT TOP 1 @TEST = TEST FROM #tempDATA


print(@TEST)

Open in new window

0
Thanks for the initial ideas on my question here
https://www.experts-exchange.com/questions/29074132/Uploading-sections-in-a-Word-document-into-an-Access-database.html?anchor=a42407148&notificationFollowed=201631007#a42407148 (still open BTW)

I can now take my quest a step further.

Say I have a 'block of content' on Word document. It can be
  • a paragrah
  • a bulleted list
  • a table

I want to be able to 'copy' that block of content to a field in an Access table, and also to be able to copy it back to a Word document, preserving the formatting as was.

I have experimented simply (manually) copying and pasting across, with some success. So I suppose it is possible - Access seems to store the relevant data, though I'm still not clear how the Styles come into play.

My question is, eventually I need to do this programmatically - (preferably with ADO/SQL as that's what I know).

Is there a super-elegant way for creating what (effectively) is a 'content management solution' with Word on the front-end and Access on the back?

Thanks
0
Hi
Could you help with below please.

Scenario:

- In Windows batch, would like to check a folder with specific file pattern e.g *.sif. We might find 1 or more files. Files are in sif extension but it just a text file in xml style. (not binary)

- Look for string "PROCESS_NAME" and get the value of of it. E.g PROCESS_NAME="TEST Workflow 1"

- Loop through all files in the directory and get all values. E.g. if we find "TEST Workflow 1" and "TEST Workflow 2" etc etc.

- Variable should be set like below.
e.g workflow_list='TEST Workflow 1','TEST Workflow 2','TEST Workflow 3'

If it is easy in powershell, we can do that, but is it easy to bring the value back to batch variable please

Have attached two sample files.

Thanks in advance :)
wf_nxg_application_error_handler_wor.txt
wf_nxg_publish_error_republish_batch.txt
0
Hi guys,

Can you please assist with function below.

I need to handle two scenarios.
To remove characters 'BX' and replace with two preceding zero’s if zero after 'BX' exist.
example:
BX0000000005100368  - mapped to - 000000000005100368

And if zeroes not exist, remove 'BX' only.
example:
BXG1563300110901 - mapped to - G1563300110901

<xsl:value-of select="concat('00', substring-after($string, 'BX'))"/>

Open in new window




thank you,
Darius
0
I made a new excel fluent ribbon via the Custom UI Editor for Microsoft Office.
This line of xml occurred in a conventional  tab and group xml segment:

<button id="Tab1Gp1_2" label="FILE path" tag="2" getEnabled="GetEnabled" onAction="file"/>  

But when I saved the the xml, and re-opened the .xlsm file,  the onAction macro file was deleted from the standard module within which it was written (the same module that contained:
Sub RibbonOnLoad(ribbon As IRibbonUI) etc.

No other subs were deleted, and the code ran OK in other versions of the file:

Sub file(control As IRibbonControl)
    RefreshRibbon (4)    'tag for next button to be enabled
    MsgBox "file.id = " & control.ID
End Sub

When I re-entered the macro, it was again deleted.
When I ran these elements in a different excel file and xml, the onAction call worked perfectly.

My next move is to re-build the xml and excel bas files in a new .xlms file.

I have this experience from time to time. Has anyone else had it?
Do you have an explanation, a means of avoiding it, or a means of repairing the file?

thanks
Kelvin
0
I am creating a hash off of account numbers.   using xslt, can someone help code the following?

the two account numbers i need added up are

192937465
and
123456789
the value the following code produces is 316,294,254

this is the value of the two account numbers if you take in the full 9 digit account number and use it in the summing equation.
i need for the xlst code to take the two account numbers and only add the first 8 digits of the accountnumber together together.
12345678 and 19283746 which would equal 31,629,424

the xlst code i currently have in place is

XSLT:
<xsl:variable name="ENTRYHASH">
        <xsl:call-template name="prepend-pad">
          <xsl:with-param name="padVar" select = "number(sum( /ACCOUNT/ACCOUNTNUMBER ))"/>
        </xsl:call-template>
      </xsl:variable>
0
I've connected data in Excel 2013 and trying to recreate in 2016 but getting the below error massage..

'Query results cannot overlap a table or XML mapping'

Any ideas how I can resolve this?
0
I have code that takes a nvarchar(max) value to run a SP.
If I run the SP directly on SSMS it works fine, the SP does the job. But using ASP Classic code to pass the parameter which is a very long XML string to the SP is giving errors saying the data is getting truncated. Here is the code we currently have:

set sp_usp_xmlparse = Server.CreateObject("ADODB.Command")
    sp_usp_xmlparse.ActiveConnection = MM_bluedot_STRING
    sp_usp_xmlparse.CommandText = "dbo.usp_XMLParse"
    sp_usp_xmlparse.CommandType = 4
    sp_usp_xmlparse.CommandTimeout = 0
    sp_usp_xmlparse.Prepared = true
    sp_usp_xmlparse.Parameters.Append sp_usp_xmlparse.CreateParameter("@RETURN_VALUE", 3, 4)
    sp_usp_xmlparse.Parameters.Append sp_usp_xmlparse.CreateParameter("@blob", 200, 1, -1, qnrBlobXML)
    sp_usp_xmlparse.Parameters.Append sp_usp_xmlparse.CreateParameter("@UserID", 3, 1, -1, UpdateStatus__MMColParam)
    sp_usp_xmlparse.Parameters.Append sp_usp_xmlparse.CreateParameter("@FirmID", 3, 1, -1, UpdateStatus__MMColParam2)
    sp_usp_xmlparse.Execute()

Open in new window


Any ideas what could be wrong?
0
I have a batch script Change.bat as below  which changes value of attribute httpPort in server.xml file to a hardcoded value. But my script works only if the xml file is in the same folder where the batch script exists. BUT      
The server.xml location is %~dp0\wlp\usr\servers\defaultServer\server.xml and the batch script is in the same folder where 'wlp' folder resides. What changes do I need to do in the batch ?

server.xml contents-
<!-- Enable features -->
<featureManager>
    <feature>webProfile-7.0</feature>
    <!-- <feature>localConnector-1.0</feature> -->
</featureManager>

<!-- To access this server from a remote client add a host attribute to the following element, e.g. host="*" -->
<httpEndpoint host="*" httpPort="7680" httpsPort="9443" id="defaultHttpEndpoint"/>

<!-- Automatically expand WAR files and EAR files -->
<applicationManager autoExpand="true"/>


<applicationMonitor updateTrigger="mbean"/>

Open in new window

Change.bat contents-
@echo off
setlocal EnableExtensions DisableDelayedExpansion

rem First check if the file to modify exists in directory of batch file.
set "XmlFile=%~dp0\wlp\usr\server.xml"
if not exist "%XmlFile%" goto EndBatch

rem Define some environment variables which are needed later.
set "NewPort=47682"
set "LineNumber="
set "LineCount=0"
set "TmpFile=%TEMP%\%~n0.tmp"

rem Search for the line containing attribute httpPort and get its
rem line number and the line itself loaded into environment 

Open in new window

0
Industry Leaders: We Want Your Opinion!
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

I am desperately trying to make LibreOffice work in my environment as my users already use a base version of Office Online Apps (The package does not come with the full Office Client) which is 99% effective for them. However, there are certain cases when they require a program local to their computer which I was hoping LibreOffice would be good enough to use. In most cases it seems to work fine. However, sometimes when their main program (An EMR application) spits out an XML file but instead of opening in Libre Office I get the following error:

LibreOffice 5.3.6.1 - General Error. General input/output error

It only happens with some reports for this application so I fear the problem is something specific to the applicaiton, and not LibreOffice. Still, I wanted to check to see if there was any setting anyone was aware of that I could make this work for me since, if there isn't, I'll probably have to bite the bullet and buy (or subscribe to) Microsoft Office.

I have included the error as a screen-shot. It's not much and if there's something specific about the reports the users are running that might be of assistance I can try to get that for you as well.

Thanks
ERROR-REPORT.PNG
0
Hi,

I have been asked to add the following line to my XML file by our customer but I am unsure how to or what exactly it is? I know one part is referencing a namespace...

<ns0:IMG_DOCUMENT xmlns:ns0="urn://nagelgroup.com">

The XML document currently looks like this:

<?xml version="1.0" encoding="utf-8"?>
<DocumentProcessorGroups>
<group>
  <PageCount>1</PageCount>
  <FileCount>1</FileCount>
  <FileName>C:\12345</FileName>
  <Barcode>1223458421</Barcode>
</group>
<Variables>
  <NUMMER></NUMMER>
  <DATUM></DATUM>
  <KUNDENNR></KUNDENNR>
  <KUNDENNAME></KUNDENNAME>
  <BUKREIS></BUKREIS>
</Variables>
</DocumentProcessorGroups>


But need to look like this:
<?xml version="1.0" encoding="utf-8"?><ns0:IMG_DOCUMENT xmlns:ns0="urn://nagelgroup.com">
<DocumentProcessorGroups>
<group>
  <PageCount>1</PageCount>
  <FileCount>1</FileCount>
  <FileName>C:\12345</FileName>
  <Barcode>1223458421</Barcode>
</group>
<Variables>
  <NUMMER></NUMMER>
  <DATUM></DATUM>
  <KUNDENNR></KUNDENNR>
  <KUNDENNAME></KUNDENNAME>
  <BUKREIS></BUKREIS>
</Variables>
</DocumentProcessorGroups>

My current code is:

Dim xml As XDocument = New XDocument(
                    New XDeclaration("1.0", "UTF-8", String.Empty),
                    New XCData("ns0:IMG_DOCUMENT xmlns:ns0=""urn://nagelgroup.com"""),
                    New XElement("DocumentProcessorGroups",
                        New XElement("group",
                            New 

Open in new window

0
I have a XSD Schema and I have created C# classes. When  I tried to create an XML document using XmlSerializer class, the classes are created in such a way that  instead of namespaces in XML document, the namespaces are added as attributes.

I want to create like this

<decsub:saudiEDI xmlns:decsub="http://www.saudiedi.com/schema/decsub" xmlns:cm="http://www.saudiedi.com/schema/common" xmlns:deccm="http://www.saudiedi.com/schema/deccm"
xmlns:deckey="http://www.saudiedi.com/schema/deckey" xmlns:sau="http://www.saudiedi.com/schema/sau" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.saudiedi.com/schema/decsub.xsd" sau:docType="Text" sau:id="A0" sau:msgType="Text" decsub:docType="DEC" decsub:id="A0" decsub:msgType="H2HDECSUB">
      <decsub:record>
            <sau:payload xsi:type="decsub:declarationSubInfoType">
                  <decsub:reference>
                        <decsub:userid>String</decsub:userid>
                        <decsub:acctId>Stri</decsub:acctId>
                        <decsub:docRefNo>String</decsub:docRefNo>
                        <decsub:regPort cm:type="0">Str</decsub:regPort>
                        <decsub:declarationISN>9999999999</decsub:declarationISN>
                  </decsub:reference>
.......


And it comes like this

<saudiEDI xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" d1p1:docType="DEC" d1p1:id="AN20090107120342" d1p1:msgType="H2HDECSUB" xmlns:d1p1="http://www.saudiedi.com/schema/sau" xmlns="http://www.saudiedi.com/schema/decsub">
  <d1p1:record>
    <d1p1:payload…
0
hi,

I am going through below link

https://maven.apache.org/settings.html


what is importance of below entries and their sub entries

1. proxies
2. servers
3. mirrors
4. profiles has repositories and has internal and snapshot there

if i have say 4 projects in 4 workspaces with 4 settings.xmls how do i refer all of them in eclipse ?
say
workspace_1 should point to project_1 with settigs1.xml
similary
workspace_2 should point to project_2 with settigs2.xml
workspace_3 should point to project_3 with settigs3.xml
workspace_4 should point to project_4 with settigs4.xml

please advise
0
Hi, Please see the two attached bits of code. I am using XMLReader to parse an XML document, but I'm having trouble distinguishing between different nodes with similar names; which I would like to treat separately. For example:
Product->RecordSourceIdentifier->IDValue,
Product->ProductIdentifier->IDValue,
Product->Distributors->Distributor->IDValue

Could anyone please describe how I can accomplish this?
testxmlreader.php
products.xml
0
Please see the attached XML, there are multiple resources,

I want to be able to find the resource whose name is "jdbc/PegaRULES" and create a new xml file which has only that resource.

For example: newfile.xml should be like:

<?xml version='1.0' encoding='utf-8'?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<!-- The contents of this file will be loaded for each web application -->
<Context>

    <!-- Default set of monitored resources -->
    <WatchedResource>WEB-INF/web.xml</WatchedResource>
	
<Resource
			auth="Container"
			name="jdbc/PegaRULES"
			type="javax.sql.DataSource"
			maxActive="100"
			maxIdle="30"
			maxWait="10000"
			username="user1"
			password="password1!"
			

Open in new window

0

XML

20K

Solutions

13K

Contributors

Extensible Markup Language (XML) refers to the encoding of documents such that they can be read by both machines and humans. XML documents use tags to show the beginning and end of a set of data. XML is used extensively on websites to show volumes of data, and is the default for a number of office productivity suites. This topic includes discussions of XML-related technologies, such as XQuery (the XML Query language), XPath (the XML Path language), XSLT (eXtensible Stylesheet Language Transformations), XLink (the XML Linking language) and XPointer (the XML Pointer language).