IMPORTANT:
this is not a Support Forum! Experienced users might answer from time to time questions posted here. If you need a professional and reliable answer, or if you want to report a bug, please contact Altova Support instead.

Profile: zxed
About
User Name: zxed
Forum Rank: Newbie
Real Name:
Location
Occupation:
Interests:
Gender: None Specified
Statistics
Joined: Thursday, July 16, 2009
Last Visit: Tuesday, July 21, 2009 8:02:04 PM
Number of Posts: 3
[0.02% of all post / 0.00 posts per day]
Avatar
Last 10 Posts
Topic: xsd to code
Posted: Tuesday, July 21, 2009 8:02:04 PM
thanks for your reply :) i tried out the sample code and added the outer elements... i think its partly lame that it doesn't see that the outer elements are there in the XML and only adds the node.prefix., im going to export a sample using the code i have and hope that the XML parsing webservice doesnt care about the prefix.. otherwise ill have to add 50-100 lines of Node.prefix.... and undo a lot of my

item.subitem.append.subitem1.append.subitem2.append.subitem3.append

and break them appart so that i can do a node.prefix for each parent node... :(
Topic: xsd to code
Posted: Thursday, July 16, 2009 3:17:04 PM
Thank you for the example :)

I see no problem doing that for the root node as it would need to be done just once.. but my schema imports roughly 5 others., and every single node would need its prefix, would i have to manually create the correct prefix for every node?

from the short following sample

<ext:TransactionMetadata>
<ext:SubmittingAgencyORIIdentification>
<nc:IdentificationID>TESTVAL</nc:IdentificationID>
</ext:SubmittingAgencyORIIdentification>
<ext:TransactionActionCode>NEW</ext:TransactionActionCode>
<ext:TransactionDateTime>
<nc:DateTime>2009-03-22T07:34:56</nc:DateTime>
</ext:TransactionDateTime>
<ext:TransactionSequenceIdentification>
<nc:IdentificationID>AEREA</nc:IdentificationID>
</ext:TransactionSequenceIdentification>
</ext:TransactionMetadata>

I would need to
1. add the prefix ext to TransactionMetadata
2. add the prefix ext to SubmittingAgencyORIIdentification
3. add the prefix nc IdentificationID
4. add the prefix ext to TransactionActionCode
5. add the prefix ext to TransactionDateTime
....
this would also require me to correctly add the right prefix.. by giving me control... i could have a type and make nc into nv...

no way to have it do this all automatically? :)

thank you.

Topic: xsd to code
Posted: Thursday, July 16, 2009 3:50:57 AM
I create the code (c#) for an XSD., when exporting a sample xml from XSD it adds the correct tags to each xml node... in the SaveToFile method.. it only adds the node with a xmlns attribute for where the node is from... and example will explain it better

example., when exporting sample xml from xmlspay i get
<ext:TransactionMetadata>
<ext:SubmittingAgencyORIIdentification>
<nc:IdentificationID>TESTVAL</nc:IdentificationID>
</ext:SubmittingAgencyORIIdentification>
<ext:TransactionActionCode>NEW</ext:TransactionActionCode>
<ext:TransactionDateTime>
<nc:DateTime>2009-03-22T07:34:56</nc:DateTime>
</ext:TransactionDateTime>
<ext:TransactionSequenceIdentification>
<nc:IdentificationID>AEREA</nc:IdentificationID>
</ext:TransactionSequenceIdentification>
</ext:TransactionMetadata>

when i use savetofile i get
<TransactionMetadata>
<SubmittingAgencyORIIdentification>
<IdentificationID xmlns="http://niem.gov/niem/niem-core/2.0">TESTVAL</IdentificationID>
</SubmittingAgencyORIIdentification>
<TransactionActionCode>NEW</TransactionActionCode>
<TransactionDateTime>
<DateTime xmlns="http://niem.gov/niem/niem-core/2.0">2009-03-22T07:34:56</DateTime>
</TransactionDateTime>
<TransactionSequenceIdentification>
<IdentificationID xmlns="http://niem.gov/niem/niem-core/2.0">AEREA</IdentificationID>
</TransactionSequenceIdentification>
</TransactionMetadata>

is it possible to have the generated code export xml as the first example? where instead of schema location, it uses the name with the tag?

Use of the Altova User Forum(s) is governed by the Altova Terms of Use.