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

So I have an XML that is like this:
   <section ID="something"/>      //dont render
   <id root="123"/>
   <code code="8585"/>
   <section ID="something"/>     //dont render
   <id root="123"/>
   <code code="2222"/>
  <component>               //render everything starting from this component until the end of the XML
    <section ID="something"/>
    <id root="123"/>
    <code code="20"/>
    <section ID="something"/>      //render
    <id root="456"/>
    <code code="1"/>

Open in new window

What im having trouble is that I how to start rendering starting where the code/@code='20'.
I cant use position()>1 since there could be any number of <component> varies.
Containers & Docker to Create a Powerful Team
Containers & Docker to Create a Powerful Team

Containers are an incredibly powerful technology that can provide you and/or your engineering team with huge productivity gains. Using containers, you can deploy, back up, replicate, and move apps and their dependencies quickly and easily.

My XML looks like this:
<?xml version="1.0" encoding="UTF-8"?>
			<OrderDate>7/20/2017 7:45:26 AM</OrderDate>
			<BillTo />
			<Payments />
			<ShipTo />
					<FileCreationDate>7/20/2017 7:45:58 AM</FileCreationDate>
					<InventoryNumber />
					<AisleNumber />
					<BinNumber />
					<AddOns />
						<KeyPair key="Additional Information Items"></KeyPair>
					<SpecialInstructions>test 1</SpecialInstructions>
					<MerchandiseOptions />

Open in new window

I want to produce a CSV file that looks like this:
100045,Postcard,1,329.pdf,test 1

Open in new window

I am using this xslt:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" indent="no" encoding="utf-8"/>
<xsl:template match="LineItems">


<xsl:for-each select="LineItem">
<xsl:value-of select="LineItemId"/>
<xsl:value-of select="LineItemName"/>
<xsl:value-of select="Quantity"/>
<xsl:for-each select="Component">
<xsl:value-of select="FileName"/>
<xsl:value-of select="SpecialInstructions"/>



Open in new window

My result file contains this:
3297/20/2017 7:45:26 AMDemo_CustomerdemouserORDERLineItemId,LineItemName,Quantity,FileName,SpecialInstructions
100045,Postcard,1,test 1

Open in new window

Why are Elements at the top of the XML getting written to the result, and why isn't the filename getting written?
If there are resources to help me understand what I am doing wrong, please let me know. I'm new to this.  Thanks!
I have an xml file that looks like this:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<AnswerSet title="New Answer File" version="1.1">
      <Answer name="(ANSWER FILE DESCRIPTION)" save="false">
      <Answer name="(ANSWER FILE HISTORY)" save="false">
      <Answer name="City1">
            <TextValue>Los Angeles</TextValue>
      <Answer name="NameFirst">

I've done an import of xml into a SQL Server table before but I've never seen an XML file with 'Answer name' then the name of the field.  I can get so far as loading it via OPENROWSET and outputting a hyperlink, but after that, I'm lost since I don't have named elements like I'm used to seeing.
Hi All,

Given SQL Server 2008R2, a table table_name and column column_name that contains the below XML (heavily mocked up), I need to write a query that returns a set navigates down Envelope > Body > MyFabulousVacation > Reservation > AirSegment, and returns a set with four rows (one for each <AirSegment>) and these columns
Group, Carrier, FlightNumber, Origin, Destination, DepartureTime
ArrivalTime, SupplierCode, ClassOfService, OperatingCarrier

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/wahoo/">
  <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <MyFabulousVacation xmlns="http://yabba.dabba.doo/schema/">
      <reservation Key="bkgoU0BAAA/BM8PzEHAAAA==" TotalPrice="USD569.56" BasePrice="USD56.00" Taxes="USD513.56" xmlns="http://yabba.dabba.doo/schema/">
        <AirSegment Key="bkgoU0BAAA/BI8PzEHAAAA==" Group="0" Carrier="ZZ" FlightNumber="32" Origin="HOME" Destination="HERE" DepartureTime="2017-11-14T10:45:00" ArrivalTime="2017-11-15T15:40:00" ProviderCode="1P" SupplierCode="ZZ" ClassOfService="K">
          <CodeshareInfo OperatingCarrier="ZZ" />
          <Connection />
        <AirSegment Key="bkgoU0BAAA/BJ8PzEHAAAA==" Group="0" Carrier="ZZ" FlightNumber="7971" Origin="HERE" Destination="THERE" DepartureTime="2017-11-15T18:15:00" ArrivalTime="2017-11-15T23:35:00" ProviderCode="1P" SupplierCode="ZZ" ClassOfService="K">

Open in new window


I have a contact form with an XML that loads the contact information in the contact form. I am busy adjusting this. Instead of a dropdown, I want to build an ajax life search. Can someone help with that? I like to hear it

I am calling the stored procedure using these parameters.
All but the last column (Mulitplier are varchar or nvarchar fields, so xml is fine.  How must I change things to update the multiplier field which is decimal (18,9)?

exec concord_updateDSEmatchedIndexDatatypeNotFutures @RIC='.HKCES120',
@dtvalues='<root><dts><rtrcol>Unadjusted High (col 43)</rtrcol><dt>PH</dt><multiplier>2</multiplier></dts><dts><rtrcol>Unadjusted Last Trade (col 71)</rtrcol><dt>PI</dt><multiplier>
2</multiplier></dts><dts><rtrcol>Unadjusted Low (col 57)</rtrcol><dt>PL</dt><multiplier>
2</multiplier></dts><dts><rtrcol>Unadjusted Open (col 155)</rtrcol><dt>PO</dt><multiplier>

Open in new window

ALTER proc [dbo].[concord_updateDSEmatchedIndexDatatypeNotFutures] @RIC varchar(24),
@indextype char(2),@dtvalues xml

set nocount on 

if not exists (select 1 from DSEMatchedIndex with (nolock) where Ric = @Ric)
	raiserror('RIC %s not in DSEMatchedIndex',15,127,@RIC)

DECLARE @ErrorMessage NVARCHAR(4000) 
DECLARE @ErrorSeverity INT 
DECLARE @ErrorState INT   

declare @rectype char(2)
if @indextype in ('CC','CS','CO')
	set @rectype = 'PT'
	set @rectype = 'P0'           

create table #idt (
	RIC   varchar(24) COLLATE SQL_Latin1_General_CP1_CS_AS,
	RtrColumnDesc varchar(90),	
	datatypemnem    varchar(6),
	multiplier int

insert #idt(                

Open in new window

The SQL below builds a test XML variable
WHat I need to do in SQL Server is loop through the nodes...
For EACH demovalue... in @XMLVar

Declare @IndividualID INT
Declare @CustomID INT
Declare @Commentsl VARCHAR (100)
SET @IndividualID = @XMLVar.....demovalues/demovalue/ind..value
Set @Comments  = @XMLVar.....demovalues/demovalue/val..value
Set @CustomID = (Select id from myDemoTable where DemoText = )
(I know I butchered that...)

And then,,,
 INSERT INTO indDemoTable (IndividualID, CustomID, Comments)
Select @IndividualID, CustomID, @Comments

SET @Var = '<demovalues><demovalue><ind>123456</ind><id>holder</id><val>TEST TEXT 33</val></demovalue><demovalue><ind>123457</ind><id>holder</id><val>TEST TEXT 34</val></demovalue></demovalues>'

Open in new window

Customer Table                          SalesOrderHeader Table                      
==============                         ==============
CustomerId                                    [SalesOrderID]
[AccountNumber]                         [CustomerID]
[TerritoryID]                                   [OrderDate]

Below, there are 8 xml presentations (XML_A, XML_B,...XML_H). Only XML_A has a description as shown below.

Question: Could you please provide the description for each of XML_B, XML_C, ..., XML_H?

I have the description for XML_A shown below. I need a similar description for each of XML_B, XML_C, ..., XML_H below:.
XML_A description: display rows from the SalesOrderHeader table for the Customer row  
<row SalesOrderID="43793" OrderDate="2011-06-21T00:00:00" SubTotal="3399.9900" AccountNumber="AW00011000" TerritoryID="9" />
<row SalesOrderID="51522" OrderDate="2013-06-20T00:00:00" SubTotal="2341.9700" AccountNumber="AW00011000" TerritoryID="9" />
<row SalesOrderID="57418" OrderDate="2013-10-03T00:00:00" SubTotal="2507.0300" AccountNumber="AW00011000" TerritoryID="9" />

XML_B: >>> display what.... (You provide the description for this  XML)<<<

Open in new window

I have the following xml file that I would like to read in c#.

It should be simple but I am having a little trouble reading the 'Items' in the file.  I would like to read the code and description for each 'item' in the file.  I would like to use linq but as I said, I am having a little trouble.

As always, all help appreciated



<?xml version="1.0" encoding="UTF-8" ?>
<examplepartner xmlns="http://www.example.com/example">
<Description>Item 1</Description>
<Description>Item 2</Description>
<Description>Item 3</Description>
I have an XML file (see Attached file)  with a pdf file attached to it, which can be found at the following path


I tried decoding the mimeCode (assuming this was decoded with base64?) and then tried to save it to a pdf file using a TStringStream... but it just gives me an empty pdf file.

ss := TStringStream.Create;
str := IdDecoderMIME1.DecodeString( str );
ss.WriteString( str );
ss.Position := 0;

Open in new window

How can I extract the pdf file from the xml and save it to a file?
Independent Software Vendors: We Want Your Opinion
Independent Software Vendors: 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 have something like:

<myrep  f="ccy">USD</myrep>
<myrep  f="country">GB</myrep>
<myrep  f="amount">13000</myrep>

How can I validate in an XSD when attribute is ccy to take only iso currencies, when is country to allow only country codes and when in amount to take long?

Thank you
Hello - I have a DataSet that was created by importing data from XML using Dataset.ReadXML.

How do I display the relations in the DataSet ?

Thank you
I am trying to embed automatically today's date (DDMMYYD10.) and XML records counts in the XML data file header. Is there an automatic way in SAS how to do that?

This is where today's date and record counts would go:
put &tab2. '<SampleDate>2017-06-27</SampleDate>';
 put &tab2. '<CaseCount>10</CaseCount>';

Open in new window

Full SAS code:
filename DirectX  "&basepath\examples\XMLData2.xml";
filename Complete "&basepath\examples\XMLComplete2.xml";

libname xmldir xmlv2 xmlfileref=DirectX xmltype=generic;

/* Macro variables to provide appropriate tab spacing */
%let tab="    ";
%let tab2="        ";

/* Writing two SAS datsets to xmldir library and creating XMLData.xml data file */ 
data xmldir.class(label="dataset class from sashelp library");
       set sashelp.class(obs=10);

data xmldir.cars(label="dataset cars from sashelp library");
       set sashelp.cars(obs=10); 

libname xmldir clear;

/*  XML file information and header and XML File End*/
data _null_;
 infile	DirectX end=last;
file	Complete;

if _N_ = 1 then
	put _infile_;	
    put '<Schema Name="CarsAndClass">';
    put &tab. '<Header>';
    put &tab2. '<SampleDate>2017-06-27</SampleDate>';
    put &tab2. '<CaseCount>10</CaseCount>';
    put &tab2. '<Action>Initial</Action>';
    put &tab2. '<YearPeriod>2017</YearPeriod>';
    put &tab. '</Header>';
    put &tab. '<Payload>';
	put &tab2 _infile_;	
if last then
    put &tab'</Payload>';		
    put '</Schema>';

Open in new window

the XML returned through  certain application  APIs regarding some persons is the following:

<users total_record_count="1">
<user link="http://somelink.com">
<gender desc="Male">MALE</gender>
<status desc="Active">ACTIVE</status>

Open in new window

calling these  APIs using PHP curl inside a file (say user.php):

$ch = curl_init();
$url = 'http://somelink.com';
$queryParams = '?' . urlencode('limit') . '=' . urlencode('10') . '&' . urlencode('offset') . '=' . urlencode('0') . '&' . urlencode('q') . '=' . urlencode('primary_id~PTRFBN65E13L483Q') . '&' . urlencode('apikey') . '=' . urlencode('l7xx08bb6c218cb54cc9bfae5aab76c67a19');
curl_setopt($ch, CURLOPT_URL, $url . $queryParams);
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
$response = curl_exec($ch);
echo $response;

Open in new window

gives me the desired results on the browser, but without any separator:
How can I format the resulting data?
I.E. may I "pipe" the content of $response in an array and then sutably format every member?
Thanks a lot in advance for the reply,
Hi Experts,

I use the following Invoke-Command to get values from remote xml files.

$tchome = 'c:\app\location'
$pointr = 'someuser2'
$output = Invoke-Command -ComputerName appserver -ArgumentList ($tchome,$pointr) -ScriptBlock {
      Param($tchome, $pointr)
      $xmldata = [xml](Get-Content $tchome\conf\context.xml)

Is there a way by which I can get these xml values from remote systems without using Invoke-Command because some of the servers have spn in them and give me the Kerberos authentication issue while executing scripts. (I dont have access to change the setspn as well to prevent this issue)

I would like to use some alternative (like Get-WmiObject) which does not cause the Kerberos error.

Details of error while using Invoke-Command:

[serv1] Connecting to remote server vpacdev failed with the following error message : WinRM cannot process the
request. The following error with errorcode 0x80090322 occurred while using Kerberos authentication: An unknown
security error occurred.
 Possible causes are:
  -The user name or password specified are invalid.
  -Kerberos is used when no authentication method and no user name are specified.
  -Kerberos accepts domain user names, but not local user names.
  -The Service Principal Name (SPN) for the remote computer name and port does not exist.
  -The client and remote computers are in different domains and there is no trust between the …
I am trying to create a Json object in C# that I will convert to XML.   I have a repeating set of Fees that I need to add to the json object.

Here is my code so far:

root.Deal.Fees = new ExpandoObject();
List<ExpandoObject> feeArray = new List<ExpandoObject>();

foreach (DataRow ro in ds.Tables["fees"].Rows)
    root.Deal.Fees.DealFees.Fee.Description = ro["fee_type"].ToString();;
    root.Deal.Fees.DealFees.Fee.Amount = ro["amount"].ToString();


Open in new window

No sure what else is needed.   Supply a different example if that is easier for you.
Thank you

I am writing a VB6 program to read an XML file.  The XML has encoding="UTF-8".

I have everything working with the exception of the embedded attachments.  There is a file name (jpg, doc, etc.) which I can pick up.  My problem is that the data element is just a bunch of characters.  Somehow I need to take the group of characters and convert it to a jpg or doc file.  

Does anybody know if this is possible,  and if so,  how is it done?

Thanks for your help!
I'm getting "duplicate attribute" error when attempting to create this document.  Is it not allowed to have the multiple Filter Field entries?

<?xml version="1.0" encoding="utf-8" standalone="no"?>
<ApiDocument xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://microsoft.com/wsdl/types/">
      <Filter Field="FiscalDate" Operator="Greater than or equal" Value="2017-06-19T00:00:00.000" />
      <Filter Field="FiscalDate" Operator="Less than" Value="2017-06-20T00:00:00.000" />
      <Filter Field="Location" Operator="Equal" Value="100" />
      <SortDescription Name="FiscalDate" Direction="Ascending" />
Dear experts,
I am facing a request from a customer, who maintains about 500 product sheets to different products. So far all the data were kept in Word and PDF files were made manually. Th maintenance was a nightmare and publishing online was nearly impossible.

Now the product sheets will be saved in a database / XML so that with help of some CSS libraries/frameworks (bootstrap etc.) site nice layout can be achieved while keeping the simplicity of editing content in a database and displaying the sheets online. For better reading and design reasons the sheets will contain TWO columns on normal screen and paper and 1 column only on mobile devices. This all is doable. Somehow.

However the next requirement is to be able to generate PDFs out of the same source (database/xml) and the PDF shall, of course, keep the layout for DIN A4 paper - header, footer, two columns, which flow always on first page from left column to right column and then on next pages again from left to right column. Like when you load a text in indesign for example. So that the PDFs when printed can be red.

Unfortunately the HTML page does not respect the fixed length of a DIN A4 paper and when showing two columns, they flow till the bottom of the page "infinitely".  When I tried to play with bootstrap for example, I was able to accomplish the HTML part, but then I was unable to either print it to PDF or even while using some PDF library to generate A4 standalone pages.

I hope I am expressing …
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 have a problem serialializing xml

I do not get all 3 values of 'liggingen' back in the object. I only get the first value. I tried to make a list, but no success.
What is the error in the user defined object?

This is part of the user defined object
Public Class MatenEnLigging
        Public Liggingen As Liggingen
        Public Inhoud As Integer
        Public Oppervlakte As Integer
End Class

Public Class Liggingen
        Public Ligging As String
End Class

And this is part of the XML
        	<Ligging>aan bosrand</Ligging>
            	<Ligging>aan rustige weg</Ligging>
	        <Ligging>beschutte ligging</Ligging>

Open in new window

( An extension of this question.. )

Given the below SQL Server 2008  T-SQL statement and XML fragment, how would I return the value 'Sammy Hagar' WHERE boo i:type="rockstar" ?
SET @x = '<goo xmlns="http://underdog.com" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
   <boo i:type="fruit">banana</boo>
	<boo i:type="rockstar">Sammy Hagar</boo>
	<boo i:type="planet">Mars</boo>
	<boo i:type="movie">Heathers</boo>
	<boo i:type="practicaljoke">Rick Roll</boo>
WITH XMLNAMESPACES ('http://underdog.com' as d) 
SELECT @x.value('(/d:goo/d:foo/d:boo)[1]', 'varchar(64)') AS the_amount

Open in new window

< Highly mocked up SQL Server 2008R2 T-SQL >
SET @x = '<goo xmlns="http://underdog.com" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
SELECT @x.value('(/goo/foo/boo)[1]', 'varchar(64)') AS the_amount

Open in new window

I'm expecting to return a the_amount value of 'banana', but I'm always getting NULL.  What's the fix?
Is it possible to check duplicate attribute values within same element using an XSD ?

For example:

<MyProduct  category="school" code="123">Pencil</MyProduct>
<MyProduct category="home" code="343">Vase</MyProduct>
<MyProduct category="home" code="752">Fork</MyProduct>
<MyProduct category="school" code="123">Eraser</MyProduct>

Open in new window

In the above example, a pencil and an eraser belong to same category and have same code. How can I control that no product ("MyProduct") can have same category *and* code?
(if possible)

Note: in above example, categories and codes have a specific list of values (i.e. I know I have 12 categories and 728 codes).
Thank you
I have to build an XSD and I need to have the following double conditions declared when I define an element.

1. For a given element, only a specific list of attributes is permitted. Example:

<MyElement  currency="USD" payment="online" other="today">some values here</MyElement>

Open in new window

I need MyElement to be allowed to have attributes only 'currency' and/or 'payment' but no 'other' .

1.1. For the ALLOWED attributes, I need to have a permitted list of values. Example:

<MyElement  currency="USD" payment="online">some values here</MyElement>

Open in new window

I need the 'currency' attribute to take only values USD, AUD.. etc as I specify in a list (I have a list ready)
And I need the attribute 'payment' to take one of the two values "online" or "cash".

How can I declare the MyElement in an XSD ?
Your help is much appreciated..
I have my XML file which was generated using Soap-UI and our testers are able to execute the test case by calling the api's from Soap-UI with out any issues. But when the same I integrated as a part of continuous integration using Maven I am not getting the result as expected. All of the test cases are failing

Here is the pom.xml I have
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<name>Maven 2 SoapUI Sample</name>

Open in new window







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