|
Help me read value in note <Code>, <Message>, <Time>
string result = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>
<string xmlns=\"http://tempuri.org/\">
<AAA>
<Code>5</Code>
<Message>Send MT Error!.</Message>
<Time></Time>
</AAA>
</string>"
XmlReader xReader = XmlReader.Create(new StringReader(result));
while (xReader.Read())
{
??????????????
}
Thanks so much!
^_^_^
modified 26-Aug-17 0:24am.
|
|
|
|
|
|
|
I am getting this message when I try to validate my xml document: 13:2 The markup in the document following the root element must be well-formed. Every time when I try to fix line 13, I get the same error message.
="1.0"
<registration_form>
<name>Digestive and Endoscopy Medical Office MD</name>
<register>patient information</register>
<patient>Arijit Singh</patient>
<status>Single</status>
<birthdate>10/20/1987</birthdate>
<age>27</age>
<address>6216 GreatWater Dr, Windermer, FL 34786</address>
<home>(407)-987-2525</home>
<cell>(407)-288-9331</cell>
</registration_form>
<patient employment>
<employer <information>Orlando Home Team</employer>
<occupation>Real Estate Agent</occupation>
<address>1300 e Michigan St, Orlando, FL 32812</address>
<employer>(407)-885-3539</employer>
<patient employment>
<Insurance_Information>
<subscriber>Arijit Singh</subscriber>
<subscriber's S.S.>789-53-3407</subscriber's S.S.>
<group>DC2630</group>
<co-payment>$50</co-payment>
</Insurance_Information>
<In Case of Emergency>
<name>Zina Kaur</name>
<relationship>fiancee</relationship>
<authorization>Arijit Singh</authorization>
</In Case of Emergency>
|
|
|
|
|
See wikipedia: XML - Wikipedia, the free encyclopedia[^]
Quote: Tag names cannot contain any of the characters !"#$%&'()*+,/;<=>?@[\]^`{|}~, nor a space character, and cannot begin with "-", ".", or a numeric digit.
<patient employment> Contains a space.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
I tried to write the code just like that <patient employment=""> and this <patient_employment> and <patientemployment> and I still get an error message.
|
|
|
|
|
I tried that but it did not work and I tried <patient_employment> and I tried <patientemployment> and I still got an error.
|
|
|
|
|
And did you take a good look at the line below that as well?
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Yes I did. But I still did not find any solutions to the error.
|
|
|
|
|
And what did you see?
I'll give you a clue:
<employer <information>Orlando Home Team</employer>
What is that? Does it look well formed to you?
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
no, that does not look correct. This is how I wrote the code
<employerinformation>Orlando Home Team></employerinfomation>
|
|
|
|
|
And that doesn't look right either...
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
To this point I do not know what I am doing wrong. could you just please point out what I am doing wrong and how to fix it. I have been working on this for three days and I still could not figure it out.
|
|
|
|
|
Well, you could try:
="1.0"="utf-8"
<root>
<registration_form>
<name>Digestive and Endoscopy Medical Office MD</name>
<register>patient information</register>
<patient>Arijit Singh</patient>
<status>Single</status>
<birthdate>10/20/1987</birthdate>
<age>27</age>
<address>6216 GreatWater Dr, Windermer, FL 34786</address>
<home>(407)-987-2525</home>
<cell>(407)-288-9331</cell>
</registration_form>
<patient_employment>
<employer_information>Orlando Home Team</employer_information>
<occupation>Real Estate Agent</occupation>
<address>1300 e Michigan St, Orlando, FL 32812</address>
<employer>(407)-885-3539</employer>
<patient_employment>
<Insurance_Information>
<subscriber>Arijit Singh</subscriber>
<subscribers_SS>789-53-3407</subscribers_SS>
<group>DC2630</group>
<co-payment>$50</co-payment>
</Insurance_Information>
<In_Case_of_Emergency>
<name>Zina Kaur</name>
<relationship>fiancee</relationship>
<authorization>Arijit Singh</authorization>
</In_Case_of_Emergency>
</root>
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Thank you so much, I will try it and see if it will work.
|
|
|
|
|
I tried it, but it did not validate it.
|
|
|
|
|
What are you using to validate it?
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
I am using a website called xmlvalidation.com
|
|
|
|
|
This passes for me:
="1.0"="utf-8"
<root>
<registration_form>
<name>Digestive and Endoscopy Medical Office MD</name>
<register>patient information</register>
<patient>Arijit Singh</patient>
<status>Single</status>
<birthdate>10/20/1987</birthdate>
<age>27</age>
<address>6216 GreatWater Dr, Windermer, FL 34786</address>
<home>(407)-987-2525</home>
<cell>(407)-288-9331</cell>
</registration_form>
<patient_employment>
<employer_information>Orlando Home Team</employer_information>
<occupation>Real Estate Agent</occupation>
<address>1300 e Michigan St, Orlando, FL 32812</address>
<employer>(407)-885-3539</employer>
</patient_employment>
<Insurance_Information>
<subscriber>Arijit Singh</subscriber>
<subscribers_SS>789-53-3407</subscribers_SS>
<group>DC2630</group>
<co-payment>$50</co-payment>
</Insurance_Information>
<In_Case_of_Emergency>
<name>Zina Kaur</name>
<relationship>fiancee</relationship>
<authorization>Arijit Singh</authorization>
</In_Case_of_Emergency>
</root>
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Thank you, thank you, thank you so very very much. It finally worked. Oh my gosh I have been stressing out with this code for so many days. I am very grateful that you took the time out to help me in every way possible.
|
|
|
|
|
You're welcome!
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
I want to create an XSD schema that describes this XML:
<report>
<head showpagenumer="true">
<line left="10" top="100" width="200" />
<image left="10" top="100" path="logotype.jpg" />
<text size="16" value="This is the header" />
</head>
<body leftmargin="20">
<line left="50" top="200" width="200" />
<image left="15" top="300" path="diagram.jpg" />
<text size="12" value="Here is the diagram" />
</body>
<foot showdate="true">
<line left="10" top="600" width="200" />
<image left="10" top="650" path="signature.jpg" />
<text size="12" value="This is the footer" />
</foot>
</report>
Note the following:
- I dont want to repeat the line, image and text descriptions three times in the XSD, since they will always be se same format in the head, body and foot nodes.
- As you can see, the allowed attributes in the head, body and foot nodes are different
Is it possible to create an XSD like this?
|
|
|
|
|
I guess you can do something like this:
First create your own type.
<xs:complexType name="contentType">
<xs:sequence>
<xs:element name="line">
<xs:complexType>
<xs:attribute name="left" type="xs:int" use="required" />
<xs:attribute name="top" type="xs:int" use="required" />
<xs:attribute name="width" type="xs:int" use="required" />
</xs:complexType>
</xs:element>
<xs:element name="image">
<xs:complexType>
<xs:attribute name="left" type="xs:int" use="required" />
<xs:attribute name="top" type="xs:int" use="required" />
<xs:attribute name="path" type="xs:string" use="required" />
</xs:complexType>
</xs:element>
<xs:element name="text">
<xs:complexType>
<xs:attribute name="size" type="xs:int" use="required" />
<xs:attribute name="value" type="xs:string" use="required" />
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
Then use it for your elements, head, body and foot
<xs:element name="head">
<xs:complexType>
<xs:sequence>
<xs:element name="content" type="contentType" />
</xs:sequence>
<xs:attribute name="showpagenumer" type="xs:boolean" use="required" />
</xs:complexType>
</xs:element>
|
|
|
|
|
By the way, Visual Studio (version 2015, but perhaps also others) can do that job for you:
open the xml file in the editor, and then click on the "Create Schema" icon in the toolbar.
|
|
|
|
|
Hello,
I am trying to generate a unique value for a set of elements and place an <id> element in each of the elements. They must have the same id but only the elements enclosed in an element like <envelope>. So my XML Document looks like:
<noticeProduction type="c" revision="2015-11-10">
<prologue type="c">
<institutionId>22</institutionId>
<institutionName>Test INC</institutionName>
<databaseName>testdb</databaseName>
<terminology option="S">Savings and Checking</terminology>
<impoundTerminology option="E">Escrow</impoundTerminology>
<productionDate>2016-21-03</productionDate>
<productionTime>2016-21-15 23:52:33 EDT</productionTime>
<reportTitle>Maturity Notice Production</reportTitle>
<currentCutoffNoticeProductionSerial>1345</currentCutoffNoticeProductionSerial>
<priorCutoffNoticeProductionSerial>345</priorCutoffNoticeProductionSerial>
</prologue>
<envelope type="a">
<person type="a">
<serial>5432</serial>
<personLinkCategory option="PR">Primary owner</personLinkCategory>
<firstName>Lynn</firstName>
<lastName>Tanner</lastName>
<contact type="a">
<serial>5677</serial>
<category option="BP">Business phone</category>
<value>(111)111-1111</value>
</contact>
<contact type="a">
<serial>2456</serial>
<category option="PE">Personal email</category>
<value>kkkkkkkkk@eirco423.net</value>
</contact>
<contact type="a">
<serial>1135</serial>
<category option="HP">Home phone</category>
<value>(111)111-1111</value>
</contact>
</person>
<person type="a">
<serial>5805</serial>
<personLinkCategory option="JT">Joint owner</personLinkCategory>
<firstName>Ultra</firstName>
<lastName>Tanner</lastName>
</person>
<address type="c">
<serial>2456</serial>
<addressSerial>4070</addressSerial>
<category option="R">Residence</category>
<street>43 Times Ping Two Rail Lane</street>
<city>Thomas Co Commons Oreland</city>
</address>
<notice type="a">
<serial>1587</serial>
<category option="F">Force pay</category>
<account type="c">
<serial>4358</serial>
<accountNumber>0000000000</accountNumber>
<eStatementOption option="E">E-statement only</eStatementOption>
<eStatementEmailAddress>tay3456fgee@eircom.net</eStatementEmailAddress>
<share type="c">
<serial>35688</serial>
<id>0004</id>
<description>Checking</description>
<typeSerial>6</typeSerial>
<typeDescription>Checking</typeDescription>
</share>
</account>
<transactionSerial>98432123</transactionSerial>
<monetarySerial>34563221</monetarySerial>
<postingDate>2016-21-02</postingDate>
<effectiveDate>2016-21-02</effectiveDate>
<effectiveBalance>19.72</effectiveBalance>
<effectiveBalanceResult>-1260.28</effectiveBalanceResult>
<availableBalance>19.72</availableBalance>
<availableBalanceResult>-1260.28</availableBalanceResult>
<feePostAmount>30.00</feePostAmount>
<feeDescription>Overdraft Fee</feeDescription>
<item type="a">
<serial>2378</serial>
<postingItemSerial>6532</postingItemSerial>
<category option="W">Withdrawal</category>
<source option="a">ACH</source>
<description>BANK OF AMERICA</description>
<amount>1250.00</amount>
</item>
</notice>
</envelope>
<envelope type="a">
<person type="a">
<serial>25258</serial>
<personLinkCategory option="PR">Primary owner</personLinkCategory>
<firstName>Jamie</firstName>
<middleName>M</middleName>
<lastName>Daniels</lastName>
<contact type="a">
<serial>38439</serial>
<category option="BP">Business phone</category>
<value>(610)789-0190</value>
</contact>
<contact type="a">
<serial>38440</serial>
<category option="PE">Personal email</category>
<value>hgkyfyfy@YMAIL.COM</value>
</contact>
</person>
<notice type="a">
<serial>1218</serial>
<category option="F">Force pay</category>
<account type="c">
<serial>20003</serial>
<accountNumber>0000000000</accountNumber>
<share type="c">
<serial>42452</serial>
<id>0004</id>
<description>Checking</description>
<typeSerial>6</typeSerial>
<typeDescription>Checking</typeDescription>
</share>
</account>
<transactionSerial>77313790</transactionSerial>
<monetarySerial>27773576</monetarySerial>
<postingDate>2016-03-02</postingDate>
<effectiveDate>2016-03-02</effectiveDate>
<effectiveBalanceResult>-60.00</effectiveBalanceResult>
<availableBalanceResult>-60.00</availableBalanceResult>
<feePostAmount>30.00</feePostAmount>
<feeDescription>Overdraft Fee</feeDescription>
<item type="a">
<serial>845</serial>
<postingItemSerial>5418</postingItemSerial>
<category option="W">Withdrawal</category>
<source option="a">ACH</source>
<description>USAA CHK-INTLOIORNT</description>
<amount>30.00</amount>
</item>
</notice>
<notice type="a">
<serial>1743</serial>
<category option="F">Force pay</category>
<account type="c">
<serial>20003</serial>
<accountNumber>0000000000</accountNumber>
<share type="c">
<serial>42452</serial>
<id>0000</id>
<description>Checking</description>
<typeSerial>6</typeSerial>
<typeDescription>Checking</typeDescription>
</share>
</account>
<transactionSerial>77768043</transactionSerial>
<monetarySerial>77767950</monetarySerial>
<postingDate>2016-03-02</postingDate>
<effectiveDate>2016-03-02</effectiveDate>
<effectiveBalance>-60.00</effectiveBalance>
<effectiveBalanceResult>-220.00</effectiveBalanceResult>
<availableBalance>-60.00</availableBalance>
<availableBalanceResult>-220.00</availableBalanceResult>
<feePostAmount>30.00</feePostAmount>
<feeDescription>Overdraft Fee</feeDescription>
<item type="a">
<serial>1370</serial>
<postingItemSerial>7439</postingItemSerial>
<category option="W">Withdrawal</category>
<source option="a">ACH</source>
<description>USAA CHK-KJHHUU</description>
<amount>130.00</amount>
</item>
</notice>
</envelope>
<epilogue type="c">
<envelopeCount>825</envelopeCount>
<noticeCount>1478</noticeCount>
</epilogue>
</noticeProduction>
And XLST File looks like:
="1.0"="utf-8"
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
<xsl:output method="xml" indent="yes"/>
<xsl:template match="*">
<xsl:element name="{local-name()}">
<xsl:apply-templates select="@* | node()"/>
</xsl:element>
</xsl:template>
<xsl:template match="@*">
<xsl:attribute name="{local-name()}">
<xsl:value-of select="."/>
</xsl:attribute>
</xsl:template>
<xsl:template match="text() | comment() | processing-instruction()">
<xsl:copy/>
</xsl:template>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="envelope">
<xsl:copy>
<id>
<xsl:value-of select="generate-id(.)"/>
</id>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="person">
<xsl:copy>
<id>
<xsl:value-of select="envelope/id"/>
</id>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="contact">
<xsl:copy>
<id>
<xsl:value-of select="generate-id(.)"/>
</id>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="address">
<xsl:copy>
<id>
<xsl:value-of select="generate-id(.)"/>
</id>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="notice">
<xsl:copy>
<id>
<xsl:value-of select="generate-id(.)"/>
</id>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
So I am trying to generate a unique id for envelope and take that value and copy the id to the <person>, <contact>, <notice> and tags. The id must be the same for the envelope and the tags that are enclosed in the envelope. ANy ideas?
|
|
|
|