NaturalIntelligence / fast-xml-parser

Validate XML, Parse XML and Build XML rapidly without C/C++ based libraries and no callback.
https://naturalintelligence.github.io/fast-xml-parser/
MIT License
2.45k stars 296 forks source link

XMLBuilder results in XML clipped with an ellipsis in the middle. #606

Closed nelsonhp3 closed 11 months ago

nelsonhp3 commented 11 months ago

When trying to build an XML from a rather large object resulted in an XML clipped with an ellipsis in the middle. With a small object, as in the examples in the docs, works normally. The expected data below was made with the online tool.

Code

const xmlParserOptions = {
        attributeNamePrefix: "@_",
        oneListGroup: true,
        ignoreAttributes: false,
        ignoreNameSpace: true,
        allowBooleanAttributes: true,
        parseNodeValue: true,
        parseAttributeValue: true,
        trimValues: true,
    }

const builder = new XMLBuilder(xmlParserOptions)
let result = builder.build(writer.markups[1])

Output

<Markup xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <Header>
        <Files>
            <File IfcProject="0M6o7Znnv7hxsbWgeu7oQq" IfcSpatialStructureElement="23B$bNeGHFQuMYJzvUX0FD">
                <Filename>IfcPile_01.ifc</Filename>
                <Date>2014-10-27T16:27:27Z</Date>
                <Reference>../IfcPile_01.ifc</Reference>
            </File>
        </Files>
    </Header>
    <Topic Guid="63E78882-7C6A-4BF7-8982-FC478AFB9C97" TopicType="Structural" TopicStatus="Open">
        <ReferenceLink>https://bim--it.net</ReferenceLink>
        <Title>M…4-a448-98a9e953293a.png</Snapshot>
    </Viewpoint>
    <Viewpoint Guid="21dd4807-e9af-439e-a980-04d913a6b1ce">
        <Viewpoint>Viewpoint_21dd4807-e9af-439e-a980-04d913a6b1ce.bcfv</Viewpoint>
        <Snapshot>Snapshot_21dd4807-e9af-439e-a980-04d913a6b1ce.png</Snapshot>
    </Viewpoint>
    <Viewpoint Guid="81daa431-bf01-4a49-80a2-1ab07c177717">
        <Viewpoint>Viewpoint_81daa431-bf01-4a49-80a2-1ab07c177717.bcfv</Viewpoint>
        <Snapshot>Snapshot_81daa431-bf01-4a49-80a2-1ab07c177717.png</Snapshot>
    </Viewpoint>
</Viewpoints>
</Topic>
</Markup>

expected data

<?xml version="1.0"?>
<Markup xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <Header>
    <Files>
      <File IfcProject="0M6o7Znnv7hxsbWgeu7oQq" IfcSpatialStructureElement="23B$bNeGHFQuMYJzvUX0FD">
        <Filename>IfcPile_01.ifc</Filename>
        <Date>2014-10-27T16:27:27Z</Date>
        <Reference>../IfcPile_01.ifc</Reference>
      </File>
    </Files>
  </Header>
  <Topic Guid="63E78882-7C6A-4BF7-8982-FC478AFB9C97" TopicType="Structural" TopicStatus="Open">
    <ReferenceLink>https://bim--it.net</ReferenceLink>
    <Title>Maximum Content</Title>
    <Priority>High</Priority>
    <Labels>
      <Label>Structural</Label>
    </Labels>
    <Labels>
      <Label>IT Development</Label>
    </Labels>
    <CreationDate>2015-06-21T12:00:00Z</CreationDate>
    <CreationAuthor>dangl@iabi.eu</CreationAuthor>
    <ModifiedDate>2015-06-21T14:22:47Z</ModifiedDate>
    <ModifiedAuthor>dangl@iabi.eu</ModifiedAuthor>
    <AssignedTo>linhard@iabi.eu</AssignedTo>
    <Description>This is a topic with all information present.</Description>
    <BimSnippet SnippetType="JSON">
      <Reference>JsonElement.json</Reference>
      <ReferenceSchema>http://json-schema.org</ReferenceSchema>
    </BimSnippet>
    <DocumentReferences>
      <DocumentReference IsExternal>
        <ReferencedDocument>https://github.com/BuildingSMART/BCF-XML</ReferencedDocument>
        <Description>GitHub BCF Specification</Description>
      </DocumentReference>
    </DocumentReferences>
    <DocumentReferences>
      <DocumentReference>
        <ReferencedDocument>../markup.xsd</ReferencedDocument>
        <Description>Markup.xsd Schema</Description>
      </DocumentReference>
    </DocumentReferences>
    <RelatedTopics>
      <RelatedTopic Guid="5019D939-62A4-45D9-B205-FAB602C98FE8"></RelatedTopic>
    </RelatedTopics>
    <Comments>
      <Comment Guid="780FAE52-C432-42BE-ADEA-FF3E7A8CD8E1">
        <Date>2015-08-31T12:40:17Z</Date>
        <Author>dangl@iabi.eu</Author>
        <Comment>This is an unmodified topic at the uppermost hierarchical level.
All times in the XML are marked as UTC times.</Comment>
      </Comment>
    </Comments>
    <Comments>
      <Comment Guid="897E4909-BDF3-4CC7-A283-6506CAFF93DD">
        <Date>2015-08-31T14:00:01Z</Date>
        <Author>dangl@iabi.eu</Author>
        <Comment>This comment was a reply to the first comment in BCF v2.0. This is a no longer supported functionality and therefore is to be treated as a regular comment in v2.1.</Comment>
      </Comment>
    </Comments>
    <Comments>
      <Comment Guid="39C4B780-1B48-44E5-9802-D359007AA44E">
        <Date>2015-08-31T13:07:11Z</Date>
        <Author>dangl@iabi.eu</Author>
        <Comment>This comment again is in the highest hierarchy level.
It references a viewpoint.</Comment>
        <Viewpoint Guid="8dc86298-9737-40b4-a448-98a9e953293a"></Viewpoint>
      </Comment>
    </Comments>
    <Comments>
      <Comment Guid="BD17158C-4267-4433-98C1-904F9B41CA50">
        <Date>2015-08-31T15:42:58Z</Date>
        <Author>dangl@iabi.eu</Author>
        <Comment>This comment contained some spelling errors.
Hopefully, the modifier did catch them all.</Comment>
        <ModifiedDate>2015-08-31T16:07:11Z</ModifiedDate>
        <ModifiedAuthor>dangl@iabi.eu</ModifiedAuthor>
      </Comment>
    </Comments>
    <Viewpoints>
      <Viewpoint Guid="8dc86298-9737-40b4-a448-98a9e953293a">
        <Viewpoint>Viewpoint_8dc86298-9737-40b4-a448-98a9e953293a.bcfv</Viewpoint>
        <Snapshot>Snapshot_8dc86298-9737-40b4-a448-98a9e953293a.png</Snapshot>
      </Viewpoint>
    </Viewpoints>
    <Viewpoints>
      <Viewpoint Guid="21dd4807-e9af-439e-a980-04d913a6b1ce">
        <Viewpoint>Viewpoint_21dd4807-e9af-439e-a980-04d913a6b1ce.bcfv</Viewpoint>
        <Snapshot>Snapshot_21dd4807-e9af-439e-a980-04d913a6b1ce.png</Snapshot>
      </Viewpoint>
    </Viewpoints>
    <Viewpoints>
      <Viewpoint Guid="81daa431-bf01-4a49-80a2-1ab07c177717">
        <Viewpoint>Viewpoint_81daa431-bf01-4a49-80a2-1ab07c177717.bcfv</Viewpoint>
        <Snapshot>Snapshot_81daa431-bf01-4a49-80a2-1ab07c177717.png</Snapshot>
      </Viewpoint>
    </Viewpoints>
  </Topic>
</Markup>
github-actions[bot] commented 11 months ago

We're glad you find this project helpful. We'll try to address this issue ASAP. You can vist https://solothought.com to know recent features. Don't forget to star this repo.

nelsonhp3 commented 11 months ago

For some reason, VSCode doesn't show the string completely in debug. It was just that 🤦‍♂️