[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

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

I am new to XLST and I have what I think is a pretty question.    The XLST below is only selecting attributes with metadata xml tags.  For exmaple; in the XML below there are two attributes Eco_228 & Eco_1717.  Eco_1717 does not have metadata so the XLST skips it.  Is there anyway to include this?  

XML Before:
    <Classification ID="webfolder2-2671" UserTypeID="FOL Folder" ParentID="webfolder2-2669">
      <Name>End Boots</Name>
        <AttributeLink AttributeID="Eco_228">
          <MetaData>
            <Value AttributeID="Endeca Refiner Type">Multi-Select</Value>
            <Value AttributeID="Display Sequence">2</Value>
          </MetaData>
        </AttributeLink>
        <AttributeLink AttributeID="Eco_1717"/>    --->  This line gets dropped because it does not have <MetaData> tags..  
    </Classification>

After XLST:
AttributeID                            Text                       ClassificationID            Classificatioin Name   AttributeLinkID
Endeca Refiner Type            Multi-Select         webfolder2-2671         End Boots                     Eco_228
Display Sequence                 2                            webfolder2-2671         End Boots                     Eco_228

I would like the XLST to include all attributes so I would like to do this:

AttributeID                            Text                       ClassificationID            Classificatioin Name   AttributeLinkID
Endeca Refiner Type           …
0
CompTIA Security+
LVL 12
CompTIA Security+

Learn the essential functions of CompTIA Security+, which establishes the core knowledge required of any cybersecurity role and leads professionals into intermediate-level cybersecurity jobs.

On my PC this location contains a bunch of XML files

C:\SmartCompletion\Backend\IBS.Core\Resources

I'd like to limit my search to **just** the Resources folder.

There is a particular tag inside these XML files that I want to look at and verify that it does NOT contain a certain attribute:

 <Layout mode="Complex" UsePurgeRestore="true" UseCopy="true">   //////////// this would not show up in the search results

UsePurgeRestore="true" or UsePurgeRestore="false"  must NOT be an attribute in the <Layout> tag

So this would be a match for my search:

<Layout mode="Complex" UseCopy="true">

or this:

  <Layout UseAssignment="true" mode="Complex"  EditNewView="vAssetPacksLines">


Can Visual Studio do this using Regular Expressions?

I would need the RegEx.  I'm too slow at it and I need this as fast as I can.

reg ex search

NOTE:  I am open to freeware tools that can do this kind of exclusionary search of file contents.  I have AgentRansack, for example.  I also have Notepad++.   Do either of those support RegEx searches?

Thank you!
0
I'm fairly novice with PHP, but I can usually figure things out. But I'm stuck on working around this legacy code that we use on our sales form.
 I have to shoehorn in another Card processing merchant that does things a little differently with their API.

This is processing the response from a cURL API where I receive a SOAP XML response. I'm having some issues with the actual response as well, so I have it sampled in what appears to be a proper xml format, then attempting to parse out the message objects.

The process:
1. I have the response XML converting into a "SimpleXMLElement" with the simplexml_load_string
2. Then the XML is "converted to an array", I think, with the $array = (array)$xml;
3. Then, the code should be able to look into the array values and process a Success or Failed based on the Status Value
4. Then the $data is json encoded and is passed to the JavaScript file for further processing of the notification and filling in the Auth code field of the sales form.

The Problem(s):
1. You'll see in the PHP code that I have 2 testing sections to process the response. The first uses the $array and the second skips the array and just uses the $xml. One is commented out for testing the other, of course.
2. When using the $xml section to get the values, I get real close to what I need until it get json encoded, then the output just says Object Object in the JS Alert. It appears that the code is finding the proper value of the key, but it's not …
0
I am trying to import a Win10 Startmenu .xml in a sysprep unattend.xml file.  There are no errors reported when the unattend xml is validated with MS WSI.  Sysprep runs without an error, but the startmenu layout is not imported.  Not sure if this is where I should place these powershell commands to import the layout.  This is a segment of the unattend.xml file I am using.

    <settings pass="oobeSystem">
        <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <FirstLogonCommands>
                <SynchronousCommand wcm:action="add">
                    <Description>Set Powershell Execution Policy to Unrestricted</Description>
                    <CommandLine>powershell.exe Set-ExecutionPolicy Unrestricted -force</CommandLine>
                    <Order>3</Order>
                    <RequiresUserInput>false</RequiresUserInput>
            </SynchronousCommand>
                <SynchronousCommand wcm:action="add">
                    <Description>Load Start Menu</Description>
                    <Order>4</Order>
                    <CommandLine>powershell.exe Import-StartLayout –LayoutPath C:\W10Setup\StartLayout\StartLayout.xml –MountPath $env:SystemDrive\</CommandLine>
                    <RequiresUserInput>false</RequiresUserInput>
            …
0
I need a script written to take a large xml file and extract information into a csv or directly to an MS SQL Database.  Preferably in powershell.

Attached is the a 'sample' of the XML file.  The actual file size is ~800 mb.  I have a Python script that plods through it on smaller file sizes (~14mb), but will take an amazing amount of time for the large file.  Really even a script to preprocess the file and take out all the line items with ServicePointChannelID with the 400 range would be nice, then my python script would work good.

Attached is a sample xml file, a sample output file, and the python script that creates it.

Ideally it would be nice to go over to powershell with this from Python.
test2.xml
dataexport.csv
dataexport.py
0
Hi Expert,

How Bundle XML files together into a ZIP using shell script.

Your Comments will be really Appreciate.

Thanks,
0
I am using xsl version 1.0 and in my code i have the following:


  <xsl:template match="/">

    <UpdateReservationRQ xmlns="http://webservices.sabre.com/pnrbuilder/v1_19" >

      <xsl:attribute name="Version">
        <xsl:value-of select="1.19.0"/>
      </xsl:attribute>

      <ReturnOptions RetrievePNR="true" IncludeUpdateDetails="true" ReturnLocator="true"/>
        <ReservationUpdateList>

           <xsl:apply-templates select="Infant"></xsl:apply-templates>

      </ReservationUpdateList>
    </UpdateReservationRQ>
  </xsl:template>



  <xsl:template match="Infant">

    <ReservationUpdateItem>

      <PassengerNameUpdate>
        <xsl:attribute name="op">
          <xsl:text>C</xsl:text>
        </xsl:attribute>
        <TravelerName>
          <xsl:attribute name="type">
            <xsl:text>INF</xsl:text>
          </xsl:attribute>
          <Given>
            <xsl:value-of select="BABY"/>
          </Given>
          <Surname>
            <xsl:value-of select="TEST"/>
          </Surname>
        </TravelerName>
      </PassengerNameUpdate>
    </ReservationUpdateItem>
  </xsl:template>

</xsl:stylesheet>

Open in new window


However, my output returns:
<UpdateReservationRQ Version="1.19.0" xmlns="http://webservices.sabre.com/pnrbuilder/v1_19">
	<ReturnOptions RetrievePNR="true" IncludeUpdateDetails="true" ReturnLocator="true"/>
	<ReservationUpdateList>
		<ReservationUpdateItem xmlns="http://services.sabre.com/STL/v01">
			<PassengerNameUpdate op="C">
				<TravelerName type="INF">
					<Given>BABY</Given>
					<Surname>TEST</Surname>
				</TravelerName>
			</PassengerNameUpdate>
		</ReservationUpdateItem>
	</ReservationUpdateList>
</UpdateReservationRQ>

Open in new window


I want <ReservationUpdateItem xmlns="http://services.sabre.com/STL/v01"> to be <ReservationUpdateItem> .
What do i need to change in my xsl?
0
I need to be able to separate child nodes and apply logic

my XML Source: https://vpic.nhtsa.dot.gov/api/vehicles/decodevin/ZPBUA1ZLXKLA00941?format=xml

For some reason the text values are concatenating but I want them to be broken out by the Node name and value.  I put notes in the code.  The Code DOES work just not how I need it.

  
<%

url = "https://vpic.nhtsa.dot.gov/api/vehicles/decodevin/ZPBUA1ZLXKLA00941?format=xml"
     
     ' add a BASE HREF tag
     Dim xmldoc
     dim xmlhttp 
      
     Response.write "<BASE HREF='" & url & "'><P>" & url  & "<P>"
    
     
     set xmlhttp = CreateObject("Microsoft.XMLHTTP")
     Set xmlDoc = CreateObject("Microsoft.XMLDOM") 
     xmlhttp.open "GET", url, false 
     xmlhttp.send ""
          'response.write xmlhttp.responsetext
          
          xmlDoc.async = False
          bresult=xmlDoc.loadxml(xmlhttp.responsetext)
       
       State = ""
        ' WORKS ...Set NodeList = xmlDoc.getElementsByTagName("*")
        'Set NodeList = xmlDoc.documentElement.selectNodes("/Response/*")
        'Set NodeList = xmlDoc.documentElement.selectNodes("/Response/Results/*")
   Set NodeList = xmlDoc.documentElement.selectNodes("/Response/Results/DecodedVariable")
        'Set NodeList = xmlDoc.documentElement.selectNodes("/Response/Results/DecodedVariable/*")






        For Each Node in NodeList




         'I NEED SOME SORT OF LOGIC HERE
	           If Node.tagName = "VariableId" Then		        
		        ' 

Open in new window

0
I have been looking for feeds for my website. I need an IT news feed and a products review feed, if this is in away possible.  I am going to be developing a WP website. I know that I can get feeds from other sites with the /feed or RSS. For me to automate most of my work on my blog, I want to streamline as much as I can for now in labor and cost. I signed up for Feedly on the free plan. However, I am still exploring my options. I found FMTC so expensive for me as I am just starting my website. Can I kindly get a little help and few ideas on how to approach this?  

I have the WP Review Plugin (hoping to find a feed, too).  

I have my theme, installation, domain and hosting in development by template supplier Templatemonster.
0
Please check the below screenshot.

The first command in powershell is running fine, however I need to run the same command for 8 different .exe files. I have mentioned the paths where I need to run the command.

Assist if any idea how I can put those in a loop and run the script for all simultaneously.
myscript.PNG
1
CompTIA Cloud+
LVL 12
CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

I have this https://icsc.un.org/resources/sad/dsa/restr/history/History102018.XML link where in Microsoft Excel, I can import its data via the XML and also via power query both way works.

my boss asked me to make this work into Google sheets.  I used IMPORTXML but it does not work, perhaps due to the limitation of function.

the total rows are 16422 rows data.  I searched a lot in forums and failed to find a solution.   I would greatly appreciate your help on this.  I can use Scripts or anything that would make this work in Google Sheets.
Excel-File.xlsx
0
Hi Experts,

I'm facing error with below table and data please help.

I want to replace the XML string <to_disposition>NULL  with </to_disposition>.

Table contain SYS.XMLTYPE columnWant to replace <to_disposition>NULL with </to_disposition>
Please let me know if you need more details.

Thanks,

Mihir
0
I am trying to import this relatively small table into the Google Sheets

=importxml("https://icsc.un.org/resources/sad/dsa/restr/history/History102018.XML","//table")

I am not familiar with the XML Xpath syntaxes.

All i want is to get the table in my google sheet.

any help is appreciated

what should i change in "//table" the second argument of the IMPORTXML function to be able to make it work?
0
I have a SQL Server query that extracts XML from an XML feed.  It uses openxml like so:

select top 1 updated from openxml( @idata, '//content:feed', 2 ) with ( updated varchar(31) 'content:updated' )

I have the same database on two different servers.  Same code.  It works perfectly fine on one server and it has been working perfectly fine on another... then all of a sudden it stopped working on the 19th I believe.   There are no errors... it just returns NULL instead of the XML value containing the feed update date.

Any idea why it stopped working?  Is there something that may have got stuck or disabled somehow on the problem server in sql server 2008?  I'm sure it's some type of configuration issue.  I don't really know the ins and outs of the OpenXML statement.  I know there are other alternatives but I'm just trying to get it back running before considering a major code change.  Thanks!
0
Hi,

We have created a web application using HTML and XSLT-files for texts. Now all the texts are in Dutch and have to be translated in English. The company that translates the texts is not able to deal with the XSLT-format. Is there a way to export only the texts from the XSLT-file? Below an example to make this clear.

Suppose the xslt file contains: <xsl:if condition="True">This is a text</xls-if> then I only want 'This is a text' in the export.

Regards,

Arne
0
Have an XML file which is an export of my wife's WordPress blog. I need to export the blog content.  I am attaching the XML file, itself. I have never used XPATH and am willing to learn, but unsure how to proceed. Each blog entry is under <content:encoded>. I am not sure how to simply extract the content into a txt/docx format. Appreciate the help!
Thank you!
JohnD
1stepatatimemindbodyspirit.WordPress.xml
0
My understanding of the XML language is that it is used to store and transport documents across the world wide web, but I have yet to experience some specific examples of it being used.
One that I thought of is, that if I wanted to move some data from a SQL Server database to an Oracle database, then I would transfer it as an XML document.
Is this how it would be done ?  
What other examples can you experts think of ?
0
All the folders in screenshot are created by copying and renaming one Template folder. Now all sub-folders contains one xml file, need to update the path in these xml's with the path of Crystal Reports and DocMan folder, which exist in all these folders.

[xml]$XmlDocument = Get-Content -Path d:\Site\"$($name)\$($name).xml"
$XmlDocument.breakfast_menu.food.DocMan = 'd:\Site\'
$XmlDocument.breakfast_menu.food.Crystalreports = 'd:\Site\'
$XmlDocument.Save("D:\Site\"$($name)\$($name).xml")

The above script is not giving the desired result.

My earlier script for copying and renaming:
$source = 'd:\Site\Template'
$target = 'd:\Site\'
$xmlPath = 'D:\Tenant.xml'

$xml = [xml](Get-Content -Path $xmlPath)
$envCode = $xml.SelectSingleNode('Tenants/ENVcode').InnerText.Trim()
$xml.SelectNodes('Tenants/Schools/School') | ForEach-Object {
      $name = "$($envCode)-$($_.InnerText.Trim())"
      $destination = Join-Path -Path $target -ChildPath $name
      Copy-Item -Path $source -Destination $destination -Recurse -Force -Verbose
      Get-ChildItem -Path $destination -Filter default.xml -Recurse | Rename-Item -NewName "$($name).xml"      
}
Screenshot.png
0
<?xml version="1.0" encoding="UTF-16"?>
<cust-response>
   <result-response>
     <load entity="CUSTOMER" id="1234">
        <result-entry result-id="456" succeed="Yes">
           <return F_RESULT="focused" STATUS="C" />
        </result-entry>
        <result-entry result-id="789" succeed="No">
           <errors>
              <error name="other">
                 <desc>
                      <error-message>Result cannot be validated</error-message>
                 </desc>
              </errors>
        </result-entry>
     </load>
     <load entity="CUSTOMER" id="5678">
        <result-entry result-id="789" succeed="Yes">
           <return F_RESULT="focused" STATUS="C" />
        </result-entry>
        <result-entry result-id="555" succeed="No">
           <errors>
              <error name="other">
                 <desc>
                      <error-message>Result cannot be validated</error-message>
                 </desc>
              </errors>
        </result-entry>
     </load>
   </result-response>
</cust-response>

I want to return a class array of the following:
   CustomerId
      Result-id's and succeed yes or no and if errors showing the error messages
0
OWASP: Avoiding Hacker Tricks
LVL 12
OWASP: Avoiding Hacker Tricks

Learn to build secure applications from the mindset of the hacker and avoid being exploited.

I import my XSD file i got parsing error while i have build

 org.xml.sax.SAXParseException: schema_reference.4: Failed to read schema document 'x/request/xxx.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>.
0
I need to get information from a XML file where this file is auto upload every 30 seconds.
I want to show this information in a website.

Just to show an example, my website is a radio, and I want to show to users what music he listen.
0
I have One XML file in  d:/Site/Template/default.xml and parallel to the default.xml file , I have two folders in Template folder named as - Crystal Reports and DocMan. My default.xml file contains the two nodes CrystalReports and DocMan. I need to automatically edit the nodes with the updated path of the folder at new location.

I am using the below script to copy and rename all the folders. After running the below script I also need to update the new paths in the respective XML's in each new created folder.

$source = 'd:\Site\Template'
$target = 'd:\Site\'
$xmlPath = 'D:\Tenant.xml'

$xml = [xml](Get-Content -Path $xmlPath)
$envCode = $xml.SelectSingleNode('Tenants/ENVcode').InnerText.Trim()
$xml.SelectNodes('Tenants/Schools/School') | ForEach-Object {
      $name = "$($envCode)-$($_.InnerText.Trim())"
      $destination = Join-Path -Path $target -ChildPath $name
      Copy-Item -Path $source -Destination $destination -Recurse -Force -VerboseI need to insert path in XML of the DocMan and CrystalReports folder      Get-ChildItem -Path $destination -Filter default.xml -Recurse | Rename-Item -NewName "$($name).xml"
}

After running this I will get all the folders with names listed in my Tenant file. Also inside all the folders, my default.xml file is renamed to name same as the folder name.xml. I just need to update the paths also inside all these new folder.xml with the corresponding new path in CrsRep and Doc Node.
0
Hi all,
I'm having a problem reading in an RDLC xml file.  My purpose is to collect information about the dataset(s), e.g. Dataset Name and Table name.
I've been dealing with xml projects for decades and for some reason every piece of code I try returns nothing.
Try
            Dim xmlDOC As New XmlDocument()
            xmlDOC.Load(XMLFILE)

            Dim nodeList As XmlNodeList = xmlDOC.SelectNodes("/Report/DataSets/DataSet")
            MsgBox(nodeList.Count)
            For Each node As XmlNode In nodeList
                MsgBox("DataSet Name: " & node("Name").InnerText)
            Next



        Catch ex As Exception
            MsgBox(ex.Message)
        End Try

Open in new window

0
I have one simple Xml file- Tenants

<?xml version="1.0" encoding="UTF-8"?>
<Tenants>
  <ENVcode>
    SIT
  </ENVcode>
  <Schools>
      <School>
            E1234
      </School>
      <School>
            E1236
      </School>
      <School>
            E1238
      </School>
  </Schools>
 </Tenants>

Also I have one folder for which I need to copy that and paste the contents in another folder and the name should be read from the xml file - "Tenants" and format of name should be <ENVCode>-<School>.

I am writing the below command. Can anyone help please.

[xml]$XmlDocument = Get-Content -Path D:\a1\Tenant.xml
 Copy-Item -Path d:\a1 -Destination d:\$XmlDocument.Tenants.ENVcode-$XmlDocument.Tenants.Schools.School

In our case the folder should be pasted to 3 different folders with name SIT-E1234 , SIT-E1236, SIT-E1238.

Also inside these folders we need to rename all their xml files in the same format.xml

Also tried the below-

[xml]$XmlDocument = Get-Content -Path D:\a1\Tenant.xml
Copy-Item -Path "d:\a1\a11\*" -Destination "d:\a2\a11\"$XmlDocument.Tenants.ENVcode-$XmlDocument.Tenants.Schools.School"-"recurse -Force -Verbose
0
Hi experts. Please have a look at the attached file which contains a script that creates a XML schema collection.
I am trying to understand the role played by each of the namespaces defined at the start.
There is a target namespace called 'Product ModelManuInstructions', which is also the default namespace because it has 'xmlns ='  without a colon or a prefix.
Following on from this the XMLSchema namespace is also defined with the prefix 'xsd'.

My understanding is that the XMLSchema namespace will contain items that are used generally (or widely) by namespaces, e.g. element, choice, string, complex type, while the target namespace is more specific to the application viz. 'tool', 'material' and 'blueprint'.
Is this a correct interpretation ?  

If so, does the collection always have to contain the XMLSchema namespace and could the target namespace have been omitted leaving the the default namespace on it's own or vice-versa ?
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).