We help IT Professionals succeed at work.






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


I am parsing an XML file but as this breaks there is no clear way to see at which record this fails, hence I have added a console log each value such as:

   Dim sqlConn = New SqlConnection(ConfigurationManager.ConnectionStrings("ProjectConnectionString").ToString)
            Dim ds As DataSet = New DataSet()
            Dim dt As DataTable = New DataTable
            'dt.Columns.Add("IDNumber", GetType(Integer))
            dt.Columns.Add("code", GetType(Integer))
            dt.Columns.Add("stage", GetType(String))
            dt.Columns.Add("systemplantreference", GetType(String))
            dt.Columns.Add("equipmentdescription", GetType(String))
            dt.Columns.Add("[level]", GetType(String))
            dt.Columns.Add("location", GetType(String))
            dt.Columns.Add("detailsnotes", GetType(String))
            dt.Columns.Add("duration", GetType(Integer))
            dt.Columns.Add("targetreportdate", GetType(Integer))
            dt.Columns.Add("progress", GetType(Integer))
            dt.Columns.Add("reporteddate", GetType(DateTime))
            dt.Columns.Add("start", GetType(DateTime))
            dt.Columns.Add("[end]", GetType(DateTime))

            Dim dr As DataRow
            For Each _dr As DataRow In ds.Tables(0).Rows
                dr = dt.NewRow

                'dr("IDNumber") = _dr(0)

Open in new window

this is a VBscript  How do I convert the xml response to a text file without the tagnames?

Dim xml : xml = PostURL(HRP_BaseDomain & path, values)

Dim oXMLDoc, oXMLHTTP, oXMLResults, oXMLFields
Function PostURL(path, values)
   LogItem "path: " & HRP_BaseDomain & "   " &  path : LogError : Err.Clear
   On Error Resume Next
   set oXMLHTTP = createobject ("MSXML2.XMLHTTP.6.0")
   oXMLHTTP.open "POST", path, false
   oXMLHTTP.setRequestHeader "Content-type","application/x-www-form-urlencoded"
  oXMLHTTP.send values
   LogError : Err.Clear
   PostURL = oXMLHTTP.responseText
End Function

Open in new window

using C# remove the root node in an xml
<?xml version="1.0" encoding="utf-8"?>
<string xmlns="http://www.w3.org/2001/XMLSchema-instance"><Member xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

I want to remove
<string xmlns="http://www.w3.org/2001/XMLSchema-instance">
so it will look like this:

<?xml version="1.0" encoding="utf-8"?>
<Member xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
public int Calculator(int fristno, int secondno)
            return(fristno + secondno);

this will give int as an element tag. how do I customized that?
I have a potential client that is using an ERP system called Priority which produces various documents such as invoices using a Word template with mapped XML fields.

Sometimes they will produce a single document, sometimes it is a batch.

They want the document to say different things depending on the data.

If this were a Word mail merge I would use a If..Then..Else field in the mail merge, but they tell me that isn't working.  I guess that is because they aren't running a Word merge.

Can you use IF fields in this XML situation, if so how?
I am trying to Build a SOAP Request using a  string builder.

                strbuilder.Append("<soapenv:Envelope xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:soapenv=""http://schemas.xmlsoap.org/soap/envelope/"" xmlns:urn=""urn:IKosWebIntf-IKosWeb"">").AppendLine()
                strbuilder.Append("<urn:ImportCompany soapenv:encodingStyle=""http://schemas.xmlsoap.org/soap/encoding/"">").AppendLine()
                strbuilder.Append("<Customers xsi:type=""xsd:String"">" + xml + "</Customers>").AppendLine()
                strbuilder.Append("<Method xsi:type=""xsd:int"">0</Method>").AppendLine()

The Output I get is:  

{<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:IKosWebIntf-IKosWeb">
<urn:ImportCompany soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<Customers xsi:type="xsd:String"><COMPANYS><COMPANY><COMPANY_CODE …
i have an application that can work in ONLINE mode and OFFLINE mode
When application starts, it read a config.xml where it find parameters to start offline or online
My goal is make two small batch file for my user so it can change to OFFLINE and ONLINE without make complex change on xml file
something like put 3 file in directory C:\application:
Config.xml (really used)

ONLINE and OFFLINE is only a copy oh the same file with different parameters

My problem is not make mistake with file in use, so batch file has to rename and manage file in the right way!
Checking some condition in order to understand if now is ONLINE or OFFLINE
Example -> two batch rename other with _NOUSED, and two batch when start check if any files are named with _NOUSED in order to understand which is used!

Please help! Thanks!
I have this statement that I would like to run in python as a for each loop then insert all of the data into a table...… I'd like to use pyodbc and maybe pull the data into dataframes…. ?? then take the panda df and insert into a table, but the first thing is to get this running for every table

the first query would be to get the tables then loop thru each table and run the last query

select * from sys.tables- Get this into a variable or list and loop thru and run the below query 

--Filter out all of dates, and the id attributes metadata
 DECLARE @Table SYSNAME = 'ArrestInfo'
-- REVERSE and STUFF used to remove trailing UNION in string
                                     + ', COUNT(DISTINCT(' 
                                     + QUOTENAME(name) + ')) AS [Count] FROM '
                                     + QUOTENAME(@Table) + ' Group by ' + name + '' + ' UNION ' 
                              -- get column name from sys.columns  
                              FROM   sys.columns 
							  WHERE  object_id = Object_id(@Table) 

                              -- concatenate result strings with FOR XML PATH
                              FOR XML PATH (''))), 1, 7, ';'));

Open in new window

I want to read SSIS package code into a PowerShell variable and parse for the VersionBuild. I've found examples online and it works for some but not others. I've come across two formats of XML, one seems for an older versions of SISS, one for newer. The two different versions are below and the code examples I've found work for the older versions but not newer.

The code I'm using is:
[xml]$pkgCode = Get-Content -Path $pkg.FullName
$verNode = $pkgCode.Executable.Property | Where-Object {$_.Name -Like 'VersionBuild'}
$BuildVersion = $verNode.'#text'

Open in new window

Is there code that will work reading either XML format?

Older version (I can parse this)
<?xml version="1.0"?><DTS:Executable xmlns:DTS="www.microsoft.com/SqlServer/Dts" DTS:ExecutableType="SSIS.Package.2">
<DTS:Property DTS:Name="PackageFormatVersion">3</DTS:Property>
<DTS:Property DTS:Name="VersionComments"></DTS:Property>
<DTS:Property DTS:Name="CreatorName">WFS\Mahesh.Sabne</DTS:Property>
<DTS:Property DTS:Name="CreatorComputerName">CSN-C-SABNEM01</DTS:Property>
<DTS:Property DTS:Name="CreationDate" DTS:DataType="7">4/24/2012 12:28:56 AM</DTS:Property>
<DTS:Property DTS:Name="PackageType">5</DTS:Property>
<DTS:Property DTS:Name="ProtectionLevel">0</DTS:Property>
<DTS:Property DTS:Name="MaxConcurrentExecutables">-1</DTS:Property>
<DTS:Property DTS:Name="PackagePriorityClass">0</DTS:Property>
<DTS:Property DTS:Name="VersionMajor">1</DTS:Property>
<DTS:Property DTS:Name="VersionMinor">0</DTS:Property>
<DTS:Property DTS:Name="VersionBuild">526</DTS:Property>
<DTS:Property DTS:Name="VersionGUID">{B026A66C-971C-47D9-84D2-4A8075450EF0}</DTS:Property>

Open in new window

Newer version (returns nothing with my code)
<?xml version="1.0"?>
<DTS:Executable xmlns:DTS="www.microsoft.com/SqlServer/Dts"
  DTS:CreationDate="3/25/2013 2:31:59 PM"

Open in new window

Is it possible to generate a data model class in C# given this snippet?

I am looking for either automation or programmatic solutions, but I want to actually generate a C# class FROM the XML snippet!

(Specifically, given a complex type)

Something like:

public class ServiceAppointment
public ServiceAppointment(){}

public string AccountId;
public double ActualDuration;




<complexType name="ServiceAppointment">
<extension base="ens:sObject">
<element name="Account" nillable="true" minOccurs="0" type="ens:Account"></element>
<element name="AccountId" nillable="true" minOccurs="0" type="tns:ID"></element>
<element name="ActivityHistories" nillable="true" minOccurs="0" type="tns:QueryResult"></element>
<element name="ActualDuration" nillable="true" minOccurs="0" type="xsd:double"></element>
<element name="ActualEndTime" nillable="true" minOccurs="0" type="xsd:dateTime"></element>
<element name="ActualStartTime" nillable="true" minOccurs="0" type="xsd:dateTime"></element>
<element name="Address" nillable="true" minOccurs="0" type="tns:address"></element>
<element name="AppointmentNumber" nillable="true" minOccurs="0" type="xsd:string"></element>
<element name="ArrivalWindowEndTime" nillable="true" minOccurs="0" type="xsd:dateTime"></element>
<element name="ArrivalWindowStartTime" nillable="true" minOccurs="0" type="xsd:dateTime"></element>
<element name="AttachedContentDocuments" nillable="true" 

Open in new window

In a stored procedure i receive an XML as a parameter.  It looks like:


Open in new window

I need to do some processing on each <id> tag.  My first thought was to place them in a temporary table and then use a cursor to read each one and do the neccessary processing.

However there may be a way to traverse the XML in a cursor like scenario so i do not need the temporary table and you are welcome to suggest a solution.

How would extract each <id> tag and place it in a temporary table?

I am thinking:

Traverse the xml, extract <id> tag, and create a temp table

Create cursor to traverse table

While cursor returns data DO
  Process the current <id>.
end ;

Open in new window

Thanks in advance!
I am creating an XML file with VBA, certain characters are not allowed and I'm trying to filter them out.

Does anyone know what this is: 

If I paste into word it gives me a question mark in a box. If I look at the record in SQL or Notepad, it just shows as a space.
Hi all

I want to be able to pass a "wardTitle" variable to the XML from this page and be able to save just the resulting details as json.

The following returns a XML file of all our councillors and their details. I want to be able to filter on the passed "wardTitle" and only then return the details associated with the councillors who come under that wardtitle


For example If I pass "Cheriton Ward" only the node <wardtitle>Cheriton Ward</wardtitle> would be returned with all it's children so thats the <councillors node> and 3 <councillor> nodes with their associated content

I have tried using xpath but It then seems really cumbersome to iterate through every single node rather than just be able to grab that and convert it to json

one of the 3 councillor nodes for Cheriton ward

I hope that makes sense, if not please shout :(
I had this question after viewing Change a specific key value in app.config file with another value..

I have a very similar issue but the solution provided to the question above is not working for me. The .xml file that I want to update has entries like the ones below. I need to update some of the entries not all. The values that I will provide need to be stored as variables, not hard coded.

<?xml version="1.0" encoding="utf-8"?>
  <setParameter name= "MachineValidationKey" value="" />
  <setParameter name= "Smart Card Auth URI" value="https://localhost/SmartCardAuthService/" />
  <setParameter name= "MachineDecryptionKey" value="" />

My code (based on the previous answer) is below. Is the "add[@key]" specific to the config file or is that a construct for the SelectSingleNode?  

$filename = 'server1.xml'

$XPath = "parameters/setParameter/add[@key='MachineValidationKey']"

#$XPath = "parameters/setParameter/add[@name='MachineValidationKey']"

$Attribute = "value"
$machinekey = 'SecretString123'

$xml = [xml] (Get-Content -Path $filename)


$xml.SelectSingleNode("parameters/setParameter/add[@name='MachineValidationKey']").SetAttribute("value", "$machinekey")


But is resulting in the …

I'm trying to export my data to an excel document.

this is my first time doing it in MVC C# so I need your help please.

Do I need to create a view document for "ExportToExcel " ?

I'm doing the example that is in this URL:

Thank you for your help ;-)

Filtering the data in my model

    public List<RuleDetail> RuleDetailList(CABRSearchRules model)
            List<RuleDetail> modelList = new List<RuleDetail>();

            IEnumerable<CABR_RuleDetail> list = new List<CABR_RuleDetail>();
            IEnumerable<CABR_HistoryRuleDetail> Historylist = new List<CABR_HistoryRuleDetail>();

            if (model.SelectedCurrentOrHistoryID == 1) //Current
                list = _unitOfWorkCABusinessRules.RuleDetailRepo.GetAll().ToList();

                //Filter Status
                if (model.SelectedStatus != null)
                    list = list.Where(x => x.isActive == model.SelectedStatus);

                //Filter Environment
                if (model.SelectedEnvironment != "All")
                    list = list.Where(x => x.Environment == model.SelectedEnvironment);

                //Filter Version
                if (model.SelectedVersion != null)
                    list = list.Where(x => model.SelectedVersion.Any(m => Equals(x.Version, m)));

                //Filter CQ Ticket
                if (model.SelectedCQticket != null)
                    list = 

Open in new window

I am sending form data to a 3rd party API but get this error:

HTTP/1.1 415 Cannot process the message because the content type 'application/x-www-form-urlencoded' was not the expected type 'text/xml; charset=utf-8'

So, I am trying to troubleshoot by sending the data via Postman but getting the same error. Not really sure how to resolve this? I have been trying to change the content type to text and xml etc. but still keep getting similar errors.

In the headers I have:

Content-Type : application/xml

Not sure if that needs to change
Hello Experts;
I'm trying to parse out nodes from an XML string, which is saved in a txt field in my sql database. I am not experiences w/ XML data files btw.
The string doesn't start at the root and the field isn't type xml.  

Attached is an picture of the text field with the elements I'd like to query out:  

For example; I'd like to be able to pull <PitchType> from the records starting with <PitchPush>.

I've tried cross apply XML_Data.notes(...) and as the field isn't a type xml it errors.
I've seen methods that use the namespace, or refer to 'if you have the root'; neither of which are the case for my data.  

Are there methods for this? If necessary I'm willing to pull the strings into a csv & import to temp table. This data will be static when (if) I can get to it.

Thank you!
i have no idea what i am doing here... short story - our phone system is capable of integrating with our CRM but it isn't working. i believe the problem is that the phone number of the incoming caller is being passed from the phone system to the crm without any hyphens in the string but all the phone numbers stored in the crm have hyphens in them and the match never takes place. i have confirmed this by hard coding a phone number into the xml "xsi" template stored on the phone server that facilitates the query of the crm - when i do this, it finds a match and everything is happy.

so, my question is - is there a way in the xml file to "transform" the string being passed from the phone system and add a hyphen to it? i have almost no experience with xml.

it seems the value in the xml file is called Number and is used like this: $filter=contains(telephone1,'[Number]')

i would love to create a variable that i could use instead of Number and put a hyphen in it and just use that everywhere instead of '[Number]'.

am i making any sense? many thanks in advance.

I need help in XSLT.

In my XSLT, I have many links in href previously.
For sme reason I need to move entire web app to virtual folder.

Now, I have to place another variable before all href link with
so, previously, link was
{//web/menu[@title='Contact Us']/@url}

Now after modifying link become as below
{$virtualFolderPath}{//web/menu[@title='Contact Us']/@url}

Sample XSLT code below:
<xsl:if test="//web/menu[@title = 'Contact Us']">
      <a href="{$virtualFolderPath}{//web/menu[@title='Contact Us']/@url}" class="dropdown-toggle main-links">Contact Us</a>

Problem Statement:

If link is full link like:
then href link become
as path in
{$virtualFolderPath} is /b2c

How should I fix so that if URL starts from
then do not add my path:
and URL should be direct

Please guide.
I receive "Invalid argument supplied for foreach()" when I am parsing an XML file.  The program goes ahead and parses out the data, but I need to understand the warning, then do what is needed to get rid of it.  My code is below.  It is the second 'foreach' that throws the warning (5th line).

Any help will be much appreciated!

foreach($data->STRUCTURES->ROOF as $roofingItem) {
while($i <= $count) {
      foreach($data->STRUCTURES->ROOF[$i]->LINES->LINE as $lineitem) {
            if($type == "VALLEY") {
                  $valley=$valley + $data->STRUCTURES->ROOF[$i]->LINES->LINE[$ii]['length'];
            if($type == "RIDGE") {
                  $ridge=$ridge + $data->STRUCTURES->ROOF[$i]->LINES->LINE[$ii]['length'];
            if($type == "Eave") {
                  $eave=$eave + $data->STRUCTURES->ROOF[$i]->LINES->LINE[$ii]['length'];
            if($type == "Rake") {
                  $rake=$rake + $data->STRUCTURES->ROOF[$i]->LINES->LINE[$ii]['length'];
            if($type == "Flashing") {
                  $flashing=$flashing + $data->STRUCTURES->ROOF[$i]->LINES->LINE[$ii]['length'];
            if($type == "StepFlash") {
                  $stepflash=$stepflash + $data->STRUCTURES->ROOF[$i]->LINES->LINE[$ii]['length'];
            if($type == "HIP") {
                  $hip=$hip + $data->STRUCTURES->ROOF[$i]->LINES->LINE[$ii]['length'];
I am using PDFParser (https://www.pdfparser.org/documentation). I understand that it builds upon TCPDF library and both the PDF Parser and TCDF provide examples.  Does anyone know where I can find a more complete manual ??  I am really looking for a PDF parser to XML format using PHP 5X
Thank you.

I wanted to add param in xsl:attribute in XSLT

My code is as below:

 <xsl:param name="virtualFolderPath" select="'/xyz'"/>

<xsl:attribute name="src">
    <xsl:value-of select="ThumbImageHomePage"/>

Open in new window

I wanted to add value of param 'virtualFolderPath' before
 <xsl:value-of select="ThumbImageHomePage"/>

I tried many ways its not working.

I tried following ways. Nothing works.
 Please advise the solution.

1. <xsl:value-of select="concat(virtualFolderPath, ThumbImageHomePage)"/>

  2.   <xsl:param name="name" select="virtualFolderPath"></xsl:param>
<xsl:value-of select="ThumbImageHomePage"/>

3.  <xsl:with-param name="with" select="virtualFolderPath" />
                  <xsl:value-of select="ThumbImageHomePage"/>

Open in new window

I using localhost, Win 10 and have Java 13.0.1 64 bit installed, and have both IIS and Wampserver (both have different listening ports.) installed.
I am trying to convert PDF to XML and found a great snippet of coding at the following url:

Open in new window

The problem I am having is the with the com.lowagie.text-2.1.7 jar file from the following url:

Open in new window

It gives me the error -  see below attached screenshot  : no main manifest attribute in c:\wamp\www\PDFConvert\com.lowagie.text-2.1.7 jar
How can I fix this ?? I have also emailed the developer of the code to inquire as if I am using the right package and believe that I am because of
"lowagie" being part of the handlers.
Any help/guidance would be appreciated...
I need to programmatically convert pdf files to XML to be able to extract data and insert into a database.
I have researched and seen many examples.
My environment is: I am developing using localhost, I have Java 13.0.1 installed , I have set the java bin path in environment variable (rebooted afterwards). I have both inetpub and wampserver installed (listening on different ports) and have successfully compiled java classes (beginners examples) on my computer.
I found this coding (listed below) at: https://stackoverflow.com/questions/16936013/java-code-for-pdf-to-xml-conversion.

I am not very skilled at Java. I compiled the class  at the cmd line: javac c:\wamp\www\PDFConvert\ConvertPDFToXML.java and receive the errors (36 of them!). The errors are concern with the first 3 lines after the public class declaration  - static StreamResult streamResult;  static TransformerHandler handler; static AttributesImpl atts;
The errors are  "cannot find static streamResult steamResult" ; "cannot find static streamResult TransformerHandler " ;"cannot find static streamResult AttributesImpl " for each time the above 3 appeared in the coding.
SO I decided to add the following code to the top of the coding:
import java.util.stream;
import javax.xml.transform.sax;
import org.xml.sax.helpers;

Open in new window

That just resulted in producing same type of errors for those lines.
I have attached a screenshot of the errors.
Could someone be as so kind as to help and educate me in what…
Hi Bash experts,

Trying to parse multiple xml files in a directory.
Extract an attribute value from available xml files. e.g liferay-version=""
sort them and get the greatest value from the identified list. e.g "" and store them in a variable

Was trying using python, but due to restriction on my work server. couldn't install additional packages, so couldn't use python.

Is it possible using sed/awk/bash or any way please.

<?xml version="1.0" encoding="utf-8"?>
<package date-created="26/11/2019" liferay-version="" patch-version="5.0">
  <description />
  <system />

Open in new window

<?xml version="1.0" encoding="utf-8"?>
<package date-created="26/11/2019" liferay-version="" patch-version="6.0">
  <description />
  <system />

Open in new window

<?xml version="1.0" encoding="utf-8"?>
<package date-created="26/11/2019" liferay-version="" patch-version="7.0">
  <description />
  <system />

Open in new window

<?xml version="1.0" encoding="utf-8"?>
<package date-created="26/11/2019" liferay-version="" patch-version="8.0">
  <description />
  <system />

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