Skip to content

ModelXmlSerializer#import removes leading zeroes from user object #605

@meshbrain

Description

@meshbrain

Describe the bug

I am importing an XML string:

<GraphDataModel>
	<root>
		<Cell id="0">
			<Object as="style"/>
		</Cell>
		<Cell id="1" parent="0">
			<Object as="style"/>
		</Cell>
		<Cell id="12" parent="1" vertex="1">
			<Object label="SEL0013" name="SEL0013" description="" type="SELECT" from_selected="" to_selected="" list_select_key="" communication_type="" template="" split_type="count" tmp_table="_datalab_tmp_0006_s_012" node_query=" SELECT DISTINCT table0.indiv_id FROM test_dataset.mdm_mag_ord AS table0 WHERE ((table0.postal_cd like '090%'))" node_count_query=" SELECT COUNT(DISTINCT table0.indiv_id) FROM test_dataset.mdm_mag_ord AS table0 WHERE ((table0.postal_cd like '090%'))" count="0" as="value">
				<Array as="tables">
					<Object uuid="3e64438a-191a-4d4a-a599-8669a9bd6edc" tableName="mdm_mag_ord" removable="0" sql="(postal_cd like '090%')">
						<Object combinator="and" not="0" id="2e465275-f77f-4ee0-8088-c6b2fbd479cd" as="query">
							<Array as="rules">
								<Object field="postal_cd" operator="beginsWith" valueSource="value" value="090" id="afab26b6-44ae-41a1-94ef-60c6f1149995"/>
							</Array>
						</Object>
					</Object>
				</Array>
				<Array as="incomingConnections"/>
				<Array as="split_rows"/>
			</Object>
			<Geometry _x="30" _y="60" _width="100" _height="50" as="geometry"/>
			<Object shape="rectangle" as="style"/>
		</Cell>
		<Cell id="28" parent="1" edge="1" source="1" target="12">
			<Geometry relative="1" as="geometry"/>
			<Object as="style"/>
		</Cell>
	</root>
</GraphDataModel>

Note the value 090 in <Object field="postal_cd" operator="beginsWith" valueSource="value" value="090" id="afab26b6-44ae-41a1-94ef-60c6f1149995"/>

When I use new ModelXmlSerializer(currentGraph.getDataModel()).import(xml) to import the string to the graph, 090 is changed to 90.

To Reproduce

Steps to reproduce the behavior:

  1. Import the given XML with new ModelXmlSerializer(currentGraph.getDataModel()).import(xml).
  2. Log the user object in console.

Expected behavior

"090" should be preserved as "090", not converted to 90.

Screenshots

Image

Environment

  • maxGraph version or commit: 0.13.0
  • Desktop or mobile: Desktop
  • OS and version: macOS 12.7.6
  • Browser and version: Chrome 131.0.6778.140 (arm64)
  • Node/npm version (if applicable): node v20.11.1, npm 10.5.0
  • Used frameworks (if applicable): react@18.3.1, next@14.2.16

Additional context

Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions