只包含bar / baz元素,没有反映XML文件中的文本 。 基于谷歌搜索我发现一篇文章暗示XSD.exe并不是很好地处理混合内容,但是这个例子比选择合成器使用了序列而不是。从我的经验来看,在 " choice"的情况下它完全没有处理它! 无论如何,我所有这些都是基于旧的。 .Net的版本,我想知道是否 VS 2003版本的XSD.exe在混合内容架构方面做得更好。 另外,我是否有可能处理这些通过提供一些 自定义序列化/反序列化代码的各种情况? 提前致谢, Bill 解决方案 Hello Bill, 什么是text chunks酒吧和/或巴兹之间发生的?你能给我一个样品吗?谢谢。 Luke " Microsoft安全声明:您是否安装了补丁? Microsoft安全公告MS03-026? ?如果不是,Microsoft强烈建议您使用以下链接查看有关Microsoft的信息 安全公告MS03-026 http://www.microsoft.com/security/se...s/ms03-026.asp 和/或 访问Windows Update,访问 http:// windowsupdate.microsoft.com 安装 补丁。从Windows Update站点运行SCAN程序将有助于确保您掌握所有安全补丁,而不仅仅是MS03-026。 [我在几个小时前发布了这个回复,但因为它似乎没有 使它可能重复它...] > 只是文本,正如您在混合=真中所期望的那样内容模型。想想你用来模拟带有嵌入式< p>的XHTML文本的XSD的元素等 Bill " MSFT" <卢****** @ online.microsoft.com>在消息中写道 news:7l ************** @ cpmsftngxa06.phx.gbl ... Hello Bill, 什么是文本块酒吧和/或巴兹之间发生的?你能给我一个样品吗?谢谢。 Luke Microsoft安全公告:您是否安装了Microsoft安全公告MS03-026的补丁?如果不是,Microsoft强烈建议您查看以下关于Microsoft的信息安全公告MS03-026 http://www.microsoft.com/security/se...s/ms03-026.asp 和/或在 http://windowsupdate.microsoft.com 上访问Windows Update以安装补丁。从Windows Update站点运行SCAN程序将有助于确保您掌握所有安全补丁,而不仅仅是MS03-026。 我认为问题应该与text chunk的命名空间有关。如果没有已知的命名空间,xsd.exe将生成错误。我相信以下代码应该有效: < xs:element name =" bar" type =" xs:int" /> < xs:element name =" bat" type =" xs:int" /> < xs:element name =" baz" type =" xs:int" /> Luke (此帖子按原样提供,不作任何保证,并且不授予 权利。) I''m trying to generate class definitions from an XSD that contains somethinglike:<xs:complexType name="foo" mixed="true"><xs:choice minOccurs = "0" maxOccurs="unbounded"><xs:element name = "bar" type = "something"/>...<xs:element name = "baz" type = "somethingelse"/></xs:choice></xs:complexType>The C# code generated by XSD.exe creates a class that has an array ofobjects to allow for an arbitrary number of elements (reflecting themaxOccurs="unbounded"), but doesn''t appear to allow for possible text chunksoccurring between the bar and/or baz elements. When I actually deserializeinto the generated class structure from an XML containing such text I get noerrors or complaints, but the resulting objects have arrays of length 1containing just the bar/baz element and nothing reflecting the text that isin the XML file.Based on a google search I found an article that implies XSD.exe doesn''treally handle mixed content well, but the example used a sequence ratherthan a choice compositor. It appears from my experience that, in the case of"choice" it doesn''t handle it at all!Anyway, I''m basing all this on the "old" version of .Net and am wondering ifthe VS 2003 version of XSD.exe does any better with mixed content schema.Also, is it possible for me to handle these sorts of cases by providing somecustom serialize/deserialize code?Thanks in advance,Bill 解决方案 Hello Bill,What is the "text chunks" occurring between the bar and/or baz? Can yougive me a sample? Thanks.Luke"Microsoft Security Announcement: Have you installed the patch forMicrosoft Security Bulletin MS03-026?? If not Microsoft strongly advisesyou to review the information at the following link regarding MicrosoftSecurity Bulletin MS03-026 http://www.microsoft.com/security/se...s/ms03-026.asp and/or tovisit Windows Update at http://windowsupdate.microsoft.com to install thepatch. Running the SCAN program from the Windows Update site will help toinsure you are current with all security patches, not just MS03-026." [I posted this reply some hours ago, but since it dosen''t appear to havemade it am possibly duplicating it...]Just text, as you would expect in a mixed = "true" content model. Think ofthe XSD you''d use to model XHTML text with embedded <p> elements, etc.Bill"MSFT" <lu******@online.microsoft.com> wrote in messagenews:7l**************@cpmsftngxa06.phx.gbl... Hello Bill, What is the "text chunks" occurring between the bar and/or baz? Can you give me a sample? Thanks. Luke "Microsoft Security Announcement: Have you installed the patch for Microsoft Security Bulletin MS03-026?? If not Microsoft strongly advises you to review the information at the following link regarding Microsoft Security Bulletin MS03-026 http://www.microsoft.com/security/se...s/ms03-026.asp and/orto visit Windows Update at http://windowsupdate.microsoft.com to install the patch. Running the SCAN program from the Windows Update site will help to insure you are current with all security patches, not just MS03-026."I think the problem should be related to the namespace for the "textchunks". Without a known namespace, xsd.exe will generate an error. Ibelieve following code should work:<xs:element name = "bar" type = "xs:int"/><xs:element name = "bat" type = "xs:int"/><xs:element name = "baz" type = "xs:int"/>Luke(This posting is provided "AS IS", with no warranties, and confers norights.) 这篇关于XSD.exe处理生成类中的混合内容类型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-30 08:05