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 trying to produce an xml from a table and i am having trouble when trying to include column values as child nodes.

The table has many columns but I am having trouble with four columns that have to be nested in a child node.  These are the columns and they are all of type bit.

They are:

[RiskInflam]
[Vascularisation]
[Glaucoma]
[RiskAnnan]

I need to produce the xml in the format
<RiskFactors>
  <RiskFactor></RiskFactor>
</RiskFactors>

So when the row has the following values:

[RiskInflam]            1
[Vascularisation]      0
[Glaucoma]            1
[RiskAnnan]             0

I need to produce:
<RiskFactors>
  <RiskFactor>RF_RiskInflam</RiskFactor>
  <RiskFactor>RF_Glaucoma</RiskFactor>
</RiskFactors>

This is embedded in an xml document with other columns.

<LS2ECCTR xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Version>1</Version>
<LS-ID>1234567890</LS-ID>
…. Risk factors…..
</LS2ECCTR>

I am not sure of the sql/xml syntax to produce this.  Can anyone help?
0
Cloud Class® Course: C++ 11 Fundamentals
LVL 12
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.


I have a xml  like <url href="www.google.com">www.google1.com</url>
i am using dom parser to cheak both url should match or not (www.google.com and www.google1.com)
so i am Writing The code is :
String s=""; Document doc = dBuilder.parse(inputFile); NodeList nodeList= doc.getElementsByTagName("url"); for (int i = 0; i < nodeList.getLength(); i++) { Node node = nodeList.item(i); if(node.getNodeName().equals("url")){//Reconfirm after that getting content Element element = (Element) node; s=element.getTextContent(); String s2=element.getAttribute("href"). }So can u help me how to get href content so that i can cheak both value










0
XSLT 2.0 or 3.0: What is the difference between
<apply-templates />

Open in new window

and
<apply-templates select="*"/>

Open in new window

?
0
Hello,


I need to validate an XML file using an XSD scheme imposed by a provider.

For that I use the library libxml2 version 2.9.4 and msxml6 under Windows and I get different results.

With libxml2 the XML file is not valid on Windows or Linux.
With MSXML6 the XML file is considered valid.

Below are some simplified examples. To easily validate the XML file with the XSD, I use Microsoft Visual Studio (msxml) and compare with Notepad ++ (XMLTools plugin that apparently uses libxml2).

XML file :
<?xml version="1.0" encoding="utf-8"?>
<root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:root="http://www.xmlValidation.com/root" xsi:schemaLocation="./schema_strict.xsd">
      <object identifier="1ABC001DE"/>
</root>

XSD file :
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
  <xs:complexType name="codeType">
    <xs:attribute name="identifier" use="required">
      <xs:simpleType>
        <xs:restriction base="xs:NMTOKEN">
          <xs:maxLength value="10"/>
          <xs:pattern value="\d\p{Lu}\p{Lu}\p{Lu}\d\d\d\p{Lu}\p{Lu}(\p{Lu}|\d|)"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
  </xs:complexType>
      <xs:element name="root">
            <xs:complexType>
                  <xs:sequence>      
                        <xs:element name="object" type="codeType" minOccurs="0">
                        </xs:element>
                  </xs:sequence>
            </xs:complexType>
      …
0
I have a simple input XML file:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<rootelement xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="index.xsd">
    <compound>
        <name>FooBar</name>
        <member>
            <name>Something</name>
        </member>
    </compound>
</rootelement>

Open in new window

and a simple schema file to go with it index.xsd:
<?xml version='1.0' encoding='utf-8' ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="rootelement" type="RootType"/>

  <xs:complexType name="RootType">
    <xs:sequence>
      <xs:element name="compound" type="CompoundType"/>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="CompoundType">
    <xs:sequence>
      <xs:element name="name" type="xs:string"/>
      <xs:element name="member" type="MemberType"/>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="MemberType">
    <xs:sequence>
      <xs:element name="name" type="xs:string"/>
    </xs:sequence>
  </xs:complexType>

</xs:schema>

Open in new window

and a simple XSLT 2.0 transformation file:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  version="2.0">
  
  <xsl:template match="/">
    <xsl:apply-templates select="rootelement" />
  </xsl:template>
  
  <xsl:template match="rootelement">
    <xsl:copy-of select="." />
    <xsl:value-of select="." />

  </xsl:template>
  
</xsl:stylesheet>

Open in new window

which when I run the transform on the input XML file, I get the error:

"FOTY0012: The node <rootelement> has no typed value"

when it hits the line: <xsl:value-of select="." />

Is there a way I can modify the schema file index.xsd so I don't get this error?

The closest to an explanation I could find is:
XML Path Language (XPath) 2.0
2.5.2 Typed Value and String Value

http://www.w3.org/TR/xpath20/#id-typed-value

However, I'm still not clear on why it doesn't just grab the text and return it, like XPATH 1.0 does, or like it does if I don't supply the schema.
0
This is a wild one. One of my clients using iTunes on an iMac has lost his (many) playlists.  Details:

1. Very large iTunes collection (approx 300GB). Many custom playlists (don't know how many)

2. A couple of weeks ago, he started iTunes and says "some music and all playlists are gone"  The "some music" appears to be purchased music (most of his collection is his ripped CDs).

3. Before I had a chance to do the standard XML file manipulations to re-import his playlists, he says he found a shortcut to his external USB drive which contained an iTunes folder, and dragged the iTunes Music folder right into his running iTunes.  He says this caused his music to appear (complete, as far as he can tell).  I told him that this was not a good idea, as this may affect his playlists.  He confirmed that his playlists were still missing.

4. I ran the standard fix of attempting to re-import his iTunes Music Library.xml file, but it gives an error saying that some playlists could not be imported because the music is missing.  The result is that all the standard iTunes lists are there, but none of his own custom lists.

Is there any hope of restoring his collection?  He apparently didn't have a time machine backup, though he did use Carbonite (none of his iTunes files are on Carbonite as far as I can tell).

Thanks.
Dave
0
Hi,

I'd like to automate WSUS deploy. That can be done using an xml: https://www.petri.com/automating-wsus-2016-installation-with-powershell
So now I'd like to change the xml with the servername.

In other words, I need to replace the computername (Servernamexyz in my example, can change overtime) in this xml.

So I'd get the xml in $XML = get-content c:\myxml.xml
tags to replace are
<S N="ServerName">Servernamexyz</S>
and  <S N="PSComputerName">Servernamexyz</S>

How do I replace <S N="ServerName"> whatever </s> and  <S N="PSComputerName">Whatever</S> ?
I can then write result back to xml.

Thanks for your input.
J.
0
I am using
https://jsonplaceholder.typicode.com

Open in new window

to test some code which post, get, delete etc.

This works great but I now need to do the same tests with xml.

My question is... Are there any websites like
https://jsonplaceholder.typicode.com

Open in new window

for xml testing?

Is so, what are the urls?
0
I have an existing xml file and I want to be able to add data but with the <![CDATA[ somedata ]]> into the node wwhen I try i just get :   &lt;![CDATA[mystring]]&gt;.

try many things but so far fail

that what I use

                        If n1.Name = "name" Then

                            Dim MyXMLNode As XmlNode = n1.SelectSingleNode("ldm1")
                            'If we have the node let's change the text
                            If MyXMLNode IsNot Nothing Then
                                Dim strtxt As String = "<![CDATA[" & strtxtPlats & "]]>"
                                 ' CData = myXmlDocument.CreateCDataSection (strtxtPlats)
                                MyXMLNode.InnerText =strtxt

                               
                            End If

cheer's
0
You can see on this screencast that there is a lot of characters, text and tags around the relevant text for translation:

https://www.screencast.com/t/FimkTUPq

To make it easier to view the text for translation only, is there any way to delete or hide the other text, characters and tags so only the text for translation is displayed in Notepad++? By a regular expression for example?

The file types are .yml, .json2, .xlf and .xliff (I think it's XML that is displayed in all of them).
0
Introducing Cloud Class® training courses
LVL 12
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

I had this question after viewing how to update an xml file using vb.net.

How could I do this in VS 2005?
0
Hello Experts!

I'm attempting to parse an XML string using VB.NET 2010. The XML contains multiple namespaces which are declared in a way I haven't seen before. Rather than using a string literal for the URI, the prefix and the URI are the same. I need to be able to capture all of the values in the XML but I'm getting an error which reads:

'xyz' is an unexpected token. The expected token is '"' or '''. Line 7, position 26.

Here is a sample of the XML:
<COMPANYXYZ>
  <SYSTEM101>
    <HEADER>
      <ID>ABCD-101-ZYXW-99</ID>
    </HEADER>
    <BODY>
      <PROCESS xmlns:xyz=xyz>
        <xyz:JOBNUMBER>A523</xyz:JOBNUMBER>
        <xyz:BATCH>
          <xyz:STATUS>
            <xyz:CODE>0</xyz:CODE>
          </xyz:STATUS>
          <xyz:CARDINFO>
            <subSys:RESPONSE xmlns:subSys=subSys>
              <responseDetail NAME="STATUS">FINISHED</responseDetail>
              <responseDetail NAME="RESPONSE_MSG">The job finished.</responseDetail>
            </subSys:RESPONSE>
          </xyz:CARDINFO>
        </xyz:BATCH>
      </PROCESS>
    </BODY>
  </SYSTEM101>
</COMPANYXYZ>

Open in new window


Here is a sample of the VB code:
        Dim theXml As String = GetXmlString()

        Dim xmlDoc As XmlDocument = New XmlDocument()
        xmlDoc.LoadXml(theXml)

        Dim idNums As XmlNodeList
        idNums = xmlDoc.GetElementsByTagName("ID")
        Console.WriteLine("ID: " + idNums(0).InnerXml)

        Dim respDetails As XmlNodeList
        respDetails = xmlDoc.GetElementsByTagName("responseDetail")
        Dim i As Integer
        For i = 0 To respDetails.Count - 1
            Console.WriteLine(respDetails(i).InnerXml)
        Next

Open in new window


Details:
  • I didn't create the XML and have no control over how it is being sent to me.
  • The XML in the sample above correctly reflects the error I'm seeing - specifically the way the namespaces are declared - however I've edited the tags for security reasons. (The names have been changed to protect the innocent, so to speak.)
  • I don't have a lot of experience working with namespaces in XML in general in VB.
  • I've looked into the XmlNamespaceManager class but I haven't been able to get it to work in this scenario.
  • When I remove all references to namespaces from the XML that I'm being sent, the code I'm using works, however I'd rather not edit what I'm being sent.
  • The error is appearing as soon as the xmlDoc.LoadXml() method is called.
  • The VB code I'm using may not be the most efficient or best way of pulling out the data - it's just for demonstration and the code is failing before it reaches that point anyway. Please feel free to suggest a better method.
0
Hey,
I want to serialize an object to xml with delphi 7,  i searched but i didn't find a full solution, i think with HttpRio we can do it .
thank you in advance.
0
File attributes? and web interfaces.
We have a custom application that generates an xml file download to the user workstation.  This file is then uploaded to our vendor web site to place purchases.
For User A, this is no problem. It works properly from any browser installed on his PC.
For User B, the upload fails to execute, either without comment, or sometimes complaining of an xml file error.  Does not elaborate on what the error is, just says there is one.  (gotta love that.)  It does not matter what browser, the error is the same.

Sounds fairly straight forward right? Why bother you guys with this?  This is where it gets interesting.

If user A generates the file, and sends it to user B via email attachment, User B cannot upload it. Going the other way, the file generated by user B cannot be uploaded by user A if it is sent via email attachment, BUT it WILL upload if it is sent via Slack instant message!  This fact was a total random discovery, and in fact we then found that if user B generates the file, sends it to himself via slack, he can then upload it!

I have exhaustively gone through all the browser settings, versions for windows, browser, updates, Java, .net, anti-virus even default xml viewer and all match.

When user A comes down and logs in on the problem machine, the problem exists for him as well, so a user profile problem is not a probable cause.

I have two files in front of me, One that will work, one that won't, and the only thing different…
0
Hello Experts, I got a task that need to complete. We need to file and report to regulator on a quarterly basis. Our compliance team has been filling the information through the web portal but lately they want to switch to use xml file. The content can be fill in much quicker instead of browsing the page on the web. I got a xml template from regulator with the questions but don't understand where to enter content or how to answer the questions.  Please see below for example. Box 160 is asking for highest NAV. Where/how do I input the answer? Also, box 162 is regarding an answer Yes or No. How/where should i input that in the XML file?

<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" attributeFormDefault="unqualified"
           elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="EasyFileForm">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="Box0160" type="efInteger" minOccurs="0" maxOccurs="1">
          <xs:annotation>
            <xs:documentation>Statement: Cover</xs:documentation>
            <xs:documentation>Enter the highest NAV during the Reporting Period:</xs:documentation>
          </xs:annotation>
        </xs:element>      
        <xs:element name="Box0162" type="efYesNo" minOccurs="0" maxOccurs="1">
          <xs:annotation>
            <xs:documentation>Statement: Cover</xs:documentation>
            <xs:documentation>Have …
0
I am getting lot of XML files from different clients with similar data structured differently or say , all of them follow different schemas but the actual data is same.

I want to develop a website, where clients can upload their XML files and I can extract information that I need from those XML files for processing client's request.

I want to make use of the XSLT transformation, where I can write XSL stylesheets and transform different schemas (coming from clients) into my own schema.

I am a C# developer and I know .NET has its XSLT processor. Has anyone done something like this?  where should I store the XSL files on the server and how do we apply those XSL stylesheets to the XML, once clients uploads them.

Also, I have heard of other XSLT processors, like Saxon. If I want to go with something other than the .NET XSLT processor. how should I go about it ?
0
hi i am kumar:i have a issue in my java application:actually i wants to read xml file using dom parser:in xml file lots of Numeric Character Entities like(&#x000A9;&#x000EA;) are parsent in diffrent place;i have a requirment to find that Numeric Character Entities with pattern :  whenever we fing we simply skip that node content element:
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
        DocumentBuilder builder = factory.newDocumentBuilder();
         Document d = builder.parse(file);
        d.getDocumentElement().normalize();
NodeList  ndlist1= d.getElementsByTagName("title");
for (int i = 0; i < ndlist1.getLength(); i++) {
            Node node = ndlist1.item(i);
            String attValue = "";
           attValue = node.getTextContent();
            System.out.println("val=" + attValue);

Open in new window

:
when i print cpntent of node they can print some special charcter:so my pattern doesnot  find:so kindly help me to figure out this problem
0
I am trying to read an XML file like the one below into an Excel sheet
      <Item>
            <Filename>H:\MrX@gmail.com\inbox\Company\file214.txt</Filename>
            <Location>H:\MrX@gmail.com\inbox\Company</Location>
            <ShortName>file214.txt</ShortName>
      </Item>
      <Item>
            <Filename>H:\MrX@gmail.com\inbox\Company\===file215.txt===</Filename>
            <Location>H:\MrX@gmail.com\inbox\Company</Location>
            <ShortName>===file215.txt===</ShortName>
      </Item>      
      <Item>
            <Filename>H:\MrX@gmail.com\inbox\Company\= file216.txt =</Filename>
            <Location>H:\MrX@gmail.com\inbox\Company</Location>
            <ShortName>= file216.txt =</ShortName>
      </Item>      
      
I am using the following intructions for read the xml file and copy it to the working sheet

## all dim etc omitted to make this shorter

Set list = xDoc.SelectNodes("//Results/Item")
        For Each Node In list
            iRow = iRow + 1
            '***Note: node names are Casesensitive***
            On Error Resume Next
            mySheet.Range("A" & iRow) = Node.SelectSingleNode("Filename").Text
            mySheet.Range("B" & iRow) = Node.SelectSingleNode("Location").Text
            mySheet.Range("C" & iRow) = Node.SelectSingleNode("ShortName").Text
 etc
 My problem is that when the file name starts in "=", no shortname is copied
 That is, mySheet.range ("C"&iRow) is empty in cases 2 and 3 from the example above:
 
 Questions:
 Why is this happening?
 Other than equal sign, are there any other initial character that causes …
0
I Have Xml File :  where one tag is <copyright ownership="publisher">&#x000A9; Manoj Kumar corporation.</copyright>:and i want to read that value.but issue is  when i reading &#x000A9 this charcter it print sone special symbol :but i donot wants :i want to print on console same as in xml like:&#x000A9; Manoj Kumar corporation.  
so can u help me :i am using for xml parsing DOM
Regards
Manoj Kumar

My code is:
 DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
	        DocumentBuilder builder = factory.newDocumentBuilder();
	         Document d = builder.parse(file);
	        d.getDocumentElement().normalize();
	        NodeList  ndlist1= d.getElementsByTagName("title");
	    	for (int i = 0; i < ndlist1.getLength(); i++) {
	            Node node = ndlist1.item(i);

	            String attValue = "";
	           attValue = node.getTextContent();
	            System.out.println("val=" + attValue);
	            
	         	           
	           
	     	}

Open in new window

0
Free Tool: Path Explorer
LVL 12
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Good morning all, I have a question related to writing an Excel spreadsheet from ColdFusion (XML). I'm not sure if my problem is my Oracle query, or the way I have the XML put together, but I'm getting some errors when I do certain things. I've attached the code that I'm working with and will try to explain what I'm doing. I'm dealing with two tables, "BUDGET_MIPRS_SENT" and "UNOB_REMARKS". This is a one to many, where I may have several remarks listed in UNOB_REMARKS for a specific entry in BUDGET_MIPRS_SENT. What I want to do is be able to have a spreadsheet that has only the three most recent "remarks" rather than all of the remarks for each record in BUDGET_MIPRS_SENT. So I guess I want to group the remarks together and have a single record on the spreadsheet with the 3 latest remarks grouped together. The way I have the query works when I display on a web page, but when trying to get a spreadsheet I get an error:

Context validation error for tag cfoutput. Either the end tag &lt;/cfoutput&gt; encountered on line 669 at column 3 requires a matching start tag or tag cfoutput does not support end tag. <br>The error occurred on line -1. | Referer: | Template: /mcadev/reports/testreport.cfm |
testreport.txt
0
I have xml  as clob in table request_detail where xml is stored in column detail :

<?xml version="1.0" encoding="UTF-8"?><ns2:OrderServiceRequest xmlns:ns2="ca/abc/com/integration" xmlns="ca/abc/oms/autotype/omscommonrequest" xmlns:S="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cil="http://cil.int.abc.ca" xmlns:io="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:io10="ca/abc/com/integration" xmlns:io11="http://www.w3.org/2005/08/addressing" xmlns:io12="ca/abc/oms/autotype/productavailability" xmlns:io13="ca/abc/oms/autotype/cancelorder" xmlns:io14="ca/abc/oms/autotype/submitrequest" xmlns:io15="ca/abc/oms/autotype/omscommonresponse" xmlns:io16="ca/abc/oms/autotype/billingRetrieve" xmlns:io17="ca/abc/oms/autotype/locationmanagement" xmlns:io18="http://www.w3.org/2003/05/soap-envelope" xmlns:io19="ca/abc/oms/autotype/productconfiguration" xmlns:io2="http://www.ibm.com/websphere/sibx/smo/v6.0.1" xmlns:io20="ca/abc/oms/autotype/omscommonrequest" xmlns:io21="wsdl.http://cil.int.abc.ca" xmlns:io22="ca/abc/oms/orderretrieval" xmlns:io3="http://www.ibm.com/xmlns/prod/websphere/mq/sca/6.0.0" xmlns:io4="ca/abc/oms/autotype/omscommon" xmlns:io5="ca/abc/oms/autotype/qualification" xmlns:io6="ca/abc/oms/customerprofile" xmlns:io7="http://cil.int.abc.ca" xmlns:io8="http://CILNBOMFCustomerOrderMod" xmlns:io9="http://www.ibm.com/xmlns/prod/websphere/http/sca/6.1.0" xmlns:ns0="wsdl.http://cil.int.abc.ca" xmlns:ns3="ca/abc/oms/autotype/omscommon" 

Open in new window

0
Not sure why the modify is not updating the xml in temp catalog3 table

any help much appreciated

WITH XMLNAMESPACES  -- XML namespace def must be the first in with clause.
    (DEFAULT 'http://schemas.microsoft.com/sqlserver/reporting/2006/03/reportdatasource'
            ,'http://schemas.microsoft.com/SQLServer/reporting/reportdesigner'
     AS rd)
,SDS AS
    (SELECT SDS.name AS SharedDsName
           ,SDS.[Path]
           ,CONVERT(xml, CONVERT(varbinary(max), content)) AS DEF
     FROM dbo.[Catalog] AS SDS
     WHERE SDS.Type = 5)     -- 5 = Shared Datasource



SELECT CON.[Path]
      ,CON.SharedDsName
      ,CON.ConnString
	  INTO #CATALOG1
FROM
    (SELECT SDS.[Path]
           ,SDS.SharedDsName
           ,DSN.value('ConnectString[1]', 'varchar(150)') AS ConnString
     FROM SDS
          CROSS APPLY 
          SDS.DEF.nodes('/DataSourceDefinition') AS R(DSN)
     ) AS CON
-- Optional filter:
-- WHERE CON.ConnString LIKE '%Initial Catalog%=%TFS%'
ORDER BY CON.[Path]
        ,CON.SharedDsName;



WITH XMLNAMESPACES  -- XML namespace def must be the first in with clause.
(DEFAULT 'http://schemas.microsoft.com/sqlserver/reporting/2006/03/reportdatasource'
        ,'http://schemas.microsoft.com/SQLServer/reporting/reportdesigner'
 AS rd)
,SDS AS
(SELECT SDS.name AS SharedDsName
       ,SDS.[Path]
       ,CONVERT(xml, CONVERT(varbinary(max), content)) AS DEF
 FROM dbo.[Catalog] AS SDS
 WHERE SDS.Type = 5)     -- 5 = Shared Datasource
SELECT [SharedDsName], 

Open in new window

0
Question: How can I Transform one XML file format to another XML file format using XSLT. I am new to XML/XSLT so I need help. I need to spit a string inside the xml.

XML1
<?xml version="1.0" encoding="utf-8"?>
<root type="array">
<persons>
<person_id>_:genid1</person_id>
<type>http://www.w3.org/2000/01/rdf-schema#Datatype</type>
<oneofs>
<oneof>This is a very long string</oneof>
</oneofs>
</persons>
<persons>
<person_id>_:genid108</person_id>
<type>http://www.w3.org/2000/01/rdf-schema#Datatype</type>
<oneofs>
<oneof>This is  another very long string</oneof>
</oneofs>
</persons>
</root>
XML2
<?xml version="1.0" encoding="utf-8"?>
<root type="array">
<persons>
<person_id>_:genid1</person_id>
<type>http://www.w3.org/2000/01/rdf-schema#Datatype</type>
<oneofs>
<oneof>This is </oneof>
<oneofagain>a very long string</oneofagain>
</oneofs>
</persons>
<persons>
<person_id>_:genid108</person_id>
<type>http://www.w3.org/2000/01/rdf-schema#Datatype</type>
<oneofs>
<oneof>This is </oneof>
<oneofagain>another very long string</oneofagain>
</oneofs>
</persons>
</root>
0
I am writing a a class in VB.Net which makes calls for RestAPI's via HttpWebRequest. All works fine and i get the response i am expecting.
What i am looking for is some simple method to evaluate the Body if it is a Json Object, Json Array or an XML doc so i know how to handle
the return data. I don't have any schema to validate against. I just want to know what type of data it is.
0
So lets say I have this XML document:

<s:Envelope 
        xmlns:s="http://www.w3.org/2003/05/soap-envelope" 
        xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
        <s:Header>
            <VsDebuggerCausalityData 
                xmlns="http://schemas.microsoft.com/vstudio/diagnostics/servicemodelsink">uIDPo4tYpt6X40FEk+VSAe5mc8MAAAAAP497cBuXfk+uFIOY80O0iuLtIW56q7hLktgVYPhbnHMACQAA
            </VsDebuggerCausalityData>
            <o:Security s:mustUnderstand="1" 
                xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
                <o:BinarySecurityToken u:Id="uuid-10490fb0-8ee0-4a4c-a8db-77242c9a3b7f-2" ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3" EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">MIIF+TCCBOGgAwIBAgIQIWv3OdE866kXP/....t</o:BinarySecurityToken>
                <e:EncryptedKey Id="_0" 
                    xmlns:e="http://www.w3.org/2001/04/xmlenc#">
                    <e:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p">
                        <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" 
                            xmlns="http://www.w3.org/2000/09/xmldsig#" />
                    </e:EncryptionMethod>
                    <KeyInfo 
                        

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