Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
protobuf
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
protobuf
Commits
4b75bbe4
Commit
4b75bbe4
authored
Sep 30, 2011
by
csharptest
Committed by
rogerk
Sep 30, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for incorrect handling of Whitespace after an array open in XmlFormatReader
parent
353b0fad
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
50 additions
and
2 deletions
+50
-2
XmlFormatReader.cs
src/ProtocolBuffers.Serialization/XmlFormatReader.cs
+4
-0
JsonCompatibilityTests.cs
...tocolBuffers.Test/Compatibility/JsonCompatibilityTests.cs
+18
-0
XmlCompatibilityTests.cs
...otocolBuffers.Test/Compatibility/XmlCompatibilityTests.cs
+22
-0
TestWriterFormatXml.cs
src/ProtocolBuffers.Test/TestWriterFormatXml.cs
+6
-2
No files found.
src/ProtocolBuffers.Serialization/XmlFormatReader.cs
View file @
4b75bbe4
...
...
@@ -315,11 +315,15 @@ namespace Google.ProtocolBuffers.Serialization
}
else
{
string
found
;
ReadMessageStart
(
field
);
if
(
PeekNext
(
out
found
)
&&
found
==
"item"
)
{
foreach
(
string
item
in
NonNestedArrayItems
(
"item"
))
{
yield
return
item
;
}
}
ReadMessageEnd
();
}
}
...
...
src/ProtocolBuffers.Test/Compatibility/JsonCompatibilityTests.cs
View file @
4b75bbe4
...
...
@@ -7,6 +7,24 @@ namespace Google.ProtocolBuffers.Compatibility
{
[
TestFixture
]
public
class
JsonCompatibilityTests
:
CompatibilityTests
{
protected
override
object
SerializeMessage
<
TMessage
,
TBuilder
>(
TMessage
message
)
{
StringWriter
sw
=
new
StringWriter
();
JsonFormatWriter
.
CreateInstance
(
sw
)
.
WriteMessage
(
message
);
return
sw
.
ToString
();
}
protected
override
TBuilder
DeserializeMessage
<
TMessage
,
TBuilder
>(
object
message
,
TBuilder
builder
,
ExtensionRegistry
registry
)
{
JsonFormatReader
.
CreateInstance
((
string
)
message
).
Merge
(
builder
);
return
builder
;
}
}
[
TestFixture
]
public
class
JsonCompatibilityFormattedTests
:
CompatibilityTests
{
protected
override
object
SerializeMessage
<
TMessage
,
TBuilder
>(
TMessage
message
)
{
...
...
src/ProtocolBuffers.Test/Compatibility/XmlCompatibilityTests.cs
View file @
4b75bbe4
using
System.IO
;
using
System.Xml
;
using
Google.ProtocolBuffers.Serialization
;
using
Google.ProtocolBuffers.TestProtos
;
using
NUnit.Framework
;
...
...
@@ -22,4 +23,24 @@ namespace Google.ProtocolBuffers.Compatibility
return
reader
.
Merge
(
"root"
,
builder
,
registry
);
}
}
[
TestFixture
]
public
class
XmlCompatibilityFormattedTests
:
CompatibilityTests
{
protected
override
object
SerializeMessage
<
TMessage
,
TBuilder
>(
TMessage
message
)
{
StringWriter
text
=
new
StringWriter
();
XmlWriter
xwtr
=
XmlWriter
.
Create
(
text
,
new
XmlWriterSettings
{
Indent
=
true
,
IndentChars
=
" "
});
XmlFormatWriter
writer
=
XmlFormatWriter
.
CreateInstance
(
xwtr
).
SetOptions
(
XmlWriterOptions
.
OutputNestedArrays
);
writer
.
WriteMessage
(
"root"
,
message
);
return
text
.
ToString
();
}
protected
override
TBuilder
DeserializeMessage
<
TMessage
,
TBuilder
>(
object
message
,
TBuilder
builder
,
ExtensionRegistry
registry
)
{
XmlFormatReader
reader
=
XmlFormatReader
.
CreateInstance
((
string
)
message
).
SetOptions
(
XmlReaderOptions
.
ReadNestedArrays
);
return
reader
.
Merge
(
"root"
,
builder
,
registry
);
}
}
}
\ No newline at end of file
src/ProtocolBuffers.Test/TestWriterFormatXml.cs
View file @
4b75bbe4
...
...
@@ -194,7 +194,9 @@ namespace Google.ProtocolBuffers
.
Build
();
StringWriter
sw
=
new
StringWriter
();
XmlFormatWriter
.
CreateInstance
(
sw
).
WriteMessage
(
"root"
,
message
);
XmlWriter
xwtr
=
XmlWriter
.
Create
(
sw
,
new
XmlWriterSettings
{
Indent
=
true
,
IndentChars
=
" "
});
XmlFormatWriter
.
CreateInstance
(
xwtr
).
WriteMessage
(
"root"
,
message
);
string
xml
=
sw
.
ToString
();
...
...
@@ -221,7 +223,9 @@ namespace Google.ProtocolBuffers
.
Build
();
StringWriter
sw
=
new
StringWriter
();
XmlFormatWriter
.
CreateInstance
(
sw
)
XmlWriter
xwtr
=
XmlWriter
.
Create
(
sw
,
new
XmlWriterSettings
{
Indent
=
true
,
IndentChars
=
" "
});
XmlFormatWriter
.
CreateInstance
(
xwtr
)
.
SetOptions
(
XmlWriterOptions
.
OutputNestedArrays
|
XmlWriterOptions
.
OutputEnumValues
)
.
WriteMessage
(
"root"
,
message
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment