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

XML Validation - Info required

$
0
0

In the below xml, I have 3 car groups G1, G2, G3. Each car group has a set of car specification. 
When a car is assigned to a particular group then it can have only the specs of that group.
e.g. G1 group --> 1, 2, 3
      G2 group --> 2, 3, 4

<CarGroups>
<CarGroup id="G1">
<Name resourceId ="Ferrari"/>
</CarGroup>
<CarGroup id="G2">
<Name resourceId ="Honda"/>
</CarGroup>
<CarGroup id="G3">
<Name resourceId ="McLaren"/>
</CarGroup>
</CarGroups>

<Cars>
<Car>
<CarGroupRef id="G1" />
<CarSpec>
1, 2, 3
</CarSpec>
</Car>
<Car>
<CarGroupRef id="G1" />
<CarSpec>
1, 2, 3
</CarSpec>
</Car>
<Car>
<CarGroupRef id="G2" />
<CarSpec>
  2, 3, 4
</CarSpec>
</Car>
</Cars>

User creates the below Car definition in xml :
<Car>
<CarGroupRef id="G1" />
<CarSpec>
1, 2, 3
</CarSpec>
</Car>
User creates another car definition :
<Car>
<CarGroupRef id="G1" />
<CarSpec>
2, 3, 4
</CarSpec>
</Car>

I need to show an error with this definition as G1 group can have only 1, 2, 3 as specs (as defined in first definition).
Is there a way to put a validation which will validate the xml between different Car definition that user provides ? 
(The car specs come from user, so I am not sure whether the validation can be handled in a xsd. 
Validation should start once client enters wrong specs in second definition taking reference of the first definition.)



Remove DTD and XMNS in xml file using XSLT

$
0
0
Hi,

I want to DTD and XMLNS in xml file useing xslt.

XMl Document:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE Report SYSTEM "https://test.com/test/reports/dtd/tdr_1_11.dtd">
<Report Name="Transaction Detail"
        Version="1.11"
        xmlns="https://test.com/test/reports/dtd/tdr_1_11.dtd"
        AccountID="testaccount"
        ReportStartDate="2012-11-21T07:00:00"
        ReportEndDate="2012-11-22T07:00:00">
    <Requests>
    </Requests>
</Report>


Result:


<?xml version="1.0" encoding="utf-8"?>
<Report Name="Transaction Detail"
        Version="1.11"
        AccountID="testaccount"
        ReportStartDate="2012-11-21T07:00:00"
        ReportEndDate="2012-11-22T07:00:00">
    <Requests>
    </Requests>
</Report>

Can you please share the xslt for the above one.?

How to get value matching node text using Xpath Xdocument in C# NET?

$
0
0

Hi All,

How do i get matching node values using xpath?

Below is scenario:

<xref rid="ch1" ref-type="fig">testing data</xref>

<xref rid="ch2" ref-type="fig">test</xref>

<xref rid="ch3" ref-type="fig">abc</xref>

<xref rid="ch4" ref-type="fig">tester </xref>

Output: 

<xref rid="ch1" ref-type="fig">testing data</xref>

<xref rid="ch2" ref-type="fig">test</xref>

<xref rid="ch4" ref-type="fig">tester </xref>

I want to get only those xref node whose data is start with test using Xpath..

Thanks in Advance!!

Vikas


XSLT error: Unexpected token '{' in the expression. Converting to XAML/WPF data binding

$
0
0

 

Im having difficulties converting XSLT into a WPF data binding object. Because of the '{' character that I need in the data binding, XSLT ends up choking on it and throwing an error when it tries doing the conversion. Here is the partial code of what it looks like:

 

<

xsl:elementname="GroupBox">

<

xsl:attributename="Visibility">

<xsl:value-ofselect="{Binding IsChecked, ElementName=advancedPushButton, Converter={StaticResource BoolToVisibilityConverter}, ConverterParameter={xTongue Tiedtatic l:BoolToVisibilityConverter.TrueToCollapsed}}"></xsl:value-of>

</

xsl:attribute>

</

xsl:element>

 

I can enclose the entire select statement with single quotes ( ' ) inside of the double quotes, to get it to pass it as a full text string and that works. It bypasses resolving the namespaces this way though, and if it does not put in the namespaces, then it will not work. Is there a way to get it not to choke on the curly brackets { } and still have it add the namespaces? I tried manually adding namespace attributes, but when I set an attribute name to something like xmlns:l it see's the ':' character and does not like it and wont do it. Apparently I cannot use that character in the name of an attribute.

 

 

The following has the single quotes and will work, but will not add the namespaces then:

<xsl:elementname="GroupBox">

<

xsl:attributename="Visibility">

<xsl:value-ofselect="'{Binding IsChecked, ElementName=advancedPushButton, Converter={StaticResource BoolToVisibilityConverter}, ConverterParameter={xTongue Tiedtatic l:BoolToVisibilityConverter.TrueToCollapsed}}'"></xsl:value-of>

</

xsl:attribute>

</

xsl:element>

XSD Documentation

$
0
0

I need to store some configuration data in XML files. Users have to be able to create those XML files through a GUI by simply selecting certain values. In order for them to know what each option means, some tooltip and description for each one should be displayed. I am trying to achieve this through XSD file. My program will parse the different options incl. tooltip and description to dynamically generate the GUI. The XSD file will also validate the generated XML file. Below is an example. How can I get the green part (tooltip & description attributes) implemented?

<xs:schema>
  <xs:simpleTypename="option1">
    <xs:restrictionbase="xs:string">
      <xs:enumerationvalue="entry11"tooltip="blah11" description=”desc11”/>
      <xs:enumerationvalue="entry12"tooltip ="blah12" description=”desc12”/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleTypename="option2">
   
<xs:restrictionbase="xs:string">
      <xs:enumerationvalue="entry21"tooltip ="blah21" description=”desc21”/>
      <xs:enumerationvalue="entry22"tooltip ="blah22" description=”desc22”/>
    </xs:restriction>
  </xs:simpleType>

  <xs:elementname="input1"type="option1"/>
  <xs:elementname="input2"type="option2"/>
</xs:schema>


How to use linq to get values by language?

$
0
0

Hello,

   Can anybody help me on this?

   I cannot find a way to get values with linq for specific language, as for example something like:

var xElementWebSorted = 

                    from xel in xElementWeb.Descendants()
                    where xElementWeb.Attribute("Culture") == "en-US"
                    select xel

Kind regards.

Claude


Startindex cannot be less than zero when trying to create a sample xml file from a xsd file

$
0
0

Using Visual studio pro 2015

I have a xsd file and need to generate a xml sample file from it.
Ive opened the file with the XML editor. When i Try to "Generate Sample XML", I'm met with the following:

Have anyone experienced this?

Any hints or tips on how to find the fault are welcome!

brgs

Bjørn

Generate XML from XSD yields an error. What to do next?

$
0
0

I have received an XSD file from a third party, and in there is the definition of XML files I will have to exchange with them.


In order to try and test, I have tried to generate sample XML via the XML Schema Explorer and then choose "Generate sample XML" from the root node of the XSD.




I get noting but the message Startindex cannot be less than zero:



Although I completely agree with that message :-) I wonder what I can do at this point? I have no influence on the XSD (if that would be the cause of the error??) but perhaps something completely different is going on here???

XMLSpy tells me that the XSD is well formed / correct. So there won't be any obvious errors in there. But stil....

My dev environment is VS Professional 2015 update 2. My dev language is C# and I am trying to build a portable library for further use in Win/Android/iOS environments (but I guess that has nothing to do with the issue).


Peter


"Every misfortune is a new challenge"


Can one detect XSL output method value?

$
0
0

An XSLT will have either:

<

xsl: outputmethod="html" />

or

<

xsl: outputmethod="xml" />

(editable by end-user).  Is there any way I can detect/retrieve the value of the method in my XSL code so that I can act on it?  I haven't found one....

Add Prefix:"ds" - SignedXml

$
0
0
Hi,

I want to Add predfix "DS" in signed Document with "SignedXmL".

Is there a way to set the prefix on the Signature of a Signed XML Document (SignedXml class in .Net)?

So instead of:

<Signaturexmlns="http://www.w3.org/2000/09/xmldsig#>
...
</Signature>

I could have the following:

<ds:Signaturexmlns:ds="http://www.w3.org/2000/09/xmldsig#>
...
</ds:Signature>



Thanks

Signature namespace prefix

$
0
0

 

Hi,

i am signing XMLs:

....code....

MySignature.ComputeSignature()

MyXmlElement=MySignature.GetXml()

 

and i obtain the famous "<Signature xmlns=http://www.w3.org/2000/09/xmldsig#>"  etc...

 

How can i obtain "<dsTongue Tiedignature xmlnsBig Smiles=http://www.w3.org/2000/09/xmldsig#>" ?

(Note: before ComputeSignature() it is not possible making changes, you know)

I'm very tired surfing for all over the web.

I will pray for a solution (i'm been reading in a lot of forums, etc) haha.

 

 

 

 

 

SQL SSIS Package Performance in a schedule job

$
0
0

I have a complex SQL 2012R2 SSIS Package. When I execute it in Visual Studio IDE takes less than an hour to excite. After deploying it to "Integration Services Catalogs" and setup a step in schedule job to execute the same package, the execution time is 5 to 7 time longer. Why? Same package 6X from VS to schedule Job! Appreciative any hit and inputs.

Let me expand on this. The VS is in a server pointing to the SQL Server DEVDWSQL01. When I run the VS always less than hour. Same code deployed in DEVDWSQL01. Scheduled job running in DEVDWSQL01, same code execution time 6 to 8 time longer. VS Server has 2 CPU,  2 Geg of memory a single C drive. DEVDWSQL01 has 32 CPUs, 24 Geg of memory, 4 Drives (C 86 GB, D 14 GB, E 38 GB, F 46 GB).


Generating c# classes from XSD file

$
0
0

Hi

  I have downloaded All Files(Offline) from http://stix.mitre.org/language/version1.1.1/ 

My goal is to convert XSD file to C# class file. when I try "xsd stix_core.xsd /c" , it gives error and doesn't generate c# class file.

Any suggestion?

Thanks

 


Drew

Passing dynamic value as Key to XSLT from the XML

$
0
0

I'm applying grouping in the XSLT based on the attribute that comes from the XML.But i dont see any grouping done now. Can anyone please help me on this.. Below is my XSLT and XML

I would like to achieve like below, My GroupingColumn will be coming from the XML and I need to match that GroupingColumn value with XSL FO and generate the table like below.

<xsl:key name="Report" match="Report" use="@GroupingColumn1" /><xsl:variable name="GroupingColumn"><xsl:value-of select="/PdfPrinter/Reports/Header/GroupingColumn1" /></xsl:variable>

When i applied $GroupingColumn in the blow XSLT, it is not being reflected. But i'm able to print the correct value for $GroupingColumn.$GroupingColumn will give me the column name so that i can use it in the below grouping logic.How to do this?

XSLT

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:msxsl="urn:schemas-microsoft-com:xslt"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:ext="http://exslt.org/common"
    xmlns:utilityExtension="pdfprinter:extensions:utility"
    exclude-result-prefixes="msxsl utilityExtension"><xsl:output method="xml" indent="yes" omit-xml-declaration="yes" encoding="utf-8"/><xsl:key name="Report" match="Report" use="GroupingColumn1" /><xsl:template match="/"><xsl:apply-templates select="Reports/Header"/><xsl:variable name="GroupingColumn"><xsl:value-of select="/PdfPrinter/Reports/Header/GroupingColumn1" /></xsl:variable><xsl:variable name="columnFontSize">12pt</xsl:variable><xsl:variable name="columnFontType">Helvetica</xsl:variable><xsl:variable name="headerOrgName">Pavan</xsl:variable><xsl:variable name="headerPrintedBy">Printed By</xsl:variable><xsl:variable name="headerPrintedDate">Printed Date</xsl:variable><xsl:variable name="headerReportID">Report ID</xsl:variable><xsl:variable name="logo" select="utilityExtension:MapPath('~/App_Data/Resources/IMAGES/logo.jpg')"/><fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"><!-- defines the layout master --><fo:layout-master-set><fo:simple-page-master master-name="all-pages" page-width="1600pt" page-height="1190pt"><fo:region-body region-name="xsl-region-body" column-gap="0.250in" margin="0.7in" margin-left="0.7in"/><fo:region-before region-name="xsl-region-before" display-align="after" extent="0.700in" /><fo:region-after region-name="xsl-region-after" extent="0.700in"/></fo:simple-page-master><fo:page-sequence-master master-name="default-sequence"><fo:repeatable-page-master-reference master-reference="all-pages"/></fo:page-sequence-master></fo:layout-master-set><!-- starts actual layout --><fo:page-sequence master-reference="default-sequence" initial-page-number="1"><fo:static-content border-bottom-width="1pt" border-bottom-style="solid" border-bottom-color="rgb(192,192,192)" flow-name="xsl-region-before" font-size="10pt" font-family="Helvetica"><fo:block color="rgb(105,105,105)" text-align-last="justify"><fo:inline font-size="10pt" font-weight="normal">&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; Page <fo:page-number/> of <fo:page-number-citation ref-id="theEnd"/></fo:inline></fo:block></fo:static-content><fo:static-content border-top-width="1pt" width="1000pt" border-top-style="solid" border-top-color="rgb(192,192,192)" padding-top="2pt" flow-name="xsl-region-after" font-size="10pt" font-family="Helvetica"><fo:table table-layout="fixed" width="500pt"><fo:table-column column-width="proportional-column-width(4)"/><fo:table-column column-width="proportional-column-width(1)"/><fo:table-body><fo:table-row><fo:table-cell><fo:block text-align="right" color="rgb(105,105,105)">&#160;</fo:block></fo:table-cell></fo:table-row></fo:table-body></fo:table></fo:static-content><fo:flow flow-name="xsl-region-body" font-size="10pt" font-family="Helvetica"><fo:block><fo:table border-collapse="collapse" width="1200pt"  table-layout="auto" margin-top="-0.002in"><fo:table-column column-width="proportional-column-width(55)" column-number="1"/><fo:table-column column-width="proportional-column-width(45)" column-number="2"/><fo:table-body><fo:table-row><fo:table-cell><fo:block color="rgb(0,0,128)" font-size="16pt" font-weight="bold">&#160;</fo:block><fo:block color="rgb(0,0,128)" font-weight="bold"></fo:block><fo:block color="rgb(0,0,0)" font-weight="bold" font-family="{$columnFontType}" font-size="{$columnFontSize}"><fo:external-graphic src="{$logo}"/>&#160;&#160;&#160;&#160;<fo:block><xsl:value-of select="$GroupingColumn"/></fo:block></fo:block><fo:block color="rgb(0,0,128)" font-weight="bold">&#160;&#160;&#160;&#160;</fo:block><fo:block color="rgb(0,0,0)" font-weight="bold" font-family="{$columnFontType}" font-size="{$columnFontSize}"><xsl:value-of select="$headerReportID"/></fo:block><fo:block><xsl:value-of select="/PdfPrinter/Reports/Header/ReportID" /></fo:block></fo:table-cell><fo:table-cell><fo:block text-align="left"><fo:inline font-weight="bold" font-family="{$columnFontType}" font-size="{$columnFontSize}"><xsl:value-of select="$headerPrintedBy"/>  :</fo:inline><fo:block><xsl:value-of select="/PdfPrinter/Reports/Header/PrintedBy" /></fo:block></fo:block><fo:block text-align="left"><fo:inline font-weight="bold" font-family="{$columnFontType}" font-size="{$columnFontSize}"><xsl:value-of select="$GroupingColumn"/>  :</fo:inline><fo:block><xsl:value-of select="/PdfPrinter/Reports/Header/PrintedDate" /></fo:block></fo:block></fo:table-cell></fo:table-row></fo:table-body></fo:table><fo:block/></fo:block><fo:block text-align="center"><fo:table border-bottom-width="5pt" font-weight="bold" inline-progression-dimension="auto" width="900pt" border-bottom-color="rgb(51,51,153)" border-collapse="collapse"><fo:table-column column-number="1"/><fo:table-body><fo:table-row border-bottom-color="rgb(0,0,255)" display-align="before"><fo:table-cell border-bottom-width="3pt" border-bottom-style="solid" border-bottom-color="rgb(51,51,153)" padding="2pt" text-align="left"><fo:block text-align="center" font-size="12pt" font-weight="bold" font-family="Helvetica" border-bottom="10pt  "></fo:block><fo:block><xsl:value-of select="/PdfPrinter/Reports/Header/ReportTitle" /></fo:block><fo:block border-bottom-width="10pt" text-align="center"/></fo:table-cell></fo:table-row></fo:table-body></fo:table></fo:block><fo:block font-size="18pt"
                font-family="sans-serif"
                line-height="24pt"
                space-after.optimum="15pt"
                background-color="blue"
                color="white"
                text-align="center"
                padding-top="3pt">
            Users Report</fo:block><fo:block text-align="center"><!-- table start --><fo:table role="html:table" width="1200pt" border="2px" border-collapse="collapse"
                    border-spacing="0px" border-style="outset hidden"
                    space-after="1em" space-before="1em"><!--table header--><xsl:for-each select="/PdfPrinter/Reports/Report[1]/*[local-name() != '$GroupingColumn']"><fo:table-column column-width="proportional-column-width(4.77)"/></xsl:for-each><fo:table-header border="1px solid" display-align="before"
                             end-indent="0pt" last-line-end-indent="0pt"
                             role="html:thead" start-indent="0pt"
                             text-align="start"
                             text-indent="0pt"><fo:table-row height="20.81pt" display-align="center" overflow="hidden"><xsl:for-each select="/PdfPrinter/Reports/Report[1]/*[local-name() != '$GroupingColumn']"><fo:table-cell text-align="center" border="rgb(0, 0, 0) solid 1pt" padding="2pt"><fo:block color="rgb(0,0,0)" text-align="center" font-weight="normal" font-family="{$columnFontType}" font-size="{$columnFontSize}"><xsl:value-of select="name()"/></fo:block></fo:table-cell></xsl:for-each></fo:table-row></fo:table-header><!--table body--><fo:table-body><xsl:for-each select="PdfPrinter/Reports/Report[generate-id() = generate-id(key('Report', $GroupingColumn)[1])]"><fo:table-row><fo:table-cell number-columns-spanned="{count(*) - 1}"><fo:block>
            @GroupingColumn : <xsl:apply-templates select="$GroupingColumn" /></fo:block></fo:table-cell></fo:table-row><xsl:for-each select="key('Report', $GroupingColumn)"><fo:table-row display-align="before"><xsl:for-each select="*[local-name() != '$GroupingColumn']"><fo:table-cell text-align="center" border-top-color="rgb(0, 0, 0)" border-top-style="solid" border-width="1pt" padding="2pt"><fo:block><xsl:value-of select="."/></fo:block></fo:table-cell></xsl:for-each></fo:table-row></xsl:for-each></xsl:for-each></fo:table-body></fo:table><!-- table end --></fo:block></fo:flow></fo:page-sequence></fo:root></xsl:template></xsl:stylesheet>

XML

<Reports><Report><CreatedDate>2015-10-07T17:36:45</CreatedDate><LogType>InvalidPassword</LogType><LoginID>B1ADMIN</LoginID><Name>XYZ</Name><AppVersion></AppVersion><System>OS</System><UserIPAddress>192.168.1.83</UserIPAddress><LoginDate /><LogoutDate /><Remarks></Remarks></Report><Report><CreatedDate>2015-10-07T17:37:06</CreatedDate><LogType>InvalidPassword</LogType><LoginID>B1ADMIN</LoginID><Name>XYZ</Name><AppVersion></AppVersion><System>OS</System><UserIPAddress>192.168.1.83</UserIPAddress><LoginDate /><LogoutDate /><Remarks></Remarks></Report><Report><CreatedDate>2015-10-07T17:41:10</CreatedDate><LogType>FailedLogin</LogType><LoginID>B1ADMIN</LoginID><Name>XYZ</Name><AppVersion></AppVersion><System>OS</System><UserIPAddress>192.168.1.83</UserIPAddress><LoginDate /><LogoutDate /><Remarks></Remarks></Report><Header><ReportID>AUD001</ReportID><GroupingColumn1>LoginID</GroupingColumn1><PrintedBy>DebugTest</PrintedBy><PrintedDate>2016-07-22</PrintedDate></Header></Reports>

If you look the GroupingColumn1 attribute in the XML which is LoginID, I would like to group my table based on this value in the XSL FO. GroupingCOlumn is one of the columns present in the <Report> section of XML which i get it from the frontend. If GroupingColumn is LogType, then i should be able to apply grouping by LogType. I hope i'm clear..

@GroupingColumn is what i'm assigning dynamically in the XSL FO. Please help me on this.


BB 10 Firing on all cylinders!

Help with XML transformation

$
0
0

I need to transform the following XML:

<Summary><assets>54</assets><projects>471</projects></Summary>

into:

<Summary><item name="assets" value="54"></item><item name="projects" value="471"></item></Summary>
Can anybody, please help?


You need to add XmlChoiceIdentifierAttribute to the 'EvalDate' member.

$
0
0
Hello,

I am trying to make a custom XMLserializer for my class.
wrote a simple writeXML method for my class and it works.
My class has int members.
However, when I add a member of type datetime, the writeXML doesn't work anymore!
This is the sort of an error i get:
 System.InvalidOperationException: There was an error reflecting property 'datetime member'. ---> System.InvalidOperationException: You need to add XmlChoiceIdentifierAttribute to the 'datetime member' member.

here is my code for writeXML:
public void WriteXml(String filePath)
{
   StreamWriter stWriter = null;
   XmlSerializer xmlSerializer;

   xmlSerializer = new XmlSerializer(this.GetType());
   stWriter = new StreamWriter(filePath);
   System.Xml.Serialization.XmlSerializerNamespaces xs = new XmlSerializerNamespaces();
    //To remove namespace and any other inline information tag
    xs.Add("", "");
   xmlSerializer.Serialize(stWriter, this, xs);
       
}

here are the attributes i have mentioned for the datetime member of the class:
[System.Xml.Serialization.XmlElementAttribute()]
[XmlElementAttribute(DataType = "date")]

note added: I get similar error for class member of type BOOL

any help would be greatly appreciated.

(I use framework 2, visual studio .net 2005, C#)

Header and footer Issue with dynamically generated Word document

$
0
0

Hi,

I'm facing with a tough problem of generating a Word doc with Exact Layout from data pulled from a database.  While I'm able to generate a Word doc from db data on demand leveraging office XML standard, see below

<html xmlns:o="urn:schemas-microsoft-com:office:office"
      xmlns:w="urn:schemas-microsoft-com:office:word" 
      xmlns="http://www.w3.org/TR/REC-html40">

...

The issue lies in the Exact Layout of such a Word doc.  Currently the generated Word doc has double header and footer at the last page, question, how to eliminate the extra header and footer at the last page?

I was wondering if Word CSS guide supports something like below:

@page lastpage
{
mso-header: none;
mso-footer: none; 

  }

or

@page lastpage
{
 mso-header: false;
 mso-footer: false; 

  }

Thanks in advance.

Don

C#-XML Schema

$
0
0
how to remove particular element in a schema file using C# code?i already finded the element in schema need to replace the property or remove the element.

How the update the value for the second element in xml file?

$
0
0

<ABCD xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.xml.com">
    <BCDE>
        <Date></Date>
        <DCity></DCity>
        <ACity></ACity>
        <CDEF>
            <DEFG>
                <Date>2016-08-29</Date>
                <ORIG>AAA</ORIG>
                <DEST>BBB</DEST>
            </DEFG>
            <DEFG>
  <Date>2016-09-01</Date>
                <ORIG>AAA</ORIG>
                <DEST>BBB</DEST>
            </DEFG>
        </CDEF>
        <Offset>0</Offset>
        <GHFL>
            <HLJK>
                <HHHH>Adult</HHHH>
                <GGGG>0</GGGG>
            </HLJK>
        </GHFL>
        <CCDD>EEEE</CCDD>
    </BCDE>
</ABCD>

I can successfully update the Date for the first element DEFG by the following xpath.

   ht.Add("//a:ABCD/a:BCDE/a:CDEF[1]/a:DEFG/a:Date", DateTime.Now.AddDays(1).ToString("yyyy-MM-dd"));

However I failed to update the Date for the second element DEFG by the following xpath.

   ht.Add("//a:ABCD/a:BCDE/a:CDEF[2]/a:DEFG/a:Date", DateTime.Now.AddDays(1).ToString("yyyy-MM-dd"));

SO how to update the second element?

             


Please click the Mark as Answer button if a post solves your problem!

Learning Linq2XML - Basic Query frustrations

$
0
0

I'm new to Linq to XML and eager to learn, but getting a little frustrated. I'm also using LinqPad to test out syntax:

I have a simple xml file "tasks" with elements "task"  Each "task" contains basic info include a CustomerId. I want to query the xml file for a particular customerId and return that entire Element so that I can then populate a data Structure.  I can't seem to get it work.

tasks><task><TxnID></TxnID><TxnDate>7/28/2016</TxnDate><EmployeeName>My Name</EmployeeName><EmployeeID>20000-931786752</EmployeeID><CustomerName>My Best Client</CustomerName><CustomerID>800002F5-1294851965</CustomerID><ItemServiceName>Consulting</ItemServiceName><ItemServiceID>40000-931904334</ItemServiceID><Notes>test</Notes><isBillable>false</isBillable><LapseSeconds>0</LapseSeconds></task><task><TxnID></TxnID><TxnDate>7/28/2016</TxnDate><EmployeeName>My Name</EmployeeName><EmployeeID>20000-931786752</EmployeeID><CustomerName>ICON</CustomerName><CustomerID>800003B3-1464136019</CustomerID><ItemServiceName>Consulting</ItemServiceName><ItemServiceID>40000-931904334</ItemServiceID><Notes>Second task</Notes><isBillable>false</isBillable><LapseSeconds>0</LapseSeconds></task></tasks>

My simple task Query is:

var tasks = XElement.Load("C:\\Development\\TaskTracker\\TaskTracker\\TaskTracker\\bin\\Debug\\Tasks.xml");

IEnumerable<XElement> thisTask =
	from el in tasks.Elements("tasks")
	where tasks.Element("CustomerListID").Value == "800003B3-1464136019"
	select el;


tasks.Dump();
and it returns empty.  So, how to do this simple query?  Thanks


Viewing all 935 articles
Browse latest View live


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