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

How to get the values from a XML file in vb.net and than this value put into a table in database?

$
0
0

I have  to get the values from a XML file in vb.net and than this value put into a table in database. The values in  XML file change each time so it means...each time we have a diff XML file.    Please Help . Thank you

<title>DROGHE D'ABUSO SCREEENING</title><component><section><code code="32010" codeSystemName="Codifica Interna Laboratorio" displayName="Oppiacei"><!--TRASCODIFICA ANALISI NON DISPONIBILE--></code><text><paragraph></paragraph><table><thead><tr><th>Esame</th><th>Esito</th><th>Abnormal Flag</th><th>Unita di misura</th><th>Range di riferimento</th><th>Metodo</th></tr></thead><tbody><tr><td>Oppiacei</td><td>Negativo</td><td></td><td></td><td>ASSENTI</td><td/></tr></tbody></table><footnote></footnote><paragraph></paragraph><!--Inizio Microbiologia sezione humane readable--><!--Fine   Microbiologia sezione humane readable--></text><entry typeCode="DRIV"><!-- INIZIO MONO RISULTATO --><act classCode="ACT" moodCode="EVN"><code code="32010" codeSystemName="Codifica Interna Laboratorio" displayName="Oppiacei"><!--TRASCODIFICA ANALISI NON DISPONIBILE--></code><statusCode code="completed" /><!--(INIZIO) GESTIONE MICROBIOLOGIA MONO RISULTATO --><!--(FINE) GESTIONE MICROBIOLOGIA MONO RISULTATO --><entryRelationship typeCode="COMP"><observation classCode="OBS" moodCode="EVN"><code code="32010" codeSystemName="Codifica Interna Laboratorio" displayName="Oppiacei"><!--TRASCODIFICA RISULTATI NON DISPONIBILE--><!--ANL_COMPLETED--></code><statusCode code="completed" /><effectiveTime value="20170216121035" /><value xsi:type="ST">Negativo</value><!----><referenceRange typeCode="REFV"><observationRange classCode="OBS" moodCode="EVN.CRT"><value xsi:type="ST">ASSENTI</value><interpretationCode code="N" /></observationRange></referenceRange></observation></entryRelationship><!-- VAL USED --></act><!-- FINE MONO RISULTATO --></entry></section></component><component><section><code code="32020" codeSystemName="Codifica Interna Laboratorio" displayName="Metadone"><!--TRASCODIFICA ANALISI NON DISPONIBILE--></code><text><paragraph></paragraph><table><thead><tr><th>Esame</th><th>Esito</th><th>Abnormal Flag</th><th>Unita di misura</th><th>Range di riferimento</th><th>Metodo</th></tr></thead><tbody><tr><td>Metadone</td><td>Negativo</td><td></td><td></td><td>ASSENTE</td><td /></tr></tbody></table><footnote></footnote><paragraph></paragraph><!--Inizio Microbiologia sezione humane readable--><!--Fine   Microbiologia sezione humane readable--></text><entry typeCode="DRIV"><!-- INIZIO MONO RISULTATO --><act classCode="ACT" moodCode="EVN"><code code="32020" codeSystemName="Codifica Interna Laboratorio" displayName="Metadone"><!--TRASCODIFICA ANALISI NON DISPONIBILE--></code><statusCode code="completed" /><!--(INIZIO) GESTIONE MICROBIOLOGIA MONO RISULTATO --><!--(FINE) GESTIONE MICROBIOLOGIA MONO RISULTATO --><entryRelationship typeCode="COMP"><observation classCode="OBS" moodCode="EVN"><code code="32020" codeSystemName="Codifica Interna Laboratorio" displayName="Metadone"><!--TRASCODIFICA RISULTATI NON DISPONIBILE--><!--ANL_COMPLETED--></code><statusCode code="completed" /><effectiveTime value="20170216121035" /><value xsi:type="ST">Negativo</value><!----><referenceRange typeCode="REFV"><observationRange classCode="OBS" moodCode="EVN.CRT"><value xsi:type="ST">ASSENTE</value><interpretationCode code="N" /></observationRange></referenceRange></observation></entryRelationship><!-- VAL USED --></act><!-- FINE MONO RISULTATO --></entry></section></component><component><section><code code="32030" codeSystemName="Codifica Interna Laboratorio" displayName="Cannabinoidi(THC)"><!--TRASCODIFICA ANALISI NON DISPONIBILE--></code><text><paragraph></paragraph><table><thead><tr><th>Esame</th><th>Esito</th><th>Abnormal Flag</th><th>Unita di misura</th><th>Range di riferimento</th><th>Metodo</th></tr></thead><tbody><tr><td>Cannabinoidi(THC)</td><td>Negativo</td><td></td><td></td><td>ASSENTE</td><td /></tr></tbody></table><footnote></footnote><paragraph></paragraph><!--Inizio Microbiologia sezione humane readable--><!--Fine   Microbiologia sezione humane readable--></text><entry typeCode="DRIV"><!-- INIZIO MONO RISULTATO --><act classCode="ACT" moodCode="EVN"><code code="32030" codeSystemName="Codifica Interna Laboratorio" displayName="Cannabinoidi(THC)"><!--TRASCODIFICA ANALISI NON DISPONIBILE--></code><statusCode code="completed" /><!--(INIZIO) GESTIONE MICROBIOLOGIA MONO RISULTATO --><!--(FINE) GESTIONE MICROBIOLOGIA MONO RISULTATO --><entryRelationship typeCode="COMP"><observation classCode="OBS" moodCode="EVN"><code code="32030" codeSystemName="Codifica Interna Laboratorio" displayName="Cannabinoidi(THC)"><!--TRASCODIFICA RISULTATI NON DISPONIBILE--><!--ANL_COMPLETED--></code><statusCode code="completed" /><effectiveTime value="20170216121035" /><value xsi:type="ST">Negativo</value><!----><referenceRange typeCode="REFV"><observationRange classCode="OBS" moodCode="EVN.CRT"><value xsi:type="ST">ASSENTE</value><interpretationCode code="N" /></observationRange></referenceRange></observation></entryRelationship><!-- VAL USED --></act><!-- FINE MONO RISULTATO --></entry></section></component><component><section><code code="32065" codeSystemName="Codifica Interna Laboratorio" displayName="Amfetamine/Metamfetamine/Ecstasy"><!--TRASCODIFICA ANALISI NON DISPONIBILE--></code><text><paragraph></paragraph><table><thead><tr><th>Esame</th><th>Esito</th><th>Abnormal Flag</th><th>Unita di misura</th><th>Range di riferimento</th><th>Metodo</th></tr></thead><tbody><tr><td>Amfetamine/Metamfetamine/Ecstasy</td><td>Negativo</td><td></td><td></td><td>ASSENTE</td><td /></tr></tbody></table><footnote></footnote><paragraph></paragraph><!--Inizio Microbiologia sezione humane readable--><!--Fine   Microbiologia sezione humane readable--></text><entry typeCode="DRIV"><!-- INIZIO MONO RISULTATO --><act classCode="ACT" moodCode="EVN"><code code="32065" codeSystemName="Codifica Interna Laboratorio" displayName="Amfetamine/Metamfetamine/Ecstasy"><!--TRASCODIFICA ANALISI NON DISPONIBILE--></code><statusCode code="completed" /><!--(INIZIO) GESTIONE MICROBIOLOGIA MONO RISULTATO --><!--(FINE) GESTIONE MICROBIOLOGIA MONO RISULTATO --><entryRelationship typeCode="COMP"><observation classCode="OBS" moodCode="EVN"><code code="32065" codeSystemName="Codifica Interna Laboratorio" displayName="Amfetamine/Metamfetamine/Ecstasy"><!--TRASCODIFICA RISULTATI NON DISPONIBILE--><!--ANL_COMPLETED--></code><statusCode code="completed" /><effectiveTime value="20170216121035" /><value xsi:type="ST">Negativo</value><!----><referenceRange typeCode="REFV"><observationRange classCode="OBS" moodCode="EVN.CRT"><value xsi:type="ST">ASSENTE</value><interpretationCode code="N" /></observationRange></referenceRange></observation></entryRelationship><!-- VAL USED --></act><!-- FINE MONO RISULTATO --></entry></section></component><component><section><code code="32050" codeSystemName="Codifica Interna Laboratorio" displayName="Cocaina"><!--TRASCODIFICA ANALISI NON DISPONIBILE--></code><text><paragraph></paragraph><table><thead><tr><th>Esame</th><th>Esito</th><th>Abnormal Flag</th><th>Unita di misura</th><th>Range di riferimento</th><th>Metodo</th></tr></thead><tbody><tr><td>Cocaina</td><td>Negativo</td><td></td><td></td><td>ASSENTE</td><td /></tr></tbody></table><footnote></footnote><paragraph></paragraph><!--Inizio Microbiologia sezione humane readable--><!--Fine   Microbiologia sezione humane readable--></text><entry typeCode="DRIV"><!-- INIZIO MONO RISULTATO --><act classCode="ACT" moodCode="EVN"><code code="32050" codeSystemName="Codifica Interna Laboratorio" displayName="Cocaina"><!--TRASCODIFICA ANALISI NON DISPONIBILE--></code><statusCode code="completed" /><!--(INIZIO) GESTIONE MICROBIOLOGIA MONO RISULTATO --><!--(FINE) GESTIONE MICROBIOLOGIA MONO RISULTATO --><entryRelationship typeCode="COMP"><observation classCode="OBS" moodCode="EVN"><code code="32050" codeSystemName="Codifica Interna Laboratorio" displayName="Cocaina"><!--TRASCODIFICA RISULTATI NON DISPONIBILE--><!--ANL_COMPLETED--></code><statusCode code="completed" /><effectiveTime value="20170216121035" /><value xsi:type="ST">Negativo</value><!----><referenceRange typeCode="REFV"><observationRange classCode="OBS" moodCode="EVN.CRT"><value xsi:type="ST">ASSENTE</value><interpretationCode code="N" /></observationRange></referenceRange></observation></entryRelationship><!-- VAL USED --></act><!-- FINE MONO RISULTATO --></entry></section></component><component><section><code code="35520" codeSystemName="Codifica Interna Laboratorio" displayName="Benzodiazepine"><!--TRASCODIFICA ANALISI NON DISPONIBILE--></code><text><paragraph></paragraph><table><thead><tr><th>Esame</th><th>Esito</th><th>Abnormal Flag</th><th>Unita di misura</th><th>Range di riferimento</th><th>Metodo</th></tr></thead><tbody><tr><td>Benzodiazepine</td><td>Negativo</td><td></td><td></td><td>ASSENTE</td><td /></tr></tbody></table><footnote></footnote><paragraph></paragraph><!--Inizio Microbiologia sezione humane readable--><!--Fine   Microbiologia sezione humane readable--></text><entry typeCode="DRIV"><!-- INIZIO MONO RISULTATO --><act classCode="ACT" moodCode="EVN"><code code="35520" codeSystemName="Codifica Interna Laboratorio" displayName="Benzodiazepine"><!--TRASCODIFICA ANALISI NON DISPONIBILE--></code><statusCode code="completed" /><!--(INIZIO) GESTIONE MICROBIOLOGIA MONO RISULTATO --><!--(FINE) GESTIONE MICROBIOLOGIA MONO RISULTATO --><entryRelationship typeCode="COMP"><observation classCode="OBS" moodCode="EVN"><code code="35520" codeSystemName="Codifica Interna Laboratorio" displayName="Benzodiazepine"><!--TRASCODIFICA RISULTATI NON DISPONIBILE--><!--ANL_COMPLETED--></code><statusCode code="completed" /><effectiveTime value="20170216121035" /><value xsi:type="ST">Negativo</value><!----><referenceRange typeCode="REFV"><observationRange classCode="OBS" moodCode="EVN.CRT"><value xsi:type="ST">ASSENTE</value><interpretationCode code="N" /></observationRange></referenceRange></observation></entryRelationship><!-- VAL USED --></act><!-- FINE MONO RISULTATO --></entry></section></component><component><section><code code="35530" codeSystemName="Codifica Interna Laboratorio" displayName="Barbiturici"><!--TRASCODIFICA ANALISI NON DISPONIBILE--></code><text><paragraph></paragraph><table><thead><tr><th>Esame</th><th>Esito</th><th>Abnormal Flag</th><th>Unita di misura</th><th>Range di riferimento</th><th>Metodo</th></tr></thead><tbody><tr><td>Barbiturici</td><td>Negativo</td><td></td><td></td><td></td><td /></tr></tbody></table><footnote></footnote><paragraph></paragraph><!--Inizio Microbiologia sezione humane readable--><!--Fine   Microbiologia sezione humane readable--></text><entry typeCode="DRIV"><!-- INIZIO MONO RISULTATO --><act classCode="ACT" moodCode="EVN"><code code="35530" codeSystemName="Codifica Interna Laboratorio" displayName="Barbiturici"><!--TRASCODIFICA ANALISI NON DISPONIBILE--></code><statusCode code="completed" /><!--(INIZIO) GESTIONE MICROBIOLOGIA MONO RISULTATO --><!--(FINE) GESTIONE MICROBIOLOGIA MONO RISULTATO --><entryRelationship typeCode="COMP"><observation classCode="OBS" moodCode="EVN"><code code="35530" codeSystemName="Codifica Interna Laboratorio" displayName="Barbiturici"><!--TRASCODIFICA RISULTATI NON DISPONIBILE--><!--ANL_COMPLETED--></code><statusCode code="completed" /><effectiveTime value="20170216121035" /><value xsi:type="ST">Negativo</value><!----></observation></entryRelationship><!-- VAL USED --></act><!-- FINE MONO RISULTATO --></entry></section></component><component><section><code code="32080" codeSystemName="Codifica Interna Laboratorio" displayName="Buprenorfina"><!--TRASCODIFICA ANALISI NON DISPONIBILE--></code><text><paragraph></paragraph><table><thead><tr><th>Esame</th><th>Esito</th><th>Abnormal Flag</th><th>Unita di misura</th><th>Range di riferimento</th><th>Metodo</th></tr></thead><tbody><tr><td>Buprenorfina</td><td>Negativo</td><td></td><td></td><td>ASSENTE</td><td /></tr></tbody></table><footnote></footnote><paragraph></paragraph><!--Inizio Microbiologia sezione humane readable--><!--Fine   Microbiologia sezione humane readable--></text><entry typeCode="DRIV"><!-- INIZIO MONO RISULTATO --><act classCode="ACT" moodCode="EVN"><code code="32080" codeSystemName="Codifica Interna Laboratorio" displayName="Buprenorfina"><!--TRASCODIFICA ANALISI NON DISPONIBILE--></code><statusCode code="completed" /><!--(INIZIO) GESTIONE MICROBIOLOGIA MONO RISULTATO --><!--(FINE) GESTIONE MICROBIOLOGIA MONO RISULTATO --><entryRelationship typeCode="COMP"><observation classCode="OBS" moodCode="EVN"><code code="32080" codeSystemName="Codifica Interna Laboratorio" displayName="Buprenorfina"><!--TRASCODIFICA RISULTATI NON DISPONIBILE--><!--ANL_COMPLETED--></code><statusCode code="completed" /><effectiveTime value="20170216115332" /><value xsi:type="ST">Negativo</value><!----><referenceRange typeCode="REFV"><observationRange classCode="OBS" moodCode="EVN.CRT"><value xsi:type="ST">ASSENTE</value><interpretationCode code="N" /></observationRange></referenceRange></observation></entryRelationship><!-- VAL USED --></act><!-- FINE MONO RISULTATO --></entry></section></component></section></component><component typeCode="COMP"><section classCode="DOCSECT" moodCode="EVN"><!--Completo--><code code="TOS-DROGHE" displayName="TOSSICOLOGIA D'ABUSO"><!-- TRASCODIFICA PER SPECIALITA' NON DISPONIBILE--></code>




How the table should look in db.

How do I add a condition to my vb.net code?

$
0
0
In the xml document below, I would like to check for 3 things

1. If Phone/@Current ='true'
2. If Type/@Word ='HOME'
3. If Invalid is not true

I have done 1 and 2 but I am not sure how to do 3 in the same line of code.  

My xml document which is put into an object objxmlPhoneNode

<?xml version="1.0" encoding="UTF-8"?><Phone Op="A" Current="true">	<Type Op="A" Word="HOME">Home</Type>	<Number Op="A">444-081-7031</Number>	<Invalid>true</Invalid></Phone>





I have taken care of condition number 1 and 2. I need hep to add condition 3. i.e. If Invalid is not true. 

objxmlPhoneNode = objXmlPartyNode.SelectSingleNode("Phone[@Current='true' and Type/@Word='HOME']")

xml message creation with default name space

$
0
0

Hi,

I need to create xml message. I was trying to manually create xml message to make sure it is in valid format. I am getting error with below xml format

<myRequest xmlns:xsi="http://www.hi.com/HH8/09876543" xmlns="http://www.hi.com/HH8/09876543" >  (no prefix. I just assigned value to xmlns). We are sending this message to third party vendor.

  <element1>

     ........

   </element1>

</myRequest>

element1 is showing curly underline which means it is an error.

If I do <element1 xmlns:"">, then it is fine.

I do not want to prefix name space any sub elements. I was it to be default namespace with url assigned.

How can I do that.

Thank You

Editing XML File through VP App

$
0
0

So, I'm making an App for my software class, it's an ATM. It starts off with a form, where you enter the PIN into the textbox, and it checks against the XML file, and if it's correct, it lets you in.

Code:

Private Sub btnPINENTER_Click(sender As Object, e As EventArgs) Handles btnPINENTER.Click

    Dim AccountPIN As Integer

    Dim AccountName As String

    Dim InputPIN As Integer = Val(txtPIN.Text)

    Dim xelement As XElement = XElement.Load("Accounts.xml")
    Dim Records As IEnumerable(Of XElement) = xelement.Elements()

    For Each Account In Records
        AccountPIN = (Account.Element("PIN").Value)
        AccountName = (Account.Element("Name").Value)

        If InputPIN = AccountPIN Then

            MsgBox("Correct Password" & vbNewLine & "Welcome" & AccountName)
            Me.Hide()
            FrmATM.Show()
            txtPIN.Text = ""

        End If
    Next Account
End Sub

The next step is that the second form works like an ATM machine. So there are three buttons, Deposit, Withdraw and Account Balance. Now I need a way to be able to use the Deposit and WIthdraw buttons so that they can update the data in the XML File, but I'm clueless on how to do this. I'm a newbie as you can tell. Any help is greatly appreciated.

Getting error "The ':' character, hexadecimal value 0x3A, cannot be included in a name"

$
0
0
Hi,
Please help.

I am getting the error "The ':' character, hexadecimal value 0x3A, cannot be included in a name" when i am creating a XElement.

Like:

XElement

root = newXElement(nodeName, string.Empty);

Value in nodeName is Abc:Xyz

Then it gives me error The ':' character, hexadecimal value 0x3A, cannot be included in a name

Please suggest

search pattern and extract from file using powershell

$
0
0

I have almost 400 .sql files where i need to search for a specific pattern and output the results.

e.g

*file1.sql

select * from mydb.ops1_tbl from something1 <other n lines>

*file2.sql

select * from mydb.ops2_tbl from something2 <other n lines>

*file3.sql

select * from mydb.ops3_tbl ,mydb.ops4_tbl where a = b <other n lines>

expected result

file1.sql mydb.ops1_tbl

file2.sql mydb.ops2_tbl

file3.sql mydb.ops3_tbl mydb.ops4_tbl

Below script in powershell - able to fetch the filname

Get-ChildItem-Recurse-Filter*.sql|Select-String-pattern "mydb."|group path|select name

Below script in powershell - able to fetch the line

Get-ChildItem-Recurse-Filter*.sql |Select-String-pattern "mydb."|select line

I need in the above format, someone has any pointer?


Rakesh Jayaram http://blogs.msdn.com/b/rakesh_ramblings/

About XSD.EXE - resolving xs:import namespace="http://schemas.microsoft.com/ado/2006/04/codegeneration" schemaLocation="System.Data.Resources.CodeGenerationSchema.xsd" />

$
0
0

Hello Folks,

I was not able to find ready-to-use library for handling CSDL Schema v3.0 - need representation of collections, serialization and option to extend existing definition.

I new that one version, with some limitation and extentions, are present in EF6 (v6.2), but it's useless for me regards to the mix with EF6 specific. (By the way - why not implement clear CSDL v3.0 support? it just few ms longer to parse source)

Any way I do find a full schema definition for CSDL v3.0 - https://msdn.microsoft.com/en-us/library/hh879916.aspx - and try to use xsd.exe to generate classes. Version of csd.exe are  4.7.2046.30319

CSDL Schema v3.0 contain two imports: 

<xs:import namespace="http://schemas.microsoft.com/ado/2006/04/codegeneration" schemaLocation="System.Data.Resources.CodeGenerationSchema.xsd" /><xs:import namespace="http://schemas.microsoft.com/ado/2009/02/edm/annotation" schemaLocation="System.Data.Resources.AnnotationSchema.xsd" />

I do find referenced files and put them into same folder as main Schema file. Content look suitable for import.

It looks strange, but xsd.exe reports that elements from included files are missing. 

Again - it didn't report that files are missing, but report that are missing elements from the file.

I do take a look on the application code and find that all what xsd.exe doing for xs:import is clean up a SchemaLocation. 

Again - didn't do anything, just set SchemaLocation to null for each xs:import in the file.

This looks very strange for me.

But, Ok - there is an option to specify multiple xsd-files as source. I just didn't see how they will be sync with namespaces.

I try to specify all required files in the command line, but got an error regards to :

  - Group 'GExpression' from targetNamespace='http://schemas.microsoft.com/ado/2009/11/edm' has invalid definition: Circular group reference.

Main question is - is there an option to properly convert (any) xsd to set of the classes? 

Side question - Is it correct that xs:import are ignored in xsd.exe? 


Sincerely, Highly skilled coding monkey.

How do I add a condition for notificationevents?

$
0
0

I need help to add a condition to my xslt. For all NotificationEvents, the HearingType/@Word='ACT' How do I do it? That is HearingType code must be ACT

<?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"><xsl:output method="xml" encoding="UTF-8" omit-xml-declaration="yes"/><xsl:template match="/"><xsl:apply-templates select="Integration/Case/Hearing"/></xsl:template><xsl:template match="Hearing"><!-- Set variable for Hearing ID --><xsl:variable name="vID"><!--Get Hearing ID--><xsl:value-of select="@ID"/></xsl:variable><xsl:choose><xsl:when test="(@Op='A') and (HearingType/@Op='A')"><NotificationEvent notificationType="PrepareHearingDocument"><xsl:attribute name="elementState">New</xsl:attribute><xsl:attribute name="elementName">Hearing</xsl:attribute><xsl:attribute name="elementKey"><xsl:value-of select="$vID"/><!--Get ID equal to ID from Hearing--></xsl:attribute><xsl:text>HearingScheduled</xsl:text></NotificationEvent></xsl:when><xsl:when test="@Op='D' and count(Setting/CourtroomMinutes/HearingResult/@Word)=0"><NotificationEvent notificationType="PrepareHearingDocument"><xsl:attribute name="elementState">New</xsl:attribute><xsl:attribute name="elementName">Hearing</xsl:attribute><xsl:attribute name="elementKey"><xsl:value-of select="$vID"/></xsl:attribute><xsl:text>HearingDeleted</xsl:text></NotificationEvent></xsl:when><!--HearingDeleted--><xsl:when test="(@Op='E') and (string-length(CancelledReason)!=0) and (CancelledReason/@Op='E')"><NotificationEvent notificationType="PrepareHearingDocument"><xsl:attribute name="elementState">New</xsl:attribute><xsl:attribute name="elementName">Hearing</xsl:attribute><xsl:attribute name="elementKey"><xsl:value-of select="$vID"/></xsl:attribute><xsl:text>HearingCancelled</xsl:text></NotificationEvent></xsl:when><!--HearingCancelled--><xsl:otherwise><xsl:if test="(HearingType/@Op='E')"><NotificationEvent notificationType="PrepareHearingDocument"><xsl:attribute name="elementState">New</xsl:attribute><xsl:attribute name="elementName">Hearing</xsl:attribute><xsl:attribute name="elementKey"><xsl:value-of select="$vID"/></xsl:attribute><xsl:text>HearingModified</xsl:text></NotificationEvent></xsl:if><!--HearingModified--><xsl:for-each select="Setting[@Op='A']"><NotificationEvent notificationType="PrepareHearingDocument"><xsl:attribute name="elementState">New</xsl:attribute><xsl:attribute name="elementName">Setting</xsl:attribute><xsl:attribute name="elementKey"><xsl:value-of select="$vID"/></xsl:attribute><xsl:attribute name="subElementKey"><xsl:value-of select="@ID"/></xsl:attribute><xsl:text>SettingScheduled</xsl:text></NotificationEvent></xsl:for-each><!--SettingScheduled--><xsl:for-each select="Setting[@Op='E']"><xsl:if test="string-length(RescheduledType)!=0"><NotificationEvent notificationType="PrepareHearingDocument"><xsl:attribute name="elementState">Existing</xsl:attribute><xsl:attribute name="elementName">Setting</xsl:attribute><xsl:attribute name="elementKey"><xsl:value-of select="$vID"/></xsl:attribute><xsl:attribute name="subElementKey"><xsl:value-of select="@ID"/></xsl:attribute><xsl:text>SettingRescheduled</xsl:text></NotificationEvent></xsl:if><!--SettingRescheduled--><xsl:choose><xsl:when test="(string-length(CancelledReason)!=0) and (CancelledReason/@Op='E')"><NotificationEvent notificationType="PrepareHearingDocument"><xsl:attribute name="elementState">Existing</xsl:attribute><xsl:attribute name="elementName">Setting</xsl:attribute><xsl:attribute name="elementKey"><xsl:value-of select="$vID"/></xsl:attribute><xsl:attribute name="subElementKey"><xsl:value-of select="@ID"/></xsl:attribute><xsl:text>SettingCancelled</xsl:text></NotificationEvent></xsl:when><!--SettingCancelled--><xsl:when test="(Cancelled='True') and (string-length(RescheduledReason)=0)"><NotificationEvent notificationType="PrepareHearingDocument"><xsl:attribute name="elementState">Existing</xsl:attribute><xsl:attribute name="elementName">Setting</xsl:attribute><xsl:attribute name="elementKey"><xsl:value-of select="$vID"/></xsl:attribute><xsl:attribute name="subElementKey"><xsl:value-of select="@ID"/></xsl:attribute><xsl:text>SettingCancelled</xsl:text></NotificationEvent></xsl:when><!--SettingCancelled--><xsl:when test="(StartTime/@Op='E') or (EndTime/@Op='E') or (InterpreterNeeded/@Op='E') or (Interpreter/@Op='E') or (CourtSessionBlock/StartTime/@Op='E') or (CourtSessionBlock/EndTime/@Op='E')"><NotificationEvent notificationType="PrepareHearingDocument"><xsl:attribute name="elementState">Existing</xsl:attribute><xsl:attribute name="elementName">Setting</xsl:attribute><xsl:attribute name="elementKey"><xsl:value-of select="$vID"/></xsl:attribute><xsl:attribute name="subElementKey"><xsl:value-of select="@ID"/></xsl:attribute><xsl:text>SettingModified</xsl:text></NotificationEvent></xsl:when><!--SettingModified--></xsl:choose></xsl:for-each><xsl:for-each select="Setting/CourtroomMinutes"><xsl:if test="(@Op='E') and (count(*[name(.)!='HearingResult'][@Op='E'])!=0) and (string-length(HearingResult/@Op)=0)"><NotificationEvent notificationType="PrepareHearingDocument"><xsl:attribute name="elementState">Existing</xsl:attribute><xsl:attribute name="elementName">Setting</xsl:attribute><xsl:attribute name="elementKey"><xsl:value-of select="$vID"/></xsl:attribute><xsl:attribute name="subElementKey"><xsl:value-of select="../@ID"/></xsl:attribute><xsl:text>SettingHeldModified</xsl:text></NotificationEvent></xsl:if><!--SettingHeldModified--><!--Setting Held--><xsl:if test="((@Op='A') or (@Op='E')) and (HearingResult/@Op='E') and ((HearingResult='Held') or (HearingResult/@Word='CNVOCCUR'))"><NotificationEvent notificationType="PrepareHearingDocument"><xsl:attribute name="elementState">Existing</xsl:attribute><xsl:attribute name="elementName">Setting</xsl:attribute><xsl:attribute name="elementKey"><xsl:value-of select="$vID"/></xsl:attribute><xsl:attribute name="subElementKey"><xsl:value-of select="../@ID"/></xsl:attribute><!--Setting Held--><xsl:text>SettingHeld</xsl:text></NotificationEvent></xsl:if><!--SettingHeld--><xsl:if test="(@Op='D')"><NotificationEvent notificationType="PrepareHearingDocument"><xsl:attribute name="elementState">Existing</xsl:attribute><xsl:attribute name="elementName">Setting</xsl:attribute><xsl:attribute name="elementKey"><xsl:value-of select="$vID"/></xsl:attribute><xsl:attribute name="subElementKey"><xsl:value-of select="../@ID"/></xsl:attribute><xsl:text>SettingHeldReversed</xsl:text></NotificationEvent></xsl:if><!--SettingHeldReversed--></xsl:for-each></xsl:otherwise></xsl:choose></xsl:template></xsl:stylesheet>



Want to Convert my XML into a Key Value Pair or as a Dictionary.

$
0
0

Hi,

Below is my XML structure.

<MyData>

<Data>

<Name>Test1</Name>

<Value>Pass</Value>

<ID>1</ID>

</Data>

<Data>

<Name>Test2</Name>

<Value>Fail</Value>

<ID>2</ID>

</Data>

<Data>

<Name>Test3</Name>

<Value>DependentFailed</Value>

<ID>3</ID>

</Data>

</MyData>

I want to convert this into a dictionary while converting using XML Serializer.

Want only Name and Value fields as Key (Name) and Value(Value).

Class structure will be

Class MyData

{

[XmlElement]

public Dictionary<string,string> Data {get;set;}

}

What attributes i have to specify in XmlElement Tag to achieve this!!?

Sum of similar tag elements in XSLT

$
0
0

I'm  already have write a XSLT for xml mapping for slimier tag, according to that out put coming with same tag repeating and few tagging, i want to summarize that similar tag including values sum.Can you please help on this.

Current XSLT Mapping 

<InvoiceType><xsl:value-of select="//cw:TransactionInfo/cw:ShipmentCollection/cw:Shipment/cw:SubShipmentCollection/cw:SubShipment/cw:JobCosting/cw:ChargeLineCollection/cw:ChargeLine/cw:SellInvoiceType"/></InvoiceType>


<xsl:for-each select = "//cw:TransactionInfo/cw:PostingJournalCollection"> 

                 <xsl:if test = "cw:PostingJournal/cw:ChargeCode/cw:Code[text()='DO']"> 

             <DOC> <xsl:value-of select="//cw:PostingJournalCollection/cw:PostingJournal/cw:ChargeCode/cw:Code[text()='DO']/ancestor::cw:PostingJournal/cw:ChargeTotalAmount"/> </DOC>

                  </xsl:if> 

<xsl:if test = "cw:PostingJournal/cw:ChargeCode/cw:Code[text()='DDOCU']"> 

             <DOC> <xsl:value-of select="//cw:PostingJournalCollection/cw:PostingJournal/cw:ChargeCode/cw:Code[text()='DDOCU']/ancestor::cw:PostingJournal/cw:ChargeTotalAmount"/> </DOC>

                  </xsl:if>

                 <xsl:if test = "cw:PostingJournal/cw:ChargeCode/cw:Code[text()='IOUDDOCUM']"> 

             <DOC> <xsl:value-of select="//cw:PostingJournalCollection/cw:PostingJournal/cw:ChargeCode/cw:Code[text()='IOUDDOCUM']/ancestor::cw:PostingJournal/cw:ChargeTotalAmount"/> </DOC>

                  </xsl:if>

                <xsl:if test = "cw:PostingJournal/cw:ChargeCode/cw:Code[text()='CONGESC']"> 

            <FREIGHT> <xsl:value-of select="//cw:PostingJournalCollection/cw:PostingJournal/cw:ChargeCode/cw:Code[text()='CONGESC']/ancestor::cw:PostingJournal/cw:ChargeTotalAmount"/> </FREIGHT>

                  </xsl:if>

                 <xsl:if test = "cw:PostingJournal/cw:ChargeCode/cw:Code[text()='FRT']"> 

            <FREIGHT> <xsl:value-of select="//cw:PostingJournalCollection/cw:PostingJournal/cw:ChargeCode/cw:Code[text()='FRT']/ancestor::cw:PostingJournal/cw:ChargeTotalAmount"/> </FREIGHT>

                  </xsl:if>

                 <xsl:if test = "cw:PostingJournal/cw:ChargeCode/cw:Code[text()='GRI']"> 

            <FREIGHT> <xsl:value-of select="//cw:PostingJournalCollection/cw:PostingJournal/cw:ChargeCode/cw:Code[text()='GRI']/ancestor::cw:PostingJournal/cw:ChargeTotalAmount"/> </FREIGHT>

                  </xsl:if>

Current Out put

<InvoiceNo>AR INV EFL-CM1-00026395</InvoiceNo>
<InvoiceType>
</InvoiceType>
<DOC>1000.0000</DOC>
<DOC>1000.0000</DOC>
<DOC>1000.0000</DOC>
<FREIGHT>1000.0000</FREIGHT>
<FREIGHT>1000.0000</FREIGHT>
<FREIGHT>1000.0000</FREIGHT>
<FREIGHT>1000.0000</FREIGHT>
<EXW>1000.0000</EXW>
<EXW>1000.0000</EXW>
<EXW>1000.0000</EXW>

Expected Result'

<InvoiceNo>AR INV EFL-CM1-00026395</InvoiceNo>
<InvoiceType>
</InvoiceType>
<DOC>3000.0000</DOC>
<FREIGHT>4000.0000</FREIGHT>
<EXW>3000.0000</EXW>

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             

Load Multiple files Using SSIS

$
0
0

HI ,

I have A probleme loading xml files into sql server 2008 using ssis .

until now i didn't found a practical solution ; please guys i need hepl (soooo important)

How do I solve Cannot implicitly convert type 'uint' to 'int'. An implicit conversion exists(are you missing a cast?)

$
0
0

 I need help solve Cannot implicitly convert type 'uint' to 'int'. An implicit conversion exists(are you missing a cast?)

The following line of code is working fine, however a during code review, I was asked to replace this line of code with a different one. The new line suggested is not working because I am getting the above error. 

How to I make this new line of code work?

Here is the line that is working

objPrepHearDoc.Hearing.HearingKey = Convert.ToInt32(aobjXmlInputDoc.DocumentElement.SelectSingleNode("Case/Hearing[@ID=" + strEventId + "]/@ID").InnerText);

Here is the suggested code change that is not working and generating cannot implicitly convert type 'uint' to 'int'. An implicit conversion exists(are you missing a cast?) 

objPrepHearDoc.Hearing.HearingKey = Convert.ToUInt32(strEventId); 

Avoid duplicate using XSLT in XML transfrmation

$
0
0

My XML is 

<RxHistoryResponse>
                <Response>
                    <Approved />
                </Response>
                <Pharmacy>
                    <Name>WALGREENS #12555</Name>
                    <Address>
                        <AddressLine1>2404 S PERRYVILLE RD</AddressLine1>
                        <City>ROCKFORD</City>
                        <State>IL</State>
                        <ZipCode>61108</ZipCode>
                    </Address>
                    <Identification>
                        <DEANumber />
                    </Identification>
                </Pharmacy>
 </RxHistoryResponse>
 <RxHistoryResponse>
                <Response>
                    <Approved />
                </Response>
                <Pharmacy>
                    <Name>WALGREENS #12555</Name>
                    <Address>
                        <AddressLine1>2404 S PERRYVILLE RD</AddressLine1>
                        <City>ROCKFORD</City>
                        <State>IL</State>
                        <ZipCode>61108</ZipCode>
                    </Address>
                    <Identification>
                        <DEANumber />
                    </Identification>
                </Pharmacy>
 </RxHistoryResponse>
 <RxHistoryResponse>
                <Response>
                    <Approved />
                </Response>
                <Pharmacy>
                    <Name>WALGREENS #2020</Name>
                    <Address>
                        <AddressLine1>1014 Lake st</AddressLine1>
                        <City>Chicago</City>
                        <State>IL</State>
                        <ZipCode>60403</ZipCode>
                    </Address>
                    <Identification>
                        <DEANumber />
                    </Identification>
                </Pharmacy>
 </RxHistoryResponse>

My out put should be 

Pharmacy      Address                                          City       State 
WALGREENS #125552404 S PERRYVILLE RD    ROCKFORD IL
WALGREENS #20201014 Lake stChicagoIL

The duplicate pharmacy info should not <g class="gr_ gr_40 gr-alert gr_gramm gr_inline_cards gr_run_anim Grammar multiReplace" data-gr-id="40" id="40">shown</g>.





How to I check if string length equals zero in C#?

$
0
0

I have if statement if C# and I want to add a condition to check if string length equals zero for xml code 

<xsl:when test="(Cancelled='True') and (string-length(RescheduledReason)=0)">Cancelled</xsl:when>

Here is what I already have but I have not checked string length for RescheduledReason =0. This is what I need help to add it to my if statement.

//HearingCancelled 

if ((objxmlNode.SelectSingleNode("Cancelled") != null) && (objxmlNode.SelectSingleNode("Cancelled").InnerText == "True"))                       

{   

objPrepHearDoc.Hearing.Settings[i].SettingStatus = "Cancelled";                     

}



XML SpreadSheets StyleIDs Change upon saving?

$
0
0

I'm currently working on a little project where I write an XML Excel spreadsheet. So far i'm able to get everything down including the styles and populate the sheet with data.

The main issue is that, upon editing or saving in excel my style ids seems to all change to a random number. An example would be where i define

<Style ss:ID="s8">

after saving in excel it'll become something like

<Style ss:ID="s64">

I'm not sure why it does this or where it even gets this style number from. But is there any consistent way to save without removing my old style? Do i have to follow some unique pattern when listing the style ids or is there another way to prevent it from changing styleids? 

the main reason for this is because in my little program i plan to parse the Rows and cell data. If it keeps changing the styleid data then it'll be useless since i cant append new or edit old values. 



Implementation and performance of xsd.exe?

$
0
0

Hello, 

Is here any one who work on xsd.exe code?

I do get "Circular reference" error on standard schema definition and try to find where is a problem.

SchemaSet is for 3 schemas:

- CSDL Schema v3.0.xsd

- System.Data.Resources.AnnotationSchema.xsd

- System.Data.Resources.CodeGenerationSchema.xsd

and give "Circular reference" on compilation.

The same schemas compiled with deprecated XmlSchema.Compile() - didn't give any trouble.

I review a decompiled code... xmmm... I would be fired at once if I provide something similar as solution.

Additional review show that some parts can be implemented to work  up to 6x faster.

Is there any interest to review code and resolve problems in xsd.exe?


Sincerely, Highly skilled coding monkey.

msxsl.exe License/Distribution

$
0
0

Hello,

I'm a software developer and I'm hoping that I can distribute msxsl.exe

https://www.microsoft.com/en-us/download/details.aspx?id=21714

Can anybody provide me with licensing information for this .exe and whether or not I can freely distribute it?

Thanks!

Chris 

XML, Xsd, C#

$
0
0

hello every one,

how can i deserelize an xsd generated class in order to use it?

here is my class. I have to show the elements in a combo box.

thanks for support :) 

//------------------------------------------------------------------------------
// <auto-generated>
//     Ce code a été généré par un outil.
//     Version du runtime :4.0.30319.42000
//
//     Les modifications apportées à ce fichier peuvent provoquer un comportement incorrect et seront perdues si
//     le code est régénéré.
// </auto-generated>
//------------------------------------------------------------------------------

using System.Xml.Serialization;

// 
// This source code was auto-generated by xsd, Version=4.7.2046.0.
// 

namespace Xml_read.Model
{
    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.7.2046.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true)]
[System.Xml.Serialization.XmlRootAttribute(Namespace="", IsNullable=false)]
public partial class voitures {
    private voituresVoiture[] itemsField;
    /// <remarks/>
    [System.Xml.Serialization.XmlElementAttribute("voiture", Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
    public voituresVoiture[] Items {
        get {
            return this.itemsField;
        }
        set {
            this.itemsField = value;
        }
    }
}

/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.7.2046.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true)]
public partial class voituresVoiture {
    private string nb_voituresField;
    /// <remarks/>
    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
    public string nb_voitures {
        get {
            return this.nb_voituresField;
        }
        set {
            this.nb_voituresField = value;
        }
    }
}
}

XML parsing help

$
0
0

Hi,

I need to grab the "Quantity" value from the below xml code using C#:

<td>
<content styleCode="xContentWrapping">
<content ID="_42da39b0-83d2-4906-b8d9-531456d3220b">ALPRAZolam 0.25 MG Oral Tablet</content>
<content styleCode="xLabel">; </content>
<content styleCode="xSecondary" ID="_5eba331f-cc26-4e5b-a9fb-fb2614bc14a4">two times daily [2]</content>
<br />
<content styleCode="xLabel"> Quantity: </content>
         <content>180 </content>
<br />
<content styleCode="xLabel xSecondary">Refills: </content>
<content styleCode="xSecondary">3</content>
<br />
</content>
</td>

Is there a simple way to do this or do I need to interrogate each tag to get this?

XmlDsigExcC14NTransform Namespace Propogation

$
0
0

Hi All,

I am using the System.Security.Cryptography.Xml.XmlDsigExcC14NTransform function to convert an XML document into C14N standard ready for applying hashes and digital signatures. I am having trouble creating the correct output as expected by the web service I am invoking.

I have tracked the problem down to the C14N, and the problem seems to be for namespaces which are defined in the <soap:Envelope> element and are then also included in the PrefixList when using Exclusive C14N Canonicalization. In this case, the namespaces specified in the PrefixList which are defined in the <soap:Envelope> (but not defined in the actual child element) are not propagated down to the child when running C14N transformation.

For example, if I have this;

<soap:Envelope xmlns:parent="parent-namespace" xmlns:soap="w3.org/2003/05/soap-envelope">

    <soap:Header>

        <MessageID>abcdef-123456-abc123</MessageID>

    <soap:Header>

    <soap:Body>

    ....

    </soap:Body>

<soap:Envelope>

If I then want to create a C14N version of <MessageID> I use the following code;

Dim instring As New StreamReader("C:\Sample.xml")
Dim xmldoc As String = instring.ReadToEnd

Dim canon As New System.Security.Cryptography.Xml.XmlDsigExcC14NTransform
Dim xd As New System.Xml.XmlDocument
   
xd.LoadXml(xmldoc)
canon.LoadInput(xd)
       
canon.InclusiveNamespacesPrefixList = "parent soap"

Dim outstream As New StreamReader(CType(canon.GetOutput(), IO.Stream))
Dim outstring As String = outstream.ReadToEnd

msgbox(outstring)

 

However, when looking at the output displayed in the messagebox (i.e. the output in string 'outstring') then I see that the <MessageID> element doesnot have the "parent" or "soap" namespaces added to it's attributes.

At first I did not think this was an issue. But then I tested a web service using the SoapUI tool and what I observed there is that SoapUIdoes propagate those namespaces down to the child element.

Please note I have simplified the issue here as ultimately I am testing some WS Security elements involving hashes, but the problem I am seeing at the moment is that the string value being sent in to the hash (SHA-256) function is different between using the .NET C14N and using SoapUI. The above illustrates the point, but what I don't quite understand is why the <soap:Envelope> namespace attributes are not propagated down to the child element. Do I somehow need to tell the Transform that I only want to extract the <MessageID> element? I didn't see any object or properties to allow this?

 

 

Viewing all 935 articles
Browse latest View live