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

I need some advice on getting variables out of an XML response to a curl post.

The curl produces an xml response, eg:

<?xml version="1.0"?><ncresponse
orderID="TEST-21"
PAYID="304713xyz72"
PAYIDSUB="0"
NCSTATUS="0"
NCERROR="0"
ACCEPTANCE="test123"
STATUS="9"
IPCTY="99"
CCCTY="BE"
ECI="7"
CVCCheck="NO"
AAVCheck="NO"
VC="NO"
AAVZIP="NO"
AAVADDRESS="NO"
AAVNAME="NO"
AAVPHONE="NO"
AAVMAIL="NO"
amount="12.34"
currency="GBP"
PM="CreditCard"
BRAND="VISA"
TICKET="No Transaction found"
SUBBRAND="TEST"
ALIAS="010089D0-B4F9-876S-AA4E-14F807CB1889"
ECOM_BILLTO_POSTAL_CITY=""
ECOM_BILLTO_POSTAL_COUNTRYCODE=""
ECOM_BILLTO_POSTAL_STATEDESC=""
ECOM_BILLTO_POSTAL_STREET_LINE1=""
ECOM_BILLTO_POSTAL_STREET_LINE2=""
ECOM_BILLTO_POSTAL_POSTALCODE=""
CN="111"
ECOM_BILLTO_POSTAL_NAME_LAST=""
ECOM_BILLTO_POSTAL_NAME_FIRST="111"
ECOM_BILLTO_TELECOM_PHONE_NUMBER=""
ECOM_SHIPTO_POSTAL_CITY=""
ECOM_SHIPTO_POSTAL_COUNTRYCODE=""
ECOM_SHIPTO_POSTAL_STATEDESC=""
ECOM_SHIPTO_POSTAL_STREET_LINE1=""
ECOM_SHIPTO_POSTAL_STREET_LINE2=""
ECOM_SHIPTO_POSTAL_POSTALCODE=""
ECOM_SHIPTO_POSTAL_NAME_LAST="111"
NCERRORPLUS="!"
BIN="411111">
</ncresponse>

Open in new window


How do I extract each of the variables to use for further processing with PHP
0
Microsoft Azure 2017
LVL 13
Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

Dear Experts,
the below code, it works perfectly fine,

$xmlDATA = '<?xml version="1.0" encoding="utf-8"?><VposResponse><MerchantId>000000000125427</MerchantId><TransactionType>Sale</TransactionType></VposResponse>';

$xml = simplexml_load_string($xmlDATA);

echo $MerchantId = $xml->MerchantId;
echo "<br><br>";
echo $TransactionType = $xml->TransactionType;

Open in new window


however it doesn't work, altough it is the same data.

 $xmlDATA = htmlentities($_POST["BankResponse"]);


$xml = simplexml_load_string($xmlDATA);

echo "MerchantId :" .  $MerchantId = $xml->MerchantId;
echo "<br><br>";
echo "TransactionType :" . $TransactionType = $xml->TransactionType;

Open in new window


I don't understand why it is not working. what do you suggest I should do?
0
I am trying to insert this statement:
(SELECT STUFF((SELECT ',' + CAST(SEQUENCE_NO AS varchar(10)) + '-' + CASE WHEN OPERATION_TYPE IS NOT NULL THEN OPERATION_TYPE ELSE CASE WHEN SERVICE_ID IS NOT NULL THEN SERVICE_ID ELSE RESOURCE_ID END END FROM dbo.CT_Dashboards_Operations WITH (NOLOCK) WHERE (dbo.CT_Dashboards_Operations.TYPE = owo.TYPE) AND (dbo.CT_Dashboards_Operations.BASE_ID = owo.BASE_ID) AND (dbo.CT_Dashboards_Operations.LOT_ID = owo.LOT_ID) AND (dbo.CT_Dashboards_Operations.SPLIT_ID = owo.SPLIT_ID) AND (dbo.CT_Dashboards_Operations.SUB_ID = owo.SUB_ID) AND (dbo.CT_Dashboards_Operations.SEQUENCE_NO < op.SEQUENCE_NO) AND ((RESOURCE_ID <> 'INFO') AND ((OPERATION_TYPE <> 'QC_MTR') OR (OPERATION_TYPE IS NULL)) AND (NDE_Type IS NULL)) OR ((OPERATION_TYPE = 'QC_MTR') AND (LaborTicketCount = 0)) OR ((NDE_Type = 'XR') AND (Complete <> 1)) OR ((NDE_Type IS NOT NULL) AND (NDE_Type <> 'XR') AND (Qty_Accepted = 0)) FOR XML PATH('')), 1, 1, '') FROM dbo.CT_Dashboards_Operations)

Open in new window


Into this view:

SELECT        TOP (100) PERCENT owo.SITE_ID, dbo.SHOP_RESOURCE_SITE_VIEW.USER_1 AS Dashboard_Group, owo.PullDate, dbo.CT_InvDash_Items_Pass_06_All_Demand_Summary.MinOfPullDate, CASE WHEN MinOfPullDate IS NULL
                          THEN PullDate ELSE MinOfPullDate END AS PriorityDate, CASE WHEN Op.RESOURCE_ID = 'ASSY' THEN CASE WHEN op.OPERATION_TYPE LIKE 'HARDNESS%' OR
                         op.OPERATION_TYPE LIKE 'MARK%' THEN 'OTHER' ELSE 'ASSY' END ELSE 

Open in new window

0
Given this information...
POST /Sale/Application/v2/mypage.asmx HTTP/1.1
Host: b2b2.mywebsite.com
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://tempuri.org/Persist"

Open in new window




How would I post my xml data to a service in vb.net web page win 4.5 environment

I do NOT want to import the wsdl
0
Looking for a powershell script that sets locale for all servers to Ireland

Is there a handy way to do this?

Do i need to use it a regional XML file as link below

https://www.lewisroberts.com/2017/03/01/set-language-culture-timezone-using-powershell/
1
Stumped.
 Server 2012 core with 2 VMs. VM1 had a usb drive attached for backup.
When swapping drive, forgot to remove it in VM1 before I unplugged the cable to the usb drive. Couldn't start VM1 w/o drive at all. Got it reconnected. It didn't show up in VM settings under controller 0. Tried to re-add  it in settings but errors that the drive is already attached. Went into the xml file and removed anything pertaining to the usb drive and I must have taken out something I shouldn't have and it said it couldn't find the file. I'm pretty bad at xml'
Any ideas now to reconnect (or remove and re-add it) the usb drive to the virtual machine. I have the machine files. Would deleting the vm and creating a new vm and attaching the machine file. Any suggestions are very welcome.
Drive-already-attached.jpg
Not-initiate.jpg
0
Below is an excerpt of the XML code used to create the Ribbon in Access.

The bit I can't get to grips with is where are the images held for each button? It is defined here:  imageMso=""FileCheckIn"
So is the image "FileCheckIn" held within Access? In which case, how do I find the list of images that I can use? Or do I have to import them in?

The code is:
ID	RibbonName	RibbonXML
1	Dashboard	"<customUI xmlns=""http://schemas.microsoft.com/office/2006/01/customui"">
  <ribbon startFromScratch=""true"">
    <tabs>
      <tab id=""tabDashboard"" label=""Dashboard"" visible=""true"">
        <group id=""grpJobSheet"" label=""Job Sheet"">
          <button id=""btnArtwork"" size=""large"" label=""Artwork"" imageMso=""PhotoAlbumInsert"" onAction=""mcrgBillableTaskRecent.OpenBillableTaskRecentAP""/>
          <button id=""btnWeb"" size=""large"" label=""Web"" imageMso=""ViewWebLayoutView"" onAction=""mcrgBillableTaskRecent.OpenBillableTaskRecentW""/>
          <button id=""btnIn_houseProduction"" size=""large"" label=""In-house Production"" imageMso=""FileCheckIn"" onAction=""mcrgOrderProduction.OpenOrderProductionNoSupplier""/>

Open in new window

0
Hi,

I have the below xml stuff inserted into a clob column in a dummy table. I am aware that ideally it needs to be an xmltype column in the table but it is not possible to change from clob to xmltype now. Hence need your help with the extract and extractvalue functions to get the node values out from the below. I am not an expert into the xml world and hence please suggest.

<?xml version="1.0"?>
<tns:FIToFI xmlns:outdir="http://www.abcd.co.in/v2/outdir" xmlns:head="urn:iso:std:iso:20022:tech:xsd:head_pacs008.001.001.01" xmlns:pt="urn:iso:std:iso:20022:tech:xsd:pacs.008.001.04" xmlns:pt_supp="urn:cash:std:xsd:supp.pacs.008.v2" xmlns:tns="urn:cash:std:xsd:FIToFI">
  <tns:Header>
    <head:Fr>
      <head:OrgId>
        <head:Id>
          <head:OrgId>
            <head:AnyBIC>POINT1</head:AnyBIC>
          </head:OrgId>
        </head:Id>
      </head:OrgId>
    </head:Fr>
    <head:To>
      <head:OrgId>
        <head:Id>
          <head:OrgId>
            <head:AnyBIC>POINT2</head:AnyBIC>
          </head:OrgId>
        </head:Id>
      </head:OrgId>
    </head:To>
    <head:BizMsgIdr>ABCD1234567890</head:BizMsgIdr>
    <head:MsgDefIdr>pacs.008.001.04</head:MsgDefIdr>
    <head:BizSvc>BASH_GST</head:BizSvc>
    <head:CreDt>2019-02-10T01:59:02Z</head:CreDt>
  </tns:Header>
  <tns:Document>
    <tns:FIToFICstmrCdtTrf>
      <tns:GrpHdr>
        <pt:MsgId>KA09881902108848</pt:MsgId>
        <pt:CreDtTm>2019-02-10T01:59:02</pt:CreDtTm>
        

Open in new window

0
How can I use c# to search the alternate data streams of files? I have XML in the alternate data streams of files (word, powerpoint, excel, text, pdf). I would like to search the XML n the alternate data streams to find a search term. The end result I'm hoping to get to is a windows desktop form that allows users to select a folder, enter a search term then click a button to search the alternate data streams of every file in that folder then return a list of the files that have the search term. Is this possible? Any help is appreciated.
0
Greetings Experts!

Working with vbscript and a very limited knowledge of XML files, I'm trying to create a function that gets several pieces of information from the MaterialPosting element of an XML file.  

As long as I stick to elements that 1) are always present in the XML and 2) have values directly under the /JobInfo/MaterialPosting element, such as StockCode, I can get what I need but I'm having trouble retrieving the values of items that are one level deeper, such as Bins and Serials.  I was able to figure out how to get the value of the Bins/Bin element (see line 21 of the code below). However, it doesn't work for serials because the Serials element does not always exist.  

After spending the better part of a day with the Microsoft docs on XML Dom, my head is spinning and I still don't get it.  The code below is my latest attempt.  It returns an error of "object doesn't support this property or method" at line 11.  

How can I check to see if the element called Serials exists in my XML and, if the Serial element exists, retrieve its value?

Many thanks, in advance, for your help!



Dim objDom, objNodeList, Counter, myXML
   Set objDom = CreateObject("MSXML2.DOMDocument")
   objDom.LoadXML(XMLOut)

   Set objNodeList = objDom.SelectNodes ("//JobInfo/MaterialPosting")
       If objNodeList.length > 0 then

  ' Loop through each of the MaterialPosting elements
      For Counter = 0 To objNodeList.length - 1
          dim aSerialNode
          

Open in new window

0
Become a Certified Penetration Testing Engineer
LVL 13
Become a Certified Penetration Testing Engineer

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

BCP QUERY OUT, I am not sure how to query out, so i am attempting to output the headers which i will then combine with the data. I have never used query out to do this as we usually create a table and place the headers in the bcp the data out of the table then combine.   IS it possible to do this with query out..

                                                declare @outfile nvarchar(1000),@comrun nvarchar(500)
                        set @outfile = '\\eincutil01\Syteline\report\outputfiles\ezimmerman\'  + db_name() + 'PaperLessBak.csv'


                     SET @HEAD = 'BCP "select ''CONUM'',''LINE'',''CUSTPO'',''BILLTO'',''BILLTOADDR'',''SHIPTO'',''SHIPTOADDR'',''SHIPCODE'',''DESCTIPTION'',''ITEM'',
                                   ''DESCRIPTION'',''UM'',''QTYORDER'',''QTYREQUIRED'',''QTYSHIPPED'',''WHSE'',''DUEDATE'',''PROMISEDATE'',''CERTYPE'',''COFC'',''COLLECTACCT'',
                                   ''LOCATION'',''QTYONHAND'',''ITEMTOBECUT'',''ITEMTOCUTTO'',''QTYTOCUT'',''LOC'' " queryout ' +  @outfile +'  -c -t, -T -SEINCDATA01'
                                       PRINT  @HEAD
                        
                              exec master..xp_cmdshell @HEAD
                        
                              exec master..xp_cmdshell @HEAD

ERROR
usage: BCP {dbtable | query} {in | out | queryout | format} datafile
  [-m maxerrors]            [-f formatfile]          [-e errfile]
  [-F firstrow]             [-L lastrow]             [-b batchsize]
  [-n native type]          [-c character type]      [-w wide character type]
  [-N keep non-text native] [-V file format version] [-q quoted identifier]
  [-C code page specifier]  [-t field terminator]    [-r row …
0
Hello,

I'm working on a db export (Oracle 12c) where I need to export the data to xml. Since I really need to have logic in place to create the elements, I can't just do a straight-forward export. So, I'm using XMLTYPE with DBMS_XMLDOM.

My question is... I now need to get the result writen to a file. I know that dbms_output.put_line just won't cut it because of 1. it's limitations on size and 2. it's a resource hog. I have it in the code block below because I've been using it for debugging.

I've also looked at using UTL_FILE, but that also has limitations on size. So, after doing some research, I found that using either using dbms_xmldom.writetofile or DBMS_XSLProcessor.Clob2File might be my best option. The thing is, whether using UTL_FILE, dbms_xmldom.writetofile or DBMS_XSLProcessor.Clob2File, all of the examples I've found use a cursor. The way that I coded this, I can't figure out how to implement a cursor.

Please note that I've already gone through the process of creating a directory object as the system user in the db.
CREATE DIRECTORY xmldata as '/home/orace/xml';

And, I logged in as the oracle user on the server and created this "xml" directory in '/home/oracle/xml'.

Whether I try using dbms_xmldom.writetofile or put the the XML in a clob "l_xmltype.getClobVal()" and try to write, I'm always getting the "ORA-29280: invalid directory path" error and I really don't know what I'm missing.

I've shortened my function quite a bit for this question. …
0
I have used a macro supplied by Norie for importing data into Excel 2010, until I tried the attached XML. The imported numbers do not look right.

Original post and solution: https://www.experts-exchange.com/questions/29134758/Importing-an-XML-array-to-an-Excel-column.html?headerLink=workspace_answered_questions

Can anyone tell me what is broken about the xml file, or macro, which prevents importing?

Thanks

2.xml
0
Hello. Please forgive if this has been answered already. I've searched but couldn't find an answer though. I'm pretty new to XML in Oracle and I'm trying to create an XML extract from an Oracle 12c DB. Here is an example output that I'm trying to accomplish...

<?xml version="1.0" encoding="UTF-8"?>
<catalog catalog-id="master-catalog>
    <header>
        <image-settings>
            <external-location>
                <http-url>http</http-url>
                <https-url>https</https-url>
            </external-location>
            <view-types>
                <view-type>large</view-type>
                <view-type>medium</view-type>
                <view-type>small</view-type>
                <view-type>swatch</view-type>
            </view-types>
            <alt-pattern>${productname}</alt-pattern>
            <title-pattern>${productname}</title-pattern>
        </image-settings>
    </header>
    <product product-id="0">
        <ean/>
        <upc>0</upc>
        <unit/>
        <min-order-quantity>1</min-order-quantity>
        <step-quantity>1</step-quantity>
        <store-force-price-flag>false</store-force-price-flag>
        <store-non-inventory-flag>false</store-non-inventory-flag>
        <store-non-revenue-flag>false</store-non-revenue-flag>
...

Open in new window


This is what I've come up with so far...

SELECT XMLRoot(
  XMLElement("catalog", XMLAttributes('master-catalog' AS "catalog-id"),
    XMLElement("header",
      XMLElement("image-settings",
        XMLElement("external-location",
          XMLElement("http-url", 'http/'),
          XMLElement("https-url", 'https')
        ),
        XMLElement("view-types",
          XMLElement("view-type",'large'),
          XMLElement("view-type",'medium'),
          XMLElement("view-type",'small'),
          XMLElement("view-type",'swatch')
        ),
        XMLElement("alt-pattern",'${productname}'),
        XMLElement("title-pattern",'${productname}')
      )
    ),
    XMLElement("category", XMLAttributes("category-id", 'root'),
      XMLElement("online-flag",'true')
    ),
    XMLAgg(
      XMLElement("product", XMLAttributes(p.part_number AS "product-id"))
    )
  ), VERSION '1.0', STANDALONE YES).getClobVal() as XMLDATA
from products p
where p.buyable = 1;

Open in new window


When I run this I'm getting the following error:

ORA-19208: parameter 2 of function XMLELEMENT must be aliased
19208.  00000 -  "parameter %s of function %s must be aliased"
*Cause:    The indicated parameter of the XML generation function has not been aliased, although it is an expression.
*Action:   Specify an alias for the expression using the AS clause.
Error at Line: 26 Column: 15

Open in new window


I'm really not sure what exactly needs to be aliased. I'm not using XMLForest or anything and I did add an alias to the XMLRoot. Maybe the error I'm getting is because of something else I'm doing wrong. Is it even possible to have a hard-coded value in  XMLAttributes (e.g. the "master-catalog" in XMLElement("catalog", XMLAttributes('master-catalog' AS "catalog-id"))? Or, just maybe, there is a much better way for me to get the result I need.

Hopefully you can help me out.

Thanks,
Larry
0
I need to merge a bunch of xml files and save into 1 removing any duplicate entries
I'm getting errors in ConsoleApplication2 @ line         private history = new history();

Severity	Code	Description	Project	File	Line	Suppression State
Error	CS1519	Invalid token '=' in class, struct, or interface member declaration	ConsoleApplication2	d:\VB\Test\ConsoleApplication2\ConsoleApplication2\Program.cs	13	Active

Open in new window


any suggestions what the above is?

Unless there is a better way I was going to use sort on id to filter out duplicates with the newest file taking precedence over older


using System.IO;
using xml;

namespace ConsoleApplication2
{
    class Program
    {
        private history = new history();

        static void Main(string[] args)
        {
            string RootDir = @"C:\Users\user\AppData\Roaming\AppName\user";
            
            if (Directory.Exists(RootDir))
            {
                var Files = Directory.EnumerateFiles(RootDir, "history.xml", SearchOption.AllDirectories);
                foreach (string File in Files)
                {
                    this.history += xml.history.Load(File);
                }

            }
        }
    }
}

Open in new window


xml.cs

using System.Xml.Serialization;

namespace xml
{
    
    public class history
    {
        List<post> post{ get; set; } = new List<post>();
        private static string xmlFile { get; set; }

        public static history Load(string xmlFile)
        {

Open in new window

0
A number of years ago I designed a form in Adobe LiveCycle Designer. This document allowed me (users) to send the data that had been entered into the form as a xml file via email. This was handy since you could save the xml files and import a large number of them into excel at one time. I would like to know if it is possible to do this in the new versions of Acrobat (XI Pro). I found some JavaScript code that allow me to send the entire form, but then all of the data has to be re-entered into excel. I would appreciate and help of directionEmployee-Information.pdf
0
How do I convert the following nested XML creation:
 
Dim xmlKW As String = "  <keywords>" &
            vbCr & vbLf & "    <item>" &
            vbCr & vbLf & "      <name>angels</name>" &
            vbCr & vbLf & "      <enabled>true</enabled>" &
            vbCr & vbLf & "      <threshold>0.5</threshold>" &
            vbCr & vbLf & "    </item>" &
            vbCr & vbLf & "    <item>" &
            vbCr & vbLf & "      <name>there</name>" &
            vbCr & vbLf & "      <enabled>true</enabled>" &
            vbCr & vbLf & "      <threshold>0</threshold>" &
            vbCr & vbLf & "    </item>" &
            vbCr & vbLf & "    <item>" &
            vbCr & vbLf & "      <name>test</name>" &
            vbCr & vbLf & "      <enabled>true</enabled>" &
            vbCr & vbLf & "      <threshold>0.4</threshold>" &
            vbCr & vbLf & "      <pronunciations>" &
            vbCr & vbLf & "        <item>" &
            vbCr & vbLf & "          <phonemes>t eh s t</phonemes>" &
            vbCr & vbLf & "          <enabled>true</enabled>" &
            vbCr & vbLf & "        </item>" &
            vbCr & vbLf & "      </pronunciations>" &
            vbCr & vbLf & "    </item>" &
            vbCr & vbLf & "</keywords>"

to a serialised string using something similar to:

        public static string SetTime()
        {
            var dateTimeOffset = new DateTimeOffset(DateTime.Now);

            return JsonConvert.SerializeObject(new
0
I have a Premiere Elements 2018 .prel file that I want to open in Premiere Pro 6. That doesnt work. There are a few sites where one can downgrade a Premiere Pro file to an earlier PP-version, but so far I couldnt find anything for the change from elements to pro. The .prel file seems a relatigvely simple XML, can anyone guide me to edit it so that it can be opened in PremPro?
0
How do I create a JSON array in vb.net using Newtonsoft.JSON (json.net) from this xml string;

<?xml version="1.0" encoding="UTF-8"?>
<result>
  <version>2</version>
  <name>ListResult1</name>
  <model_name>ENGLISH</model_name>
  <my_list>test</my_list>
  <myitems>
    <item>
      <name>thing1</name>
      <enabled>true</enabled>
      <threshold>0.5</threshold>
      <types1/>
    </item>
    <item>
      <name>thing2</name>
      <enabled>true</enabled>
      <threshold>0</threshold>
      <types1s/>
    </item>
    <item>
      <name>thing3</name>
      <enabled>true</enabled>
      <threshold>0.4</threshold>
      <types1>
        <item>
          <otherthing1>text2</otherthing1>
          <enabled>true</enabled>
          <otherthing2>0</otherthing2>
          <otherthing3>true</otherthing3>
        </item>
      </types1>
    </item>
  </myitems>
</result>
0
Become a CompTIA Certified Healthcare IT Tech
LVL 13
Become a CompTIA Certified Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

I have the following input:

<root>
	<CollectMiscFeeRQ>
		<Payment xmlns="http://services.sabre.com/STL/v01">
			<Amount currencyCode="MXN">549</Amount>
			<FormOfPayment>
				<Cash/>
			</FormOfPayment>
		</Payment>
		<Payment xmlns="http://services.sabre.com/STL/v01">
			<Amount currencyCode="MXN">549</Amount>
			<FormOfPayment>
				<Cash/>
			</FormOfPayment>
		</Payment>
		<Payment xmlns="http://services.sabre.com/STL/v01">
			<Amount currencyCode="MXN">549</Amount>
			<FormOfPayment>
				<Cash/>
			</FormOfPayment>
		</Payment>
	</CollectMiscFeeRQ>
</root>

Open in new window



I want to group by FOP so that my output sums the total:

	<Payment xmlns="http://services.sabre.com/STL/v01">
		<Amount currencyCode="MXN">1647</Amount>
		<FormOfPayment>
			<Cash/>
		</FormOfPayment>
	</Payment>

Open in new window




I was trying to do something like this but it failed:

  <xsl:key name="paymentCash" match="stl:Payment" use="stl:FormOfPayment/stl:Cash"/>


      <xsl:for-each select="stl:Payment[stl:FormOfPayment/stl:Cash and generate-id(.)=generate-id(key('paymentCash', stl:FormOfPayment/stl:Cash)[1])]" >
....

but it would never enter the for-each clause.
0
I'm trying to deserialize an XML reponse into a C# class but due t the complexity of the XML and the re-use of names, Restsharp only gets the top level elements:

The elements I'm ooking to get are the Collection types where nodeType="System", I need a List of all of these that include the Objects for each collection and also the 'Real' objects that are within the Objects elements.

So, the result would be a list of Collections (e.g. Bedroom, Kitchen). Each item would have an Objects Collection, that contained a list of Objects (e.g. "TEMP_SP", "TEMP")

I'm using Restsharp but need the Class structure to handle full deserialization of the XML response.

<?xml version="1.0" encoding="UTF-8"?>

-<Collection xmlns="http://bacnet.org/csml/1.2" name="Test">


-<Collection name="Bedroom">


-<Struct name="Bedroom" nodeType="System">

<String name="location" value=""/>

<String name="address" value=""/>

<String name="description" value=""/>

<String name="template" value="vstat.xml"/>


-<Struct name="Objects">

<Real name="TEMP_SP" value="23" physical="/.bacnet/Birchall HQ/1300/analog-value,10" description="" displayName="GB Occupied Space Setpoint"/>

<Real name="TEMP" value="15.8905" physical="/.bacnet/Birchall HQ/1300/analog-input,2" description="" displayName="Conference Room Temp"/>

</Struct>

</Struct>


-<Struct name="Default System Dashboard" nodeType="Other">

<Enumerated name="Type" value="System"/>

<Enumerated name="Layout" value="2"/>


-<Collection 

Open in new window

0
Im trying to optimize SQL and XQuery  stored procedure to be as quick and efficient as possible in comparing old and new values.

The biggest slow down comes down to the FULL OUTER JOIN when comparing old folder counts to new folder counts.

Does anyone know a better way to write that? Or is that the best way to go?

	DECLARE 	@paramVcAccountID INT = 2,
	@paramVcUserID	INT = 2,
	@paramFolderUnreadCountDtoXml XML  =N'<?xml version="1.0"?>
<root xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <FolderUnreadCountDto>
    <FolderID>30</FolderID>
    <UnreadCount>0</UnreadCount>
  </FolderUnreadCountDto>
  <FolderUnreadCountDto>
    <FolderID>31</FolderID>
    <UnreadCount>0</UnreadCount>
  </FolderUnreadCountDto>
  <FolderUnreadCountDto>
    <FolderID>32</FolderID>
    <UnreadCount>361</UnreadCount>
  </FolderUnreadCountDto>
  <FolderUnreadCountDto>
    <FolderID>33</FolderID>
    <UnreadCount>9</UnreadCount>
  </FolderUnreadCountDto>
  <FolderUnreadCountDto>
    <FolderID>12109</FolderID>
    <UnreadCount>6</UnreadCount>
  </FolderUnreadCountDto>
  <FolderUnreadCountDto>
    <FolderID>12125</FolderID>
    <UnreadCount>0</UnreadCount>
  </FolderUnreadCountDto>
  <FolderUnreadCountDto>
    <FolderID>12143</FolderID>
    <UnreadCount>4</UnreadCount>
  </FolderUnreadCountDto>
  <FolderUnreadCountDto>
    <FolderID>12145</FolderID>
    <UnreadCount>0</UnreadCount>
  </FolderUnreadCountDto>
  <FolderUnreadCountDto>
    

Open in new window

0
readings.xml

Hi,

I want to import an XML array to excel column B and at the same time automatically create a running numerical index in column A (starting at 1).

See attached example of the XML data.

Is this possible?

Thank you.
0
I am having an issue with SQL not returning a value properly. I am using the following:
(Test_Value_One * 100) AS Test_Value_Goal
the value of Test_Value_One is .075. I am writing this to an xml file but the result displayed is: 7.500000000000000e+001
Not sure why this is occurring. Any assistance would be greatly appreciated.
0
I have a JsonHelper for deserliasing a string:

Public Module JsonHelper

    Public Function FromClass(Of T)(data As T, Optional isEmptyToNull As Boolean = False, Optional jsonSettings As JsonSerializerSettings = Nothing) As String

        Dim response As String = String.Empty

        If Not EqualityComparer(Of T).Default.Equals(data, Nothing) Then
            response = JsonConvert.SerializeObject(data, jsonSettings)
        End If

        Return If(isEmptyToNull, (If(response = "{}", "null", response)), response)

    End Function

    Public Function ToClass(Of T)(data As String, Optional jsonSettings As JsonSerializerSettings = Nothing) As T

        Dim response = Nothing

        If Not String.IsNullOrEmpty(data) Then
            response = If(jsonSettings Is Nothing,
                JsonConvert.DeserializeObject(Of T)(data),
                JsonConvert.DeserializeObject(Of T)(data, jsonSettings))
        End If

        Return response

    End Function

End Module

Open in new window


which worlks fine for

{{ Result: { Version: 2, Name: StatusResult, Database: ok, Licenses: ok, InternalServices: ok, ReportingService: ok } }}

Open in new window


However - how would I extend this to deserialise the following string:

"{""result"":{""version"":2,""name"":""UserResult"",""user"":{""login"":""admin"",""active"":true,""max_pending_requests"":10,""roles"":[""admin"",""prioritize""]}}}"

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).