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

Blank App (Uninversal Windows) Visual Basic.

$
0
0

*Note to Moderators... I hope I have selected the correct forum to post in. If not, please advise. Thank you*

I have entered in any text, this happens when I double click to MainPage.xaml so as I can begin my design process. I have tried to uninstall/re-install, repair, and doing as it says. What there options do/would you have for me? Perhaps a complete list of all programs installed with VS, may be something is not getting uninstalled or something. I am at a loss please help. Thank you in advance. My operating system is Window 10, and my setting is set to developer mode.

The textbox displays the following text:

 

System.Runtime.InteropServices.COMException

The operation attempted to access data outside the valid rangeThe operation attempted to access data outside the valid range

  at Microsoft.VisualStudio.DesignTools.HostUtility.AppPackage.AppPackageNativeMethods.IApplicationActivationManager.ActivateApplication(String appUserModelId, String activationContext, ActivateOptions options, Int32& processId)  at Microsoft.VisualStudio.DesignTools.HostUtility.AppPackage.DesignerWrtUtility.ActivateApplication(String appUserModelId, String activationContext, Object site, Boolean isRunningElevated)  at Microsoft.VisualStudio.DesignTools.HostUtility.Platform.AppContainerProcessDomainFactory.ActivateApplicationInternal(String appUserModelId, String activationContext, Object site)  at Microsoft.VisualStudio.DesignTools.HostUtility.Platform.AppContainerProcessDomainFactory.CreateDesignerProcess(String applicationPath, String clientPort, Uri hostUri, IDictionary environmentVariables, Int32& processId, Object& processData)  at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Primitives.ProcessDomainFactory.ProcessIsolationDomain..ctor(ProcessDomainFactory factory, IIsolationBoundary boundary, AppDomainSetup appDomainInfo, IIsolationTarget isolationTarget, String baseDirectory)   at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Primitives.ProcessDomainFactory.CreateIsolationDomain(IIsolationBoundary boundary)  at Microsoft.VisualStudio.DesignTools.HostUtility.Platform.AppContainerProcessDomainFactory.CreateIsolationDomain(IIsolationBoundary boundary)  at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Primitives.IsolationBoundary.Initialize()  at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Primitives.IsolationBoundary.CreateInstance[T](Type type)  at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.IsolatedObjectFactory.Initialize()  at Microsoft.VisualStudio.DesignTools.DesignerHost.Services.VSIsolationService.CreateObjectFactory(IIsolationTarget isolationTarget, IObjectCatalog catalog)  at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.IsolationService.CreateLease(IIsolationTarget isolationTarget)  at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.IsolationService.CreateLease(IIsolationTarget isolationTarget)  at Microsoft.VisualStudio.DesignTools.DesignerContract.IsolatedDesignerService.CreateLease(IIsolationTarget isolationTarget, CancellationToken cancelToken, DesignerServiceEntry& entry, IServiceProvider serviceOverrides)  at Microsoft.VisualStudio.DesignTools.DesignerContract.IsolatedDesignerService.IsolatedDesignerView.CreateDesignerViewInfo(CancellationToken cancelToken)  at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.IsolatedTaskScheduler.InvokeWithCulture[T](CultureInfo culture, Func`2 func, CancellationToken cancelToken)  at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.IsolatedTaskScheduler.<>c__DisplayClass10_0`1.<StartTask>b__0()  at System.Threading.Tasks.Task`1.InnerInvoke()   at System.Threading.Tasks.Task.Execute()

 

 


XSL Upgrade

$
0
0

Inherited a Web application that is using XSL Version 1.0 to build Excel reports using visual studio 2013. The application uses XSLCompiledTransform to create and outputStream of XSL (Excel documents). 

I'm looking for an upgrade to the XSL or some simpler method  to create Excel documents other than XSL 1.0. Any ideas suggestions on a path forward would be appreciated.

 

XML Transform using XSLT when simple type is repeating

$
0
0

Hi,

I am trying to transform one xml to another xml using xslt transform.
when there is a complex node repeating then all nodes are properly transformed and things are fine.
If the simple type is repeating then same count of nodes are transformed but value of all nodes are value of the very first node.

This is a part of xml

    <GetDataResult xmlns="http://tempuri.org/">
        <string xmlns="http://schemas.microsoft.com/2003/10/Serialization/Arrays">0</string>
        <string xmlns="http://schemas.microsoft.com/2003/10/Serialization/Arrays">1</string>
        <string xmlns="http://schemas.microsoft.com/2003/10/Serialization/Arrays">2</string>
        <string xmlns="http://schemas.microsoft.com/2003/10/Serialization/Arrays">3</string>
    </GetDataResult>


this is my Xslt snippet part

    <response>
        <xsl:for-each select="ns1:GetDataResponse/ns1:GetDataResult/ns2:string" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
            <item>
                <xsl:value-of select="/ns1:GetDataResponse/ns1:GetDataResult/ns2:string/text()" />
            </item>
        </xsl:for-each>
    </response>

i tried few combinations of Xslt for each loop, however the final result is as below. all the items have value of the first repeating node.

    <?xml version="1.0" encoding="utf-16"?>
    <Fields>
        <response>
            <item>0</item>
            <item>0</item>
            <item>0</item>
            <item>0</item>
        </response>
    </Fields>

this it transformation code snippet.

        XmlDocument xslDoc = new XmlDocument();
        xslDoc.InnerXml = XsltCode;
        System.Xml.Xsl.XslTransform xslTransform = new System.Xml.Xsl.XslTransform();
        StringWriter xmlResult = new StringWriter();
        try
        {
            //Load XSL Transform Object
            xslTransform.Load(xslDoc, new XmlUrlResolver(), null);
            //Load the xsl parameter if Any
            System.Xml.Xsl.XsltArgumentList xslArgs = new System.Xml.Xsl.XsltArgumentList();
            //Call the actual Transform method
            xslTransform.Transform(xmlDoc, null, xmlResult, new XmlUrlResolver());
        }
        catch
        { }
        string firstParse = xmlResult.ToString();

Regards,

 Harish

MSXML cannot load XML from URL

$
0
0

I have 2 computers:

0) at job (connected to the corpotarive netwotk with router-based VPN connection), computer is in domain (let it be named asdomain);

1) at home (connected to the corpotarive netwotk through computer-based VPN connection), computer doesn't belong to domain.

There is a server in the corporative network (let it be named vm-server) which contains XML I need to download. Download link from computer 0 looks likehttp://vm-server:8080/url/File.xml, from computer 1 — http://vm-server.domain:8080/url/File.xml. Both links can be opened in browser without any problem, but when trying to load the file withIXMLDOMDocument::load from computer 1 I get an error code 0x800c0008 INET_E_DOWNLOAD_FAILURE ("The download has failed (the connection was interrupted)"). But this is wrong, everything works as always!

How to solve this problem? Or at least how to get some more details to get closer to understanding a source of the problem?


I want to draw attention that URL is correct in both cases, because browser shows XML contents in any case.

P.S. I'm sorry if question was posted to wrong forum, I didn't find better one.


If I fall I will arise on my way to paradise

Element Requires Further Child Elements

$
0
0
So I was designing an XML file based on a certain DTD. The logic is thus:

    Category >> Books(can have many entries) >>Author[required], Price[required], Description, Image)

Here is the DTD generated:

 
  <!ELEMENT CATAGORY (PRODUCT+)>    <!ELEMENT PRODUCT    (NAME,PRICE,DESCRIPTION*,PICTURE*)>    <!ATTLIST PRODUCT    NAME CDATA #REQUIRED    PRICE CDATA #REQUIRED    DESCRIPTION CDATA #IMPLIED    PICTURE CDATA #IMPLIED    CATEGORY (BOOKS|GADGETS|OTHERS) "BOOKS"    AUTHOR CDATA #REQUIRED    ISBN CDATA #IMPLIED    INVENTORY (InStock|Backordered|Discontinued) "InStock">



However, I am unable to write a valid XML. I wrote thus:

 
  <CATAGORY>    	<PRODUCT NAME="XML BOOK" AUTHOR="XML GENIUS" CATEGORY="BOOKS" DESCRIPTION="BRILLIANT XML BOOK."  INVENTORY="InStock" ISBN="653725327" PRICE="36.99" PICTURE=""/>    	<PRODUCT NAME="XML MASTERS" AUTHOR="XML TEACHER" CATEGORY="BOOKS" DESCRIPTION="" INVENTORY="InStock" ISBN="" PICTURE="" PRICE="23.99"/>	    </CATAGORY>



I get the following error. Any help is appreciated. 

  C
ontent model of element <PRODUCT> requires further child elements.	Error location: CATAGORY / PRODUCT	Details		VC: Element Valid (2): Content model of element <PRODUCT> requires further child elements.    


An XSL transform question, for analysing Bing Maps Directions API output.

$
0
0

Hello

I want to analyse the XML output of the Directions Bing Maps API. 
That's because I need to calculate km in each countries for the returned road.

My problem boils down to create an XSL to transform an XML like this one:

<trip><step> <road>aaa</road> <country>XXX</country> </step><step> <road>bbb</road> </step><step> <road>ccc</road> <entering>YYY</entering> </step><step> <road>ddd</road> </step><step> <road>eee</road> </step><step> <road>ggg</road> <entering>ZZZ</entering> </step><step> <road>hhh</road> </step></trip>


into an XML like that one:

<trip><step> <road>aaa</road> <country>XXX</country> </step><step> <road>bbb</road> <country>XXX</country> </step><step> <road>ccc</road> <country>YYY</country> </step><step> <road>ddd</road> <country>YYY</country> </step><step> <road>eee</road> <country>YYY</country> </step><step> <road>ggg</road> <country>ZZZ</country> </step><step> <road>hhh</road> <country>ZZZ</country> </step></trip>

In the final XML, each step of a trip is allocated to a country.
Using other fields I will easily be able to summarize km (miles) in each country.

I would like to perform the transformation with an XSL.
Would you know how to do that?

With my thanks and best regards,

Michel







Convert some .xml into a defined .txt format, using an .xsl

$
0
0

Hi,

I hope someone can help.  I'm looking to convert a fixed input .xml file into a defined .txt file using an .xsl to transform some of the fields.

My .xml is;

<Pharos><Material><Owner><Name>Scripps Networks International</Name></Owner><MatId>TC-34982-A-01</MatId><Duration>00:46:33:00</Duration><Title>Mysteries At The Museum</Title><SubTitle /><MaterialType>Movie</MaterialType><VersionType>TX</VersionType><AspectRatio /><TrackTypeLink><TrackTypeName>Video</TrackTypeName></TrackTypeLink><TrackTypeLink><TrackTypeName>Stereo German</TrackTypeName></TrackTypeLink><TrackTypeLink><TrackTypeName>Mono Hungarian</TrackTypeName></TrackTypeLink><TrackTypeLink><TrackTypeName>Mono Russian</TrackTypeName></TrackTypeLink><TrackTypeLink><TrackTypeName>Mono Mono (Eng Track Sub)</TrackTypeName></TrackTypeLink><TrackTypeLink><TrackTypeName>Stereo English</TrackTypeName></TrackTypeLink><TrackTypeLink><TrackTypeName>Mono Polish</TrackTypeName></TrackTypeLink><TrackTypeLink><TrackTypeName>Stereo Turkish</TrackTypeName></TrackTypeLink><TrackTypeLink><TrackTypeName>Mono Bulgarian</TrackTypeName></TrackTypeLink><TrackTypeLink><TrackTypeName>Mono Czech</TrackTypeName></TrackTypeLink><Track><InTimeCode>09:59:30:00</InTimeCode><OutTimeCode>10:46:03:00</OutTimeCode><StartOfMedia>10:00:00:00</StartOfMedia><FileId>TC-34982-A-01</FileId><MediaName>ArqivaObjectId</MediaName></Track></Material><ImportMetaData><Note>This is a test import</Note></ImportMetaData></Pharos>

The result I would like to create is;

CLIP
clip_id TC-34982-A-01
title Mysteries At The Museum
tape  TC-34982-A-01
type PROG_NOT_QCD
tc_in 09:59:30:00
tc_out 10:46:03:00
aspect_ratio 2
active_region 1
clip_unavail 1
end
end

where the fields
clip_id
title
tape
tc_in
tc_out
Are dynamically linked to the input .xml file.  The other fields are always fixed

--It sounds simple, but most information I can find only creates html through .xsl

Many thanks in advance

Given a predefined XSD, what is the best way to structure an XML file from raw data for a batch upload?

$
0
0

I know this is a broad question with a number of different solutions but this is a relatively new domain for me so I thought it couldn't hurt to ask.

I recently started a job that requires me to pull data / reports of differing formats - a lot of Excel reports along with raw data dumps (.csv or similar) from various HR/timekeeping systems - perform an analysis of the data and then extract those results to a pre-defined XSD format that I will then submit to an external database (manually via web).

I have experience programming in C/C++ (mostly for embedded applications) and the MS Office productivity suite along with SQL Server 2012 here at work.

What is the best path for me to accomplish this?

Much of the work I am doing is with the aim of automating future data submissions. Prior to my arrival the vast majority of this work was being done via manual data entry. My goal is to create a process (be it a program, an existing tool, or some combination thereof) that can be used to import data/reports (of varying formats) and, given an specified XSD, structure an XML batch upload file accordingly.

A VB script in conjunction with MS Access has been recommended although there seem to be conflicting opinions about this online. I'm considering this, however, as a way to create a functional prototype (I have about 3 weeks to figure this out) that can be revised later if necessary.

Any advice would be much appreciated!!


XML File Referencing External XSL To Transform Outputs As Text In IE

$
0
0

Hello,

I'm having a nightmare with something that is supposed to be straight forward, and came here looking for some help

It's an XML file with a reference to an external XSL file that XSLT code to transform the structure of the XML nodes and output XML with a different structure... When I open the XML in any browser, only the data inside the XML nodes displays (as text), instead of the expected rendering of the XML tree. What am I missing?

The input XML file (simplified) contains: 

<?xml version="1.0" encoding="utf-8"?><?xml-stylesheet type="text/xsl" href="MyTemplate.xsl"?><Report><table1><table1_Employee_Group_Collection><Employee><XRefCode>000001234</XRefCode><EmployeeNumber>000001234</EmployeeNumber><FirstName>Mark</FirstName><LastName>Melanine</LastName><JobXRefCode>65130</JobXRefCode><DeptXRefCode>DEPT0090</DeptXRefCode><OrgXRefCode>850</OrgXRefCode><IsPrimary>0</IsPrimary><EffectiveStart>2011-03-28</EffectiveStart></Employee><Employee><XRefCode>000001234</XRefCode><EmployeeNumber>000001234</EmployeeNumber><FirstName>Mark</FirstName><LastName>Melanine</LastName><JobXRefCode>65130</JobXRefCode><DeptXRefCode>DEPT0015</DeptXRefCode><OrgXRefCode>850</OrgXRefCode><IsPrimary>0</IsPrimary><EffectiveStart>2011-02-28</EffectiveStart></Employee><Employee><XRefCode>000007890</XRefCode><EmployeeNumber>000007890</EmployeeNumber><FirstName>Summer</FirstName><LastName>Spring</LastName><DeptXRefCode>DEPT0011</DeptXRefCode><OrgXRefCode>120</OrgXRefCode><IsPrimary>0</IsPrimary><EffectiveStart>2010-12-27</EffectiveStart></Employee><Employee><XRefCode>000007890</XRefCode><EmployeeNumber>000007890</EmployeeNumber><FirstName>Summer</FirstName><LastName>Spring</LastName><DeptXRefCode>DEPT0090</DeptXRefCode><OrgXRefCode>120</OrgXRefCode><IsPrimary>0</IsPrimary><EffectiveStart>2010-12-27</EffectiveStart></Employee><Employee><XRefCode>000007890</XRefCode><EmployeeNumber>000007890</EmployeeNumber><FirstName>Summer</FirstName><LastName>Spring</LastName><DeptXRefCode>DEPT0001</DeptXRefCode><OrgXRefCode>110</OrgXRefCode><IsPrimary>0</IsPrimary><EffectiveStart>2011-01-24</EffectiveStart></Employee></table1_Employee_Group_Collection></table1></Report>
 

the XLT file MyTemplate.XSL (simplified) contains:

<?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/><xsl:template match="/Report/table1/table1_Employee_Group_Collection"><EmployeeImport><xsl:apply-templates select="Employee"/></EmployeeImport></xsl:template><xsl:template match="Employee"><XRefCode><xsl:value-of select="XRefCode"/></XRefCode><FirstName><xsl:value-of select="FirstName"/></FirstName><LastName><xsl:value-of select="LastName"/></LastName></xsl:template></xsl:stylesheet>


This is what the browser actually renders:

<xrefcode>000001234</xrefcode> <firstname>Mark</firstname> <lastname>Melanine</lastname> <xrefcode>000001234</xrefcode> <firstname>Mark</firstname> <lastname>Melanine</lastname> <xrefcode>000007890</xrefcode><firstname>Summer</firstname> <lastname>Spring</lastname> <xrefcode>000007890</xrefcode> <firstname>Summer</firstname> <lastname>Spring</lastname> <xrefcode>000007890</xrefcode> <firstname>Summer</firstname><lastname>Spring</lastname>

Where are my "tags"?

 

I tested in IE10, IE8 (XP SP3), FF, and Chrome, and none displays what I was expecting, which is:

- <EmployeeImport>
  - <Employee><XRefCode>000001234</XRefCode><FirstName>Mark</FirstName><LastName>Melanine</LastName></Employee>

    (more employee nodes here...)
 </EmployeeImport>

I really appreciate your help. Thanks in advance

Sincerely,

Rick

Multiple signatures using XAdES

$
0
0

Hi everyone and thanks in advance for the help.

my goal is to let two or more different persons to deal with a document incrementally:

- the first will create the xml, compile only a subsection of the document (according to his role) and then sign only what he compiled.

- the second will take the document from the first guy and compile his subsections, without modifying anything that the first guy wrote. Then he will add his signature, signing both his subsections and the one of the first guy.

- and so on...

How can I do it? according to the standard, XAdES specific xml elements (such as the ID of the certificate used to sign) are all inside the <object> element (in signed properties sub-element), which in my opinion implies that only one person can sign the object  (i.e. the document) at a time without having to overwrite the signature data.

Am I wrong? someone can help me undestanding if there's a way I did not considered?

Thanks,

A.

read pdf content into text file using c#.net

$
0
0
Dear all,

Im trying to read pdf content into text file using c#.net.
when i trying to read pdf, its returning content as a unicode characters .so how can i read the characters form pdf.

Thanks,
ram krishna

XML XSD and serisliase deserialise c#

$
0
0

XML XSD in c# Null operators

johnkeays

I have some code that a previous employee did using XSD to create an XML read.

(1) Where can I find sample XSD for Microsoft details as a user manual with examples.

(2) I have a simple sample to solve with null values.  Works okay when not null but fails when it reads XML file with null values.

I have not compiled this code but cut bits and pieces from the complex original.

(3) the file is two jars one glass jar with a lid and the other a red tin base with no lid.

I have an XML that looks like this

<?xml version="1.0" encoding="utf-8"?>

<Collection xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">

<jar>

    <jarBase>

       <material>glass</material>

   </jarBase>

  <lid>

     <lidmaterial>tin</lidmaterial>

     <colour>red</colour>

  <lid>

</jar>    

<jar>

    <jarBase>

       <material>tinny</material>

   </jarBase>

  <lid xsi:nil="true">

<jar>    

this file may not parse okay in an XMl reader.

Now I am having trouble getting the null for lids to work

// typical xsd output using ADAC namespace ADAC is public engineers data base definition as an XSD.

[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd","4.0.30319.1")]

[System.SerializableAttribute()]

[System.Diagnostics.DebuggerStepThroughAttribute()]

[System.ComponentModel.DesignerCategoryAttribute("code")]

[System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="http://www.adac.com.au")]

publicpartialclassjarBase{

privatestring materialField;

publicstringMaterial

{

get{

returnthis.materialField;

}

set{

this.materialField =value;

}

}

// this definition seems okay for jarBase

//

publicpartialclasslid{

privatestring lidMaterialField;

privatestring colourField;

publicstringMaterial

{

get{

returnthis.lidMaterialField;

}

set{

this.lidMaterialField =value;

}

publicstringColour

{

get{

returnthis.colourField;

}

set{

this.colourField =value;

}

}

//  this is the main routine

//

///<remarks/>

[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd","4.0.30319.1")]

[System.SerializableAttribute()]

[System.Diagnostics.DebuggerStepThroughAttribute()]

[System.ComponentModel.DesignerCategoryAttribute("code")]

[System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="http://www.adac.com.au")]

public partial class jar {

// alternative tried code like this

privateSystem.Nullable<jarBase> jarBaseField;

privatejarBase jarBaseField;

privatelid lidField;

publicjarBase JarBase

{

get{

returnthis.jarBaseField;

}

set{

this.jarBaseField =value;

}

publiclid Lid

{

get{

returnthis.lidField;

}

set{

this.lidField =value;

}

}

I need to get the nullable options to work okay on a struct. or a class.  currently using Visual Studio 2010 with the old AutoCAD versions.  My current version writes out the XML file with the xsi:null="true" okay but the readin fails as it tries to put the elemnt into a null pointer for the lid.

Any help welcomed....

john Keays


John Keays

selectSingleNode

$
0
0

Hi I have migrated my project code from  VS2012 to VS2015 

and currently it is  giving error   "MSXML::IXMLDOMDocument" has no member "selectSingleNode"

In VS2012 it was running successfully.

what may be the possible reason behind the this issue.?


How to structure a program that produces a specific XML format (defined by external XSD)?

$
0
0

I have a vendor supplied XSD for which I have been hacking together an Access/VBA script to produce usable XML. This is a short term solution and I would like to write a VB or C# program that will be maintainable in the long term so that if inputs (mainly reports pulled in Excel or possibly a flat .csv format) change, or if the vendor updates the XSD, I (or my successor) will be able to modify the program with relative ease. 

Simple, right?

My initial impulse is to structure the program with objects that correlate to the major elements defined in the XSD - namely a Report class that contains General, Organizational, Unit, and Demographic objects to encapsulate these segments of the XML document. 

Each of these objects will connect to a set of input DBs/tables (either in Access or possibly SQL Server) some of which may be shared and I'm not sure the best way to abstract this. I suppose I should implement a set of interfaces for each object and structure the program so that it each object can be easily tested (an interface or I've also been reading up on dependency injection)...

I'm a relatively "old-school" C++ programmer so much of the TDD stuff is new to me. 

I know this is a broad question, however, am I on the right track here?

Any advice would be much appreciated!

Grab style from xml

$
0
0

Hello everyone,

What is the best way to take the style from the xml node below?

<w:r w:rsidR="8965"><w:rPr><w:rStyle w:val="customStyle" /></w:rPr><w:fldChar w:fldCharType="begin" /></w:r>

Thanks


www.Photoballot.net


XML Namespace

$
0
0

Hi,

I've inherited an importer application written in C# from another company that loads XML files into a SQL database.    The importer uses XElement class to parse the XML file, but uses a fully qualified name to reference the elements i.e.

XNamespace aw = "https://somecompany/person.xsd"; 

var xElement = from records in XElement.Load(pFileName).Elements()                                   

select records;foreach (var record in xElement){

string elementValue = record.Element(aw + "firstname").Value;


I've had to design a new XSD file from scratch for our company's data requirements, and it uses custom complex types and in a custom namespace.  Here is a simple XSD file using the same design pattern to illustrate the point:

<?xml version="1.0" encoding="UTF-8"?><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:p="https://somecompany/person.xsd" targetNamespace="https://somecompany/person.xsd"><xs:complexType name="personinfo"><xs:sequence><xs:element name="firstname" type="xs:string"/><xs:element name="lastname" type="xs:string"/></xs:sequence></xs:complexType><xs:complexType name="fullpersoninfo"><xs:complexContent><xs:extension base="p:personinfo"><xs:sequence><xs:element name="address" type="xs:string"/><xs:element name="city" type="xs:string"/><xs:element name="country" type="xs:string"/></xs:sequence></xs:extension></xs:complexContent></xs:complexType><xs:element name="employee" type="p:fullpersoninfo"/></xs:schema>

Sample Data:

<?xml version="1.0" encoding="UTF-8"?><p:employee xmlns:p="https://somecompany/person.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://somecompany/person.xsd person.xsd"><firstname>Barry</firstname><lastname>Ingham</lastname><address>19 New Court Road</address><city>London</city><country>EC4R9AJ</country></p:employee>

However, when I try and access the elements using a fully-qualified name (i.e. including the namespace), the XElement method returns NULL, unless I drop the namespace and just use the local name i.e.

string elementValue = record.Element("firstname").Value;

When I print out the element name and Namespace to the Console, only the root element has an associated namespace;

Root Element Name: {https://somecompany/person.xsd}employee, Namespace: https://somecompany/person.xsd

Child Element Name: firstname, Namespace:
Child Element Name: lastname, Namespace:
Child Element Name: address, Namespace:
Child Element Name: city, Namespace:
Child Element Name: country, Namespace:

I have defined the namespace for the root element <employee>, so I assumed all descendants would have the same namespace as they're in scope, but they're blank?

I've not worked with XML that much and despite reading around namespaces, I can't understand this behaviour.

Any help would be much appreciated.

Regards,

Andrew

MSXML::IXMLDOMDocumentPtr select single node

$
0
0

Hi all,

Greetings ,I have migrated my code from VS2012 to VS2015 and
some part of my code is giving error. I will only put the snippet of the code (because the complete code is very large)

the same code is running on the some other machine (VS2012 and VS2015) but its not running on my machine in(Visual studio 2015)

but its running on VS2012 on my machine also
I just wanted to know the possible causes of this.

#import <msxml.tlb> //this file is imported // IXMLDOMDocumentPtr is declared and initialized MSXML::IXMLDOMDocumentPtr gl_pDOMDoc[2] ={NULL,NULL}; if(m_bEnabledEncryption == true )//If it is En_BSetting file { if( gl_bIsEnBSettingFileDirty == DIRTY)//Check whether EnBesetting file is dirty { //PDU_03312015 - //loadXML is working
hr =gl_pDOMDoc[m_bEnabledEncryption]->loadXML(m_strDOMXML.AllocSysString());//Load the xml file only if its dirty } } //PDU_03312015 + else// it is BSetting file { if( gl_bIsBSettingFileDirty == DIRTY)//check whether BSetting file is dirty { //PDU_03312015 -

//loadxml is working
hr =gl_pDOMDoc[m_bEnabledEncryption]->loadXML(m_strDOMXML.AllocSysString());//load the xml file only if its dirty } } } if(m_strDOMXML.IsEmpty()) { BSTR bstrRoot = m_strETool.AllocSysString(); if(gl_pDOMDoc[m_bEnabledEncryption]!=NULL) {

//createElement is working

m_pRoot = gl_pDOMDoc[m_bEnabledEncryption]->createElement(bstrRoot); //PDU_03312015 // m_pDOMDoc changed to gl_pDOMDoc[m_bEnabledEncryption] } m_pCurNode = m_pRoot; SysFreeString(bstrRoot); bstrRoot = NULL; if(gl_pDOMDoc[m_bEnabledEncryption]!=NULL) {
//appendchild is not working
//Eror is ->Error:class "MSXML::IXMLDOMDocument" has no member "appendchild"gl_pDOMDoc[m_bEnabledEncryption]->appendChild(m_pCurNode); //PDU_03312015 // m_pDOMDoc changed to gl_pDOMDoc[m_bEnabledEncryption] } } } try { ConvertSpecialCharToString(strNewKey );//HSS_03152010 m_strKeypath = m_strETool + "//" + strkeyLocalMachine + "//" + strNewKey; ProcessKeyPath(m_strKeypath);//SSM_03182010 IXMLDOMNodePtr pResultnode=NULL;

//selectsinglenode is not working

//Eror is ->Error:class "MSXML::IXMLDOMDocument" has no member "selectSingleNode"

pResultnode =gl_pDOMDoc[m_bEnabledEncryption]->selectSingleNode((_bstr_t)m_strKeypath.AllocSysString()); //PDU_03312015 // m_pDOMDoc changed to gl_pDOMDoc[m_bEnabledEncryption] if(!pResultnode) { SearchPathTillCurrentPath(m_strKeypath); bStatus =BS_SUCCESS; } else bStatus = BS_SUCCESS; } BSTR xmlstr;


//get_xml is not working

//Eror is
->Error:class "MSXML::IXMLDOMDocument" has no member "get_xml"

gl_pDOMDoc[m_bEnabledEncryption]->get_xml(&xmlstr); //PDU_03312015 // m_pDOMDoc changed to gl_pDOMDoc[m_bEnabledEncryption]

m_strDOMXML =xmlstr; int dwCipherbufSize =m_strDOMXML.GetLength();; BYTE *EncrytedBuff = new BYTE[dwCipherbufSize]; BYTE* lpData; lpData =(BYTE*)(LPCTSTR)m_strDOMXML;




Event Log XML Query for Name/Value Pair

$
0
0

I'm using Windows 7 Pro x64. I'm trying to create a custom view in Event Viewer that will contain only resume events for unknown reasons (WakeSourceType=0).

Here's the query I'm using:

<QueryList>
  <Query Id="0" Path="System">
    <Select Path="System">
     *[System[Provider[@Name='Microsoft-Windows-Power-Troubleshooter'] and (EventID=1)]]
      and
     *[EventData[Data[@Name='WakeSourceType'] and (Data='0')]]
    </Select>
  </Query>
</QueryList>

This query needs to find all events in the System log with the "Power-Troubleshooter" source and Event ID=1 for which the "WakeSourceType" is 0.

When I use the above syntax, it finds events with Power-Troubleshooter as the source, Event ID=1, andany WakeSourceType as long as any data value in the Event Data section is zero.

How can the Event Viewer query be restricted to WakeSourceType=0 name/value pairs?

(This was posted on December 10, 2015 to the Windows Desktop DevelopmentWindows Desktop Perfmon and Diagnostic tools forum, where it received no replies.)


Add computed style to word document on the fly

$
0
0

Hy,

i parse a template to create a docx document, i valorize variables in template and at the end i need to insert style node in document.xml file.But I could notmake it work

innerText = newNode.InnerText;
XmlAttribute attributes= xmldoc.CreateAttribute("w", "instr",field.NamespaceURI);
attributes.InnerText = innertext;
field.Attributes.Append(newAttr);
XmlNode childXmlNode= xmldoc.CreateElement("w", "r",field.NamespaceURI);
childXmlNode=field.AppendChild(childXmlNode);
resultNode = xmldoc.CreateElement("w", "t",field.NamespaceURI);
resultNode .InnerText = innerText;
resultNode  = childXmlNode.AppendChild(tmpNode);
attributes= xmldoc.CreateAttribute("xml:space",field.NamespaceURI);
attributes.Value = "preserve";
resultNode .Attributes.Append(newAttr);

//styleXmlNode ??

I have already try to insert style node before result node and after

The style is correctly defined in styles.xml.

Thanks for the help


www.Photoballot.net

XSL Upgrade

$
0
0

Inherited a Web application that is using XSL Version 1.0 to build Excel reports using visual studio 2013. The application uses XSLCompiledTransform to create and outputStream of XSL (Excel documents). 

I'm looking for an upgrade to the XSL or some simpler method  to create Excel documents other than XSL 1.0. Any ideas suggestions on a path forward would be appreciated.

 
Viewing all 935 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>