XML writing error

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Abdessamad Belangour

    XML writing error

    Hi all,
    I have developped an application that generate XML documents.
    At most time it works fine, but sometimes (when the size of data to export
    is big) i got the error message :
    << The StartElement token in the Epilog state will generate a nonvalid XML
    document :
    at System.XML.XMLT extWriter.AutoC omplete(Token token)
    at System.XML.XMLT extWriter.Write StartElement(St ring prefix, String
    localName,Strin g ns)
    at System.XML.XMLT extWriter.Write StartElement(St ring prefix, String
    localName,Strin g ns) at.....etc.>>
    I have reviewed well formedness of my XML instructions but i have found no
    error in them.
    Please, give me any idea to track and solve the problem.
    Thanks in advance.


  • Jon Skeet [C# MVP]

    #2
    Re: XML writing error

    Abdessamad Belangour <belangour@irin .univ-nantes.fr> wrote:[color=blue]
    > I have developped an application that generate XML documents.
    > At most time it works fine, but sometimes (when the size of data to export
    > is big) i got the error message :
    > << The StartElement token in the Epilog state will generate a nonvalid XML
    > document :
    > at System.XML.XMLT extWriter.AutoC omplete(Token token)
    > at System.XML.XMLT extWriter.Write StartElement(St ring prefix, String
    > localName,Strin g ns)
    > at System.XML.XMLT extWriter.Write StartElement(St ring prefix, String
    > localName,Strin g ns) at.....etc.>>
    > I have reviewed well formedness of my XML instructions but i have found no
    > error in them.
    > Please, give me any idea to track and solve the problem.[/color]

    The stack trace should show where in your code it's complaining -
    please post that section of code, and what the data is like at the
    time.

    --
    Jon Skeet - <skeet@pobox.co m>
    Pobox has been discontinued as a separate service, and all existing customers moved to the Fastmail platform.

    If replying to the group, please do not mail me too

    Comment

    • Abdessamad Belangour

      #3
      Re: XML writing error

      Jon,
      The stack trace indicate that the problem is in the first line of the method
      below, but the problem could be outside. Anyway all the methods calls in
      this method are safe.

      private void serializeProper ty(PropertyInfo pr)
      {
      writer.WriteSta rtElement("UML: Attribute");

      writer.WriteAtt ributeString("x mi.id",IdsGen.g enerateProperty Id(pr).ToString (
      ));
      writer.WriteAtt ributeString("n ame",pr.Name);
      writer.WriteAtt ributeString("v isibility","pub lic");
      writer.WriteAtt ributeString("i sSpecification" ,"false");
      writer.WriteAtt ributeString("o wnerScope","ins tance");
      //streotype of property accessiblility
      if ((pr.CanRead)&& (pr.CanWrite)) serializeRefToS tereotype("Read Write");
      else
      i f (pr.CanRead) serializeRefToS tereotype("Read ");
      else serializeRefToS tereotype("Writ e");

      //property type
      writer.WriteSta rtElement("UML: StructuralFeatu re.type");
      writeTypeIDREF( pr.PropertyType );//id reference
      writer.WriteEnd Element();
      writer.WriteEnd Element();
      }

      Thanks !

      "Jon Skeet [C# MVP]" <skeet@pobox.co m> a écrit dans le message de
      news:MPG.1a7f05 74f95cf25a989fa e@msnews.micros oft.com...[color=blue]
      > Abdessamad Belangour <belangour@irin .univ-nantes.fr> wrote:[color=green]
      > > I have developped an application that generate XML documents.
      > > At most time it works fine, but sometimes (when the size of data to[/color][/color]
      export[color=blue][color=green]
      > > is big) i got the error message :
      > > << The StartElement token in the Epilog state will generate a nonvalid[/color][/color]
      XML[color=blue][color=green]
      > > document :
      > > at System.XML.XMLT extWriter.AutoC omplete(Token token)
      > > at System.XML.XMLT extWriter.Write StartElement(St ring prefix, String
      > > localName,Strin g ns)
      > > at System.XML.XMLT extWriter.Write StartElement(St ring prefix, String
      > > localName,Strin g ns) at.....etc.>>
      > > I have reviewed well formedness of my XML instructions but i have found[/color][/color]
      no[color=blue][color=green]
      > > error in them.
      > > Please, give me any idea to track and solve the problem.[/color]
      >
      > The stack trace should show where in your code it's complaining -
      > please post that section of code, and what the data is like at the
      > time.
      >
      > --
      > Jon Skeet - <skeet@pobox.co m>
      > http://www.pobox.com/~skeet
      > If replying to the group, please do not mail me too[/color]


      Comment

      • Jon Skeet [C# MVP]

        #4
        Re: XML writing error

        Abdessamad Belangour <belangour@irin .univ-nantes.fr> wrote:[color=blue]
        > The stack trace indicate that the problem is in the first line of the method
        > below, but the problem could be outside. Anyway all the methods calls in
        > this method are safe.
        >
        > private void serializeProper ty(PropertyInfo pr)
        > {
        > writer.WriteSta rtElement("UML: Attribute");[/color]

        If the exception is occurring here, then it should occur every time.
        Have you tried stepping through to see whether it really is every time?

        --
        Jon Skeet - <skeet@pobox.co m>
        Pobox has been discontinued as a separate service, and all existing customers moved to the Fastmail platform.

        If replying to the group, please do not mail me too

        Comment

        Working...