Quantcast
Channel: XML, System.Xml, MSXML and XmlLite forum
Viewing all 935 articles
Browse latest View live

How to save entities in as it is in xml file

$
0
0

Hi,

This is a XML file,In this file shows some entities ,I need that this entities to save as it is to another XML file

<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE article PUBLIC "-//Atypon//DTD Atypon Systems Journal Archiving and Interchange NLM DTD v3.0.0 20090430//EN" "atypon-archivearticle3.dtd"><articlearticle-type="research-article"dtd-version="3.0"xml:lang="en"><issnpub-type="ppub">&#x0201C;15573060</issn><issnpub-type="epub">&#x0201C;15573079</issn><article-title>&#x0201C;Modern&#x0201D; Education Finance: How It Differs from the &#x0201C;Old&#x0201D; and It Implies</article-title><copyright-statement>&#x000A9; 2006 MIT Press</copyright-statement></article>

privatevoid button1_Click(object sender,EventArgs e){var doc=XDocument.Load(@"D:\a.xml");var writer =XmlWriter.Create(@"D:\a1.xml",newXmlWriterSettings{Encoding=Encoding.UTF8});

            doc.Save(writer);}



Out of Memory Exception in transformation is xslt

$
0
0

Hi ,

I get a out of memory exception when we do a xml transformation  in vs 2005

Below is the transformation :System.Exception: Failed to complete transform ---> System.Exception: Transform Failed for SubmissionID:1000, SenderPartyID:1234, ReceiverPartyID:5678 ---> System.Exception: Failed to complete transform ---> System.Exception: Function Transform failed ---> System.Exception: Failed to apply transform to XML ---> System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
   at abctrabnsform.XmlTransformStrXsl(String strInputXml, String strXslt, XsltArgumentList argList)
   

Thanks in advance -Sranjani

Reading XML problem, can't read node child

$
0
0

Hi all,

I am trying to read an XML file and can't get the node "cbc:Name". I can get the other nodes I want but not the supplier node with name and address etc. The XML I try to read is (Part of it)

<?xml version="1.0" encoding="UTF-8"?><Invoice xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2" xmlns:ccts="urn:oasis:names:specification:ubl:schema:xsd:CoreComponentParameters-2" xmlns:stat="urn:oasis:names:specification:ubl:schema:xsd:DocumentStatusCode-1.0" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:udt="urn:un:unece:uncefact:data:draft:UnqualifiedDataTypesSchemaModule:2" xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><cbc:UBLVersionID>2.0</cbc:UBLVersionID><cbc:ID>16006955</cbc:ID><cbc:IssueDate>2016-02-08</cbc:IssueDate><cbc:Note>WSO:377813</cbc:Note><cbc:TaxPointDate>2016-02-08</cbc:TaxPointDate><cbc:AccountingCostCode></cbc:AccountingCostCode><cbc:AccountingCost></cbc:AccountingCost><cac:AccountingSupplierParty><cac:Party><cac:PartyName><cbc:Name>Complies BV</cbc:Name></cac:PartyName><cac:PostalAddress><cbc:StreetName>Handelsweg 30 -32</cbc:StreetName><cbc:CityName>Tynaarlo</cbc:CityName><cbc:PostalZone>9482 WE</cbc:PostalZone><cac:Country><cbc:IdentificationCode>NL</cbc:IdentificationCode></cac:Country></cac:PostalAddress>

While trying to get

cac:AccountingSupplierParty

can't get the next nodes until cbc:Name. My code is here

            using (XmlReader lezer = XmlReader.Create("Complies.xml"))
            {
                string substr = "";
                while (lezer.Read())
                {

                    switch (lezer.NodeType)
                    {

                        case XmlNodeType.Element: // Het knooppunt is een element.
                            substr = lezer.Name;

                            if (substr == "cac:AccountingSupplierParty")
                            {
                                if (lezer.HasAttributes)
                                {
                                    for (int i = 0; i < lezer.AttributeCount; i++)
                                    {
                                        lezer.MoveToAttribute(i);
                                        Console.Write(" {0}={1}", lezer.Name, lezer.Value);
                                        switch (lezer.Name)
                                        {
                                            case "cbc:Name":
                                                leverancier = lezer.Value;
                                                break;
                                        }
                                    }
                                }
                            }
                            break;
                            case XmlNodeType.Text: //De tekst in elk element weergeven.
                                switch (substr)
                                case "cbc:Percent":
                                    string temp = lezer.Value;
                                    temp = temp.Replace('.', ',');
                                percent = decimal.Parse(temp);
                                    break;

                                case "cbc:Description":
                                    artikel = lezer.Value;
                                    break;

// reading another 2 nodes

I need only the name of the supplier, the rest is correct.

Rinaldo


Full of ideas but don&#39;t know how. Coding for fun.

XML Validation with XSD not doing what it's supposed to do

$
0
0

I'm learning XML-validation in C# and I'm stuck. When I run the code I get a validation error: "could not find schema information for the element" for each element I try to read. Any ideas what's wrong?

I have following code

XmlTextReader textReader1 = new XmlTextReader("../../APVDO.xml");
            XmlReaderSettings settings1 = new XmlReaderSettings();
            settings1.ValidationType = ValidationType.Schema;
            settings1.ValidationFlags = XmlSchemaValidationFlags.ReportValidationWarnings;
            settings1.ValidationEventHandler += settings1_ValidationEventHandler;
            settings1.Schemas.Add("http://tempuri.org/APVDO.xsd", "../../APVDO.xsd");

            XmlReader reader1 = XmlReader.Create(textReader1, settings1);

            while (reader1.Read())
            {
                //Console.WriteLine(reader1.Value);
            }

This is the XML document

<?xml version="1.0" ?><personen><docent><voornaam>data</voornaam><familienaam>data</familienaam><geboortedatum>data</geboortedatum><adres><straat>data</straat><nr>data</nr><bus>data</bus><postcode>data</postcode><gemeente>data</gemeente></adres><kinderen><kind><voornaam>data</voornaam><familienaam>data</familienaam><geboortedatum>data</geboortedatum></kind></kinderen></docent><cursist><voornaam>data</voornaam><familienaam>data</familienaam><geboortedatum>data</geboortedatum><adres woontBijOuders="true"><straat>data</straat><nr>data</nr><postcode>data</postcode><gemeente>data</gemeente></adres></cursist>
  ... // more cursist elements</personen>

And the XSD

<?xml version="1.0" encoding="utf-8"?><xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://tempuri.org/APVDO.xsd" ><xs:element name="personen"><xs:complexType><xs:sequence><xs:element maxOccurs="unbounded" name="docent"><xs:complexType><xs:sequence><xs:element name="voornaam" type="xs:string" /><xs:element name="familienaam" type="xs:string" /><xs:element name="geboortedatum" type="xs:string" /><xs:element name="adres"><xs:complexType><xs:sequence><xs:element name="straat" type="xs:string" /><xs:element name="nr" type="xs:unsignedByte" /><xs:element name="bus" type="xs:unsignedByte" /><xs:element name="postcode" type="xs:unsignedShort" /><xs:element name="gemeente" type="xs:string" /></xs:sequence></xs:complexType></xs:element><xs:element name="kinderen"><xs:complexType><xs:sequence><xs:element name="kind"><xs:complexType><xs:sequence><xs:element name="voornaam" type="xs:string" /><xs:element name="familienaam" type="xs:string" /><xs:element name="geboortedatum" type="xs:string" /></xs:sequence></xs:complexType></xs:element></xs:sequence></xs:complexType></xs:element></xs:sequence></xs:complexType></xs:element><xs:element maxOccurs="unbounded" name="cursist"><xs:complexType><xs:sequence><xs:element name="voornaam" type="xs:string" /><xs:element name="familienaam" type="xs:string" /><xs:element name="geboortedatum" type="xs:date" /><xs:element name="adres"><xs:complexType><xs:sequence><xs:element name="straat" type="xs:string" /><xs:element name="nr" type="xs:unsignedByte" /><xs:element minOccurs="0" name="bus" type="xs:unsignedByte" /><xs:element name="postcode" type="xs:unsignedShort" /><xs:element name="gemeente" type="xs:string" /></xs:sequence><xs:attribute name="woontBijOuders" type="xs:boolean" use="optional" /></xs:complexType></xs:element></xs:sequence></xs:complexType></xs:element></xs:sequence></xs:complexType></xs:element></xs:schema>

Wrapping XML entities in CDATA except already present Cdata in document using regex in c#.net

$
0
0

<?xml version="1.0" encoding="UTF-8"?>
<journal-meta>
<issn>Modern data &#x00027; is needed with dummy content. we are good to go.</issn>
<issn1><![CDATA[ data is not proper
&#x000E9;
 ]]>Modern data is needed with dummy content. we are good to go.</issn1>
<issn2>&#x000E9;Modern data is needed with dummy content. we are good to go.</issn2>
<issn3>&#x00027;Modern data is needed with dummy content. we are good to go.</issn3>

</journal-meta>

Output should  :

<?xml version="1.0" encoding="UTF-8"?>
<journal-meta>
<issn>Modern data &#x00027; is needed with dummy content. we are good to go.</issn>
<issn1><![CDATA[ data is not proper
&#x000E9;
 ]]>Modern data is needed with dummy content. we are good to go.</issn1>

<issn2><![CDATA[&#x000E9;]]>Modern data is needed with dummy content. we are good to go.</issn2>
<issn3><![CDATA[&#x00027;]]>Modern data is needed with dummy content. we are good to go.</issn3>


How to validate xml file against xsd

$
0
0

suppose this is my xml file data. now tell me how programmatically validate the xml file and display success and fail. if fail then fail or error detail need to be shown. thanks

<?xml version="1.0" encoding="windows-1252"?><OpenShipmentsxmlns="x-schema:C:\UPSLabel\OpenShipments.xdr"><OpenShipmentShipmentOption=""ProcessStatus=""><ShipTo><CompanyOrName>THE OLD FORGE GARAGE</CompanyOrName><Attention>THE OLD FORGE GARAGE</Attention><Address1>88 HIGH STREET</Address1><Address2>WERTON</Address2><Address3>DEVIZES</Address3><CountryTerritory>FR</CountryTerritory><PostalCode>SN10 5RU</PostalCode><CityOrTown>DEVIZES</CityOrTown><StateProvinceCounty>WILTSHIRE</StateProvinceCounty><Telephone>22222222</Telephone></ShipTo><ShipmentInformation><ServiceType>UPS Standard</ServiceType><PackageType>CP</PackageType><NumberOfPackages>1</NumberOfPackages><ShipmentActualWeight>1</ShipmentActualWeight><DescriptionOfGoods>Remanufactured auto parts</DescriptionOfGoods><Reference1>OUR:T619</Reference1><Reference2>UPS Standard With No Insurace </Reference2><BillingOption>PP</BillingOption></ShipmentInformation></OpenShipment></OpenShipments>

regex to match all cdata elements and replace data from existing search term .net

$
0
0

<issn2><![CDATA[&#x000E9;]]>Modern data is needed with dummy content. we are good to go.</issn2>
<issn3><![CDATA[&#x00027;]]>Modern data is needed with dummy content. we are good to go.</issn3>

output should :

<issn2>&#x000E9;Modern data is needed with dummy content. we are good to go.</issn2>
<issn3>&#x00027;Modern data is needed with dummy content. we are good to go.</issn3>

How to invalidate the cache used by XDocument.Load?

$
0
0

I'm writing a WPF application. The app will run a series of unit tests against some files. The details as to which files and expected results, etc. are in an XML file. I load it with XDocument.Load(_myFileName) every time I click the RunTests button. But if I change the file between runs, the changes are not detected. It seems that XDocument is not detecting the change to the file and is relying on its cached data. How can I force XDocument to re-read the file from disk? Or invalidate the cache so it refreshes from disk?

I see a few posts on this, but they seems to be web based and suggest using http headers to set a caching parameter.  I'm not web based, so even if this works, it's no good for me.

I also saw something about using a memorycache manager: https://msdn.microsoft.com/en-us/library/system.runtime.caching.memorycache.aspx but I can't quite figure out how this would relate to the XDocument...

Any thought on how to force the data refresh are appreciated...

Thanks.

J


http://digitalcamel.blogspot.com/


Unable to Verify Xml Signature after MS16-035 Security Update

$
0
0

After MS16-035 security update this code from MSDN doesn't work.

Where is the problem?

//
// This example signs an XML file using an
// envelope signature. It then verifies the
// signed XML.
//
using System;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
using System.Security.Cryptography.Xml;
using System.Text;
using System.Xml;

public class SignVerifyEnvelope
{

    public static void Main(String[] args)
    {
        // Generate a signing key.
        RSACryptoServiceProvider Key = new RSACryptoServiceProvider();

        string xsl = @"
    <xs:transform xmlns:xs='http://www.w3.org/1999/XSL/Transform' version='1.0'>
        <xs:template match='/'>
            <xs:apply-templates/>
        </xs:template>
        <xs:template match='ElementToTransform'>
            <transformedElement/>
        </xs:template>
    </xs:transform>";

        try
        {
            // Create an XML file to sign.
            CreateSomeXml("Example.xml");
            Console.WriteLine("New XML file created.");

            // Sign the XML that was just created and save it in a
            // new file.
            SignXmlFile("Example.xml", "SignedExample.xml", Key, xsl);
            Console.WriteLine("XML file signed.");

            // Verify the signature of the signed XML.
            Console.WriteLine("Verifying signature...");
            bool result = VerifyXmlFile("SignedExample.xml");

            // Display the results of the signature verification to \
            // the console.
            if (result)
            {
                Console.WriteLine("The XML signature is valid.");
            }
            else
            {
                Console.WriteLine("The XML signature is not valid.");
            }
        }
        catch (CryptographicException e)
        {
            Console.WriteLine(e.Message);
        }
        finally
        {
            Key.Clear();
        }

        Console.ReadLine();

    }

    // Sign an XML file and save the signature in a new file.
    public static void SignXmlFile(string FileName, string SignedFileName, RSA Key, string XSLString)
    {
        // Create a new XML document.
        XmlDocument doc = new XmlDocument();

        // Format the document to ignore white spaces.
        doc.PreserveWhitespace = false;

        // Load the passed XML file using it's name.
        doc.Load(new XmlTextReader(FileName));

        // Create a SignedXml object.
        SignedXml signedXml = new SignedXml(doc);

        // Add the key to the SignedXml document.
        signedXml.SigningKey = Key;

        // Create a reference to be signed.
        Reference reference = new Reference();
        reference.Uri = "";

        // Add an enveloped transformation to the reference.
        XmlDsigEnvelopedSignatureTransform env = new XmlDsigEnvelopedSignatureTransform();
        reference.AddTransform(env);

        // Create an XmlDsigXPathTransform object using
        // the helper method 'CreateXPathTransform' defined
        // later in this sample.

        XmlDsigXsltTransform XsltTransform = CreateXsltTransform(XSLString);

        // Add the transform to the reference.
        reference.AddTransform(XsltTransform);

        // Add the reference to the SignedXml object.
        signedXml.AddReference(reference);

        // Add an RSAKeyValue KeyInfo (optional; helps recipient find key to validate).
        KeyInfo keyInfo = new KeyInfo();
        keyInfo.AddClause(new RSAKeyValue((RSA)Key));
        signedXml.KeyInfo = keyInfo;

        // Compute the signature.
        signedXml.ComputeSignature();

        // Get the XML representation of the signature and save
        // it to an XmlElement object.
        XmlElement xmlDigitalSignature = signedXml.GetXml();

        // Append the element to the XML document.
        doc.DocumentElement.AppendChild(doc.ImportNode(xmlDigitalSignature, true));

        // Save the signed XML document to a file specified
        // using the passed string.
        XmlTextWriter xmltw = new XmlTextWriter(SignedFileName, new UTF8Encoding(false));
        doc.WriteTo(xmltw);
        xmltw.Close();
    }
    // Verify the signature of an XML file and return the result.
    public static Boolean VerifyXmlFile(String Name)
    {
        // Create a new XML document.
        XmlDocument xmlDocument = new XmlDocument();

        // Format using white spaces.
        xmlDocument.PreserveWhitespace = true;

        // Load the passed XML file into the document.
        xmlDocument.Load(Name);

        // Create a new SignedXml object and pass it
        // the XML document class.
        SignedXml signedXml = new SignedXml(xmlDocument);

        // Find the "Signature" node and create a new
        // XmlNodeList object.
        XmlNodeList nodeList = xmlDocument.GetElementsByTagName("Signature");

        // Load the signature node.
        signedXml.LoadXml((XmlElement)nodeList[0]);

        // Check the signature and return the result.
        return signedXml.CheckSignature();

    }

    // Create the XML that represents the transform.
    public static XmlDsigXsltTransform CreateXsltTransform(string xsl)
    {
        XmlDocument doc = new XmlDocument();
        doc.LoadXml(xsl);

        XmlDsigXsltTransform xform = new XmlDsigXsltTransform();
        xform.LoadInnerXml(doc.ChildNodes);

        return xform;
    }

    // Create example data to sign.
    public static void CreateSomeXml(string FileName)
    {
        // Create a new XmlDocument object.
        XmlDocument document = new XmlDocument();

        // Create a new XmlNode object.
        XmlNode node = document.CreateNode(XmlNodeType.Element, "", "MyXML", "Don't_Sign");

        // Append the node to the document.
        document.AppendChild(node);

        // Create a new XmlNode object.
        XmlNode subnode = document.CreateNode(XmlNodeType.Element, "", "ElementToTransform", "Sign");

        // Add some text to the node.
        subnode.InnerText = "Here is some data to sign.";

        // Append the node to the document.
        document.DocumentElement.AppendChild(subnode);

        // Save the XML document to the file name specified.
        XmlTextWriter xmltw = new XmlTextWriter(FileName, new UTF8Encoding(false));
        document.WriteTo(xmltw);
        xmltw.Close();
    }
}

How to get all text in xml tag through regex using c#?

$
0
0

Hi,

Can you please help me?

Which Regex pattern is useful.

Description:

For example,this is xml tag

<title-group>
<title>abcdefghjtshdfg<email>EffectiveHealthCare@ahrq.hhs.gov</email>dfgdfgg</title>
</title-group>
</book-part-meta>
<body>
<p><bold>
<italic>Comparative Effectiveness Review</italic>
</bold></p>
<p><bold>Number 154</bold></p>
<p><bold>Prepared for:</bold></p>
<p>Agency for Healthcare Research and Quality</p>
<p>U.S. Department of Health and Human Services</p>
<p>540 Gaither Road</p>
<p>Rockville, MD 20850</p>
<p><ext-link xlink:href="www.ahrq.gov" ext-link-type="uri">www.ahrq.gov</ext-link></p>
<p><bold>Contract No. 290-2012-00009-I</bold></p>

In this example,

How to get highlighted text of tag though regex?

Thanks,

Rupali


DTD must be defined

$
0
0

I am trying to create an XML file. I created one using the below code

Dim XD As XDocument = <?xml version="1.0" encoding="UTF-8" standalone="no"?><Movies></Movies>

For Each M in Movies
  XD.Root.Add(<Movie><Title><%= M.Title %></Title>
              ....</Movie>)
Next

This worked great until i started receiving the error "DTD must be defined before the document root element", so set standalone to "no" (as above). This still hasnt resolved the issue.

When viewing the XML i noticed no declaration is present but i dont know if that would cause this issue or not?

In addition, if it helps, when i read the XML my code for that is
Dim Xdoc As XDocument = XDocument.Load(UrlToXml)

how to load xml file with CDATA in c#

$
0
0
how to load xml file with CDATA in c#

file.readalltext() method truncating file data in c#

$
0
0

my xml file is

<?xml version="1.0" encoding="UTF-8"?>
<journal-meta>
<issn>Modern data &#x00027; is needed with dummy content. we are good to go.</issn>
<issn1><![CDATA[ &#x000E9; ]]>Modern data is needed with dummy content. we are good to go.</issn1>
 ]]>Modern data is needed with dummy content. we are good to go.</issn1>
<issn2>&#x000E9;Modern data is needed with dummy content. we are good to go.</issn2>
<issn3>&#x00027;Modern data is needed with dummy content. we are good to go.</issn3>

<issn4>&#x00026;Modern data is needed with dummy content. we are good to go.</issn4>
<issn5>&#x02013;Modern data is needed with dummy content. we are good to go.</issn5>
</journal-meta>

using this code truncating file data

string inputString = File.ReadAllText(OFile);

  File.WriteAllText(
             "output.xml",
             CdataText
       );

<?xml version="1.0" encoding="UTF-8"?>
<journal-meta>
<issn>Modern data &#x00027; is needed with dummy content. we are good to go.</issn>
<issn1><![CDATA[ &#x000E9; ]]>Modern data is needed with dummy content. we are good to go.</issn1>
 ]]>Modern data is needed with dummy content. we are good to go.</issn1>
<issn2>&#x000E9;Modern data is needed with dummy content. we are good to go.</issn2>

<issn5>&#x02013;Modern data is needed with dummy content. we are good to go.</issn5>
</journal-meta>





Unaxcepted behaviour of IXMLDOMDocument2Ptr in C++ and C#

$
0
0

Hi All,

I have a doubt on CPP and C# Applications running on Windows Embedded Compact-7.
I am loading a library in c++ as
    
hNWLib = LoadLibrary(L"Sample.dll");
SampleFunc= (PFN_SampleFunc)GetProcAddress(hNWLib, L"SampleFunc");

SampleFunc();

And inside the Sample.dll in "SampleFunc()" function am accessing "DOMDOCUMENTPTR" class as follows

MSXML2::IXMLDOMDocument2Ptr  doc;
MSXML2::IXMLDOMElementPtr    root;

while am accessing any of the method inside "doc" object, as like "doc->async" or "doc->appendChild" it through exception on sample application as

Exception 'Raised Exception' (0xe06d7363): Thread-Id=075601c6(pth=a34d53b8), Proc-Id=078b022a(pprc=a34d5d20) 'SAMPLE_APP.EXE',
VM-active=078b022a(pprc=a34d5d20) 'SAMPLE_APP.EXE'
PC=400513f4(coredll.dll+0x000413f4) RA=81037648(kernel.dll+0x0000e648) SP=0002fa1c, BVA=0002fa50

And the unexpected thing is, When i created a sample C# application and loads the DLL as

[DllImport("Sample.dll", SetLastError = true)]
private static unsafe extern UInt32 SampleFunc();

SampleFunc();

It's working without any issue. It is creating "MSXML2::IXMLDOMDocument2Ptr" object and working fine.

So i have some doubts regarding above trials.

Why this different behaviour in C++ and C# application with same implementation??
    (As my understanding there might not be any problem in loading the library and accessing the "SampleFunc()")
Is there have any issue regarding accessing mechanism of "MSXML2::IXMLDOMDocument2Ptr" class in C++ and C#??
    (Already including the needed xml library)
Is there have any application permission kind of things??
    (As my knowledge there is no application permissions in WEC7)

Actually i am confused with this unexpected behavior. Can anyone help me to find the reason... 

Thanks and Regards
ASWIN PP

AutoAttend.xml error: Can not read <productKey> setting in the answer file for unattended installation

$
0
0

I've been trying to make a USB flash drive able to automatically install windows 10 with a preset configuration.

I have been using a generator to make the autoattend.xml file, but after 20 sec the progression stops and and a window showing the following message: "Can not read <productKey> setting in the answer file for unattended installation."

Link for the generating website: http://windowsafg.no-ip.org/win10x86_x64.html

i have been searching for answers for this for hours, and not getting anywhere.

and i have manually tested the product key without the autoattend.xml file, and it works fine.

Here's the code i'm using:

<!--*************************************************
Windows 10 Answer File Generator
Created using Windows AFG found at:
http://windowsafg.no-ip.org

Installation Notes
Location: 
Notes: Enter your comments here...
**************************************************-->

<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
<settings pass="windowsPE">
<component name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SetupUILanguage>
<UILanguage>en-US</UILanguage>
</SetupUILanguage>
<InputLocale>0414:00000414</InputLocale>
<SystemLocale>en-US</SystemLocale>
<UILanguage>en-US</UILanguage>
<UILanguageFallback>en-US</UILanguageFallback>
<UserLocale>nb-NO</UserLocale>
</component>
<component name="Microsoft-Windows-International-Core-WinPE" 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">
<SetupUILanguage>
<UILanguage>en-US</UILanguage>
</SetupUILanguage>
<InputLocale>0414:00000414</InputLocale>
<SystemLocale>en-US</SystemLocale>
<UILanguage>en-US</UILanguage>
<UILanguageFallback>en-US</UILanguageFallback>
<UserLocale>nb-NO</UserLocale>
</component>
<component name="Microsoft-Windows-Setup" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<DiskConfiguration>
<Disk wcm:action="add">
<CreatePartitions>
<CreatePartition wcm:action="add">
<Order>1</Order>
<Type>Primary</Type>
<Size>100</Size>
</CreatePartition>
<CreatePartition wcm:action="add">
<Extend>true</Extend>
<Order>2</Order>
<Type>Primary</Type>
</CreatePartition>
</CreatePartitions>
<ModifyPartitions>
<ModifyPartition wcm:action="add">
<Active>true</Active>
<Format>NTFS</Format>
<Label>System Reserved</Label>
<Order>1</Order>
<PartitionID>1</PartitionID>
<TypeID>0x27</TypeID>
</ModifyPartition>
<ModifyPartition wcm:action="add">
<Active>true</Active>
<Format>NTFS</Format>
<Label>OS</Label>
<Letter>C</Letter>
<Order>2</Order>
<PartitionID>2</PartitionID>
</ModifyPartition>
</ModifyPartitions>
<DiskID>0</DiskID>
<WillWipeDisk>true</WillWipeDisk>
</Disk>
</DiskConfiguration>
<ImageInstall>
<OSImage>
<InstallTo>
<DiskID>0</DiskID>
<PartitionID>2</PartitionID>
</InstallTo>
<InstallToAvailablePartition>false</InstallToAvailablePartition>
</OSImage>
</ImageInstall>
<UserData>
<AcceptEula>true</AcceptEula>
<FullName>Administrator</FullName>
<Organization>VAF</Organization>
</UserData>
<EnableFirewall>true</EnableFirewall>
</component>
<component name="Microsoft-Windows-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">
<DiskConfiguration>
<Disk wcm:action="add">
<CreatePartitions>
<CreatePartition wcm:action="add">
<Order>1</Order>
<Type>Primary</Type>
<Size>100</Size>
</CreatePartition>
<CreatePartition wcm:action="add">
<Extend>true</Extend>
<Order>2</Order>
<Type>Primary</Type>
</CreatePartition>
</CreatePartitions>
<ModifyPartitions>
<ModifyPartition wcm:action="add">
<Active>true</Active>
<Format>NTFS</Format>
<Label>System Reserved</Label>
<Order>1</Order>
<PartitionID>1</PartitionID>
<TypeID>0x27</TypeID>
</ModifyPartition>
<ModifyPartition wcm:action="add">
<Active>true</Active>
<Format>NTFS</Format>
<Label>OS</Label>
<Letter>C</Letter>
<Order>2</Order>
<PartitionID>2</PartitionID>
</ModifyPartition>
</ModifyPartitions>
<DiskID>0</DiskID>
<WillWipeDisk>true</WillWipeDisk>
</Disk>
</DiskConfiguration>
<ImageInstall>
<OSImage>
<InstallTo>
<DiskID>0</DiskID>
<PartitionID>2</PartitionID>
</InstallTo>
<InstallToAvailablePartition>false</InstallToAvailablePartition>
</OSImage>
</ImageInstall>
<UserData>
<AcceptEula>true</AcceptEula>
<FullName>Administrator</FullName>
<Organization>VAF</Organization>
</UserData>
<EnableFirewall>true</EnableFirewall>
</component>
</settings>
<settings pass="offlineServicing">
<component name="Microsoft-Windows-LUA-Settings" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<EnableLUA>false</EnableLUA>
</component>
</settings>
<settings pass="offlineServicing">
<component name="Microsoft-Windows-LUA-Settings" 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">
<EnableLUA>false</EnableLUA>
</component>
</settings>
<settings pass="generalize">
<component name="Microsoft-Windows-Security-SPP" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SkipRearm>1</SkipRearm>
</component>
</settings>
<settings pass="generalize">
<component name="Microsoft-Windows-Security-SPP" 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">
<SkipRearm>1</SkipRearm>
</component>
</settings>
<settings pass="specialize">
<component name="Microsoft-Windows-International-Core" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<InputLocale>0414:00000414</InputLocale>
<SystemLocale>nb-NO</SystemLocale>
<UILanguage>nb-NO</UILanguage>
<UILanguageFallback>nb-NO</UILanguageFallback>
<UserLocale>nb-NO</UserLocale>
</component>
<component name="Microsoft-Windows-International-Core" 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">
<InputLocale>0414:00000414</InputLocale>
<SystemLocale>nb-NO</SystemLocale>
<UILanguage>nb-NO</UILanguage>
<UILanguageFallback>nb-NO</UILanguageFallback>
<UserLocale>nb-NO</UserLocale>
</component>
<component name="Microsoft-Windows-Security-SPP-UX" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SkipAutoActivation>true</SkipAutoActivation>
</component>
<component name="Microsoft-Windows-Security-SPP-UX" 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">
<SkipAutoActivation>true</SkipAutoActivation>
</component>
<component name="Microsoft-Windows-SQMApi" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<CEIPEnabled>0</CEIPEnabled>
</component>
<component name="Microsoft-Windows-SQMApi" 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">
<CEIPEnabled>0</CEIPEnabled>
</component>
<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ComputerName>Privat-PC</ComputerName>
<ProductKey>W269N-WFGWX-YVC9B-4J6C9-T83GX</ProductKey>
</component>
<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">
<ComputerName>Privat-PC</ComputerName>
<ProductKey>W269N-WFGWX-YVC9B-4J6C9-T83GX</ProductKey>
</component>
</settings>
<settings pass="oobeSystem">
<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<AutoLogon>
<Password>
<Value></Value>
<PlainText>true</PlainText>
</Password>
<Enabled>true</Enabled>
<Username>Administrator</Username>
</AutoLogon>
<OOBE>
<HideEULAPage>true</HideEULAPage>
<HideOEMRegistrationScreen>true</HideOEMRegistrationScreen>
<HideOnlineAccountScreens>true</HideOnlineAccountScreens>
<HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE>
<NetworkLocation>Home</NetworkLocation>
<SkipUserOOBE>true</SkipUserOOBE>
<SkipMachineOOBE>true</SkipMachineOOBE>
<ProtectYourPC>1</ProtectYourPC>
</OOBE>
<UserAccounts>
<LocalAccounts>
<LocalAccount wcm:action="add">
<Password>
<Value></Value>
<PlainText>true</PlainText>
</Password>
<Description>Administrator</Description>
<DisplayName>Administrator</DisplayName>
<Group>Administrators</Group>
<Name>Administrator</Name>
</LocalAccount>
</LocalAccounts>
</UserAccounts>
<RegisteredOrganization>VAF</RegisteredOrganization>
<RegisteredOwner>Administrator</RegisteredOwner>
<DisableAutoDaylightTimeSet>false</DisableAutoDaylightTimeSet>
<FirstLogonCommands>
<SynchronousCommand wcm:action="add">
<Description>Control Panel View</Description>
<Order>1</Order>
<CommandLine>reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ControlPanel" /v StartupPage /t REG_DWORD /d 1 /f</CommandLine>
<RequiresUserInput>true</RequiresUserInput>
</SynchronousCommand>
<SynchronousCommand wcm:action="add">
<Order>2</Order>
<Description>Control Panel Icon Size</Description>
<RequiresUserInput>false</RequiresUserInput>
<CommandLine>reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ControlPanel" /v AllItemsIconView /t REG_DWORD /d 0 /f</CommandLine>
</SynchronousCommand>
</FirstLogonCommands>
<TimeZone>W. Europe Standard Time</TimeZone>
</component>
<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">
<AutoLogon>
<Password>
<Value></Value>
<PlainText>true</PlainText>
</Password>
<Enabled>true</Enabled>
<Username>Administrator</Username>
</AutoLogon>
<OOBE>
<HideEULAPage>true</HideEULAPage>
<HideOEMRegistrationScreen>true</HideOEMRegistrationScreen>
<HideOnlineAccountScreens>true</HideOnlineAccountScreens>
<HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE>
<NetworkLocation>Home</NetworkLocation>
<SkipUserOOBE>true</SkipUserOOBE>
<SkipMachineOOBE>true</SkipMachineOOBE>
<ProtectYourPC>1</ProtectYourPC>
</OOBE>
<UserAccounts>
<LocalAccounts>
<LocalAccount wcm:action="add">
<Password>
<Value></Value>
<PlainText>true</PlainText>
</Password>
<Description>Administrator</Description>
<DisplayName>Administrator</DisplayName>
<Group>Administrators</Group>
<Name>Administrator</Name>
</LocalAccount>
</LocalAccounts>
</UserAccounts>
<RegisteredOrganization>VAF</RegisteredOrganization>
<RegisteredOwner>Administrator</RegisteredOwner>
<DisableAutoDaylightTimeSet>false</DisableAutoDaylightTimeSet>
<FirstLogonCommands>
<SynchronousCommand wcm:action="add">
<Description>Control Panel View</Description>
<Order>1</Order>
<CommandLine>reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ControlPanel" /v StartupPage /t REG_DWORD /d 1 /f</CommandLine>
<RequiresUserInput>true</RequiresUserInput>
</SynchronousCommand>
<SynchronousCommand wcm:action="add">
<Order>2</Order>
<Description>Control Panel Icon Size</Description>
<RequiresUserInput>false</RequiresUserInput>
<CommandLine>reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ControlPanel" /v AllItemsIconView /t REG_DWORD /d 0 /f</CommandLine>
</SynchronousCommand>
</FirstLogonCommands>
<TimeZone>W. Europe Standard Time</TimeZone>
</component>
</settings>
</unattend>



replace char using XSLT

$
0
0

Hi All,

 

Iam trying to modify the json string as shown below

{"mbs":{"msg":{"i":"6796","c":"0","st":"031116180300","et":"031216180100","th":"brown","d":[{"data":"Welcome to Abraham's Party"}],"t":[{"data":"happy"}]}}}

and my task is to replace the single notation which exists only in the d attribute with & char and the final output should be s shown below

{"mbs":{"msg":{"i":"6796","c":"0","st":"031116180300","et":"031216180100","th":"brown","d":[{"data":"Welcome to Abraham&s Party"}],"t":[{"data":"happy"}]}}}
please find the XSLT that iam using currently

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
      <xsl:output method = "text" />
      <xsl:template match="/">
            <xsl:apply-templates select="mbs"/>
      </xsl:template>
      <xsl:template match="mbs">
            <xsl:text>{"mbs":{</xsl:text>
            <xsl:text>"msg":{</xsl:text>
            <xsl:for-each select="msg">
                  <xsl:text>"i":"</xsl:text><xsl:value-of select="@mid" /><xsl:text>",</xsl:text>
                  <xsl:text>"c":"</xsl:text><xsl:value-of select="@mr" /><xsl:text>",</xsl:text>
                  <xsl:text>"st":"</xsl:text><xsl:value-of select="@st" /><xsl:text>",</xsl:text>
                  <xsl:text>"et":"</xsl:text><xsl:value-of select="@et" /><xsl:text>",</xsl:text>
                  <xsl:text>"th":"</xsl:text><xsl:value-of select="@stt" /><xsl:text>"</xsl:text>
                  <xsl:text>,"d":[</xsl:text>
                  <xsl:for-each select="d">
                        <xsl:if test="position()=1">
                  <xsl:text>{"data":"</xsl:text><xsl:value-of select="."/><xsl:text>"}</xsl:text>
                        </xsl:if>
                  </xsl:for-each>
                  <xsl:text>]</xsl:text>
                  <xsl:text>,"t":[</xsl:text>
                  <xsl:for-each select="t">
                        <xsl:if test="position()=1">
                        <xsl:text>{"data":"</xsl:text><xsl:value-of select="."/><xsl:text>"}</xsl:text>
                        </xsl:if>
                  </xsl:for-each>
                  <xsl:text>]}</xsl:text>
            </xsl:for-each>
            <xsl:text>}}</xsl:text>
      </xsl:template>
</xsl:stylesheet>

Kindly help me on the same.

Thanks,

Ram


c# .XSPF (XML) how to get node depth

$
0
0

i have a .xspf playlist that i parse but the playlist has folders inside folders so when i display my parsed data

it doesnt have the same "depth". what would be the best way to achieve this.

Here is the .xspf

the folders are <vlc:node title="FOLDER">


<?xml version="1.0" encoding="UTF-8"?><playlist xmlns="http://xspf.org/ns/0/" xmlns:vlc="http://www.videolan.org/vlc/playlist/ns/0/" version="1"><title>Playlist</title><trackList><track><location>file:///E:/Downloads/JD/New%20Folder%20%282%29/Uuskaial.mp4</location><duration>1267008</duration><extension application="http://www.videolan.org/vlc/playlist/0"><vlc:id>0</vlc:id></extension></track><track><location>file:///E:/Downloads/JD/New%20Folder%20%282%29/Uusi%20kansio/111acho.mp4</location><duration>1904013</duration><extension application="http://www.videolan.org/vlc/playlist/0"><vlc:id>1</vlc:id></extension></track><track><location>file:///E:/Downloads/JD/New%20Folder%20%282%29/Uuansio.mp4</location><duration>538800</duration><extension application="http://www.videolan.org/vlc/playlist/0"><vlc:id>2</vlc:id></extension></track> ..... ..... ..... ..... </trackList><extension application="http://www.videolan.org/vlc/playlist/0"><vlc:node title="444"><vlc:item tid="157"/><vlc:item tid="158"/><vlc:item tid="159"/><vlc:item tid="160"/><vlc:item tid="161"/><vlc:item tid="162"/><vlc:item tid="163"/><vlc:item tid="164"/><vlc:item tid="165"/><vlc:item tid="166"/><vlc:item tid="167"/><vlc:item tid="168"/><vlc:item tid="169"/><vlc:item tid="170"/><vlc:item tid="171"/><vlc:item tid="172"/><vlc:item tid="173"/><vlc:item tid="174"/><vlc:item tid="175"/></vlc:node><vlc:node title="333"><vlc:node title="em"><vlc:item tid="215"/><vlc:item tid="216"/><vlc:item tid="217"/><vlc:item tid="218"/><vlc:item tid="219"/><vlc:item tid="220"/></vlc:node><vlc:node title="soo"><vlc:item tid="236"/><vlc:item tid="237"/><vlc:item tid="238"/><vlc:item tid="239"/></vlc:node><vlc:node title="WC"><vlc:item tid="269"/><vlc:item tid="270"/><vlc:item tid="271"/><vlc:item tid="272"/><vlc:item tid="273"/><vlc:item tid="274"/><vlc:item tid="275"/><vlc:item tid="276"/><vlc:item tid="277"/><vlc:item tid="278"/><vlc:item tid="279"/></vlc:node><vlc:node title="1"><vlc:node title="12"><vlc:item tid="319"/><vlc:item tid="320"/><vlc:item tid="321"/><vlc:item tid="322"/><vlc:item tid="323"/><vlc:item tid="324"/><vlc:item tid="325"/><vlc:item tid="326"/><vlc:item tid="327"/><vlc:item tid="328"/></vlc:node><vlc:item tid="371"/><vlc:item tid="372"/><vlc:item tid="373"/><vlc:item tid="374"/><vlc:item tid="375"/><vlc:item tid="376"/><vlc:item tid="377"/><vlc:item tid="378"/><vlc:item tid="379"/><vlc:item tid="380"/></vlc:node><vlc:item tid="439"/><vlc:item tid="440"/><vlc:item tid="441"/><vlc:item tid="442"/><vlc:item tid="443"/><vlc:item tid="444"/></vlc:node></extension></playlist>

Here is the c# code

private void button4_Click(object sender, EventArgs e)
		{
			XDocument xdoc = XDocument.Load("aaah.xspf");
			XElement playlist = (XElement)xdoc.FirstNode;

			XNamespace ns = xdoc.Root.GetDefaultNamespace();
			XNamespace nx = ("http://www.videolan.org/vlc/playlist/ns/0/");
			var extension = xdoc.Root.Element(ns + "extension");
			var nodes = extension.Descendants(nx + "node").Where(n => n.Elements(nx + "item").Any());


			List<TitleAndIds> titles = nodes.Select(n => new TitleAndIds
												{
													Title = n.Attribute("title").Value,
													Ids = n.Elements(nx + "item").Select(i => int.Parse(i.Attribute("tid").Value)).ToArray()
												}).ToList();


			List<PlaylistItem> fileSignatures = (from file in xdoc.Descendants(ns + "track")
												 select new PlaylistItem
												 {
													 location = (string)file.Element(ns + "location").Value,
													 extensions = (string)file.Element(ns + "extension").Value,
													 duration = (string)file.Element(ns + "duration")
												 }).ToList();


			foreach (var item in titles)
			{
				treeView1.Nodes.Add(new TreeNode(item.Title));


				foreach (var childItem in item.Ids)
				{
					//Remove %20 (spaces)
					var file = System.Net.WebUtility.UrlDecode(fileSignatures[childItem].location);
					//trim file:/// from start
					char[] trimChar = { 'f', 'i', 'l', 'e', '/', ':' };
					file = file.TrimStart(trimChar);


					//treeView1.Nodes[titles.IndexOf(item)].Nodes.Add(new TreeNode(childItem.ToString()));
					treeView1.Nodes[titles.IndexOf(item)].Nodes.Add(new TreeNode(file));
				}
			}

		}

Thanks 


Xslt and html5 tags

$
0
0

I have an xml file with a basic structure like this

<menubar>

<menu menu_id="xxx">

<menu_item  item_id="yyy">

</menu_item></menu></menubar>

I have an xslt file that processes this and creates an html menu using basic xslt code

<ul><xsl:for-each select="menubar">

<li><xsl:value-of select="menu>

<ul><xsl:for-each select="menu/menu_item"><xsl:apply-templates>

Everything works fine in all browsers including IE11 all modes.   It also worked in Edge until the win 10  Nov update.  It now can not find the <menu tags.   If I change it to any html5 tag like <audio> it also ignores it, but if changed to menuz for example it works.   Apparently xslt treats html5 tags as white space.   Since the XML file is generated at our customers site from their configuration data our customers systems are broken in Edge.   Is there an xslt statement that overrides this behavior?

DiffXML to compare XML files gives confusing outputs

$
0
0
So I'm trying to use the XMLDiff Microsoft provides to find the difference between two XML files. The aim is to compare two XML files and find out the exact differences so I can make an Audit Trail out of them. The files may have difference structures (nodes added or removed). 

However, the XMLDiff seems to give me an unexpected output when it comes to nested repeating structures.

Example XML #1 (original):

<pd:AP xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:pd="http://www.ascentn.com/bpm/XMLSchema"><pd:processFields /><pd:formFields><pd:TextBox1>val 1</pd:TextBox1><pd:DropdownList1>Option 4</pd:DropdownList1><pd:TextBox2>val 2</pd:TextBox2><pd:CheckBox1>Option 2;Option 3;Option 4</pd:CheckBox1><pd:SubForm1_SubForm><pd:SubForm1><pd:TextBox3>val 3</pd:TextBox3><pd:DropdownList3>Option 3</pd:DropdownList3><pd:DropdownList2>Option 2</pd:DropdownList2></pd:SubForm1><pd:SubForm1><pd:TextBox3>val 4</pd:TextBox3><pd:DropdownList3>Option 5</pd:DropdownList3><pd:DropdownList2>Option 3</pd:DropdownList2></pd:SubForm1></pd:SubForm1_SubForm></pd:formFields></pd:AP>


Example XML #2 (modified):

    
<pd:AP xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:pd="http://www.ascentn.com/bpm/XMLSchema"><pd:processFields /><pd:formFields><pd:TextBox1>val 1.changed</pd:TextBox1><pd:DropdownList1>Option 4</pd:DropdownList1><pd:TextBox2>val 2</pd:TextBox2><pd:CheckBox1>Option 2;Option 3;Option 4</pd:CheckBox1><pd:SubForm1_SubForm><pd:SubForm1><pd:TextBox3>val 3.changed</pd:TextBox3><pd:DropdownList3>Option 3</pd:DropdownList3><pd:DropdownList2>Option 2</pd:DropdownList2></pd:SubForm1><pd:SubForm1><pd:TextBox3>val 4</pd:TextBox3><pd:DropdownList3>Option 5</pd:DropdownList3><pd:DropdownList2>Option 11</pd:DropdownList2></pd:SubForm1><pd:SubForm1><pd:TextBox3>val 6</pd:TextBox3><pd:DropdownList3>Option 3</pd:DropdownList3><pd:DropdownList2>Option 3</pd:DropdownList2></pd:SubForm1></pd:SubForm1_SubForm></pd:formFields></pd:AP>


The Diff XML File I get is :

    
<?xml version="1.0" encoding="utf-8"?><xd:xmldiff version="1.0" srcDocHash="12260906919056999448" options="IgnoreChildOrder IgnoreNamespaces IgnorePrefixes " fragments="no" xmlns:xd="http://schemas.microsoft.com/xmltools/2002/xmldiff"><xd:node match="1"><xd:node match="2"><xd:node match="5"><xd:add type="1" name="SubForm1" ns="http://www.ascentn.com/bpm/XMLSchema" prefix="pd"><xd:add><pd:DropdownList2 xmlns:pd="http://www.ascentn.com/bpm/XMLSchema">Option 11</pd:DropdownList2></xd:add><xd:add match="/1/2/5/2/1-2" opid="1" /></xd:add><xd:node match="1"><xd:node match="1"><xd:change match="1">val 3.changed</xd:change></xd:node></xd:node><xd:node match="2"><xd:add><pd:TextBox3 xmlns:pd="http://www.ascentn.com/bpm/XMLSchema">val 6</pd:TextBox3><pd:DropdownList3 xmlns:pd="http://www.ascentn.com/bpm/XMLSchema">Option 3</pd:DropdownList3></xd:add><xd:remove match="1-2" opid="1" /></xd:node></xd:node><xd:node match="1"><xd:change match="1">val 1.changed</xd:change></xd:node></xd:node></xd:node><xd:descriptor opid="1" type="move" /></xd:xmldiff>



This is quite strange because if you see the second node of pd:SubForm1, I have only changed the 3rd element inside it. Why does it pick it up as a node removed and added back again? Shouldn't it have flagged that as a change?

If I change the first two node in pd:SubForm1 then it picks it up as changed, but as soon as the 3rd (last node is changed) it flags it as a removal and addition (even if the first two are unchanged).

And I have IgnoreChildOrder flag set

    XmlDiff xmldiff = new XmlDiff(XmlDiffOptions.IgnoreChildOrder |
                                            XmlDiffOptions.IgnoreNamespaces |
                                            XmlDiffOptions.IgnorePrefixes);



Any idea how to bypass this or any thoughts on how to it in a better way?

Any help would be highly appreciated.

Adding unique key to Nodes to make Parent Child relationship

$
0
0

Hello All,

What I am trying to do is create an id tag with an number that will act as a primary key to link the <envelope> tag with all the tags it should have like <person> <contact> <address> <notice> <account> <share> and so on. I want to be able to query the data in Access but the data does not import very well. Does anyone have any ideas? I am new to this just need some direction.

XML Document:

<noticeProduction type="c" xmlns="http://www.example.com" revision="2015-11-10"><prologue type="c"><institutionId>22</institutionId><institutionName>Test INC</institutionName><databaseName>testdb</databaseName><terminology option="S">Savings and Checking</terminology><impoundTerminology option="E">Escrow</impoundTerminology><productionDate>2016-21-03</productionDate><productionTime>2016-21-15 23:52:33 EDT</productionTime><reportTitle>Maturity Notice Production</reportTitle><currentCutoffNoticeProductionSerial>1345</currentCutoffNoticeProductionSerial><priorCutoffNoticeProductionSerial>345</priorCutoffNoticeProductionSerial></prologue><envelope type="a"><person type="a"><serial>5432</serial><personLinkCategory option="PR">Primary owner</personLinkCategory><firstName>Lynn</firstName><lastName>Tanner</lastName><contact type="a"><serial>5677</serial><category option="BP">Business phone</category><value>(345)234-1190</value></contact><contact type="a"><serial>2456</serial><category option="PE">Personal email</category><value>ltanner4534@eirco423.net</value></contact><contact type="a"><serial>1135</serial><category option="HP">Home phone</category><value>(614)455-6778</value></contact></person><person type="a"><serial>5805</serial><personLinkCategory option="JT">Joint owner</personLinkCategory><firstName>Ultra</firstName><lastName>Tanner</lastName></person><address type="c"><serial>2456</serial><addressSerial>4070</addressSerial><category option="R">Residence</category><street>43 Times Ping Two Rail Lane</street><city>Thomas Co Commons Oreland</city></address><notice type="a"><serial>1587</serial><category option="F">Force pay</category><account type="c"><serial>4358</serial><accountNumber>0000000000</accountNumber><eStatementOption option="E">E-statement only</eStatementOption><eStatementEmailAddress>tay3456fgee@eircom.net</eStatementEmailAddress><share type="c"><serial>35688</serial><id>0004</id><description>Checking</description><typeSerial>6</typeSerial><typeDescription>Checking</typeDescription></share></account><transactionSerial>98432123</transactionSerial><monetarySerial>34563221</monetarySerial><postingDate>2016-21-02</postingDate><effectiveDate>2016-21-02</effectiveDate><effectiveBalance>19.72</effectiveBalance><effectiveBalanceResult>-1260.28</effectiveBalanceResult><availableBalance>19.72</availableBalance><availableBalanceResult>-1260.28</availableBalanceResult><feePostAmount>30.00</feePostAmount><feeDescription>Overdraft Fee</feeDescription><item type="a"><serial>2378</serial><postingItemSerial>6532</postingItemSerial><category option="W">Withdrawal</category><source option="a">ACH</source><description>BANK OF AMERICA</description><amount>1250.00</amount></item></notice></envelope><epilogue type="c"><envelopeCount>825</envelopeCount><noticeCount>1478</noticeCount></epilogue></noticeProduction>

XSLT DOcument:

<?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"><xsl:template match="/"><dataroot><xsl:apply-templates select="@*|node()"/></dataroot></xsl:template><xsl:template match="@*|node()"><xsl:copy><xsl:apply-templates select="@*|node()"/></xsl:copy></xsl:template></xsl:stylesheet>

What I want my xml document to look like:

<noticeProduction type="c" xmlns="http://www.example.com" revision="2015-11-10"><prologue type="c"><institutionId>22</institutionId><institutionName>Test INC</institutionName><databaseName>testdb</databaseName><terminology option="S">Savings and Checking</terminology><impoundTerminology option="E">Escrow</impoundTerminology><productionDate>2016-21-03</productionDate><productionTime>2016-21-15 23:52:33 EDT</productionTime><reportTitle>Maturity Notice Production</reportTitle><currentCutoffNoticeProductionSerial>1345</currentCutoffNoticeProductionSerial><priorCutoffNoticeProductionSerial>345</priorCutoffNoticeProductionSerial></prologue><envelope type="a"><id>1098333113</id><person type="a"><id>1098333113</id><serial>5432</serial><personLinkCategory option="PR">Primary owner</personLinkCategory><firstName>Lynn</firstName><lastName>Tanner</lastName><contact type="a"><id>1098333113</id><serial>5677</serial><category option="BP">Business phone</category><value>(345)234-1190</value></contact><contact type="a"><id>1098333113</id><serial>2456</serial><category option="PE">Personal email</category><value>ltanner4534@eirco423.net</value></contact><contact type="a"><id>1098333113</id><serial>1135</serial><category option="HP">Home phone</category><value>(614)455-6778</value></contact></person><person type="a"><id>1098333113</id><serial>5805</serial><personLinkCategory option="JT">Joint owner</personLinkCategory><firstName>Ultra</firstName><lastName>Tanner</lastName></person><address type="c"><id>1098333113</id><serial>2456</serial><addressSerial>4070</addressSerial><category option="R">Residence</category><street>43 Times Ping Two Rail Lane</street><city>Thomas Co Commons Oreland</city></address><notice type="a"><id>1098333113</id><serial>1587</serial><category option="F">Force pay</category><account type="c"><id>1098333113</id><serial>4358</serial><accountNumber>0000000000</accountNumber><eStatementOption option="E">E-statement only</eStatementOption><eStatementEmailAddress>tay3456fgee@eircom.net</eStatementEmailAddress><share type="c"><id>1098333113</id><serial>35688</serial><id>0004</id><description>Checking</description><typeSerial>6</typeSerial><typeDescription>Checking</typeDescription></share></account><transactionSerial>98432123</transactionSerial><monetarySerial>34563221</monetarySerial><postingDate>2016-21-02</postingDate><effectiveDate>2016-21-02</effectiveDate><effectiveBalance>19.72</effectiveBalance><effectiveBalanceResult>-1260.28</effectiveBalanceResult><availableBalance>19.72</availableBalance><availableBalanceResult>-1260.28</availableBalanceResult><feePostAmount>30.00</feePostAmount><feeDescription>Overdraft Fee</feeDescription><item type="a"><id>1098333113</id><serial>2378</serial><postingItemSerial>6532</postingItemSerial><category option="W">Withdrawal</category><source option="a">ACH</source><description>BANK OF AMERICA</description><amount>1250.00</amount></item></notice></envelope><epilogue type="c"><envelopeCount>825</envelopeCount><noticeCount>1478</noticeCount></epilogue></noticeProduction>

Viewing all 935 articles
Browse latest View live